2003-12-11 Martin Baulig <martin@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
1 2003-12-11  Martin Baulig  <martin@ximian.com>
2
3         Reworked flow analyis and made it more precise and bug-free.  The
4         most important change is that we're now using a special `Reachability'
5         class instead of having "magic" meanings of `FlowReturns'.  I'll
6         do some more cleanups and optimizations and also add some more
7         documentation this week.
8
9         * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
10         largely reworked this class.
11         (FlowReturns): Removed `Unreachable' and `Exception'; we now use
12         the new `Reachability' class instead of having "magic" values here.
13         (FlowBranching): We're now using an instance of `Reachability'
14         instead of having separate `Returns', `Breaks' etc. fields.
15
16         * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
17         based on flow analysis; ignore the return value of block.Emit ().
18
19 2003-12-10  Zoltan Varga  <vargaz@freemail.hu>
20
21         * driver.cs typemanager.cs: Find the mono extensions to corlib even
22         if they are private.
23
24 2003-12-09  Martin Baulig  <martin@ximian.com>
25
26         * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
27         call them directly on the UsageVector.
28
29 2003-12-09  Martin Baulig  <martin@ximian.com>
30
31         * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
32         Changed return type from `FlowReturns' to `Reachability'.
33
34 2003-12-09  Martin Baulig  <martin@ximian.com>
35
36         * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
37         (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
38         `Reachable' fields with a single `Reachability' one.
39
40 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
41
42         * class.cs (FindMembers): Remove foreach's.
43
44         Bootstrap times:
45         
46         BEFORE
47                 Run 1:   8.74 seconds
48                 Run 2:   8.71 seconds
49         
50         AFTER
51                 Run 1:   8.64 seconds
52                 Run 2:   8.58 seconds
53         
54
55 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
56
57         * cs-parser.jay:
58         * gen-treedump.cs:
59         * statement.cs:
60         This patch does a few things:
61                 1. EmptyStatement is now a singleton, so it is never reallocated.
62                 2. All blah is EmptyStatement constructs have been changed to
63                    blah == EmptyStatement.Value, which is much faster and valid
64                    now that EmptyStatement is a singleton.
65                 3. When resolving a block, rather than allocating a new array for
66                    the non-empty statements, empty statements are replaced with
67                    EmptyStatement.Value
68                 4. Some recursive functions have been made non-recursive.
69         Mainly the performance impact is from (3), however (1) and (2) are needed for
70         this to work. (4) does not make a big difference in normal situations, however
71         it makes the profile look saner.
72
73         Bootstrap times:
74
75         BEFORE
76         9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
77         9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
78         Total memory allocated: 56397 KB
79         
80         AFTER
81         9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
82         8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
83         Total memory allocated: 55666 KB
84
85 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
86
87         * support.cs: Rewrite DoubleHash to use its own impl. Is faster
88         than the hashtable in a hashtable version
89
90         * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
91         we always end up concating a string. This results in a huge perf
92         loss, because many strings have to be tracked by the GC. In this
93         patch, we first use a hashtable that works with two keys, so that
94         the strings do not need to be concat'ed.
95
96         Bootstrap times:
97         BEFORE
98                 Run 1:   8.74 seconds
99                 Run 2:   8.71 seconds
100         
101         AFTER
102                 Run 1:   8.65 seconds
103                 Run 2:   8.56 seconds
104         
105 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
106
107         * Makefile: Add a new target `do-time' that does a quick and simple
108         profile, leaving easy to parse output.
109
110 2003-12-08  Zoltan Varga  <vargaz@freemail.hu>
111
112         * codegen.cs (Init): Create the dynamic assembly with 
113         AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
114
115 2003-12-02 Ben Maurer  <bmaurer@users.sourceforge.net>
116
117         * support.cs: Make the PtrHashtable use only one
118         instance of its comparer.
119
120 2003-11-30  Zoltan Varga  <vargaz@freemail.hu>
121
122         * typemanager.cs: Fix lookup of GetNamespaces.
123
124 2003-11-29  Miguel de Icaza  <miguel@ximian.com>
125
126         * expression.cs: Removed redundant line.
127
128         * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
129         ArrayLists, use for loops with bounds.  
130
131         * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
132         arraylist.
133
134         * expression.cs (Invocation.OverloadResolve): Avoid foreach on
135         arraylists, use for loop with bounds.
136
137         The above three changes give us a 0.071 second performance
138         improvement out of 3.294 seconds down to 3.223.  On my machine
139         the above changes reduced the memory usage by 1,387 KB during
140         compiler bootstrap.
141
142         * cs-parser.jay (QualifiedIdentifier): New class used to represent
143         QualifiedIdentifiers.  Before we created a new string through
144         concatenation, and mostly later on, the result would be
145         manipulated by DecomposeQI through string manipulation.
146
147         This reduced the compiler memory usage for bootstrapping from
148         59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
149         compile times in 0.05 seconds.
150
151 2003-11-28  Dick Porter  <dick@ximian.com>
152
153         * support.cs: Do string compares with the Invariant culture.
154
155         * rootcontext.cs: 
156         * gen-treedump.cs: 
157         * expression.cs: 
158         * driver.cs: 
159         * decl.cs: 
160         * codegen.cs: 
161         * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
162         the comparison is done with the Invariant culture.
163
164 2003-11-27  Miguel de Icaza  <miguel@ximian.com>
165
166         * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
167         GetEnumerator method.
168
169         (ProbeCollectionType): Iterate starting at the most specific type
170         upwards looking for a GetEnumerator
171
172         * expression.cs: Shift count can be up to 31 for int/uint and 63
173         for long/ulong.
174
175 2003-11-26  Miguel de Icaza  <miguel@ximian.com>
176
177         * statement.cs (Block.LookupLabel): Also look for the label on the
178         children blocks.  Use a hash table to keep track of visited
179         nodes. 
180
181         * cfold.cs (IntConstant to UIntConstant mapping): Only return if
182         we actually did transform the other operand, otherwise fall back
183         to the common codepath that casts to long.
184
185         * cs-tokenizer.cs: Use the same code pattern as the int case.
186         Maybe I should do the parsing myself, and avoid depending on the
187         Parse routines to get this done.
188
189 2003-11-25  Miguel de Icaza  <miguel@ximian.com>
190
191         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
192         which fixes bug 51347.  This time test it.
193         
194         * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
195         attributes for example can not tell the difference between these.
196         The difference was only a syntax feature of the language. 
197
198         * attribute.cs: Apply attributes to delegates.
199
200         * delegate.cs: Call the apply attributes method.
201
202 2003-11-24  Miguel de Icaza  <miguel@ximian.com>
203
204         * convert.cs (TryImplicitIntConversion): One line bug fix: we were
205         comparing 0 vs Byte.MinValue, not the value
206
207         (ImplicitConversionRequired): When reporting a conversion error,
208         use error 31 to print out the constant error instead of the
209         simpler 29.
210
211         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
212         which fixes bug 51347.
213         
214 2003-11-22  Miguel de Icaza  <miguel@ximian.com>
215
216         * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen) 
217         which fixes the -warnaserror command line option.
218         
219 2003-11-21  Miguel de Icaza  <miguel@ximian.com>
220
221         * cfold.cs (DoNumericPromotions): During constant folding of
222         additions on UIntConstant, special case intconstants with
223         IntConstants like we do on the expression binary operator. 
224
225 2003-11-12  Miguel de Icaza  <miguel@ximian.com>
226
227         * convert.cs (ImplicitReferenceConversion): We were missing a case
228         (System.Enum are not value types or class types, so we need to
229         classify them separatedly).
230
231         * driver.cs: We do not support error 2007.
232
233 2003-11-12 Jackson Harper <jackson@ximian.com>
234
235         * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
236         system directory. Also use the full file name so users can
237         libraries names mscorlib-o-tron.dll in a non system dir.
238         
239 2003-11-10  Martin Baulig  <martin@ximian.com>
240
241         * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
242         (TypeManager.InitCoreTypes): Initialize them here, but instead of
243         calling `ResolveType()' on them, directly assign their `Type'.
244
245 2003-11-08  Martin Baulig  <martin@ximian.com>
246
247         * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
248         return value and the `out parent' parameter.
249         (TypeContainer.DefineType): Moved the CS0644 check into
250         GetClassBases().  Don't pass the interface types to the
251         `builder.DefineType()'/`builder.DefineNestedType()', but resolve
252         them later and then call `TypeBuilder.AddInterfaceImplementation()'.
253
254         * ecore.cs (TypeExpr.IsAttribute): New property.
255         (TypeExpr.GetInterfaces): New method.
256
257         * interface.cs (Interface.GetInterfaceTypeByName): Return a
258         TypeExpr instead of a Type.
259         (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
260         (Interface.DefineType): Don't pass the interface types to the
261         `builder.Definetype()'/`builder.DefineNestedType()', but resolve
262         them later and then call `TypeBulider.AddInterfaceImplementation()'.
263
264         * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
265         instead of a `Type[]'.
266         (TypeManager.RegisterBuilder): Likewise.
267         (TypeManager.AddUserInterface): Likewise.
268         (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
269         `Type[]' and also return a `TypeExpr[]'.
270         (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
271
272 2003-11-08  Martin Baulig  <martin@ximian.com>
273
274         * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
275         Expression.     
276
277 2003-11-08  Martin Baulig  <martin@ximian.com>
278
279         * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
280         TypeManager.ResolveExpressionTypes().
281
282         * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
283         instead of an Expression.
284         (TypeExpr): This is now an abstract base class for `TypeExpression'.
285         (TypeExpression): New public class; formerly known as `TypeExpr'.
286
287         * expression.cs (ComposedCast): Derive from TypeExpr.
288
289         * typemanager.cs (TypeManager.system_*_expr): These are now
290         TypExpr's instead of Expression's.
291         (TypeManager.ResolveExpressionTypes): New public static function;
292         called from DeclSpace.GetTypeResolveEmitContext() to resolve all
293         of them.        
294
295 2003-11-06  Miguel de Icaza  <miguel@ximian.com>
296
297         * expression.cs (New.DoResolve): Do not dereference value that
298         might be a null return.
299
300         * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
301         sure that the constant value has the right type.  Fixes an
302         unreported bug, similar to 50425.
303
304         * const.cs (Const.LookupConstantValue): Call
305         ImplicitStandardConversionExists before doing a conversion to
306         avoid havng the TypeManager.ChangeType do conversions.
307
308         Reduced the number of casts used
309
310         (Const.ChangeType): New routine to enable reuse of the constant
311         type changing code from statement.
312
313         * typemanager.cs (ChangeType): Move common initialization to
314         static global variables.
315
316         Fixes #50425.
317
318         * convert.cs (ImplicitReferenceConversion): Somehow we allowed
319         every value type to go through, even if it was void.  Fix that. 
320
321         * cs-tokenizer.cs: Use is_identifier_start_character on the start
322         character of the define, and the is_identifier_part_character for
323         the rest of the string.
324
325 2003-11-05  Miguel de Icaza  <miguel@ximian.com>
326
327         * expression.cs (UnaryMutator.EmitCode): When I updated
328         LocalVariableReference.DoResolve, I overdid it, and dropped an
329         optimization done on local variable references.
330
331 2003-11-04  Miguel de Icaza  <miguel@ximian.com>
332
333         * ecore.cs: Convert the return from Ldlen into an int.
334
335 2003-10-20  Miguel de Icaza  <miguel@ximian.com>
336
337         * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
338         the accessibility, this is a special case for toplevel non-public
339         classes (internal for instance).
340
341 2003-10-20  Nick Drochak <ndrochak@gol.com>
342
343         * ecore.cs: Fix typo and build.  Needed another right paren.
344
345 2003-10-19  Miguel de Icaza  <miguel@ximian.com>
346
347         * ecore.cs: Applied fix from Ben Maurer.   We were handling in the
348         `internal' case regular and protected, but not allowing protected
349         to be evaluated later.  Bug 49840
350
351 2003-10-15  Miguel de Icaza  <miguel@ximian.com>
352
353         * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
354         to kb.Nlast, and not the kb.nFirst to isolate the switch
355         statement.
356
357         Extract the underlying type, so enumerations of long/ulong are
358         treated like long/ulong.
359
360 2003-10-14  Miguel de Icaza  <miguel@ximian.com>
361
362         * expression.cs (New): Overload the meaning of RequestedType to
363         track the possible creation of the NewDelegate type, since
364         DoResolve is invoked more than once for new constructors on field
365         initialization.
366
367         See bugs: #48800 and #37014
368
369         * cs-parser.jay (declare_local_constants): Take an arraylist
370         instead of a single constant.
371
372         (local_constant_declaration): It should take a
373         constant_declarators, not a constant_declarator.  Fixes 49487
374
375         * convert.cs: Fix error report.
376
377 2003-10-13 Jackson Harper <jackson@ximian.com>
378
379         * typemanager.cs (TypeToCoreType): Add float and double this fixes
380         bug #49611
381         
382 2003-10-09  Martin Baulig  <martin@ximian.com>
383
384         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
385         to the .ctor.
386         (MethodCore.DoDefineParameters): Removed the TypeContainer
387         argument; use the DeclSpace which was passed to the .ctor instead.
388         (MethodCore.CheckParameter): Take a DeclSpace instead of a
389         TypeContainer; we only need a DeclSpace here.
390
391 2003-10-09  Martin Baulig  <martin@ximian.com>
392
393         * class.cs (MethodData): Added additional `DeclSpace ds' argument
394         to the .ctor.
395         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
396         EmitContext's .ctor.    
397
398 2003-10-09  Martin Baulig  <martin@ximian.com>
399
400         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
401         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
402         AsAccessible(), moved them as well.
403
404         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
405
406 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
407
408         * cs-parser.jay : Renamed yyName to yyNames related to jay.
409
410 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
411
412         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
413         generation for >=, as spotted by Paolo, bug 48679.  
414         Patch from David Waite.
415
416         * cs-tokenizer.cs: Add handling for #pragma.
417
418         * cs-parser.jay: Allow for both yield and yield return in the
419         syntax.  The anti-cobolization of C# fight will go on!
420
421         * class.cs (TypeBuilder.DefineType): Catch error condition here
422         (Parent.DefineType erroring out and returning null).
423
424         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
425         coping with enumerations variables, we were mistakenly processing
426         them as a regular value type instead of built-in types.  Fixes the
427         bug #48063
428
429         * typemanager.cs (IsBuiltinOrEnum): New method.
430
431 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
432
433         * cs-parser.jay: Upgrade: yield now needs the return clause.
434
435 2003-09-19  Martin Baulig  <martin@ximian.com>
436
437         * decl.cs (MemberCache.SetupCacheForInterface): Take a
438         `MemberCache parent' argument.  Normally, an interface doesn't
439         have a parent type except System.Object, but we use this in gmcs
440         for generic type parameters.
441
442 2003-09-18  Martin Baulig  <martin@ximian.com>
443
444         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
445         on `type.IsInterface'; don't check whether the type has a parent
446         to determine whether it's an interface.
447
448 2003-09-15  Martin Baulig  <martin@ximian.com>
449
450         * class.cs (TypeContainer.DefineType): Added an error flag to
451         avoid reporting duplicate CS0146's ("class definition is
452         circular.").
453
454         * driver.cs (Driver.MainDriver): Abort if
455         RootContext.ResolveTree() reported any errors.
456
457 2003-09-07  Martin Baulig  <martin@ximian.com>
458
459         * report.cs (Error, Warning): Added overloaded versions which take
460         a `params object[] args' and call String.Format().
461
462 2003-09-07  Martin Baulig  <martin@ximian.com>
463
464         * decl.cs (DeclSpace..ctor): Don't call
465         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
466         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
467         (DeclSpace.RecordDecl): New method.
468
469         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
470
471 2003-09-02  Ravi Pratap  <ravi@ximian.com>
472
473         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
474         value attributes to be applied to ParameterBuilders.
475
476         * class.cs (MethodCore.LabelParameters): Make static and more
477         generic so that it can be used from other places - like interface
478         methods, for instance.
479
480         * interface.cs (Interface.Emit): Call LabelParameters before
481         emitting attributes on the InterfaceMethod.
482
483 2003-08-26  Martin Baulig  <martin@ximian.com>
484
485         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
486         resolving aliases; fixes #47927.
487
488 2003-08-26  Martin Baulig  <martin@ximian.com>
489
490         * statement.cs (Using.DoResolve): This is internally emitting a
491         try/finally clause, so we need to set ec.NeedExplicitReturn if we
492         do not always return.  Fixes #47681.
493
494 2003-08-26  Martin Baulig  <martin@ximian.com>
495
496         * decl.cs (MemberCore): Moved WarningNotHiding(),
497         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
498         into MemberBase.
499         (AdditionResult): Make this nested in DeclSpace.
500         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
501         argument; call NamespaceEntry.Define() unless we're nested in a
502         class or struct.
503
504         * namespace.cs (Namespace.DefineName): New public function.  This
505         is called from DeclSpace's .ctor to add 
506         (Namespace.Lookup): Include DeclSpaces in the lookup.
507
508         * class.cs (Operator): Derive from MemberBase, not MemberCore.
509
510         * const.cs (Const): Derive from MemberBase, not MemberCore.     
511
512 2003-08-25  Martin Baulig  <martin@ximian.com>
513
514         * convert.cs (Convert.ExplicitReferenceConversion): When
515         converting from an interface type to a class, unbox if the target
516         type is a struct type.  Fixes #47822.
517
518 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
519
520         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
521         #47854.
522
523 2003-08-22  Martin Baulig  <martin@ximian.com>
524
525         * class.cs (TypeManager.DefineType): When defining a nested type,
526         call DefineType() on our parent; fixes #47801.
527
528 2003-08-22  Martin Baulig  <martin@ximian.com>
529
530         * class.cs (MethodData.Define): While checking if a method is an
531         interface implementation, improve the test a bit more to fix #47654.
532
533 2003-08-22  Martin Baulig  <martin@ximian.com>
534
535         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
536         correctly; fixes #47722.
537
538 2003-08-22  Martin Baulig  <martin@ximian.com>
539
540         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
541         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
542
543         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
544
545 2003-08-22  Martin Baulig  <martin@ximian.com>
546
547         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
548         can only be assigned in static constructors.  Fixes #47161.
549
550 2003-08-22  Martin Baulig  <martin@ximian.com>
551
552         Rewrote and improved the flow analysis code.
553
554         * flowbranching.cs (FlowBranching): Make this class abstract.
555         (FlowBranching.CreateBranching): New static function to create a
556         new flow branching.
557         (FlowBranchingBlock, FlowBranchingException): New classes.
558         (FlowBranching.UsageVector.Type): New public readonly field.
559         (FlowBranching.UsageVector.Breaks): Removed the setter.
560         (FlowBranching.UsageVector.Returns): Removed the setter.
561         (FlowBranching.UsageVector): Added Break(), Return(),
562         NeverReachable() and Throw() methods to modify the reachability.
563         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
564         done by FlowBranching.Merge().
565         (FlowBranching.UsageVector.MergeChild): New method; merges the
566         merge result into the current vector.
567         (FlowBranching.Merge): New abstract method to merge a branching.
568
569 2003-08-12  Martin Baulig  <martin@ximian.com>
570
571         * expression.cs (Indirection.CacheTemporaries): Create the
572         LocalTemporary with the pointer type, not its element type.
573
574 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
575
576         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
577         token was a keyword or not.
578
579         Add `error' options where an IDENTIFIER was expected;  Provide
580         CheckToken and CheckIdentifierToken convenience error reporting
581         functions. 
582
583         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
584
585         * decl.cs: Rename `NamespaceEntry Namespace' public field into
586         NameSpaceEntry NameSpaceEntry.
587
588         (LookupInterfaceOrClass): Avoid creating a full qualified name
589         from namespace and name: avoid doing lookups when we know the
590         namespace is non-existant.   Use new Tree.LookupByNamespace which
591         looks up DeclSpaces based on their namespace, name pair.
592
593         * driver.cs: Provide a new `parser verbose' to display the
594         exception thrown during parsing.  This is turned off by default
595         now, so the output of a failure from mcs is more graceful.
596
597         * namespace.cs: Track all the namespaces defined in a hashtable
598         for quick lookup.
599         
600         (IsNamespace): New method
601
602 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
603
604         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
605         we know that we need to concatenate (full typename can never be
606         null). 
607
608         * class.cs: ditto.
609
610         * statement.cs: Use a bitfield;  Do not initialize to null things
611         which are done by the constructor by default.
612
613         * cs-parser.jay: bug fix, parameter was 4, not 3.
614
615         * expression.cs: Just use the property;
616
617         * statement.cs: No need for GetVariableInfo method.
618
619 2003-08-08  Martin Baulig  <martin@ximian.com>
620
621         * flowanalysis.cs (FlowReturns): This is now nested in the
622         `FlowBranching' class.
623         (MyBitVector): Moved this here from statement.cs.
624         (FlowBranching.SiblingType): New enum type.
625         (FlowBranching.CreateSibling): Added `SiblingType' argument.
626
627 2003-08-07  Martin Baulig  <martin@ximian.com>
628
629         * flowanalysis.cs (FlowBranchingType): This is now nested in the
630         `FlowBranching' class and called `BranchingType'.
631
632 2003-08-07  Martin Baulig  <martin@ximian.com>
633
634         * flowanalysis.cs: Moved all the control flow analysis code into
635         its own file.
636
637 2003-08-07  Martin Baulig  <martin@ximian.com>
638
639         * assign.cs (Assign.DoResolve): `target' must either be an
640         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
641         #37319.
642
643 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
644
645         * expression.cs (BinaryMethod): This kind of expression is created by the
646         Binary class if it determines that the operator has to be handled
647         by a method.
648
649         (BinaryDelegate): This kind of expression is created if we are
650         dealing with a + or - operator on delegates.
651
652         (Binary): remove method, argumetns, and DelegateOperator: when
653         dealing with methods, 
654         
655         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
656
657         * statement.cs (Block): use bitfields for the three extra booleans
658         we had in use.   Remove unused topblock parameter.
659
660         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
661
662         * assign.cs: Drop extra unneeded tests.
663
664 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
665
666         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
667
668         * statement.cs (Foreach): Use VariableStorage instead of
669         LocalBuilders.   
670
671         * codegen.cs (VariableStorage): New class used by clients that
672         require a variable stored: locals or fields for variables that
673         need to live across yield.
674
675         Maybe provide a convenience api for EmitThis+EmitLoad?
676
677         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
678         these bad boys.
679
680 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
681
682         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
683         RemapParameterLValue): New methods that are used to turn a
684         precomputed FieldInfo into an expression like this:
685
686                 instance.FieldInfo
687
688         The idea is to use this instead of making LocalVariableReference
689         have more than one meaning.
690
691         * cs-parser.jay: Add error production to BASE.
692
693         * ecore.cs: Deal with TypeManager.GetField returning null, which
694         is now a valid return value.
695
696         (FieldExprNoAddress): New expression for Fields whose address can
697         not be taken.
698
699         * expression.cs (LocalVariableReference): During the resolve
700         phases, create new expressions if we are in a remapping context.
701         Remove code that dealt with remapping here.
702
703         (ParameterReference): same.
704
705         (ProxyInstance): New expression, like the `This' expression, but
706         it is born fully resolved.  We know what we are doing, so remove
707         the errors that are targeted to user-provided uses of `this'.
708
709         * statement.cs (Foreach): our variable is now stored as an
710         Expression;  During resolution, follow the protocol, dont just
711         assume it will return this.
712         
713 2003-08-06  Martin Baulig  <martin@ximian.com>
714
715         * support.cs (SeekableStreamReader.cs): New public class.
716
717         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
718         SeekableStreamReader instead of the normal StreamReader.
719
720 2003-08-04  Martin Baulig  <martin@ximian.com>
721
722         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
723         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
724         deambiguate casts and delegate invocations.
725         (parenthesized_expression): Use the new tokens to ensure this is
726         not a cast of method invocation.
727
728         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
729         when reading a `)' and Deambiguate_CloseParens () was previously
730         called.
731
732         * expression.cs (ParenthesizedExpression): New class.  This is
733         just used for the CS0075 test.
734         (Binary.DoResolve): Check for CS0075.   
735
736 2003-07-29  Ravi Pratap  <ravi@ximian.com>
737
738         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
739         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
740         reference comparison.
741
742         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
743         examine the ReturnType for equality - this is necessary in the
744         cases of implicit and explicit operators whose signature also
745         includes the return type.
746
747 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
748
749         * namespace.cs: Cache the result of the namespace computation,
750         instead of computing it every time.
751
752 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
753
754         * decl.cs: Use a global arraylist that we reuse over invocations
755         to avoid excesive memory consumption.  Reduces memory usage on an
756         mcs compile by one meg (45 average).
757
758         * typemanager.cs (LookupTypeReflection): In .NET pointers are
759         private, work around that.
760
761 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
762
763         * literal.cs (IntLiteral): Define Zero and One static literals. 
764
765         * cs-parser.jay (integer_literal): use static literals to reduce
766         memory usage for the most used literals (0, 1 and -1).  211kb
767         reduced in memory usage.
768
769         Replace all calls to `new ArrayList' with `new
770         ArrayList(4)' which is a good average number for most allocations,
771         and also requires only 16 bytes of memory for its buffer by
772         default. 
773
774         This reduced MCS memory usage in seven megabytes for the RSS after
775         bootstrapping.
776
777 2003-07-28  Ravi Pratap  <ravi@ximian.com>
778
779         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
780         handle params methods the correct way by forming only one
781         applicable set with params and normal methods in them. Earlier we
782         were looking at params methods only if we found no normal methods
783         which was not the correct thing to do.
784
785         (Invocation.BetterFunction): Take separate arguments indicating
786         when candidate and the best method are params methods in their
787         expanded form.
788
789         This fixes bugs #43367 and #46199.
790
791         * attribute.cs: Documentation updates.
792
793         (CheckAttribute): Rename to CheckAttributeTarget.
794         (GetValidPlaces): Rename to GetValidTargets.
795
796         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
797         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
798
799         Fixes bug #44468.
800
801 2003-07-28  Martin Baulig  <martin@ximian.com>
802
803         * class.cs (TypeContainer.DefineMembers): Use the base type's full
804         name when looking up the base class of a nested class.  Fixes #46977.
805
806 2003-07-26  Martin Baulig  <martin@ximian.com>
807
808         * expression.cs (Indexers.Indexer): New nested struct; contains
809         getter, setter and the indexer's type.
810         (Indexers.Properties): This is now an ArrayList of
811         Indexers.Indexer's.
812         (IndexerAccess.DoResolveLValue): Correctly set the type if the
813         indexer doesn't have any getters.
814
815         * assign.cs (Assign.DoResolve): Also do the implicit conversions
816         for embedded property and indexer assignments.
817
818 2003-07-26  Martin Baulig  <martin@ximian.com>
819
820         * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
821         preprocessor directive is not the first non-whitespace character
822         on a line.
823
824 2003-07-26  Martin Baulig  <martin@ximian.com>
825
826         * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
827         namespace parsing, follow the spec more closely.
828
829         * rootcontext.cs (RootContext.NamespaceLookup): Use the new
830         NamespaceEntry.Lookup().
831
832 2003-07-25  Martin Baulig  <martin@ximian.com>
833
834         * MethodCore.cs (OverridesSomething): New public field; it's set
835         from TypeContainer.DefineMembers if this method overrides
836         something (which doesn't need to be a method).  Fix #39462.
837
838 2003-07-25  Ravi Pratap  <ravi@ximian.com>
839
840         * typemanager.cs (GetMembers): Ensure that the list of members is
841         reversed. This keeps things in sync.
842
843         * attribute.cs (Attribute.CheckAttribute): Break as soon as we
844         find an AttributeUsage attribute.
845
846         * expression.cs (Invocation.OverloadResolve): Perform the check
847         which disallows Invoke to be directly called on a Delegate.
848
849         (Error_InvokeOnDelegate): Report error cs1533.
850         
851 2003-07-25  Martin Baulig  <martin@ximian.com>
852
853         * expression.cs (Indexers.GetIndexersForType): Only look in the
854         interface hierarchy if the requested type is already an
855         interface.  Fixes #46788 while keeping #46502 fixed.
856
857 2003-07-25  Martin Baulig  <martin@ximian.com>
858
859         * class.cs (TypeContainer.DefineMembers): Check whether all
860         readonly fields have been assigned and report warning CS0649 if
861         not.
862
863         * statement.cs (LocalInfo.IsFixed): Always return true if this is
864         a valuetype.
865
866 2003-07-24  Ravi Pratap  <ravi@ximian.com>
867
868         * decl.cs (MemberCache.AddMethods): Reverse the order of the array
869         returned from GetMethods to make things consistent with the
870         assumptions MCS makes about ordering of methods.
871
872         This should comprehensively fix bug #45127 and it does :-)
873
874         * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
875         ordering is actually reverse.
876
877         * Clean up some debug messages I left lying around.
878
879         * interface.cs (Populate*): Get rid of code which emits attributes
880         since the stage in which we emit attributes is the 'Emit' stage,
881         not the define stage.
882
883         (Emit): Move attribute emission for interface members here.
884         
885 2003-07-22  Ravi Pratap  <ravi@ximian.com>
886
887         * expression.cs (Invocation.OverloadResolve): Follow the spec more
888         closely: we eliminate methods in base types when we have an
889         applicable method in a top-level type.
890
891         Please see section 14.5.5.1 for an exact description of what goes
892         on. 
893
894         This fixes bug #45127 and a host of other related to corlib compilation.
895
896         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
897         array is the method corresponding to the top-level type (this is
898         because of the changes made to icall.c) so we change this
899         accordingly.
900
901         (MethodGroupExpr.Name): This too.
902
903         * typemanager.cs (GetElementType): New method which does the right
904         thing when compiling corlib. 
905
906         * everywhere: Make use of the above in the relevant places.
907
908 2003-07-22  Martin Baulig  <martin@ximian.com>
909
910         * cs-parser.jay (invocation_expression): Moved
911         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
912         `cast_expression', but create a InvocationOrCast which later
913         resolves to either an Invocation or a Cast.
914
915         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
916         method; call this before EmitStatement() to make sure that this
917         expression can be used as a statement.
918
919         * expression.cs (InvocationOrCast): New class; resolves to either
920         an Invocation or a Cast.
921
922         * statement.cs (StatementExpression): Call ResolveStatement() on
923         the ExpressionStatement before emitting it.
924
925 2003-07-21  Martin Baulig  <martin@ximian.com>
926
927         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
928         `ref' and `out' attributes match; fixes #46220.
929         (MemberAccess.ResolveMemberAccess): You can't reference a type
930         through an expression; fixes #33180.
931         (Indexers.GetIndexersForType): Don't return the indexers from
932         interfaces the class implements; fixes #46502.
933
934 2003-07-21  Martin Baulig  <martin@ximian.com>
935
936         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
937         CS0661 checks; fixes bug #30442.
938
939 2003-07-21  Martin Baulig  <martin@ximian.com>
940
941         * decl.cs (AdditionResult): Added `Error'.
942
943         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
944
945         * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
946         makes cs0031.cs actually work.
947
948 2003-07-20  Martin Baulig  <martin@ximian.com>
949
950         * namespace.cs: Fixed that bug which caused a crash when compiling
951         the debugger's GUI.
952
953 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
954
955         * typemanager.cs (LookupTypeReflection): Never expose types which
956         are NotPublic, NestedPrivate, NestedAssembly, or
957         NestedFamANDAssem.  We used to return these, and later do a check
958         that would report a meaningful error, but the problem is that we
959         would not get the real match, if there was a name override.
960
961 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
962
963         * namespace.cs (Namespace, Name): Do not compute the namespace
964         name dynamically, compute it in the constructor.  This reduced
965         memory usage by 1697 KB.
966
967         * driver.cs: Use --pause to pause at the end.
968
969 2003-07-17  Peter Williams  <peter@newton.cx>
970
971         * Makefile: Change the name of the test target so that it doesn't
972         conflict with the recursive test target.
973
974 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
975
976         * expression.cs (LocalVariableReference.Emit, EmitAssign,
977         AddressOf): Do not use EmitThis, that was wrong, use the actual
978         this pointer.
979
980 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
981
982         * class.cs (MethodData.Define): While checking if a method is an
983         interface implementation, improve the test: If we are not public
984         (use new test here: use the computed MethodAttributes directly,
985         instead of the parsed modifier flags) check if the `implementing'
986         method comes from an interface or not.
987
988         * pending.cs (VerifyPendingMethods): Slightly better error
989         message.
990
991         * makefile: add test target that does the mcs bootstrap.
992
993 2003-07-16  Ravi Pratap  <ravi@ximian.com>
994
995         * interface.cs (Define): Do nothing here since there are no
996         members to populate etc. Move the attribute emission out of here
997         since this was just totally the wrong place to put it. Attribute
998         application happens during the 'Emit' phase, not in the 'Define'
999         phase.
1000
1001         (Emit): Add this method and move the attribute emission here
1002
1003         * rootcontext.cs (EmitCode): Call the Emit method on interface
1004         types too.
1005
1006 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
1007
1008         * expression.cs (OverloadResolve): Report error only if Location
1009         is not 'Null' which means that there was a probe going on.
1010
1011 2003-07-14  Martin Baulig  <martin@ximian.com>
1012
1013         * expression.cs (ConditionalLogicalOperator): New public class to
1014         implement user defined conditional logical operators.
1015         This is section 14.11.2 in the spec and bug #40505.
1016
1017 2003-07-14  Martin Baulig  <martin@ximian.com>
1018
1019         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
1020
1021 2003-07-14  Martin Baulig  <martin@ximian.com>
1022
1023         * codegen.cs (EmitContext.InFixedInitializer): New public field.
1024
1025         * ecore.cs (IVariable.VerifyFixed): New interface method.
1026
1027         * expression.cs (Unary.ResolveOperator): When resolving the `&'
1028         operator, check whether the variable is actually fixed.  Fixes bug
1029         #36055.  Set a variable definitely assigned when taking its
1030         address as required by the spec.
1031
1032         * statement.cs (LocalInfo.IsFixed): New field.
1033         (LocalInfo.MakePinned): Set `IsFixed' to true.
1034
1035 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
1036
1037         * attribute.cs (Attribute.Resolve): While doing a Member lookup
1038         for .ctors, ensure that we only ask for members declared in the
1039         attribute type (BindingFlags.DeclaredOnly).
1040
1041         Fixes bug #43632.
1042
1043         * expression.cs (Error_WrongNumArguments): Report error 1501
1044         correctly the way CSC does.
1045
1046 2003-07-13  Martin Baulig  <martin@ximian.com>
1047
1048         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
1049         lookup on the fully qualified name, to make things like "X.X" work
1050         where "X.X" is a fully qualified type name, but we also have a
1051         namespace "X" in the using list.  Fixes #41975.
1052
1053 2003-07-13  Martin Baulig  <martin@ximian.com>
1054
1055         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
1056         function. If we're a CompoundAssign, we need to create an embedded
1057         CompoundAssign, not an embedded Assign.
1058         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
1059         Fixes #45854.
1060
1061 2003-07-13  Martin Baulig  <martin@ximian.com>
1062
1063         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
1064         work to fix bug #46088.
1065
1066 2003-07-13  Ravi Pratap <ravi@ximian.com>
1067
1068         * class.cs (Operator.Emit): Do not emit attributes here - it is
1069         taken care of by the Method class that we delegate too. This takes
1070         care of bug #45876.
1071         
1072 2003-07-10  Martin Baulig  <martin@ximian.com>
1073
1074         * expression.cs (TypeOfVoid): New class.
1075         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
1076
1077 2003-07-10  Martin Baulig  <martin@ximian.com>
1078
1079         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
1080         bug #35957.
1081
1082 2003-07-10  Martin Baulig  <martin@ximian.com>
1083
1084         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
1085         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
1086
1087         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
1088
1089         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
1090
1091 2003-07-10  Martin Baulig  <martin@ximian.com>
1092
1093         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
1094         of decimal.  Fixes #42850.
1095
1096         NOTE: I also fixed the created byte blob, but this doesn't work on
1097         the MS runtime and csc never produces any byte blobs for decimal
1098         arrays.
1099
1100 2003-07-10  Martin Baulig  <martin@ximian.com>
1101
1102         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
1103         structs; fixes #32068.
1104         (Block.AddChildVariableNames): Fixed #44302.
1105
1106 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1107
1108         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
1109         
1110 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1111
1112         * attribute.cs: And this test is onger needed.
1113
1114 2003-07-08  Martin Baulig  <martin@ximian.com>
1115
1116         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
1117         inaccessible types.  Fixes #36313.
1118
1119         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
1120
1121         * namespace.cs (NamespaceEntry): Create implicit entries for all
1122         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
1123         implicit entries for N1.N2 and N1.
1124
1125 2003-07-08  Martin Baulig  <martin@ximian.com>
1126
1127         Rewrote the handling of namespaces to fix a lot of the issues
1128         wrt. `using' aliases etc.
1129
1130         * namespace.cs (Namespace): Splitted this class into a
1131         per-assembly `Namespace' and a per-file `NamespaceEntry'.
1132
1133         * typemanager.cs (TypeManager.IsNamespace): Removed.
1134         (TypeManager.ComputeNamespaces): Only compute namespaces from
1135         loaded assemblies here, not the namespaces from the assembly we're
1136         currently compiling.
1137
1138 2003-07-08  Martin Baulig  <martin@ximian.com>
1139
1140         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
1141
1142 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1143
1144         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
1145         already fixed it.  
1146
1147         I thought about the memory savings here, but LookupTypeReflection
1148         is used under already very constrained scenarios.  Compiling
1149         corlib or mcs only exposes one hit, so it would not really reduce
1150         any memory consumption.
1151
1152 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1153
1154         * typemanager.cs: fixes bug #45889 by only adding public types from
1155         other assemblies to the list of known types.
1156
1157 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1158
1159         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
1160         on the type we resolved.
1161
1162 2003-07-05  Martin Baulig  <martin@ximian.com>
1163
1164         * pending.cs (PendingImplementation.ParentImplements): Don't
1165         create the proxy if the parent is abstract.
1166
1167         * class.cs (TypeContainer.DefineIndexers): Process explicit
1168         interface implementations first.  Fixes #37714.
1169
1170 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
1171
1172         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
1173         defined recursively;  but since we modify the input parameters
1174         (left is set to `this' temporarily), we reset this value if the
1175         left_is_explicit is false, which gives the original semantics to
1176         the code.  
1177
1178         * literal.cs (NullPointer): new class used to represent a null
1179         literal in a pointer context.
1180
1181         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
1182         type is a pointer, use a NullPointer object instead of a
1183         NullLiteral.   Closes 43687
1184
1185         (ExplicitConversion): Convert pointer values using
1186         the conv opcode to the proper type.
1187
1188         * ecore.cs (New): change ValueTypeVariable property into a method,
1189         that returns whether the valuetype is suitable for being used.
1190
1191         * expression.cs (Binary.DoNumericPromotions): Only return if we
1192         the int constant was a valid uint, and we can return both left and
1193         right as uints.  If not, we continue processing, to trigger the
1194         type conversion.  This fixes 39018.
1195
1196         * statement.cs (Block.EmitMeta): During constant resolution, set
1197         the CurrentBlock property on the emitcontext, so that we resolve
1198         constants propertly.
1199
1200 2003-07-02  Martin Baulig  <martin@ximian.com>
1201
1202         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
1203         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
1204
1205         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
1206         than emitting it here.
1207
1208         * statement.cs: Fixed some more flow analysis bugs.
1209
1210 2003-07-02  Martin Baulig  <martin@ximian.com>
1211
1212         * class.cs (MethodData.Define): When implementing interface
1213         methods, set Final unless we're Virtual.
1214
1215         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
1216         check work for interface methods.
1217
1218 2003-07-01  Martin Baulig  <martin@ximian.com>
1219
1220         * ecore.cs (EmitContext.This): Replaced this property with a
1221         GetThis() method which takes a Location argument.  This ensures
1222         that we get the correct error location for a CS0188.
1223
1224 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
1225
1226         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
1227         ImplicitStandardConversion.
1228
1229         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
1230
1231 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
1232
1233         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
1234         optimization.
1235
1236 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
1237
1238         * class.cs (Constructor.Define): Turn off initlocals for unsafe
1239         constructors.
1240
1241         (MethodData.Define): Turn off initlocals for unsafe methods.
1242
1243 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
1244
1245         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
1246         complete;  Fixes #37521.
1247
1248         * delegate.cs: Use Modifiers.TypeAttr to compute the
1249         TypeAttributes, instead of rolling our own.  This makes the flags
1250         correct for the delegates.
1251
1252 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
1253
1254         * class.cs (Constructor.Define): Set the private flag for static
1255         constructors as well.
1256
1257         * cs-parser.jay (statement_expression): Set the return value to
1258         null, to avoid a crash when we catch an error.
1259
1260 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
1261
1262         * cs-parser.jay: Applied patch from Jackson that adds support for
1263         extern and unsafe modifiers to destructor declarations.
1264
1265         * expression.cs: Report error 21 if the user is trying to index a
1266         System.Array.
1267
1268         * driver.cs: Add an error message, suggested by the bug report.
1269
1270         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
1271         if we do not have a ": this ()" constructor initializer.  Fixes 45149
1272
1273 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
1274
1275         * namespace.cs: Add some information to reduce FAQs.
1276
1277 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
1278
1279         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
1280         underlying enumeration types.  Fixes #43915.
1281
1282         * expression.cs: Treat ushort/short as legal values to be used in
1283         bitwise operations.
1284
1285 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
1286
1287         * delegate.cs: transfer custom attributes for paramenters from
1288         the delegate declaration to Invoke and BeginInvoke.
1289
1290 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
1291
1292         * attribute.cs: handle custom marshalers and emit marshal info
1293         for fields, too.
1294
1295 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
1296
1297         * makefile.gnu: Added anonymous.cs to the compiler sources.
1298
1299 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
1300
1301         * iterators.cs: Change the name of the proxy class to include two
1302         underscores.
1303
1304         * cs-parser.jay: Update grammar to include anonymous methods.
1305         
1306         * anonymous.cs: new file.
1307
1308 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
1309
1310         * class.cs (Field.Define): Add missing test for pointers and
1311         safety. 
1312
1313 2003-05-27  Ravi Pratap  <ravi@ximian.com>
1314
1315         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
1316         we use the stobj opcode.
1317
1318         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
1319         since it wasn't the correct fix. 
1320
1321         It still is puzzling that we are required to use stobj for IntPtr
1322         which seems to be a ValueType.
1323
1324 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
1325
1326         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
1327         during regular simple name resolution.   Now, the trick is that
1328         instead of returning for processing the simplename, we do a
1329         TypeManager.LookupType (ie, a rooted lookup as opposed to a
1330         contextual lookup type).   If a match is found, return that, if
1331         not, return for further composition.
1332
1333         This fixes long-standing 30485.
1334
1335         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1336         using the address to initialize an object, do an Stobj instead of
1337         using the regular Stelem.
1338
1339         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
1340         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
1341         Because if we are a BaseIndexerAccess that value will be true.
1342         Fixes 43643.
1343
1344         * statement.cs (GotoCase.Resolve): Return after reporting an
1345         error, do not attempt to continue. 
1346
1347         * expression.cs (PointerArithmetic.Emit): If our operand is a
1348         long, convert our constants to match the operand before
1349         multiplying.  Convert to I type before adding.   Fixes 43670.
1350         
1351 2003-05-14  Ravi Pratap  <ravi@ximian.com>
1352
1353         * enum.cs (ImplicitConversionExists) : Rename to
1354         ImplicitEnumConversionExists to remove ambiguity. 
1355
1356         * ecore.cs (NullCast): New type of cast expression class which
1357         basically is very similar to EmptyCast with the difference being
1358         it still is a constant since it is used only to cast a null to
1359         something else
1360         (eg. (string) null)
1361
1362         * convert.cs (ImplicitReferenceConversion): When casting a null
1363         literal, we return a NullCast.
1364
1365         * literal.cs (NullLiteralTyped): Remove - I don't see why this
1366         should be around anymore.
1367
1368         The renaming (reported was slightly wrong). Corrections:
1369
1370         ConvertImplicitStandard -> ImplicitConversionStandard
1371         ConvertExplicitStandard -> ExplicitConversionStandard
1372
1373         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
1374         before passing them in !
1375
1376         * convert.cs (ImplicitConversionStandard): When comparing for
1377         equal expr and target types, ensure that expr is not a
1378         NullLiteral.
1379
1380         In general, we must not be checking (expr_type ==
1381         target_type) in the top level conversion methods
1382         (ImplicitConversion, ExplicitConversion etc). This checking is
1383         done in the methods that they delegate to.
1384
1385 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
1386
1387         * convert.cs: Move Error_CannotConvertType,
1388         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
1389         ImplicitNumericConversion, ImplicitConversionExists,
1390         ImplicitUserConversionExists, StandardConversionExists,
1391         FindMostEncompassedType, FindMostSpecificSource,
1392         FindMostSpecificTarget, ImplicitUserConversion,
1393         ExplicitUserConversion, GetConversionOperators,
1394         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
1395         TryImplicitIntConversion, Error_CannotConvertImplicit,
1396         ConvertImplicitRequired, ConvertNumericExplicit,
1397         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
1398         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
1399         its own file.
1400
1401         Perform the following renames:
1402         
1403         StandardConversionExists -> ImplicitStandardConversionExists
1404         ConvertImplicit -> ImplicitConversion
1405         ConvertImplicitStandard -> ImplicitStandardConversion
1406         TryImplicitIntConversion -> ImplicitIntConversion
1407         ConvertImplicitRequired -> ImplicitConversionRequired
1408         ConvertNumericExplicit -> ExplicitNumericConversion
1409         ConvertReferenceExplicit -> ExplicitReferenceConversion
1410         ConvertExplicit -> ExplicitConversion
1411         ConvertExplicitStandard -> ExplicitStandardConversion
1412
1413 2003-05-19  Martin Baulig  <martin@ximian.com>
1414
1415         * statement.cs (TypeInfo.StructInfo): Made this type protected.
1416         (TypeInfo): Added support for structs having structs as fields.
1417
1418         * ecore.cs (FieldExpr): Implement IVariable.
1419         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
1420         VariableInfo for the field.
1421
1422 2003-05-18  Martin Baulig  <martin@ximian.com>
1423
1424         * expression.cs (This.DoResolve): Report a CS0027 if we're
1425         emitting a field initializer.
1426
1427 2003-05-18  Martin Baulig  <martin@ximian.com>
1428
1429         * expression.cs (This.ResolveBase): New public function.
1430         (This.DoResolve): Check for CS0188.
1431
1432         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
1433         This.Resolve().
1434
1435         * ecore.cs (MethodGroupExpr.DoResolve): Set the
1436         `instance_expression' to null if we don't have any non-static
1437         methods.
1438
1439 2003-05-18  Martin Baulig  <martin@ximian.com>
1440
1441         Reworked the way how local variables and parameters are handled by
1442         the flow analysis code.
1443
1444         * statement.cs (TypeInfo, VariableMap): New public classes.
1445         (VariableInfo): New public class.  This is now responsible for
1446         checking whether a variable has been assigned.  It is used for
1447         parameters and local variables.
1448         (Block.EmitMeta): Take the InternalParameters as argument; compute
1449         the layout of the flow vectors here.
1450         (Block.LocalMap, Block.ParameterMap): New public properties.
1451         (FlowBranching): The .ctor doesn't get the InternalParameters
1452         anymore since Block.EmitMeta() now computes the layout of the flow
1453         vector.
1454         (MyStructInfo): This class is now known as `StructInfo' and nested
1455         in `TypeInfo'; we don't access this directly anymore.
1456
1457         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
1458         property and removed IsAssigned(), IsFieldAssigned(),
1459         SetAssigned() and SetFieldAssigned(); we now call them on the
1460         VariableInfo so we don't need to duplicate this code everywhere.
1461
1462         * expression.cs (ParameterReference): Added `Block block' argument
1463         to the .ctor.
1464         (LocalVariableReference, ParameterReference, This): The new
1465         VariableInfo class is now responsible for all the definite
1466         assignment stuff.
1467
1468         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
1469         IsParameterAssigned, SetParameterAssigned): Removed.
1470
1471 2003-05-18  Martin Baulig  <martin@ximian.com>
1472
1473         * typemanager.cs (InitCoreTypes): Try calling
1474         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
1475         the 3-args-version.  Corlib now also needs our `void_type'.
1476         (GetMethod): Added overloaded version which takes an optional
1477         `bool report_errors' to allow lookups of optional methods.
1478
1479 2003-05-12  Martin Baulig  <martin@ximian.com>
1480
1481         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
1482         only used for locals and not for parameters.
1483
1484 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
1485
1486         * support.cs (InternalParameters.ParameterType): Return the
1487         ExternalType of the parameter.
1488
1489         * parameter.cs (Parameter.ExternalType): drop the two arguments,
1490         they were unused.
1491
1492 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
1493
1494         * class.cs (MethodData.Define): Do not set the `newslot' on
1495         interface members, if they are also flagged as "override".
1496
1497         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
1498         better code for ++i and i++.  This only works for static fields
1499         and local variables.
1500
1501         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
1502         want to pull the DeclSpace out of the builder_to_declspace instead
1503         of the TypeBuilder (like in TypeContainer.FindMembers).
1504
1505         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
1506         instead of LookupTypeContainer.  Fixes the crash on .NET for
1507         looking up interface members.
1508
1509         * const.cs: Create our own emit context during the Definition
1510         stage, so that constants are evaluated in the proper context, when
1511         a recursive definition happens.
1512
1513 2003-05-11  Martin Baulig  <martin@ximian.com>
1514
1515         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
1516         new block for a switch section.
1517         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
1518         the adding/lookup in the switch block.  Fixes #39828.
1519
1520 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
1521
1522         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
1523         functionality: I needed to convert the data after I had performed
1524         the add/sub operation into the operands type size.
1525
1526         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
1527         pass the type for the box operation, otherwise the resulting
1528         object would have been of type object.
1529
1530         (BoxedCast): Add constructor to specify the type to box as.
1531
1532 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
1533
1534         * iterators.cs: I was reusing the `count' variable inadvertently,
1535         take steps to not allow this to happen.
1536
1537 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
1538
1539         * attribute.cs (Attribute.Resolve): Params attributes are encoded
1540         by creating an array at the point where the params starts and
1541         putting all those arguments there, then adjusting the size of the
1542         array.
1543
1544 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
1545
1546         * expression.cs (New.AddressOf): Implement interface
1547         IMemoryLocation.  This is used when the `new' operator is used in
1548         the context of an invocation to a method on a value type.
1549
1550         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1551         example. 
1552
1553         * namespace.cs: Also check the using aliases here.
1554
1555         * driver.cs: Move the test for using validity after the types have
1556         been entered, so we do a single pass that also includes the using
1557         aliases. 
1558
1559         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1560         in the regular case.   CreateSiblingForFinally is doing extra
1561         error checking.
1562
1563         * attribute.cs (GetAttributeArgumentExpression): Store the result
1564         on an out value, and use the return value to indicate failure
1565         instead of using null (which is a valid return for Constant.GetValue).
1566
1567         * statement.cs: Perform the analysis flow for the increment
1568         portion after the statement, because this will be the real flow of
1569         execution.  Fixes #42385
1570
1571         * codegen.cs (EmitContext.EmitArgument,
1572         EmitContext.EmitStoreArgument): New helper functions when the
1573         RemapToProxy flag is set.
1574
1575         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1576         function.
1577
1578         Add support for remapping parameters. 
1579
1580         * iterators.cs: Propagate parameter values;  Store parameter
1581         values in the proxy classes.
1582         
1583 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
1584
1585         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
1586         need a proxy reference;  I do not know what I was thinking
1587
1588         * cs-parser.jay (constructor_initializer): catch another error,
1589         and display nice message.
1590         
1591         (field_declaration): catch void field declaration
1592         to flag a better error. 
1593
1594         * class.cs (MemberBase.CheckBase): Report an error instead of a
1595         warning if a new protected member is declared in a struct. 
1596         (Field.Define): catch the error of readonly/volatile.
1597
1598         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1599
1600         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
1601         volatile variable is taken
1602
1603 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
1604
1605         * statement.cs (Fixed.Resolve): Report an error if we are not in
1606         an unsafe context.
1607
1608 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
1609
1610         * typemanager.cs: reuse the code that handles type clashes for
1611         delegates and enumerations.
1612
1613         * class.cs (Report28): Always report.
1614
1615         * expression.cs (EncodeAsAttribute): Allow nulls here.
1616
1617 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
1618
1619         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1620         the functionality for testing whether an expression is valid for
1621         an attribute here.  Also handle the case of arrays of elements
1622         being stored. 
1623
1624         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1625         encoding a linear array into an array of objects that are suitable
1626         to be passed to an CustomAttributeBuilder.
1627
1628         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1629
1630         * ecore.cs: (FieldExpr): Handle field remapping here.
1631
1632         * iteratators.cs: Pass the instance variable (if the method is an
1633         instance method) to the constructors, so we can access the field
1634         variables on the class.
1635
1636         TODO: Test this with structs.  I think the THIS variable on
1637         structs might have to be a pointer, and not a refenrece
1638
1639 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
1640
1641         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1642         local variables to fields in a proxy class.
1643
1644         * iterators.cs (PopulateProxy): Rename our internal fields to
1645         <XXX>.  
1646         Create a <THIS> field if we are an instance method, so we can
1647         reference our parent container variables.
1648         (MapVariable): Called back from the EmitContext code to enter a
1649         new variable to field mapping into the proxy class (we just create
1650         a FieldBuilder).
1651
1652         * expression.cs
1653         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1654         for using the remapped locals to fields.
1655
1656         I placed the code here, because that gives the same semantics to
1657         local variables, and only changes the Emit code.
1658
1659         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1660         statements inside iterators.
1661         (VariableInfo): Add a FieldBuilder for the cases when we are
1662         remapping local variables to fields in a proxy class
1663
1664         * ecore.cs (SimpleNameResolve): Avoid testing two times for
1665         current_block != null.
1666
1667         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1668         not cope with strings, as it has been moved to the
1669         TableSwitchEmit.  Fixed bug in switch generation.
1670
1671         * expression.cs (New.DoResolve): Provide more context for the user
1672         when reporting an error.
1673
1674         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1675         pointers. 
1676
1677         * expression.cs (MemberAccess.DoResolve): When we get a type back,
1678         check the permissions for it.  Note than in a type-resolution
1679         context the check was already present in DeclSpace.ResolveType,
1680         but was missing from the MemberAccess.
1681
1682         (ArrayCreation.CheckIndices): warn if the user has
1683         more nested levels of expressions, but there are no more
1684         dimensions specified.  Avoids crash on bug 41906.
1685
1686 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
1687
1688         * statement.cs (Block): replace Implicit bool, for a generic
1689         flags.   
1690         New flag: `Unchecked'.  This is used during the EmitMeta phase
1691         (which is out-of-line with the regular Resolve/Emit process for a
1692         statement, as this is done ahead of time, but still gets a chance
1693         to call constant resolve).
1694         
1695         (Block.Flags): new enum for adding a new flag.
1696
1697         (Block.EmitMeta): track the state of unchecked.
1698         
1699         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1700         to enable constant resolution to work there as well.
1701
1702 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
1703
1704         * typemanager.cs (ienumerable_type): Also look up
1705         System.Collections.IEnumerable. 
1706
1707 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
1708
1709         TODO: Test more than one conditional per method.
1710         
1711         * class.cs (Indexer.Define): Report the location where the user is
1712         referencing the unsupported feature.
1713
1714         (MethodData): Overload the use of `conditionals' to
1715         minimize the creation of needless ArrayLists.   This saves roughly
1716         212kb on my machine.
1717
1718         (Method): Implement the new IIteratorContainer interface.
1719         (Method.SetYields): Implement the method by setting the ModFlags
1720         to contain METHOD_YIELDS.
1721         
1722         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1723         which just got set to null.
1724
1725         * iterators.cs: New file.
1726
1727         (Yield, YieldBreak): New statements.
1728
1729         * statement.cs (Return.Resolve): Flag an error if we are used in
1730         an iterator method.
1731
1732         * codegen.cs (InIterator): New flag set if the code is being
1733         compiled in an iterator method.
1734
1735         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
1736         internal modifier, and we just use it to avoid adding extra
1737         fields, as this is seldom used.  
1738
1739         * cs-parser.jay: Add yield_statement (yield and yield break).
1740
1741         * driver.cs: New flag -v2 to turn on version 2 features. 
1742
1743         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1744         hashtable when v2 is enabled.
1745
1746 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
1747
1748         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1749         there is already a namespace defined with this name.
1750
1751         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1752         people upgraded their corlibs.
1753
1754         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1755         always use fully qualified types, no need to use the compiler
1756         front end.
1757
1758         (TypeManager.IsNamespace): Use binarysearch.
1759         
1760         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1761         AddDelegate): I did not quite use the new IsValid API properly: I
1762         have to pass the short-name and the fullname.  I was passing only
1763         the basename instead of the fullname sometimes. 
1764
1765         (TypeContainer.DefineType): call NamespaceClash.
1766
1767         * interface.cs (Interface.DefineType): use NamespaceClash before
1768         defining the type.
1769
1770         * delegate.cs (Delegate.DefineType): use NamespaceClash before
1771         defining the type.
1772
1773         * enum.cs: (Enum.DefineType): use NamespaceClash before
1774         defining the type.
1775
1776         * typemanager.cs (: 3-line patch that gives us some tasty 11%
1777         speed increase.  First, use the negative_hits cache when we get a
1778         negative.  Second, add the type with its full original name
1779         instead of the new . and + encoded name (reflection uses + to
1780         separate type from a nested type).  Use LookupTypeReflection
1781         directly which bypasses the type->name hashtable (that we already
1782         know does not contain the type.
1783         
1784         * decl.cs (DeclSpace.ResolveTypeExpr): track the
1785         location/container type. 
1786
1787         * driver.cs: When passing utf8, use directly the UTF8Encoding.
1788
1789 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
1790
1791         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1792
1793         * delegate.cs (NewDelegate.Resolve): Test whether an instance
1794         method is being referenced in the method group from a static
1795         context, and report error 120 if so.
1796
1797         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1798         Error118. 
1799
1800         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1801         is created, we create the A namespace).
1802
1803         * cs-parser.jay: A namespace also introduces a DeclarationFound.
1804         Fixes #41591
1805
1806 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
1807
1808         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1809         invocation to ModuleBuilder.GetType with the same values will
1810         return a new type instance, so we need to cache its return
1811         values. 
1812
1813         * expression.cs (Binary.ResolveOperator): Only allow the compare
1814         operators on enums if they are of the same type.
1815
1816         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1817         types of ValueType on their own case.  Before we were giving them
1818         the same treatment as objects.
1819
1820         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1821         fullname.  Short name is used to compare against container name.
1822         Fullname is used to check against defined namespace names.
1823         
1824         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1825         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1826
1827         (Method.CheckBase): Call parent.
1828         (MemberBase.CheckBase): Check for protected members on sealed
1829         classes.
1830         (PropertyBase.CheckBase): Call parent.
1831         (Field.Define): Call parent.
1832
1833         * report.cs: Negative error codes are now mapped to 8000 - code,
1834         so that the display is render more nicely.
1835
1836         * typemanager.cs: Do not use try/catch, instead report a regular
1837         error. 
1838
1839         (GetPointerType, GetReferenceType): These methods provide
1840         mechanisms to obtain the T* and T& from a T.  We had the code
1841         previously scattered around the code base, and it also used
1842         TypeManager.LookupType that would go through plenty of caches.
1843         This one goes directly to the type source.
1844
1845         In some places we did the Type.GetType followed by
1846         ModuleBuilder.GetType, but not in others, so this unifies the
1847         processing as well.
1848
1849         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1850         statements now that we have namespace information.
1851
1852         * typemanager.cs (IsNamespace): New method, returns whether the
1853         string presented is a namespace or not.
1854
1855         (ComputeNamespaces): New public entry point, computes the list of
1856         available namespaces, using the GetNamespaces API call in Mono, or
1857         the slower version in MS.NET.   
1858
1859         Now before we start the semantic analysis phase, we have a
1860         complete list of namespaces including everything that the user has
1861         provided.
1862
1863         Deleted old code to cache namespaces in .nsc files.
1864
1865 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
1866
1867         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1868         class/struct location definition Location for the implicit
1869         constructor location.
1870
1871         (Operator.Define): Use the location of the operator for the
1872         implicit Method definition.
1873
1874         (Constructor.Emit): use the constructor location for the implicit
1875         base initializer constructor.
1876
1877         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
1878         and the Expression class now contains two new methods:
1879
1880         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
1881         isolate type lookup from the rest of the resolution process.
1882
1883         Since we use Expressions to hold type definitions due to the way
1884         we parse the input we have historically overloaded Resolve to
1885         perform the Type lookups if a special flag is passed.  Now this is
1886         eliminated and two methods take their place. 
1887         
1888         The differences in the two methods between xStep and xTerminal is
1889         that xStep is involved in our current lookup system that uses
1890         SimpleNames to compose a name, while xTerminal is used just to
1891         catch the case where the simplename lookup failed.
1892         
1893 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
1894
1895         * expression.cs (ResolveMemberAccess): Remove redundant code.
1896         TypeExpr expressions are always born fully resolved.
1897
1898         * interface.cs (PopulateMethod): Do not lookup the types twice.
1899         We were doing it once during SemanticAnalysis and once during
1900         PopulateMethod.
1901
1902         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1903         in local variable type definitions, were being returned as a
1904         SimpleName (we decomposed everything into a string), that is
1905         because primary_expression was being used instead of a type in the
1906         grammar (reduce/reduce conflicts).
1907
1908         The part that was wrong is that we converted the expression into a
1909         string (an oversimplification in one hand, compounded with primary
1910         expressions doing string concatenation).
1911
1912         So things like:
1913
1914         A.B.C [] x;
1915
1916         Would return "A.B.C[]" as a SimpleName.  This stopped things like
1917         using clauses from working on this particular context.  And a type
1918         was being matched directly against "A.B.C[]".
1919
1920         We now use the correct approach, and allow for ComposedCast to be
1921         part of the unary expression.  So the "A.B.C []" become a composed
1922         cast of "A.B.C" (as a nested group of MemberAccess with a
1923         SimpleName at the end) plus the rank composition "[]". 
1924
1925         Also fixes 35567
1926         
1927 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
1928
1929         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1930         for the access level checking.
1931
1932         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
1933         `TypeContainer container', because I kept getting confused when I
1934         was debugging this code.
1935
1936         * expression.cs (Indexers): Instead of tracking getters/setters,
1937         we now track them in parallel.  We create one arraylist less, but
1938         most importantly it is possible now for the LValue code to find a
1939         matching get for a set.
1940
1941         (IndexerAccess.DoResolveLValue): Update the code.
1942         GetIndexersForType has been modified already to extract all the
1943         indexers from a type.  The code assumed it did not.
1944
1945         Also make the code set the correct return type for the indexer.
1946         This was fixed a long time ago for properties, but was missing for
1947         indexers.  It used to be void_type.
1948
1949         (Binary.Emit): Test first for doubles instead of
1950         floats, as they are more common.
1951
1952         (Binary.EmitBranchable): Use the .un version of the branch opcodes
1953         when dealing with floats and the <=, >= operators.  This fixes bug
1954         #39314 
1955
1956         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1957         to load the array value by emitting a load on the foreach variable
1958         type.  This was incorrect.  
1959
1960         We now emit the code to load an element using the the array
1961         variable type, and then we emit the conversion operator.
1962
1963         Fixed #40176
1964
1965 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
1966
1967         * attribute.cs: Avoid allocation of ArrayLists in the common case.
1968
1969 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
1970
1971         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1972         test for protection before we test for signatures. 
1973
1974         (MethodSignature.ToString): implement.
1975
1976         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1977         to the case where we reduced into a LongConstant.
1978
1979         * decl.cs (CheckAccessLevel): If the type is an array, we can not
1980         depend on whether the information is acurrate, because the
1981         Microsoft runtime will always claim that the array type is public,
1982         regardless of the real state.
1983
1984         If the type is a pointer, another problem happens: the type is
1985         reported as non-public in Microsoft.  
1986
1987         In both cases we have to call CheckAccessLevel recursively with
1988         the underlying type as the argument to be tested.
1989
1990 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
1991
1992         * assign.cs (Assign.Emit): If we are dealing with a compound
1993         assignment expression, we should use the code path that stores the
1994         intermediate result in a temporary value.  This fixes #40903.
1995
1996         *expression.cs (Indirection.ToString): Provide ToString method for
1997         debugging. 
1998         
1999 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
2000
2001         * class.cs: Null out fields holding references to Block objects so
2002         they can be garbage collected.
2003
2004         * expression.cs (OverloadResolve): Remove unused local.
2005
2006 2003-04-07  Martin Baulig  <martin@ximian.com>
2007
2008         * codegen.cs (EmitContext.CurrentFile): New public field.
2009         (EmitContext.Mark): Use the CurrentFile to check whether the
2010         location is in the correct file.
2011         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
2012
2013 2003-04-07  Martin Baulig  <martin@ximian.com>
2014
2015         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
2016
2017         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
2018         location.  [FIXME: The location argument which gets passed to this
2019         method is sometimes wrong!]
2020
2021 2003-04-07  Nick Drochak <ndrochak@gol.com>
2022
2023         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
2024
2025 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
2026
2027         * expression.cs (Indirection.EmitAssign): We were using the
2028         temporary, but returning immediately instead of continuing the
2029         EmitAssing flow.
2030
2031 2003-04-06  Martin Baulig  <martin@ximian.com>
2032
2033         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
2034         if it's a nested child, but also deriving from the outer class.
2035         See test 190.cs.
2036
2037         * typemanager.cs (IsNestedChildOf): Make this work if it's a
2038         nested child, but also deriving from the outer class.  See
2039         test-190.cs.
2040         (FilterWithClosure): We may access private members of the outer
2041         class if we're a nested child and deriving from the outer class.
2042         (RealMemberLookup): Only set `closure_private_ok' if the
2043         `original_bf' contained BindingFlags.NonPublic.
2044
2045 2003-04-05  Martin Baulig  <martin@ximian.com>
2046
2047         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
2048
2049 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
2050
2051         * class.cs (Event.Define): Do not allow abstract events to have
2052         initializers. 
2053
2054 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
2055
2056         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
2057         block in event declarations.
2058
2059         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
2060         value type, get its address.
2061
2062         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
2063         leaving a class on the stack instead of a boolean value (int
2064         0/1).  Change the code so we compare against null, and then the
2065         result against zero.
2066
2067         * class.cs (TypeContainer.GetClassBases): We were checking for the
2068         parent class being sealed too late.
2069
2070         * expression.cs (Binary.Emit): For <= and >= when dealing with
2071         floating point values, use cgt.un and clt.un instead of cgt and
2072         clt alone.
2073
2074 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
2075
2076         * statement.cs: Apply the same optimization as MS: skip the 
2077         GetEnumerator returning an IEnumerator, and use the one returning a 
2078         CharEnumerator instead. This allows us to avoid the try-finally block 
2079         and the boxing.
2080
2081 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
2082
2083         * cs-parser.jay: Attributes cannot be applied to
2084                          namespaces. Fixes #40473
2085
2086 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2087
2088         * class.cs:
2089         (Add*): check if the name is valid using the full name for constants,
2090         fields, properties and events.
2091
2092 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
2093
2094         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
2095         char constants to be part of the enumeration.
2096
2097         * expression.cs (Conditional.DoResolve): Add support for operator
2098         true. Implements the missing functionality from 14.12
2099
2100         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
2101         operator true/false as required by the spec.
2102
2103         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
2104         implicit conversion to boolean.
2105
2106         * statement.cs (Statement.ResolveBoolean): A boolean expression is
2107         also one where the type implements `operator true'. 
2108
2109         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
2110         get an expression that will invoke operator true based on an
2111         expression.  
2112
2113         (GetConversionOperators): Removed the hack that called op_True
2114         here.  
2115
2116         (Expression.ResolveBoolean): Move this from Statement.
2117
2118 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
2119
2120         * ecore.cs (FieldExpr): do not allow initialization of initonly
2121         fields on derived classes
2122
2123 2003-03-13  Martin Baulig  <martin@ximian.com>
2124
2125         * statement.cs (Block.Emit): Call ig.BeginScope() and
2126         ig.EndScope() when compiling with debugging info; call
2127         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
2128
2129 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
2130
2131         * expression.cs (Indexers): Do not construct immediately, allow
2132         for new members to be appended as we go.  Fixes 38143
2133
2134 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2135
2136         * expression.cs: save/restore context when resolving an unchecked
2137         expression.
2138
2139 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
2140
2141         * cfold.cs: Catch division by zero in modulus operator during
2142         constant folding.
2143
2144 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
2145
2146         * interface.cs (Interface.DefineMembers): Avoid defining members
2147         twice. 
2148
2149 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
2150
2151         * driver.cs: handle the +/- options for -noconfig
2152
2153         * statement.cs (Unckeched.Resolve): Also track the state of
2154         unchecked in the Resolve phase.
2155
2156 2003-02-27  Martin Baulig  <martin@ximian.com>
2157
2158         * ecore.cs (Expression.MemberLookup): Don't create a
2159         MethodGroupExpr for something which is not a method.  Fixes #38291.
2160
2161 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
2162
2163         * class.cs (MemberBase.CheckParameters): Also check that the type
2164         is unmanaged if it is a pointer.
2165
2166         * expression.cs (SizeOf.Resolve): Add location information.
2167
2168         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
2169         a managed type is declared.
2170
2171         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
2172         parameter modifiers as well.  Fixes bug 38606
2173
2174         * class.cs: Very sad.  Am backing out the speed up changes
2175         introduced by the ArrayList -> Array in the TypeContainer, as they
2176         were not actually that much faster, and introduced a bug (no error
2177         reports on duplicated methods).
2178
2179         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
2180         source first, this will guarantee that we have a valid expression
2181         before calling in lower levels functions that will require a
2182         resolved object.  Then use this original_source in the
2183         target.ResolveLValue instead of the original source that was
2184         passed to us.
2185
2186         Another change.  Use target.Resolve instead of LValueResolve.
2187         Although we are resolving for LValues, we will let the Assign code
2188         take care of that (it will be called again from Resolve).  This
2189         basically allows code like this:
2190
2191         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
2192         class Y { void A (X x) { x [0] += o; }
2193
2194         The problem was that the indexer was trying to resolve for
2195         set_Item (idx, object o) and never finding one.  The real set_Item
2196         was set_Item (idx, X).  By delaying the process we get the right
2197         semantics. 
2198
2199         Fixes bug 36505
2200         
2201 2003-02-23  Martin Baulig  <martin@ximian.com>
2202
2203         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
2204         while calling DoEmit ().
2205
2206         * codegen.cs (EmitContext.Mark): Don't mark locations in other
2207         source files; if you use the #line directive inside a method, the
2208         compiler stops emitting line numbers for the debugger until it
2209         reaches the end of the method or another #line directive which
2210         restores the original file.
2211
2212 2003-02-23  Martin Baulig  <martin@ximian.com>
2213
2214         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
2215
2216 2003-02-23  Martin Baulig  <martin@ximian.com>
2217
2218         * statement.cs (Block.AddChildVariableNames): We need to call this
2219         recursively, not just for our immediate children.
2220
2221 2003-02-23  Martin Baulig  <martin@ximian.com>
2222
2223         * class.cs (Event.Define): Always make the field private, like csc does.
2224
2225         * typemanager.cs (TypeManager.RealMemberLookup): Make events
2226         actually work, fixes bug #37521.
2227
2228 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
2229
2230         * delegate.cs: When creating the various temporary "Parameters"
2231         classes, make sure that we call the ComputeAndDefineParameterTypes
2232         on those new parameters (just like we do with the formal ones), to
2233         allow them to be resolved in the context of the DeclSpace.
2234
2235         This fixes the bug that Dick observed in Bugzilla #38530.
2236
2237 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
2238
2239         * expression.cs (ResolveMemberAccess): When resolving a constant,
2240         do not attempt to pull a constant if the value was not able to
2241         generate a valid constant.
2242
2243         * const.cs (LookupConstantValue): Do not report more errors than required.
2244
2245 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2246
2247         * expression.cs: fixes bug #38328.
2248
2249 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2250
2251         * class.cs: Changed all the various members that can be part of a
2252         class from being an ArrayList to be an Array of the right type.
2253         During the DefineType type_list, interface_list, delegate_list and
2254         enum_list are turned into types, interfaces, delegates and enums
2255         arrays.  
2256
2257         And during the member population, indexer_list, event_list,
2258         constant_list, field_list, instance_constructor_list, method_list,
2259         operator_list and property_list are turned into their real arrays.
2260
2261         Although we could probably perform this operation earlier, for
2262         good error reporting we need to keep the lists and remove the
2263         lists for longer than required.
2264
2265         This optimization was triggered by Paolo profiling the compiler
2266         speed on the output of `gen-sample-program.pl' perl script. 
2267
2268         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
2269         not crash in methods like MemberLookupFailed that use this field.  
2270
2271         This problem arises when the compiler fails to resolve a type
2272         during interface type definition for example.
2273
2274 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2275
2276         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
2277         inherit from System.Object, so we have to stop at null, not only
2278         when reaching System.Object.
2279
2280 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
2281
2282         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
2283         DeclaredOnly because the parent indexer might have had a different
2284         name, but did not loop until the top of the hierarchy was reached.
2285
2286         The problem this one fixes is 35492: when a class implemented an
2287         indexer from an interface, we were getting the interface method
2288         (which was abstract) and we were flagging an error (can not invoke
2289         abstract method).
2290
2291         This also keeps bug 33089 functioning, and test-148 functioning.
2292
2293         * typemanager.cs (IsSpecialMethod): The correct way of figuring
2294         out if a method is special is to see if it is declared in a
2295         property or event, or whether it is one of the predefined operator
2296         names.   This should fix correctly #36804.
2297
2298 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
2299
2300         The goal here is to remove the dependency on EmptyCast.Peel ().
2301         Killing it completely.
2302         
2303         The problem is that currently in a number of places where
2304         constants are expected, we have to "probe" for an EmptyCast, and
2305         Peel, which is not the correct thing to do, as this will be
2306         repetitive and will likely lead to errors. 
2307
2308         The idea is to remove any EmptyCasts that are used in casts that
2309         can be reduced to constants, so we only have to cope with
2310         constants. 
2311
2312         This bug hunt was triggered by Bug 37363 and the desire to remove
2313         the duplicate pattern where we were "peeling" emptycasts to check
2314         whether they were constants.  Now constants will always be
2315         constants.
2316         
2317         * ecore.cs: Use an enumconstant here instead of wrapping with
2318         EmptyCast.  
2319
2320         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
2321         throwing me off.  By handling this we can get rid of a few hacks.
2322         
2323         * statement.cs (Switch): Removed Peel() code.
2324
2325 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
2326
2327         * class.cs: Location information for error 508
2328
2329         * expression.cs (New.DoResolve): Add a guard against double
2330         resolution of an expression.  
2331
2332         The New DoResolve might be called twice when initializing field
2333         expressions (see EmitFieldInitializers, the call to
2334         GetInitializerExpression will perform a resolve on the expression,
2335         and later the assign will trigger another resolution
2336
2337         This leads to bugs (#37014)
2338
2339         * delegate.cs: The signature for EndInvoke should contain any ref
2340         or out parameters as well.  We were not doing this in the past. 
2341
2342         * class.cs (Field.Define): Do not overwrite the type definition
2343         inside the `volatile' group.  Turns out that volatile enumerations
2344         were changing the type here to perform a validity test, which
2345         broke conversions. 
2346
2347 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
2348
2349         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
2350         and structs, we do not want to load the instance variable
2351
2352         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
2353         enum_type has to be handled like an object reference (implicit
2354         conversions exists from this to object), but the regular IsClass
2355         and IsValueType tests will never return true for this one.
2356
2357         Also we use TypeManager.IsValueType instead of type.IsValueType,
2358         just for consistency with the rest of the code (this is only
2359         needed if we ever use the construct exposed by test-180.cs inside
2360         corlib, which we dont today).
2361
2362 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
2363
2364         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
2365         just InternalCall.
2366
2367 2003-02-09  Martin Baulig  <martin@ximian.com>
2368
2369         * namespace.cs (Namespace..ctor): Added SourceFile argument.
2370         (Namespace.DefineNamespaces): New static public method; this is
2371         called when we're compiling with debugging to add all namespaces
2372         to the symbol file.
2373
2374         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
2375         pass it to the Namespace's .ctor.
2376
2377         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
2378         and MethodBase arguments; pass the namespace ID to the symwriter;
2379         pass the MethodBase instead of the token to the symwriter.
2380         (SymbolWriter.DefineNamespace): New method to add a namespace to
2381         the symbol file.
2382
2383 2003-02-09  Martin Baulig  <martin@ximian.com>
2384
2385         * symbolwriter.cs: New file.  This is a wrapper around
2386         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
2387         methods here in near future.
2388
2389 2003-02-09  Martin Baulig  <martin@ximian.com>
2390
2391         * codegen.cs (EmitContext.Mark): Just pass the arguments to
2392         ILGenerator.MarkSequencePoint() which are actually used by the
2393         symbol writer.
2394
2395 2003-02-09  Martin Baulig  <martin@ximian.com>
2396
2397         * location.cs (SourceFile): New public sealed class.  This
2398         contains the name and an index which is used in the location's token.
2399         (Location): Reserve an appropriate number of bits in the token for
2400         the source file instead of walking over that list, this gives us a
2401         really huge performance improvement when compiling with debugging.
2402
2403         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
2404         `SourceFile' argument instead of a string.
2405         (Driver.ProcessFile): Add all the files via Location.AddFile(),
2406         but don't parse/tokenize here, we need to generate the list of all
2407         source files before we do that.
2408         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
2409         the files.
2410
2411         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
2412         instead of a string.
2413
2414         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
2415         of a string.
2416
2417 2003-02-09  Martin Baulig  <martin@ximian.com>
2418
2419         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
2420         filename on `#line default'.
2421
2422 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
2423
2424         * statement.cs: don't clear the pinned var when the fixed statement
2425         returns from the method (fixes bug#37752).
2426
2427 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
2428
2429         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
2430         to IsValueType.
2431
2432 2003-02-07  Martin Baulig  <martin@ximian.com>
2433
2434         * driver.cs: Removed the `--debug-args' command line argument.
2435
2436         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
2437         automatically by the AsssemblyBuilder.
2438         (CodeGen.InitializeSymbolWriter): We don't need to call any
2439         initialization function on the symbol writer anymore.  This method
2440         doesn't take any arguments.
2441
2442 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
2443
2444         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
2445         from referenced assemblies as well.
2446
2447 2003-02-02  Martin Baulig  <martin@ximian.com>
2448
2449         * class.cs (MethodData.Emit): Generate debugging info for external methods.
2450
2451 2003-02-02  Martin Baulig  <martin@ximian.com>
2452
2453         * class.cs (Constructor.Emit): Open the symbol writer before
2454         emitting the constructor initializer.
2455         (ConstructorInitializer.Emit): Call ec.Mark() to allow
2456         single-stepping through constructor initializers.
2457
2458 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
2459
2460         * class.cs: Handle error 549: do not allow virtual methods in
2461         sealed classes. 
2462
2463 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
2464
2465         * decl.cs: Check access levels when resolving types
2466         
2467 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
2468
2469         * statement.cs: Add parameters and locals set in catch blocks that might 
2470         return to set vector
2471
2472 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
2473
2474         * class.cs (Operator): Set the SpecialName flags for operators.
2475         
2476         * expression.cs (Invocation.DoResolve): Only block calls to
2477         accessors and operators on SpecialName methods.
2478
2479         (Cast.TryReduce): Handle conversions from char constants.
2480
2481
2482 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
2483
2484         * statement.cs: small memory and time optimization in FlowBranching.
2485         
2486 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
2487
2488         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
2489         problem that the last fix but in the other sid (Set).
2490
2491         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
2492         access when there is no indexer in the hierarchy.
2493         
2494 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
2495
2496         * class.cs: Combine some if statements.
2497
2498 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2499
2500         * driver.cs: fixed bug #37187.
2501
2502 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
2503
2504         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
2505         any indexer, it's needed to build a list with all the indexers in the
2506         hierarchy (AllGetters), else we have problems. Fixes #35653.
2507
2508 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
2509
2510         * class.cs (MethodData.Define): It is wrong for an interface
2511         implementation to be static in both cases: explicit and implicit.
2512         We were only handling this in one case.
2513
2514         Improve the if situation there to not have negations.
2515         
2516         * class.cs (Field.Define): Turns out that we do not need to check
2517         the unsafe bit on field definition, only on usage.  Remove the test.
2518
2519 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2520
2521         * driver.cs: use assembly.Location instead of Codebase (the latest
2522         patch made mcs fail when using MS assemblies).
2523
2524 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
2525
2526         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
2527         get the path to *corlib.dll.
2528
2529 2003-01-21  Nick Drochak <ndrochak@gol.com>
2530
2531         * cs-tokenizer.cs:
2532         * pending.cs:
2533         * typemanager.cs: Remove compiler warnings
2534
2535 2003-01-20  Duncan Mak  <duncan@ximian.com>
2536
2537         * AssemblyInfo.cs: Bump the version number to 0.19.
2538         
2539 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2540
2541         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2542
2543 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
2544
2545         * class.cs (Constructor::Emit): Emit debugging info for constructors.
2546
2547 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
2548
2549         * cs-parser.jay: Small fix: we were not comparing the constructor
2550         name correctly.   Thanks to Zoltan for the initial pointer.
2551
2552 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2553
2554         * cs-tokenizer.cs: Set file name when specified with #line
2555
2556 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
2557
2558         * cs-parser.jay: Only perform the constructor checks here if we
2559         are named like the class;  This will help provider a better
2560         error.  The constructor path is taken when a type definition is
2561         not found, but most likely the user forgot to add the type, so
2562         report that rather than the constructor error.
2563
2564 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2565
2566         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2567         allocations.
2568
2569 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2570
2571         * cs-parser.jay: Add cleanup call.
2572
2573 2003-01-13  Duncan Mak  <duncan@ximian.com>
2574
2575         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2576         consistent with other methods.
2577
2578 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2579
2580         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2581         
2582 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2583
2584         * attribute.cs: only set GuidAttr to true when we have a
2585         GuidAttribute.
2586
2587 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2588
2589         * ecore.cs:
2590         * expression.cs:
2591         * typemanager.cs: fixes to allow mcs compile corlib with the new
2592         Type.IsSubclassOf fix.
2593
2594 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
2595
2596         * expression.cs (LocalVariableReference.DoResolve): Classify a
2597         constant as a value, not as a variable.   Also, set the type for
2598         the variable.
2599
2600         * cs-parser.jay (fixed_statement): take a type instead of a
2601         pointer_type, so we can produce a better error message later.
2602         
2603         * statement.cs (Fixed.Resolve): Flag types that are not pointers
2604         as an error.  
2605         
2606         (For.DoEmit): Make inifinite loops have a
2607         non-conditional branch back.
2608
2609         (Fixed.DoEmit): First populate the pinned variables, then emit the
2610         statement, then clear the variables.  Before I was emitting the
2611         code once for each fixed piece.
2612
2613
2614 2003-01-08  Martin Baulig  <martin@ximian.com>
2615
2616         * statement.cs (FlowBranching.MergeChild): A break in a
2617         SWITCH_SECTION does not leave a loop.  Fixes #36155.
2618
2619 2003-01-08  Martin Baulig  <martin@ximian.com>
2620
2621         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2622         lives in the same number space than `param_map'.  Fixes #36154.
2623
2624 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
2625
2626         * cs-parser.jay (constructor_declaration): Set the
2627         Constructor.ModFlags before probing for it.  This makes the
2628         compiler report 514, 515 and 132 (the code was there, but got
2629         broken). 
2630
2631         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2632         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2633         (GotoCase.Resolve): Set `Returns' to ALWAYS.
2634
2635 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2636
2637         * enum.cs: create the enum static fields using the enum type.
2638
2639 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2640
2641         * class.cs: don't try to create the ParamBuilder for the return
2642         type if it's not needed (and handle it breaking for the ms runtime
2643         anyway).
2644
2645 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2646
2647         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2648
2649 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
2650
2651         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2652         the command.   This showed up while compiling the JANET source
2653         code, which used \r as its only newline separator.
2654
2655 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
2656
2657         * class.cs (Method.Define): If we are an operator (because it
2658         reuses our code), then set the SpecialName and HideBySig.  #36128
2659
2660 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
2661
2662         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2663         exception, report error 120 `object reference required'.
2664
2665         * driver.cs: Add --pause option, used during to measure the size
2666         of the process as it goes with --timestamp.
2667
2668         * expression.cs (Invocation.DoResolve): Do not allow methods with
2669         SpecialName to be invoked.
2670
2671 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
2672
2673         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2674         number before adding it.
2675
2676 2002-12-21  Ravi Pratap  <ravi@ximian.com>
2677
2678         * ecore.cs (StandardImplicitConversion): When in an unsafe
2679         context, we allow conversion between void * to any other pointer
2680         type. This fixes bug #35973.
2681
2682 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2683
2684         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2685         is not thrown when extensionless outputs are used 
2686
2687 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2688
2689         * rootcontext.cs: fixed compilation of corlib.
2690
2691 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
2692
2693         * attribute.cs (Attributes.Contains): Add new method.
2694
2695         * class.cs (MethodCore.LabelParameters): if the parameter is an
2696         `out' parameter, check that no attribute `[In]' has been passed.
2697
2698         * enum.cs: Handle the `value__' name in an enumeration.
2699
2700 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
2701
2702         * decl.cs: Added special case to allow overrides on "protected
2703         internal" methods
2704         
2705 2002-12-18  Ravi Pratap  <ravi@ximian.com>
2706
2707         * attribute.cs (Attributes.AddAttributeSection): Rename to this
2708         since it makes much more sense.
2709
2710         (Attributes.ctor): Don't require a Location parameter.
2711         
2712         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2713
2714         * attribute.cs (ApplyAttributes): Remove extra Location parameters
2715         since we already have that information per attribute.
2716
2717         * everywhere : make appropriate changes.
2718
2719         * class.cs (LabelParameters): Write the code which actually
2720         applies attributes to the return type. We can't do this on the MS
2721         .NET runtime so we flag a warning in the case an exception is
2722         thrown.
2723
2724 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
2725
2726         * const.cs: Handle implicit null conversions here too.
2727
2728 2002-12-17  Ravi Pratap  <ravi@ximian.com>
2729
2730         * class.cs (MethodCore.LabelParameters): Remove the extra
2731         Type [] parameter since it is completely unnecessary. Instead
2732         pass in the method's attributes so that we can extract
2733         the "return" attribute.
2734
2735 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
2736
2737         * cs-parser.jay (parse): Use Report.Error to flag errors instead
2738         of ignoring it and letting the compile continue.
2739
2740         * typemanager.cs (ChangeType): use an extra argument to return an
2741         error condition instead of throwing an exception.
2742
2743 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
2744
2745         * expression.cs (Unary.TryReduce): mimic the code for the regular
2746         code path.  Perform an implicit cast in the cases where we can
2747         implicitly convert to one of the integral types, and then reduce
2748         based on that constant.   This fixes bug #35483.
2749
2750 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2751
2752         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2753
2754 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2755
2756         * namespace.cs: fixed bug #35489.
2757
2758 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
2759
2760         * class.cs: Remove some dead code.
2761
2762         * cs-parser.jay: Estimate the number of methods needed
2763         (RootContext.MethodCount);
2764
2765         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2766         numbers instead of StringBuilders.
2767
2768         * support.cs (PtrHashtable): Add constructor with initial size;
2769         We can now reduce reallocations of the method table.
2770
2771 2002-12-10  Ravi Pratap  <ravi@ximian.com>
2772
2773         * attribute.cs (ApplyAttributes): Keep track of the emitted
2774         attributes on a per-target basis. This fixes bug #35413.
2775
2776 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
2777
2778         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2779         default to the Windows 1252 encoding.
2780
2781         (UnixParseOption): Support version, thanks to Alp for the missing
2782         pointer. 
2783
2784         * AssemblyInfo.cs: Add nice assembly information.
2785
2786         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2787         (bug 35169).
2788
2789         * cs-parser.jay: Allow a trailing comma before the close bracked
2790         in the attribute_section production.
2791
2792         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2793         address of the instance was being taken, I will take this out,
2794         because we take the address of the object immediately here.
2795
2796 2002-12-09  Ravi Pratap  <ravi@ximian.com>
2797
2798         * typemanager.cs (AreMultipleAllowed): Take care of the most
2799         obvious case where attribute type is not in the current assembly -
2800         stupid me ;-)
2801
2802 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
2803
2804         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2805         definitions, instead of doing that afterwards.  
2806
2807         Also we use a nice little hack, depending on the constructor, we
2808         know if we are a "composed" name or a simple name.  Hence, we
2809         avoid the IndexOf test, and we avoid 
2810
2811         * codegen.cs: Add code to assist in a bug reporter to track down
2812         the source of a compiler crash. 
2813
2814 2002-12-07  Ravi Pratap  <ravi@ximian.com>
2815
2816         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2817         types have been emitted for a given element and flag an error
2818         if something which does not have AllowMultiple set is used more
2819         than once.
2820
2821         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2822         attribute types and their corresponding AllowMultiple properties
2823
2824         (AreMultipleAllowed): Check the property for a given type.
2825
2826         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2827         property in the case we have a TypeContainer.
2828
2829         (Attributes.AddAttribute): Detect duplicates and just skip on
2830         adding them. This trivial fix catches a pretty gross error in our
2831         attribute emission - global attributes were being emitted twice!
2832
2833         Bugzilla bug #33187 is now fixed.
2834
2835 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
2836
2837         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2838         instead of pp_and).
2839
2840         * expression.cs (Binary.ResolveOperator): I can only use the
2841         Concat (string, string, string) and Concat (string, string,
2842         string, string) if the child is actually a concatenation of
2843         strings. 
2844
2845 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
2846
2847         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2848         context where we need a 2-character lookahead.
2849
2850         * pending.cs (PendingImplementation): Rework so we can keep track
2851         of interface types all the time, and flag those which were
2852         implemented by parents as optional.
2853
2854 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
2855
2856         * expression.cs (Binary.ResolveOperator): Use
2857         String.Concat(string,string,string) or
2858         String.Concat(string,string,string,string) when possible. 
2859
2860         * typemanager: More helper methods.
2861
2862
2863 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2864
2865         * pending.cs: remove the bogus return from GetMissingInterfaces()
2866         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2867
2868 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2869
2870         * namespace.cs: avoid duplicated 'using xxx' being added to
2871         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2872         when we get more than one 'using' statement for the same namespace.
2873         Report a CS0105 warning for it.
2874
2875 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
2876
2877         * cs-tokenizer.cs (consume_identifier): use read directly, instead
2878         of calling getChar/putback, uses internal knowledge of it.    
2879
2880         (xtoken): Reorder tokenizer so most common patterns are checked
2881         first.  This reduces the compilation time in another 5% (from 8.11s
2882         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2883
2884         The parsing time is 22% of the compilation in mcs, and from that
2885         64% is spent on the tokenization process.  
2886
2887         I tried using a binary search for keywords, but this is slower
2888         than the hashtable.  Another option would be to do a couple of
2889         things:
2890
2891                 * Not use a StringBuilder, instead use an array of chars,
2892                   with a set value.  Notice that this way we could catch
2893                   the 645 error without having to do it *afterwards*.
2894
2895                 * We could write a hand-parser to avoid the hashtable
2896                   compares altogether.
2897
2898         The identifier consumption process takes 37% of the tokenization
2899         time.  Another 15% is spent on is_number.  56% of the time spent
2900         on is_number is spent on Int64.Parse:
2901
2902                 * We could probably choose based on the string length to
2903                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
2904                   computations. 
2905
2906         Another 3% is spend on wrapping `xtoken' in the `token' function.
2907
2908         Handle 0xa0 as whitespace (#34752)
2909         
2910 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
2911
2912         * typemanager.cs (IsCLRType): New routine to tell whether a type
2913         is one of the builtin types.  
2914
2915         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
2916         typecode in more places instead of doing pointer comparissions.
2917         We could leverage some knowledge about the way the typecodes are
2918         laid out.
2919
2920         New code to cache namespaces in assemblies, it is currently not
2921         invoked, to be used soon.
2922
2923         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2924
2925         * expression.cs (Binary.ResolveOperator): specially handle
2926         strings, and do not perform user-defined operator overloading for
2927         built-in types.
2928
2929 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
2930
2931         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2932         internalcall as it is a pretty simple operation;  Avoid whenever
2933         possible to call Char.IsLetter.
2934
2935         (consume_identifier): Cut by half the number of
2936         hashtable calls by merging the is_keyword and GetKeyword behavior.
2937
2938         Do not short-circuit, because if we do, we
2939         report errors (ie, #if false && true would produce an invalid
2940         directive error);
2941         
2942
2943 2002-11-24  Martin Baulig  <martin@ximian.com>
2944
2945         * expression.cs (Cast.TryReduce): If we're in checked syntax,
2946         check constant ranges and report a CS0221.  Fixes #33186.
2947
2948 2002-11-24  Martin Baulig  <martin@ximian.com>
2949
2950         * cs-parser.jay: Make this work for uninitialized variable
2951         declarations in the `for' initializer.  Fixes #32416.
2952
2953 2002-11-24  Martin Baulig  <martin@ximian.com>
2954
2955         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2956         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
2957
2958 2002-11-24  Martin Baulig  <martin@ximian.com>
2959
2960         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2961         argument; if true, we also check for user-defined conversions.
2962         This is only needed if both arguments are of a user-defined type.
2963         Fixes #30443, added test-175.cs.
2964         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2965
2966         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2967
2968 2002-11-24  Martin Baulig  <martin@ximian.com>
2969
2970         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2971         function to get the store opcode.
2972         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2973         only emit the Ldelema if the store opcode is Stobj.  You must run
2974         both test-34 and test-167 to test this.  Fixes #34529.
2975
2976 2002-11-23  Martin Baulig  <martin@ximian.com>
2977
2978         * ecore.cs (Expression.MemberLookup): Added additional
2979         `qualifier_type' argument which is used when we're being called
2980         from MemberAccess.DoResolve() and null if we're called from a
2981         SimpleName lookup.
2982         (Expression.MemberLookupFailed): New method to report errors; this
2983         does the CS1540 check and reports the correct error message.
2984
2985         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2986         argument for the CS1540 check and redone the way how we're dealing
2987         with private members.  See the comment in the source code for details.
2988         (FilterWithClosure): Reverted this back to revision 1.197; renamed
2989         `closure_start_type' to `closure_qualifier_type' and check whether
2990         it's not null.  It was not this filter being broken, it was just
2991         being called with the wrong arguments.
2992
2993         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2994         and pass it the correct `qualifier_type'; this also does the error
2995         handling for us.
2996
2997 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
2998
2999         * expression.cs (Invocation.EmitParams): If the we are dealing
3000         with a non-built-in value type, load its address as well.
3001
3002         (ArrayCreation): Use a a pretty constant instead
3003         of the hardcoded value 2.   Use 6 instead of 2 for the number of
3004         static initializers.  
3005
3006         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
3007         because they are not really value types, just glorified integers. 
3008
3009         * driver.cs: Do not append .exe, the CSC compiler does not do it.
3010
3011         * ecore.cs: Remove redundant code for enumerations, make them use
3012         the same code path as everything else, fixes the casting issue
3013         with enumerations in Windows.Forms.
3014
3015         * attribute.cs: Do only cast to string if it is a string, the
3016         validation happens later.
3017
3018         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
3019         people upgrade their corlibs.
3020
3021         * ecore.cs: Oops, enumerations were not following the entire code path
3022
3023 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
3024
3025         * typemanager.cs (FilterWithClosure): Commented out the test for
3026         1540 in typemanager.cs, as it has problems when accessing
3027         protected methods from a parent class (see test-174.cs). 
3028
3029         * attribute.cs (Attribute.ValidateGuid): new method.
3030         (Attribute.Resolve): Use above.
3031
3032 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
3033
3034         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
3035
3036         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
3037         handling for enumerations, as we only needed the TypeContainer
3038         functionality to begin with (this is required for the fix below to
3039         work for enums that reference constants in a container class for
3040         example). 
3041
3042         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
3043
3044         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
3045         a valid TypeBuilder to perform lookups on.o
3046
3047         * class.cs (InheritableMemberSignatureCompare): Use true in the
3048         call to GetGetMethod and GetSetMethod, because we are comparing
3049         the signature, and we need to get the methods *even* if they are
3050         private. 
3051
3052         (PropertyBase.CheckBase): ditto.
3053
3054         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
3055         GotoCase.Resolve): Use Peel on EmpytCasts.
3056
3057         * ecore.cs (EmptyCast): drop child, add Peel method.
3058
3059 2002-11-17  Martin Baulig  <martin@ximian.com>
3060
3061         * ecore.cs (EmptyCast.Child): New public property.
3062
3063         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
3064         label resolved to an EmptyCast.  Fixes #34162.
3065         (GotoCase.Resolve): Likewise.
3066         (Block.EmitMeta): Likewise.
3067
3068 2002-11-17  Martin Baulig  <martin@ximian.com>
3069
3070         * expression.cs (Invocation.BetterConversion): Prefer int over
3071         uint; short over ushort; long over ulong for integer literals.
3072         Use ImplicitConversionExists instead of StandardConversionExists
3073         since we also need to check for user-defined implicit conversions.
3074         Fixes #34165.  Added test-173.cs.
3075
3076 2002-11-16  Martin Baulig  <martin@ximian.com>
3077
3078         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
3079         with the `true' and `false' literals.  Fixes #33151.
3080
3081 2002-11-16  Martin Baulig  <martin@ximian.com>
3082
3083         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
3084         October 22nd; don't do the cs1540 check for static members.
3085
3086         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
3087         now using our own filter here and doing the cs1540 check again.
3088
3089 2002-11-16  Martin Baulig  <martin@ximian.com>
3090
3091         * support.cs (InternalParameters): Don't crash if we don't have
3092         any fixed parameters.  Fixes #33532.
3093
3094 2002-11-16  Martin Baulig  <martin@ximian.com>
3095
3096         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
3097         when looking up static methods to make this work on Windows.
3098         Fixes #33773.
3099
3100 2002-11-16  Martin Baulig  <martin@ximian.com>
3101
3102         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
3103         a setter rather than using PropertyInfo.CanWrite.
3104
3105 2002-11-15  Nick Drochak  <ndrochak@gol.com>
3106
3107         * class.cs: Allow acces to block member by subclasses. Fixes build
3108         breaker.
3109
3110 2002-11-14  Martin Baulig  <martin@ximian.com>
3111
3112         * class.cs (Constructor.Emit): Added the extern/block check.
3113         Fixes bug #33678.
3114
3115 2002-11-14  Martin Baulig  <martin@ximian.com>
3116
3117         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
3118         iteration while looking for indexers, this is needed because the
3119         indexer may have a different name in our base classes.  Fixed the
3120         error reporting (no indexers at all, not get accessor, no
3121         overloaded match).  Fixes bug #33089.
3122         (IndexerAccess.DoResolveLValue): Likewise.
3123
3124 2002-11-14  Martin Baulig  <martin@ximian.com>
3125
3126         * class.cs (PropertyBase.CheckBase): Make this work for multiple
3127         indexers.  Fixes the first part of bug #33089.
3128         (MethodSignature.InheritableMemberSignatureCompare): Added support
3129         for properties.
3130
3131 2002-11-13  Ravi Pratap  <ravi@ximian.com>
3132
3133         * attribute.cs (Attribute.Resolve): Catch the
3134         NullReferenceException and report it since it isn't supposed to
3135         happen. 
3136         
3137 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
3138
3139         * expression.cs (Binary.EmitBranchable): Also handle the cases for
3140         LogicalOr and LogicalAnd that can benefit from recursively
3141         handling EmitBranchable.  The code now should be nice for Paolo.
3142
3143 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
3144
3145         * typemanager.cs (LookupType): Added a negative-hit hashtable for
3146         the Type lookups, as we perform quite a number of lookups on
3147         non-Types.  This can be removed once we can deterministically tell
3148         whether we have a type or a namespace in advance.
3149
3150         But this might require special hacks from our corlib.
3151
3152         * TODO: updated.
3153
3154         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
3155         and double which avoids a conversion from an integer to a double.
3156
3157         * expression.cs: tiny optimization, avoid calling IsConstant,
3158         because it effectively performs the lookup twice.
3159
3160 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
3161
3162         But a bogus return here to keep the semantics of the old code
3163         until the Mono runtime is fixed.
3164         
3165         * pending.cs (GetMissingInterfaces): New method used to remove all
3166         the interfaces that are already implemented by our parent
3167         classes from the list of pending methods. 
3168
3169         * interface.cs: Add checks for calls after ResolveTypeExpr.
3170
3171 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
3172
3173         * class.cs (Class.Emit): Report warning 67: event not used if the
3174         warning level is beyond 3.
3175
3176         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
3177         being a NullLiteral.
3178
3179         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
3180         specifiers. 
3181
3182         * class.cs (TypeContainer.GetClassBases): Cover a missing code
3183         path that might fail if a type can not be resolved.
3184
3185         * expression.cs (Binary.Emit): Emit unsigned versions of the
3186         operators. 
3187
3188         * driver.cs: use error 5.
3189         
3190 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
3191
3192         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
3193
3194 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
3195
3196         * cs-parser.jay (switch_section): A beautiful patch from Martin
3197         Baulig that fixed 33094.
3198
3199 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
3200
3201         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
3202         Check whether the base is abstract and report an error if so.
3203
3204         * expression.cs (IndexerAccess.DoResolveLValue,
3205         IndexerAccess.DoResolve): ditto. 
3206
3207         (Invocation.DoResolve): ditto.
3208         
3209         (Invocation.FullMethodDesc): Improve the report string.
3210
3211         * statement.cs (Block): Eliminate IsVariableDefined as it is
3212         basically just a wrapper for GetVariableInfo.
3213
3214         * ecore.cs (SimpleName): Use new 
3215
3216         * support.cs (ReflectionParamter.ParameterType): We unwrap the
3217         type, as we return the actual parameter ref/unref state on a
3218         different call.
3219
3220 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
3221
3222         * support.cs: Return proper flags REF/OUT fixing the previous
3223         commit.  
3224
3225         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
3226         not used to mean `ref' but `ref or out' in ParameterReference
3227         
3228         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
3229         full type signature instead of calling TypeManger.CSharpName
3230         ourselves. 
3231
3232         * support.cs (InternalParameters.ParameterDesc): Do not compare
3233         directly to the modflags, because REF/OUT will actually be bitsets
3234         if set. 
3235
3236         * delegate.cs (VerifyMethod): Check also the modifiers.
3237
3238         * cs-tokenizer.cs: Fix bug where floating point values with an
3239         exponent where a sign was missing was ignored.
3240
3241         * driver.cs: Allow multiple assemblies to be specified in a single
3242         /r: argument
3243
3244 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
3245
3246         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
3247         because identifiers after a parenthesis would end up in this kind
3248         of production, and we needed to desamiguate it for having casts
3249         like:
3250
3251                 (UserDefinedType *) xxx
3252
3253 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
3254
3255         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
3256         we should set on the Bindingflags.NonPublic, but not turn on
3257         private_ok.  private_ok controls whether a Private member is
3258         returned (this is chekced on the filter routine), while the
3259         BindingFlags.NonPublic just controls whether private/protected
3260         will be allowed.   This fixes the problem part of the problem of
3261         private properties being allowed to be used in derived classes.
3262
3263         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
3264         so we can call the children DoResolveLValue method (this will
3265         properly signal errors on lvalue assignments to base properties)
3266         
3267         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
3268         getter are null, and we have a property info, we know that this
3269         happened because the lookup failed, so we report an error 122 for
3270         protection level violation.
3271
3272         We also silently return if setter and getter are null in the
3273         resolve functions, this condition only happens if we have flagged
3274         the error before.  This is the other half of the problem. 
3275
3276         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
3277         not have accessibility information, that is why we were returning
3278         true in the filter function in typemanager.cs.
3279
3280         To properly report 122 (property is inaccessible because of its
3281         protection level) correctly, we report this error in ResolveAccess
3282         by failing if both the setter and the getter are lacking (ie, the
3283         lookup failed). 
3284
3285         DoResolve and DoLResolve have been modified to check for both
3286         setter/getter being null and returning silently, the reason being
3287         that I did not want to put the knowledge about this error in upper
3288         layers, like:
3289
3290         int old = Report.Errors;
3291         x = new PropertyExpr (...);
3292         if (old != Report.Errors)
3293                 return null;
3294         else
3295                 return x;
3296
3297         So the property expr is returned, but it is invalid, so the error
3298         will be flagged during the resolve process. 
3299
3300         * class.cs: Remove InheritablePropertySignatureCompare from the
3301         class, as we no longer depend on the property signature to compute
3302         whether it is possible to implement a method or not.
3303
3304         The reason is that calling PropertyInfo.GetGetMethod will return
3305         null (in .NET, in Mono it works, and we should change this), in
3306         cases where the Get Method does not exist in that particular
3307         class.
3308
3309         So this code:
3310
3311         class X { public virtual int A { get { return 1; } } }
3312         class Y : X { }
3313         class Z : Y { public override int A { get { return 2; } } }
3314
3315         Would fail in Z because the parent (Y) would not have the property
3316         defined.  So we avoid this completely now (because the alternative
3317         fix was ugly and slow), and we now depend exclusively on the
3318         method names.
3319
3320         (PropertyBase.CheckBase): Use a method-base mechanism to find our
3321         reference method, instead of using the property.
3322
3323         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
3324         routines are gone now.
3325
3326         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
3327         names, they were incorrectly named.
3328
3329         * cs-tokenizer.cs: Return are more gentle token on failure. 
3330
3331         * pending.cs (PendingImplementation.InterfaceMethod): This routine
3332         had an out-of-sync index variable, which caused it to remove from
3333         the list of pending methods the wrong method sometimes.
3334
3335 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
3336
3337         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
3338         CanWrite, because those refer to this particular instance of the
3339         property, and do not take into account the fact that we can
3340         override single members of a property.
3341
3342         Constructor requires an EmitContext.  The resolution process does
3343         not happen here, but we need to compute the accessors before,
3344         because the resolution does not always happen for properties.
3345         
3346         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
3347         subclass, before we did not update this flag, but we did update
3348         bindingflags. 
3349
3350         (GetAccessors): Drop this routine, as it did not work in the
3351         presence of partially overwritten set/get methods. 
3352
3353         Notice that this broke the cs1540 detection, but that will require
3354         more thinking. 
3355         
3356 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3357
3358         * class.cs:
3359         * codegen.cs:
3360         * driver.cs: issue a warning instead of an error if we don't support
3361         debugging for the platform. Also ignore a couple of errors that may
3362         arise when trying to write the symbols. Undo my previous patch.
3363
3364 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3365
3366         * driver.cs: ignore /debug switch except for Unix platforms.
3367
3368 2002-10-23  Nick Drochak  <ndrochak@gol.com>
3369
3370         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
3371
3372 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
3373
3374         * driver.cs: Do not make mcs-debug conditional, so we do not break
3375         builds that use it.
3376
3377         * statement.cs (UsageVector.MergeChildren): I would like Martin to
3378         review this patch.  But basically after all the children variables
3379         have been merged, the value of "Breaks" was not being set to
3380         new_breaks for Switch blocks.  I think that it should be set after
3381         it has executed.  Currently I set this to the value of new_breaks,
3382         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
3383         conservative, but I do not understand this code very well.
3384
3385         I did not break anything in the build, so that is good ;-)
3386
3387         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
3388
3389 2002-10-20  Mark Crichton  <crichton@gimp.org>
3390
3391         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
3392
3393 2002-10-20  Nick Drochak  <ndrochak@gol.com>
3394
3395         * cfold.cs: Fixed compile blocker.
3396
3397 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
3398
3399         * driver.cs: I was chekcing the key, not the file.
3400
3401 2002-10-19  Ravi Pratap  <ravi@ximian.com>
3402
3403         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
3404         message that we were generating - we just need to silently return
3405         a null.
3406
3407 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
3408
3409         * class.cs (Event.Define): Change my previous commit, as this
3410         breaks the debugger.  This is a temporary hack, as it seems like
3411         the compiler is generating events incorrectly to begin with.
3412
3413         * expression.cs (Binary.ResolveOperator): Added support for 
3414         "U operator - (E x, E y)"
3415
3416         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
3417         y)".
3418
3419         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
3420         init-only variables, but this path did not take into account that
3421         there might be also instance readonly variables.  Correct this
3422         problem. 
3423
3424         This fixes bug 32253
3425
3426         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
3427         delegates as well.
3428
3429         * driver.cs: Change the extension for modules to `netmodule'
3430
3431         * cs-parser.jay: Improved slightly the location tracking for
3432         the debugger symbols.
3433
3434         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
3435         modifiers that were specified instead of the hardcoded value
3436         (FamAndAssem).  This was basically ignoring the static modifier,
3437         and others.  Fixes 32429.
3438
3439         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
3440         fixed a bug in the process (32476)
3441
3442         * expression.cs (ArrayAccess.EmitAssign): Patch from
3443         hwang_rob@yahoo.ca that fixes bug 31834.3
3444
3445 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
3446
3447         * driver.cs: Make the module extension .netmodule.
3448
3449 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
3450
3451         * driver.cs: Report an error if the resource file is not found
3452         instead of crashing.
3453
3454         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
3455         false, like Emit does.
3456
3457 2002-10-16  Nick Drochak  <ndrochak@gol.com>
3458
3459         * typemanager.cs: Remove unused private member.  Also reported mcs
3460         bug to report this as a warning like csc.
3461
3462 2002-10-15  Martin Baulig  <martin@gnome.org>
3463
3464         * statement.cs (Statement.Emit): Made this a virtual method; emits
3465         the line number info and calls DoEmit().
3466         (Statement.DoEmit): New protected abstract method, formerly knows
3467         as Statement.Emit().
3468
3469         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
3470
3471 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
3472
3473         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
3474         have fixed a remaining problem: not every AddXXXX was adding a
3475         fully qualified name.  
3476
3477         Now everyone registers a fully qualified name in the DeclSpace as
3478         being defined instead of the partial name.  
3479
3480         Downsides: we are slower than we need to be due to the excess
3481         copies and the names being registered this way.  
3482
3483         The reason for this is that we currently depend (on the corlib
3484         bootstrap for instance) that types are fully qualified, because
3485         we dump all the types in the namespace, and we should really have
3486         types inserted into the proper namespace, so we can only store the
3487         basenames in the defined_names array.
3488
3489 2002-10-10  Martin Baulig  <martin@gnome.org>
3490
3491         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
3492         from bug #31834, see the bug report for a testcase which is
3493         miscompiled.
3494
3495 2002-10-10  Martin Baulig  <martin@gnome.org>
3496
3497         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
3498         flow analysis code for this.
3499
3500         * statement.cs (Do, While, For): Tell the flow analysis code about
3501         infinite loops.
3502         (FlowBranching.UsageVector): Added support for infinite loops.
3503         (Block.Resolve): Moved the dead code elimination here and use flow
3504         analysis to do it.
3505
3506 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
3507
3508         * class.cs (Field.Define): Catch cycles on struct type
3509         definitions. 
3510
3511         * typemanager.cs (IsUnmanagedtype): Do not recursively check
3512         fields if the fields are static.  We only need to check instance
3513         fields. 
3514
3515         * expression.cs (As.DoResolve): Test for reference type.
3516
3517         * statement.cs (Using.ResolveExpression): Use
3518         ConvertImplicitRequired, not ConvertImplicit which reports an
3519         error on failture
3520         (Using.ResolveLocalVariableDecls): ditto.
3521
3522         * expression.cs (Binary.ResolveOperator): Report errors in a few
3523         places where we had to.
3524
3525         * typemanager.cs (IsUnmanagedtype): Finish implementation.
3526
3527 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
3528
3529         * expression.cs: Use StoreFromPtr instead of extracting the type
3530         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
3531
3532         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3533         an enumeration value to a System.Enum, but System.Enum is not a
3534         value type, but an class type, so we need to box.
3535
3536         (Expression.ConvertExplicit): One codepath could return
3537         errors but not flag them.  Fix this.  Fixes #31853
3538
3539         * parameter.cs (Resolve): Do not allow void as a parameter type.
3540
3541 2002-10-06  Martin Baulig  <martin@gnome.org>
3542
3543         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3544         if it's a class type and not a struct.  Fixes #31815.
3545
3546 2002-10-06  Martin Baulig  <martin@gnome.org>
3547
3548         * statement.cs: Reworked the flow analysis code a bit to make it
3549         usable for dead code elimination.
3550
3551 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3552
3553         * cs-parser.jay: allow empty source files. Fixes bug #31781.
3554
3555 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3556
3557         * expression.cs (ComposedCast.DoResolveType): A quick workaround
3558         to fix the test 165, will investigate deeper.
3559
3560 2002-10-04  Martin Baulig  <martin@gnome.org>
3561
3562         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3563         finally blocks actually work.
3564         (Try.Resolve): We don't need to create a sibling for `finally' if
3565         there is no finally block.
3566
3567 2002-10-04  Martin Baulig  <martin@gnome.org>
3568
3569         * class.cs (Constructor.Define): The default accessibility for a
3570         non-default constructor is private, not public.
3571
3572 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3573
3574         * class.cs (Constructor): Make AllowedModifiers public, add
3575         EXTERN.
3576
3577         * cs-parser.jay: Perform the modifiers test here, as the
3578         constructor for the Constructor class usually receives a zero
3579         because of the way we create it (first we create, later we
3580         customize, and we were never checking the modifiers).
3581
3582         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3583         is a version of LookupTypeReflection that includes the type-name
3584         cache.  This can be used as a fast path for functions that know
3585         the fully qualified name and are only calling into *.GetType() to
3586         obtain a composed type.
3587
3588         This is also used by TypeManager.LookupType during its type
3589         composition.
3590
3591         (LookupType): We now also track the real type name, as sometimes
3592         we can get a quey for the real type name from things like
3593         ComposedCast.  This fixes bug 31422.
3594         
3595         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3596         complete type fullname, it does not have to go through the type
3597         resolution system to obtain the composed version of the type (for
3598         obtaining arrays or pointers).
3599         
3600         (Conditional.Emit): Use the EmitBoolExpression to
3601         generate nicer code, as requested by Paolo.
3602
3603         (ArrayCreation.CheckIndices): Use the patch from
3604         hwang_rob@yahoo.ca to validate the array initializers. 
3605
3606 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
3607
3608         * class.cs (ConstructorInitializer.Emit): simplify code by using
3609         Invocation.EmitCall, and at the same time, fix the bugs in calling
3610         parent constructors that took variable arguments. 
3611
3612         * ecore.cs (Expression.ConvertNumericExplicit,
3613         Expression.ImplicitNumericConversion): Remove the code that
3614         manually wrapped decimal (InternalTypeConstructor call is now gone
3615         as well).
3616
3617         * expression.cs (Cast.TryReduce): Also handle decimal types when
3618         trying to perform a constant fold on the type.
3619
3620         * typemanager.cs (IsUnmanagedtype): Partially implemented.
3621
3622         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3623         that only turned off an error report, and did nothing else. 
3624
3625 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
3626
3627         * driver.cs: Handle and ignore /fullpaths
3628
3629 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
3630
3631         * expression.cs (Binary.ResolveOperator): Catch the case where
3632         DoNumericPromotions returns true, 
3633
3634         (Binary.DoNumericPromotions): Simplify the code, and the tests.
3635
3636 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
3637
3638         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3639         report error 70.
3640
3641 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
3642
3643         * ecore.cs (ConvertNumericExplicit): It is not enough that the
3644         conversion exists, but it is also required that the conversion be
3645         performed.  This manifested in "(Type64Enum) 2".  
3646
3647         * class.cs (TypeManager.AddMethod): The fix is not to change
3648         AddEnum, because that one was using a fully qualified name (every
3649         DeclSpace derivative does), but to change the AddMethod routine
3650         that was using an un-namespaced name.  This now correctly reports
3651         the duplicated name.
3652
3653         Revert patch until I can properly fix it.  The issue
3654         is that we have a shared Type space across all namespaces
3655         currently, which is wrong.
3656
3657         Options include making the Namespace a DeclSpace, and merge
3658         current_namespace/current_container in the parser.
3659
3660 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
3661
3662         * cs-parser.jay: Improve error reporting when we get a different
3663         kind of expression in local_variable_type and
3664         local_variable_pointer_type. 
3665
3666         Propagate this to avoid missleading errors being reported.
3667
3668         * ecore.cs (ImplicitReferenceConversion): treat
3669         TypeManager.value_type as a target just like object_type.   As
3670         code like this:
3671
3672         ValueType v = 1;
3673
3674         Is valid, and needs to result in the int 1 being boxed before it
3675         is assigned to the value type v.
3676
3677         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3678         to validate the enumeration name.
3679
3680         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3681         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
3682         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3683
3684         * ecore.cs (TryImplicitIntConversion): When doing an
3685         implicit-enumeration-conversion, check if the type is 64-bits and
3686         perform a conversion before passing to EnumConstant.
3687
3688 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
3689
3690         * decl.cs (Error_AmbiguousTypeReference); New routine used to
3691         report ambiguous type references.  Unlike the MS version, we
3692         report what the ambiguity is.   Innovation at work ;-)
3693
3694         (DeclSpace.FindType): Require a location argument to
3695         display when we display an ambiguous error.
3696
3697         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3698
3699         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3700
3701         * expression.cs (EmitDynamicInitializers): Apply patch from
3702         hwang_rob@yahoo.ca that fixes the order in which we emit our
3703         initializers. 
3704
3705 2002-09-21  Martin Baulig  <martin@gnome.org>
3706
3707         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3708         delegate takes no arguments.
3709
3710 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
3711
3712         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3713         from integers.
3714
3715         * expression.cs: Extract the underlying type.
3716
3717         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3718
3719         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3720
3721 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
3722
3723         * class.cs (TypeContainer.DefineType): We can not use the nice
3724         PackingSize with the size set to 1 DefineType method, because it
3725         will not allow us to define the interfaces that the struct
3726         implements.
3727
3728         This completes the fixing of bug 27287
3729
3730         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3731         means also structs.  This fixes part of the problem. 
3732         (Expresion.ImplicitReferenceConversionExists): ditto.
3733
3734         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3735         error if there were no errors reported during the type lookup
3736         process, to avoid duplicates or redundant errors.  Without this
3737         you would get an ambiguous errors plus a type not found.  We have
3738         beaten the user enough with the first error.  
3739
3740         (DeclSparce.FindType): Emit a warning if we have an ambiguous
3741         reference. 
3742
3743         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3744         during the resolution process, stop the lookup, this avoids
3745         repeated error reports (same error twice).
3746
3747         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3748
3749         * typemanager.cs (LookupType): Redo the type lookup code to match
3750         the needs of System.Reflection.  
3751
3752         The issue is that System.Reflection requires references to nested
3753         types to begin with a "+" sign instead of a dot.  So toplevel
3754         types look like: "NameSpace.TopLevelClass", and nested ones look
3755         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3756         levels. 
3757
3758 2002-09-19  Martin Baulig  <martin@gnome.org>
3759
3760         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3761         says that a method always returns or always throws an exception,
3762         don't report the CS0161.
3763
3764         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3765         set `Returns = new_returns'.
3766
3767 2002-09-19  Martin Baulig  <martin@gnome.org>
3768
3769         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3770         to an enum constant, check for a CS0176.
3771
3772 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
3773
3774         * class.cs (TypeContainer.CheckPairedOperators): Now we check
3775         for operators that must be in pairs and report errors.
3776
3777         * ecore.cs (SimpleName.DoResolveType): During the initial type
3778         resolution process, when we define types recursively, we must
3779         check first for types in our current scope before we perform
3780         lookups in the enclosing scopes.
3781
3782         * expression.cs (MakeByteBlob): Handle Decimal blobs.
3783
3784         (Invocation.VerifyArgumentsCompat): Call
3785         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3786         I thought we were supposed to always call this, but there are a
3787         few places in the code where we dont do it.
3788
3789 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
3790
3791         * driver.cs: Add support in -linkres and -resource to specify the
3792         name of the identifier.
3793
3794 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3795
3796         * ecore.cs (StandardConversionExists): Sync with the conversion
3797         code: allow anything-* to void* conversions.
3798
3799         (FindMostSpecificSource): Use an Expression argument
3800         instead of a Type, because we might be handed over a Literal which
3801         gets a few more implicit conversions that plain types do not.  So
3802         this information was being lost.
3803
3804         Also, we drop the temporary type-holder expression when not
3805         required.
3806
3807 2002-09-17  Martin Baulig  <martin@gnome.org>
3808
3809         * class.cs (PropertyBase.CheckBase): Don't check the base class if
3810         this is an explicit interface implementation.
3811
3812 2002-09-17  Martin Baulig  <martin@gnome.org>
3813
3814         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3815         different `IndexerName' attributes.
3816
3817         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3818         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3819         virtual CommonResolve().
3820
3821 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3822
3823         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3824         and convert that to the UnderlyingType.
3825
3826         * statement.cs (Foreach.Resolve): Indexers are just like variables
3827         or PropertyAccesses.
3828
3829         * cs-tokenizer.cs (consume_string): Track line numbers and columns
3830         inside quoted strings, we were not doing this before.
3831
3832 2002-09-16  Martin Baulig  <martin@gnome.org>
3833
3834         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3835         resolve it.  This is needed for the definite assignment check of the
3836         instance expression, fixes bug #29846.
3837         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3838
3839 2002-09-16  Nick Drochak  <ndrochak@gol.com>
3840
3841         * parameter.cs: Fix compile error.  Cannot reference static member
3842         from an instance object.  Is this an mcs bug?
3843
3844 2002-09-14  Martin Baulig  <martin@gnome.org>
3845
3846         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3847         multiple times.  Fixes bug #30295, added test-166.cs.
3848
3849 2002-09-14  Martin Baulig  <martin@gnome.org>
3850
3851         * statement.cs (Block.Emit): Don't emit unreachable code.
3852         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3853         `break' statements.
3854         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3855
3856 2002-09-14  Martin Baulig  <martin@gnome.org>
3857
3858         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3859         is set.
3860
3861 2002-09-14  Martin Baulig  <martin@gnome.org>
3862
3863         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3864         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3865         be false on the ms runtime.
3866
3867 2002-09-13  Martin Baulig  <martin@gnome.org>
3868
3869         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3870         the CS0038 error message.
3871
3872 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
3873
3874         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3875         constant inside, return it.
3876
3877 2002-09-12  Martin Baulig  <martin@gnome.org>
3878
3879         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3880         implicit conversion can be done between enum types.
3881
3882         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3883         check whether an implicit conversion to the current enum's UnderlyingType
3884         exists and report an error if not.
3885
3886         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3887         without debugging support.
3888
3889         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3890         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
3891
3892 2002-09-12  Martin Baulig  <martin@gnome.org>
3893
3894         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3895
3896         * ecore.cs (IMemberExpr.DeclaringType): New property.
3897         (SimpleName.SimpleNameResolve): Check whether we're accessing a
3898         nonstatic member of an outer type (CS0038).
3899
3900 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
3901
3902         * driver.cs: Activate the using-error detector at warning level
3903         4 (at least for MS-compatible APIs).
3904
3905         * namespace.cs (VerifyUsing): Small buglett fix.
3906
3907         * pending.cs (PendingImplementation): pass the container pointer. 
3908
3909         * interface.cs (GetMethods): Allow for recursive definition.  Long
3910         term, I would like to move every type to support recursive
3911         definitions, not the current ordering mechanism that we have right
3912         now.
3913
3914         The situation is this: Attributes are handled before interfaces,
3915         so we can apply attributes to interfaces.  But some attributes
3916         implement interfaces, we will now handle the simple cases
3917         (recursive definitions will just get an error).  
3918
3919         * parameter.cs: Only invalidate types at the end if we fail to
3920         lookup all types.  
3921
3922 2002-09-09  Martin Baulig  <martin@gnome.org>
3923
3924         * ecore.cs (PropertyExpr.Emit): Also check for
3925         TypeManager.system_int_array_get_length so this'll also work when
3926         compiling corlib.  Fixes #30003.
3927
3928 2002-09-09  Martin Baulig  <martin@gnome.org>
3929
3930         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3931         and throw an exception if we can't get the type's size.  Fixed #30040,
3932         added test-165.cs.
3933
3934 2002-09-09  Martin Baulig  <martin@gnome.org>
3935
3936         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3937
3938         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3939         context.  Fixes bug #30027.
3940
3941         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3942         virtual functions.  Fixes bug #30043, added test-164.cs.
3943
3944 2002-09-08  Ravi Pratap  <ravi@ximian.com>
3945
3946         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3947
3948 2002-09-08  Nick Drochak  <ndrochak@gol.com>
3949
3950         * driver.cs: Use an object to get the windows codepage since it's not a
3951         static property.
3952
3953 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
3954
3955         * statement.cs (For.Emit): for infinite loops (test == null)
3956         return whether there is a break inside, not always "true".
3957
3958         * namespace.cs (UsingEntry): New struct to hold the name of the
3959         using definition, the location where it is defined, and whether it
3960         has been used in a successful type lookup.
3961         
3962         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3963         strings.
3964
3965         * decl.cs: ditto.
3966
3967 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3968
3969         * attribute.cs : Fix incorrect code which relied on catching
3970         a NullReferenceException to detect a null being passed in
3971         where an object was expected.
3972
3973 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
3974
3975         * statement.cs (Try): flag the catch variable as assigned
3976
3977         * expression.cs (Cast): Simplified by using ResolveType instead of
3978         manually resolving.
3979
3980         * statement.cs (Catch): Fix bug by using ResolveType.
3981
3982 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3983
3984         * expression.cs (BetterConversion): Special case for when we have
3985         a NullLiteral as the argument and we have to choose between string
3986         and object types - we choose string the way csc does.
3987
3988         * attribute.cs (Attribute.Resolve): Catch the
3989         NullReferenceException and report error #182 since the Mono
3990         runtime no more has the bug and having this exception raised means
3991         we tried to select a constructor which takes an object and is
3992         passed a null.
3993
3994 2002-09-05  Ravi Pratap  <ravi@ximian.com>
3995
3996         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3997         message (1502, 1503) when we can't locate a method after overload
3998         resolution. This is much more informative and closes the bug
3999         Miguel reported.
4000
4001         * interface.cs (PopulateMethod): Return if there are no argument
4002         types. Fixes a NullReferenceException bug.
4003
4004         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
4005         expressions too. Previously we were checking only in one place for
4006         positional arguments leaving out named arguments.
4007
4008         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
4009         type to the enum type is not allowed. Remove code corresponding to
4010         that.
4011
4012         (ConvertNumericExplicit): Allow explicit conversions from
4013         the underlying type to enum type. This precisely follows the spec
4014         and closes a bug filed by Gonzalo.
4015         
4016 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4017
4018         * compiler.csproj:
4019         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
4020
4021 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
4022
4023         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
4024         it was important that we stored the right value after the
4025         reduction in `converted'.
4026
4027 2002-09-04  Martin Baulig  <martin@gnome.org>
4028
4029         * location.cs (Location.SymbolDocument): Use full pathnames for the
4030         source files.
4031
4032 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
4033
4034         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
4035         of the expression resolve mechanism, because that will catch the
4036         SimpleName error failures.
4037
4038         (Conditional): If we can not resolve the
4039         expression, return, do not crash.
4040
4041 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4042
4043         * cs-tokenizer.cs:
4044         (location): display token name instead of its number.
4045
4046 2002-08-28  Martin Baulig  <martin@gnome.org>
4047
4048         * expression.cs (Binary.ResolveOperator): Don't silently return
4049         but return an error if an operator cannot be applied between two
4050         enum types.
4051
4052 2002-08-28  Martin Baulig  <martin@gnome.org>
4053
4054         * class.cs (Constructor.Define): Set the permission attributes
4055         correctly instead of making all constructors public.
4056
4057 2002-08-28  Martin Baulig  <martin@gnome.org>
4058
4059         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
4060         for private members before reporting a CS0103; if we find anything,
4061         it's a CS0122.
4062
4063 2002-08-28  Martin Baulig  <martin@gnome.org>
4064
4065         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
4066         to check whether `closure_start_type == closure_invocation_type',
4067         we also need to check whether `m.DeclaringType == closure_invocation_type'
4068         before bypassing the permission checks.  We might be accessing
4069         protected/private members from the base class.
4070         (TypeManager.RealMemberLookup): Only set private_ok if private
4071         members were requested via BindingFlags.NonPublic.
4072
4073         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
4074
4075         * expression.cs (MemberAccess.ResolveMemberAccess): Set
4076         MethodGroupExpr.IsExplicitImpl if appropriate.
4077         (Invocation.DoResolve): Don't report the CS0120 for explicit
4078         interface implementations.
4079
4080 2002-08-27  Martin Baulig  <martin@gnome.org>
4081
4082         * expression.cs (Invocation.DoResolve): If this is a static
4083         method and we don't have an InstanceExpression, we must report
4084         a CS0120.
4085
4086 2002-08-25  Martin Baulig  <martin@gnome.org>
4087
4088         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
4089         `==' between a valuetype and an object.
4090
4091 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
4092
4093         * ecore.cs (TypeExpr): Provide a ToString method.
4094
4095 2002-08-24  Martin Baulig  <martin@gnome.org>
4096
4097         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
4098         now called proggie.dbg and it's a binary file.
4099
4100 2002-08-23  Martin Baulig  <martin@gnome.org>
4101
4102         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
4103
4104 2002-08-23  Martin Baulig  <martin@gnome.org>
4105
4106         * struct.cs (MyStructInfo.ctor): Make this work with empty
4107         structs; it's not allowed to use foreach() on null.
4108
4109 2002-08-23  Martin Baulig  <martin@gnome.org>
4110
4111         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
4112         writer the full pathname of the generated assembly.
4113
4114 2002-08-23  Martin Baulig  <martin@gnome.org>
4115
4116         * statements.cs (FlowBranching.UsageVector.MergeChildren):
4117         A `finally' block never returns or breaks; improved handling of
4118         unreachable code.
4119
4120 2002-08-23  Martin Baulig  <martin@gnome.org>
4121
4122         * statement.cs (Throw.Resolve): Allow `throw null'.
4123
4124 2002-08-23  Martin Baulig  <martin@gnome.org>
4125
4126         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
4127         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
4128         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
4129         MemberLookup would return a wrong event if this is an explicit
4130         interface implementation and the class has an event with the same
4131         name.
4132
4133 2002-08-23  Martin Baulig  <martin@gnome.org>
4134
4135         * statement.cs (Block.AddChildVariableNames): New public method.
4136         (Block.AddChildVariableName): Likewise.
4137         (Block.IsVariableNameUsedInChildBlock): Likewise.
4138         (Block.AddVariable): Check whether a variable name has already
4139         been used in a child block.
4140
4141         * cs-parser.jay (declare_local_variables): Mark all variable names
4142         from the current block as being used in a child block in the
4143         implicit block.
4144
4145 2002-08-23  Martin Baulig  <martin@gnome.org>
4146
4147         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
4148         find the symbol writer.
4149
4150         * driver.cs: csc also allows the arguments to /define being
4151         separated by commas, not only by semicolons.
4152
4153 2002-08-23  Martin Baulig  <martin@gnome.org>
4154
4155         * interface.cs (Interface.GetMembers): Added static check for events.
4156
4157 2002-08-15  Martin Baulig  <martin@gnome.org>
4158
4159         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
4160         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
4161
4162         * ecore.cs (Expression.MemberLookup): Added documentation and explained
4163         why the MethodData.EmitDestructor() change was necessary.
4164
4165 2002-08-20  Martin Baulig  <martin@gnome.org>
4166
4167         * class.cs (TypeContainer.FindMembers): Added static check for events.
4168
4169         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
4170
4171         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
4172         use Type.GetEvents(), not Type.FindMembers().
4173
4174 2002-08-20  Martin Baulig  <martin@gnome.org>
4175
4176         * decl.cs (MemberCache): Added a special method cache which will
4177         be used for method-only searched.  This ensures that a method
4178         search will return a MethodInfo with the correct ReflectedType for
4179         inherited methods.      
4180
4181 2002-08-20  Martin Baulig  <martin@gnome.org>
4182
4183         * decl.cs (DeclSpace.FindMembers): Made this public.
4184
4185 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4186
4187         * delegate.cs: fixed build on windows.
4188         [FIXME:  Filed as bug #29150: MCS must report these errors.]
4189
4190 2002-08-19  Ravi Pratap  <ravi@ximian.com>
4191
4192         * ecore.cs (StandardConversionExists): Return a false
4193         if we are trying to convert the void type to anything else
4194         since that is not allowed.
4195
4196         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
4197         we flag error 70 in the event an event is trying to be accessed
4198         directly from outside the declaring type.
4199
4200 2002-08-20  Martin Baulig  <martin@gnome.org>
4201
4202         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
4203         MemberCache from typemanager.cs to decl.cs.
4204
4205 2002-08-19  Martin Baulig  <martin@gnome.org>
4206
4207         * class.cs (TypeContainer): Implement IMemberContainer.
4208         (TypeContainer.DefineMembers): Create the MemberCache.
4209         (TypeContainer.FindMembers): Do better BindingFlags checking; only
4210         return public members if BindingFlags.Public was given, check
4211         whether members are static.
4212
4213 2002-08-16  Martin Baulig  <martin@gnome.org>
4214
4215         * decl.cs (DeclSpace.Define): Splitted this in Define and
4216         DefineMembers.  DefineMembers is called first and initializes the
4217         MemberCache.
4218
4219         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
4220         DefineMembers() on all our DeclSpaces.
4221
4222         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
4223         but call DefineMembers() on all nested interfaces.  We call their
4224         Define() in our new Define() function.
4225
4226         * interface.cs (Interface): Implement IMemberContainer.
4227         (Interface.Define): Moved all code except the attribute stuf to
4228         DefineMembers().
4229         (Interface.DefineMembers): Initialize the member cache.
4230
4231         * typemanager.cs (IMemberFinder): Removed this interface, we don't
4232         need this anymore since we can use MemberCache.FindMembers directly.
4233
4234 2002-08-19  Martin Baulig  <martin@gnome.org>
4235
4236         * typemanager.cs (MemberCache): When creating the cache for an
4237         interface type, add all inherited members.
4238         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
4239         to `out bool used_cache' and documented it.
4240         (TypeManager.MemberLookup): If we already used the cache in the first
4241         iteration, we don't need to do the interfaces check.
4242
4243 2002-08-19  Martin Baulig  <martin@gnome.org>
4244
4245         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
4246         here from IMemberFinder and don't implement this interface anymore.
4247         (DeclSpace.MemberCache): Moved here from IMemberFinder.
4248
4249         * typemanager.cs (IMemberFinder): This interface is now only used by
4250         classes which actually support the member cache.
4251         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
4252         since we only put DeclSpaces into this Hashtable.
4253         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
4254         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
4255
4256 2002-08-16  Martin Baulig  <martin@gnome.org>
4257
4258         * typemanager.cs (ICachingMemberFinder): Removed.
4259         (IMemberFinder.MemberCache): New property.
4260         (TypeManager.FindMembers): Merged this with RealFindMembers().
4261         This function will never be called from TypeManager.MemberLookup()
4262         so we can't use the cache here, just the IMemberFinder.
4263         (TypeManager.MemberLookup_FindMembers): Check whether the
4264         IMemberFinder has a MemberCache and call the cache's FindMembers
4265         function.
4266         (MemberCache): Rewrote larger parts of this yet another time and
4267         cleaned it up a bit.
4268
4269 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
4270
4271         * driver.cs (LoadArgs): Support quoting.
4272
4273         (Usage): Show the CSC-like command line arguments.
4274
4275         Improved a few error messages.
4276
4277 2002-08-15  Martin Baulig  <martin@gnome.org>
4278
4279         * typemanager.cs (IMemberContainer.Type): New property.
4280         (IMemberContainer.IsInterface): New property.
4281
4282         The following changes are conditional to BROKEN_RUNTIME, which is
4283         defined at the top of the file.
4284
4285         * typemanager.cs (MemberCache.MemberCache): Don't add the base
4286         class'es members, but add all members from TypeHandle.ObjectType
4287         if we're an interface.
4288         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
4289         is the current type.
4290         (MemberCache.CacheEntry.Container): Removed this field.
4291         (TypeHandle.GetMembers): Include inherited members.
4292
4293 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4294
4295         * typemanager.cs: fixed compilation and added a comment on a field that
4296         is never used.
4297
4298 2002-08-15  Martin Baulig  <martin@gnome.org>
4299
4300         * class.cs (ConstructorInitializer.Resolve): In the
4301         Expression.MemberLookup call, use the queried_type as
4302         invocation_type.
4303
4304         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
4305         declared' attribute, it's always true.
4306         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
4307         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
4308         temporary wrapper for FindMembers which tells MemberLookup whether
4309         members from the base classes are included in the return value.
4310         This will go away soon.
4311         (TypeManager.MemberLookup): Use this temporary hack here; once the
4312         new MemberCache is completed, we don't need to do the DeclaredOnly
4313         looping here anymore since the MemberCache will take care of this.
4314         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
4315         (MemberCache): When creating the MemberCache for a class, get
4316         members from the current class and all its base classes.
4317         (MemberCache.CacheEntry.Container): New field.  This is a
4318         temporary hack until the Mono runtime is fixed to distinguish
4319         between ReflectedType and DeclaringType.  It allows us to use MCS
4320         with both the MS runtime and the unfixed Mono runtime without
4321         problems and without accecting performance.
4322         (MemberCache.SearchMembers): The DeclaredOnly looping from
4323         TypeManager.MemberLookup is now done here.      
4324
4325 2002-08-14  Martin Baulig  <martin@gnome.org>
4326
4327         * statement.cs (MyStructInfo.MyStructInfo): Don't call
4328         Type.GetFields on dynamic types but get the fields from the
4329         corresponding TypeContainer.
4330         (MyStructInfo.GetStructInfo): Added check for enum types.
4331
4332         * typemanager.cs (MemberList.IsSynchronized): Implemented.
4333         (MemberList.SyncRoot): Implemented.
4334         (TypeManager.FilterWithClosure): No need to check permissions if
4335         closure_start_type == closure_invocation_type, don't crash if
4336         closure_invocation_type is null.
4337
4338 2002-08-13  Martin Baulig  <martin@gnome.org>
4339
4340         Rewrote TypeContainer.FindMembers to use a member cache.  This
4341         gives us a speed increase of about 35% for the self-hosting MCS
4342         build and of about 15-20% for the class libs (both on GNU/Linux).
4343
4344         * report.cs (Timer): New class to get enhanced profiling.  This
4345         whole class is "TIMER" conditional since it remarkably slows down
4346         compilation speed.
4347
4348         * class.cs (MemberList): New class.  This is an IList wrapper
4349         which we're now using instead of passing MemberInfo[]'s around to
4350         avoid copying this array unnecessarily.
4351         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
4352         (ICachingMemberFinder, IMemberContainer): New interface.
4353         (TypeManager.FilterWithClosure): If `criteria' is null, the name
4354         has already been checked, otherwise use it for the name comparision.
4355         (TypeManager.FindMembers): Renamed to RealMemberFinder and
4356         provided wrapper which tries to use ICachingMemberFinder.FindMembers
4357         if possible.  Returns a MemberList, not a MemberInfo [].
4358         (TypeHandle): New class, implements IMemberContainer.  We create
4359         one instance of this class per type, it contains a MemberCache
4360         which is used to do the member lookups.
4361         (MemberCache): New class.  Each instance of this class contains
4362         all members of a type and a name-based hash table.
4363         (MemberCache.FindMembers): This is our new member lookup
4364         function.  First, it looks up all members of the requested name in
4365         the hash table.  Then, it walks this list and sorts out all
4366         applicable members and returns them.
4367
4368 2002-08-13  Martin Baulig  <martin@gnome.org>
4369
4370         In addition to a nice code cleanup, this gives us a performance
4371         increase of about 1.4% on GNU/Linux - not much, but it's already
4372         half a second for the self-hosting MCS compilation.
4373
4374         * typemanager.cs (IMemberFinder): New interface.  It is used by
4375         TypeManager.FindMembers to call FindMembers on a TypeContainer,
4376         Enum, Delegate or Interface.
4377         (TypeManager.finder_to_member_finder): New PtrHashtable.
4378         (TypeManager.finder_to_container): Removed.
4379         (TypeManager.finder_to_delegate): Removed.
4380         (TypeManager.finder_to_interface): Removed.
4381         (TypeManager.finder_to_enum): Removed.
4382
4383         * interface.cs (Interface): Implement IMemberFinder.
4384
4385         * delegate.cs (Delegate): Implement IMemberFinder.
4386
4387         * enum.cs (Enum): Implement IMemberFinder.
4388
4389         * class.cs (TypeContainer): Implement IMemberFinder.
4390
4391 2002-08-12  Martin Baulig  <martin@gnome.org>
4392
4393         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
4394
4395 2002-08-12  Martin Baulig  <martin@gnome.org>
4396
4397         * ecore.cs (ITypeExpression): New interface for expressions which
4398         resolve to a type.
4399         (TypeExpression): Renamed to TypeLookupExpression.
4400         (Expression.DoResolve): If we're doing a types-only lookup, the
4401         expression must implement the ITypeExpression interface and we
4402         call DoResolveType() on it.
4403         (SimpleName): Implement the new ITypeExpression interface.
4404         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
4405         hack, the situation that we're only looking up types can't happen
4406         anymore when this method is called.  Moved the type lookup code to
4407         DoResolveType() and call it.
4408         (SimpleName.DoResolveType): This ITypeExpression interface method
4409         is now doing the types-only lookup.
4410         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
4411         (ResolveFlags): Added MaskExprClass.
4412
4413         * expression.cs (MemberAccess): Implement the ITypeExpression
4414         interface.
4415         (MemberAccess.DoResolve): Added support for a types-only lookup
4416         when we're called via ITypeExpression.DoResolveType().
4417         (ComposedCast): Implement the ITypeExpression interface.
4418
4419         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
4420         Expression.Resolve() with ResolveFlags.Type instead.
4421
4422 2002-08-12  Martin Baulig  <martin@gnome.org>
4423
4424         * interface.cs (Interface.Define): Apply attributes.
4425
4426         * attribute.cs (Attribute.ApplyAttributes): Added support for
4427         interface attributes.
4428
4429 2002-08-11  Martin Baulig  <martin@gnome.org>
4430
4431         * statement.cs (Block.Emit): Only check the "this" variable if we
4432         do not always throw an exception.
4433
4434         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
4435         whether the property has a set accessor.
4436
4437 2002-08-11  Martin Baulig  <martin@gnome.org>
4438
4439         Added control flow analysis support for structs.
4440
4441         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
4442         with control flow analysis turned off.
4443         (IVariable): New interface.
4444         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
4445         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
4446         (FieldExpr.DoResolve): Resolve the instance expression with flow
4447         analysis turned off and do the definite assignment check after the
4448         resolving when we know what the expression will resolve to.
4449
4450         * expression.cs (LocalVariableReference, ParameterReference):
4451         Implement the new IVariable interface, only call the flow analysis
4452         code if ec.DoFlowAnalysis is true.
4453         (This): Added constructor which takes a Block argument.  Implement
4454         the new IVariable interface.
4455         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
4456         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
4457         This does the definite assignment checks for struct members.
4458
4459         * class.cs (Constructor.Emit): If this is a non-static `struct'
4460         constructor which doesn't have any initializer, call
4461         Block.AddThisVariable() to tell the flow analysis code that all
4462         struct elements must be initialized before control returns from
4463         the constructor.
4464
4465         * statement.cs (MyStructInfo): New public class.
4466         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
4467         argument to this indexer.  If non-zero, check an individual struct
4468         member, not the whole struct.
4469         (FlowBranching.CheckOutParameters): Check struct members.
4470         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
4471         overloaded versions of these methods which take an additional
4472         `int field_idx' argument to check struct members.
4473         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
4474         overloaded versions of these methods which take an additional
4475         `string field_name' argument to check struct member.s
4476         (VariableInfo): Implement the IVariable interface.
4477         (VariableInfo.StructInfo): New public property.  Returns the
4478         MyStructInfo instance of the variable if it's a struct or null.
4479         (Block.AddThisVariable): New public method.  This is called from
4480         Constructor.Emit() for non-static `struct' constructor which do
4481         not have any initializer.  It creates a special variable for the
4482         "this" instance variable which will be checked by the flow
4483         analysis code to ensure that all of the struct's fields are
4484         initialized before control returns from the constructor.
4485         (UsageVector): Added support for struct members.  If a
4486         variable/parameter is a struct with N members, we reserve a slot
4487         in the usage vector for each member.  A struct is considered fully
4488         initialized if either the struct itself (slot 0) or all its
4489         members are initialized.
4490
4491 2002-08-08  Martin Baulig  <martin@gnome.org>
4492
4493         * driver.cs (Driver.MainDriver): Only report an error CS5001
4494         if there were no compilation errors.
4495
4496         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
4497         `UnsafeContext' property to determine whether the parent is in
4498         unsafe context rather than checking the parent's ModFlags:
4499         classes nested in an unsafe class are unsafe as well.
4500
4501 2002-08-08  Martin Baulig  <martin@gnome.org>
4502
4503         * statement.cs (UsageVector.MergeChildren): Distinguish between
4504         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
4505         we return.  Added test17() and test18() to test-154.cs.
4506
4507 2002-08-08  Martin Baulig  <martin@gnome.org>
4508
4509         * typemanager.cs (TypeManager.FilterWithClosure): If we have
4510         Family access, make sure the invoking type isn't a subclass of the
4511         queried type (that'd be a CS1540).
4512
4513         * ecore.cs (Expression.MemberLookup): Added overloaded version of
4514         this method which takes an additional `Type invocation_type'.
4515
4516         * expression.cs (BaseAccess.DoResolve): Use the base type as
4517         invocation and query type.
4518         (MemberAccess.DoResolve): If the lookup failed and we're about to
4519         report a CS0122, try a lookup with the ec.ContainerType - if this
4520         succeeds, we must report a CS1540.
4521
4522 2002-08-08  Martin Baulig  <martin@gnome.org>
4523
4524         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
4525         (MethodGroupExpr): Implement the IMemberExpr interface.
4526
4527         * expression (MemberAccess.ResolveMemberAccess): No need to have
4528         any special code for MethodGroupExprs anymore, they're now
4529         IMemberExprs.   
4530
4531 2002-08-08  Martin Baulig  <martin@gnome.org>
4532
4533         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4534         Family, FamANDAssem and FamORAssem permissions.
4535         (TypeManager.IsSubclassOrNestedChildOf): New public method.
4536
4537 2002-08-08  Martin Baulig  <martin@gnome.org>
4538
4539         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4540         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4541         or loop block.
4542
4543 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4544
4545         * driver.cs: implemented /resource option to embed managed resources.
4546
4547 2002-08-07  Martin Baulig  <martin@gnome.org>
4548
4549         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4550         (FieldBase.HasFieldInitializer): New public property.
4551         (FieldBase.GetInitializerExpression): New public method.  Resolves and
4552         returns the field initializer and makes sure it is only resolved once.
4553         (TypeContainer.EmitFieldInitializers): Call
4554         FieldBase.GetInitializerExpression to get the initializer, this ensures
4555         that it isn't resolved multiple times.
4556
4557         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
4558         the resolving process (SimpleName/MemberLookup) that we're currently
4559         emitting a field initializer (which must not access any instance members,
4560         this is an error CS0236).
4561
4562         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4563         argument, if the `IsFieldInitializer' flag is set, we must report and
4564         error CS0236 and not an error CS0120.   
4565
4566 2002-08-07  Martin Baulig  <martin@gnome.org>
4567
4568         * ecore.cs (IMemberExpr): New public interface.
4569         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4570         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4571         if the expression is an IMemberExpr.
4572
4573         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4574         to be null, implicitly default to `this' if we're non-static in
4575         this case.  Simplified the code a lot by using the new IMemberExpr
4576         interface.  Also fixed bug #28176 here.
4577
4578 2002-08-06  Martin Baulig  <martin@gnome.org>
4579
4580         * cs-parser.jay (SimpleLookup): Removed.  We need to create
4581         ParameterReferences during semantic analysis so that we can do a
4582         type-only search when resolving Cast, TypeOf and SizeOf.
4583         (block): Pass the `current_local_parameters' to the Block's
4584         constructor.
4585
4586         * class.cs (ConstructorInitializer): Added `Parameters parameters'
4587         argument to the constructor.
4588         (ConstructorInitializer.Resolve): Create a temporary implicit
4589         block with the parameters.
4590
4591         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4592         references here if we aren't doing a type-only search.
4593
4594         * statement.cs (Block): Added constructor which takes a
4595         `Parameters parameters' argument.
4596         (Block.Parameters): New public property.
4597
4598         * support.cs (InternalParameters.Parameters): Renamed `parameters'
4599         to `Parameters' and made it public readonly.
4600
4601 2002-08-06  Martin Baulig  <martin@gnome.org>
4602
4603         * ecore.cs (Expression.Warning): Made this public as well.
4604
4605         * report.cs (Report.Debug): Print the contents of collections.
4606
4607 2002-08-06  Martin Baulig  <martin@gnome.org>
4608
4609         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
4610         used to tell Resolve() which kinds of expressions it may return.
4611         (Expression.Resolve): Added overloaded version of this method which
4612         takes a `ResolveFlags flags' argument.  This can be used to tell
4613         Resolve() which kinds of expressions it may return.  Reports a
4614         CS0118 on error.
4615         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4616         ResolveFlags.SimpleName.
4617         (Expression.Error118): Added overloaded version of this method which
4618         takes a `ResolveFlags flags' argument.  It uses the flags to determine
4619         which kinds of expressions are allowed.
4620
4621         * expression.cs (Argument.ResolveMethodGroup): New public method.
4622         Resolves an argument, but allows a MethodGroup to be returned.
4623         This is used when invoking a delegate.
4624
4625         * TODO: Updated a bit.
4626
4627 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4628
4629         Fixed compilation with csc.
4630
4631         * ecore.cs: Expression.Error made public. Is this correct? Should
4632         Warning be made public too?
4633
4634         * expression.cs: use ea.Location instead of ea.loc.
4635         [FIXME:  Filed as bug #28607: MCS must report these errors.]
4636
4637 2002-08-06  Martin Baulig  <martin@gnome.org>
4638
4639         * ecore.cs (Expression.loc): Moved the location here instead of
4640         duplicating it in all derived classes.
4641         (Expression.Location): New public property.
4642         (Expression.Error, Expression.Warning): Made them non-static and
4643         removed the location argument.
4644         (Expression.Warning): Added overloaded version which takes an
4645         `int level' argument.
4646         (Expression.Error118): Make this non-static and removed the
4647         expression and location arguments.
4648         (TypeExpr): Added location argument to the constructor.
4649
4650         * expression.cs (StaticCallExpr): Added location argument to
4651         the constructor.
4652         (Indirection, PointerArithmetic): Likewise.
4653         (CheckedExpr, UnCheckedExpr): Likewise.
4654         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4655         (StringPtr): Likewise.
4656
4657
4658 2002-08-05  Martin Baulig  <martin@gnome.org>
4659
4660         * expression.cs (BaseAccess.DoResolve): Actually report errors.
4661
4662         * assign.cs (Assign.DoResolve): Check whether the source
4663         expression is a value or variable.
4664
4665         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4666         while resolving the corresponding blocks.
4667
4668         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4669         an error, don't silently return null.
4670
4671         * statement.cs (Block.AddVariable): Do the error reporting here
4672         and distinguish between CS0128 and CS0136.
4673         (Block.DoResolve): Report all unused labels (warning CS0164).
4674         (LabeledStatement): Pass the location to the constructor.
4675         (LabeledStatement.HasBeenReferenced): New property.
4676         (LabeledStatement.Resolve): Set it to true here.
4677
4678         * statement.cs (Return.Emit): Return success even after reporting
4679         a type mismatch error (CS0126 or CS0127), this is what csc does and
4680         it avoids confusing the users with any consecutive errors.
4681
4682 2002-08-05  Martin Baulig  <martin@gnome.org>
4683
4684         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4685
4686         * const.cs (Const.LookupConstantValue): Catch circular definitions.
4687
4688         * expression.cs (MemberAccess.DoResolve): Silently return if an
4689         error has already been reported.
4690
4691         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4692         error has already been reported.
4693
4694 2002-08-05  Martin Baulig  <martin@gnome.org>
4695
4696         * statement.cs (UsageVector): Only initialize the `parameters'
4697         vector if we actually have any "out" parameters.
4698
4699 2002-08-05  Martin Baulig  <martin@gnome.org>
4700
4701         * expression.cs (Binary.ResolveOperator): When combining delegates,
4702         they must have the same type.
4703
4704 2002-08-05  Martin Baulig  <martin@gnome.org>
4705
4706         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4707         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4708         work with the ms runtime and we also don't need it: if we're a
4709         PropertyBuilder and not in the `indexer_arguments' hash, then we
4710         are a property and not an indexer.
4711
4712         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4713         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4714         since the latter one doesn't work with the ms runtime.
4715
4716 2002-08-03  Martin Baulig  <martin@gnome.org>
4717
4718         Fixed bugs #27998 and #22735.
4719
4720         * class.cs (Method.IsOperator): New public field.
4721         (Method.CheckBase): Report CS0111 if there's already a method
4722         with the same parameters in the current class.  Report CS0508 when
4723         attempting to change the return type of an inherited method.
4724         (MethodData.Emit): Report CS0179 if a method doesn't have a body
4725         and it's not marked abstract or extern.
4726         (PropertyBase): New abstract base class for Property and Indexer.
4727         (PropertyBase.CheckBase): Moved here from Property and made it work
4728         for indexers.
4729         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4730         the same so we can reuse it there.
4731         (Property, Indexer): Derive from PropertyBase.
4732         (MethodSignature.inheritable_property_signature_filter): New delegate
4733         to find properties and indexers.
4734
4735         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4736         argument and improved error reporting.
4737
4738         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4739         EmptyReadOnlyParameters and made it a property.
4740
4741         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4742         version of this method which takes a `PropertyInfo indexer'.
4743         (TypeManager.RegisterIndexer): New method.
4744
4745         * class.cs: Added myself as author of this file :-)
4746
4747 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4748
4749         * class.cs: fixed compilation on windoze.
4750
4751 2002-08-03  Martin Baulig  <martin@gnome.org>
4752
4753         * interface.cs (Interface.GetInterfaceBases): Check whether all
4754         base interfaces are at least as accessible than the current one.
4755
4756         * class.cs (TypeContainer.GetClassBases): Check whether base types
4757         are at least as accessible than the current type.
4758         (TypeContainer.AsAccessible): Implemented and made non-static.
4759         (MemberBase.CheckParameters): Report errors if the accessibility
4760         checks fail.
4761
4762         * delegate.cs (Delegate.Delegate): The default visibility is
4763         internal for top-level types and private for nested types.
4764         (Delegate.Define): Report errors if the accessibility checks fail.
4765
4766         * enum.cs (Enum.Enum): The default visibility is internal for
4767         top-level types and private for nested types.
4768         (Enum.DefineType): Compute the correct visibility.
4769
4770         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4771         function which takes a `bool is_toplevel' instead of a TypeContainer.
4772
4773         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4774         builtin type.
4775
4776 2002-08-02  Martin Baulig  <martin@gnome.org>
4777
4778         * expression.cs (LocalVariableReferenc): Added constructor which
4779         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4780         (LocalVariableReference.IsReadOnly): New property.
4781         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4782         variable is readonly, use our own readonly flag to do this; you can
4783         use the new constructor to get a writable reference to a read-only
4784         variable.
4785
4786         * cs-parser.jay (foreach_statement, using_statement): Get a writable
4787         reference to the local variable.
4788
4789 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
4790
4791         * rootcontext.cs (ResolveCore): Also include System.Exception
4792
4793         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4794         we reach an EmptyStatement.
4795
4796         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4797         is also fine.
4798
4799         * expression.cs (Binary.ResolveOperator): Check error result in
4800         two places.
4801
4802         use brtrue/brfalse directly and avoid compares to null.
4803
4804 2002-08-02  Martin Baulig  <martin@gnome.org>
4805
4806         * class.cs (TypeContainer.Define): Define all nested interfaces here.
4807         Fixes bug #28407, added test-155.cs.
4808
4809 2002-08-01  Martin Baulig  <martin@gnome.org>
4810
4811         * class.cs (Event.EmitDefaultMethod): Make this work with static
4812         events.  Fixes #28311, added verify-3.cs.
4813
4814 2002-08-01  Martin Baulig  <martin@gnome.org>
4815
4816         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4817         `is_disposable' fields.
4818         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4819         `hm.is_disposable' if we're using the collection pattern.
4820         (Foreach.EmitCollectionForeach): Use the correct type for the
4821         enumerator's local variable, only emit the try/finally block if
4822         necessary (fixes #27713).
4823
4824 2002-08-01  Martin Baulig  <martin@gnome.org>
4825
4826         * ecore.cs (Expression.report118): Renamed to Error118 and made
4827         it public static.
4828
4829         * statement.cs (Throw.Resolve): Check whether the expression is of
4830         the correct type (CS0118) and whether the type derives from
4831         System.Exception (CS0155).
4832         (Catch.Resolve): New method.  Do the type lookup here and check
4833         whether it derives from System.Exception (CS0155).
4834         (Catch.CatchType, Catch.IsGeneral): New public properties.
4835
4836         * typemanager.cs (TypeManager.exception_type): Added.
4837
4838 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
4839
4840         * driver.cs: Updated About function.
4841
4842 2002-07-31  Martin Baulig  <martin@gnome.org>
4843
4844         Implemented Control Flow Analysis.
4845
4846         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4847         (EmitContext.CurrentBranching): Added.
4848         (EmitContext.StartFlowBranching): Added.
4849         (EmitContext.EndFlowBranching): Added.
4850         (EmitContext.KillFlowBranching): Added.
4851         (EmitContext.IsVariableAssigned): Added.
4852         (EmitContext.SetVariableAssigned): Added.
4853         (EmitContext.IsParameterAssigned): Added.
4854         (EmitContext.SetParameterAssigned): Added.
4855         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4856         Added control flow analysis stuff here.
4857
4858         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4859         resolve the expression as lvalue.
4860         (LocalVariableReference.DoResolve): Check whether the variable has
4861         already been assigned.
4862         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4863         the parameter as assigned here.
4864         (ParameterReference.DoResolve): Check whether the parameter has already
4865         been assigned.
4866         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4867         expression as lvalue.
4868
4869         * statement.cs (FlowBranching): New class for the flow analysis code.
4870         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4871         (LabeledStatement.IsDefined): New public property.
4872         (LabeledStatement.AddUsageVector): New public method to tell flow
4873         analyis that the label may be reached via a forward jump.
4874         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4875         flow analysis.
4876         (VariableInfo.Number): New public field.  This is used by flow analysis
4877         to number all locals of a block.
4878         (Block.CountVariables): New public property.  This is the number of
4879         local variables in this block (including the locals from all parent
4880         blocks).
4881         (Block.EmitMeta): Number all the variables.
4882
4883         * statement.cs: Added flow analysis support to all classes.
4884
4885 2002-07-31  Martin Baulig  <martin@gnome.org>
4886
4887         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4888         To get debugging messages, compile mcs with /define:MCS_DEBUG and
4889         then use this argument.
4890
4891         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4892
4893         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4894         use this to specify /define options.
4895
4896 2002-07-29  Martin Baulig  <martin@gnome.org>
4897
4898         * statement.cs (Fixed): Moved all code that does variable lookups
4899         and resolvings from Emit to Resolve.
4900
4901         * statement.cs (For): Moved all code that does variable lookups
4902         and resolvings from Emit to Resolve.
4903
4904         * statement.cs (Using): Moved all code that does variable lookups
4905         and resolvings from Emit to Resolve.
4906
4907 2002-07-29  Martin Baulig  <martin@gnome.org>
4908
4909         * attribute.cs (Attribute.Resolve): Explicitly catch a
4910         System.NullReferenceException when creating the
4911         CustromAttributeBuilder and report a different warning message.
4912
4913 2002-07-29  Martin Baulig  <martin@gnome.org>
4914
4915         * support.cs (ParameterData.ParameterName): Added method to
4916         get the name of a parameter.
4917
4918         * typemanager.cs (TypeManager.IsValueType): New public method.
4919
4920 2002-07-29  Martin Baulig  <martin@gnome.org>
4921
4922         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
4923         is a flag which specifies that it's either ref or out.
4924         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4925         the out parameter to `out Parameter.Modifier mod', also set the
4926         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4927
4928         * support.cs (InternalParameters.ParameterModifier): Distinguish
4929         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4930         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4931
4932         * expression.cs (Argument.GetParameterModifier): Distinguish
4933         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4934         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4935
4936 2002-07-29  Martin Baulig  <martin@gnome.org>
4937
4938         * expression.cs (ParameterReference.ParameterReference): Added
4939         `Location loc' argument to the constructor.
4940
4941         * cs-parser.jay: Pass location to ParameterReference.
4942
4943 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
4944
4945         * statement.cs (Try): Initialize the location.
4946
4947         * cs-parser.jay: pass location to Try.
4948
4949         * expression.cs (Unary.Reduce): Change the prototype to return
4950         whether a constant fold could be performed or not.  The result is
4951         returned in an out parameters.  In the case of Indirection and
4952         AddressOf, we want to perform the full tests.
4953
4954 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
4955
4956         * statement.cs (Statement.Emit): Flag dead code.
4957
4958 2002-07-27  Andrew Birkett  <andy@nobugs.org>
4959
4960         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4961
4962 2002-07-27  Martin Baulig  <martin@gnome.org>
4963
4964         * class.cs (MethodData.Define): Put back call to
4965         TypeManager.AddMethod(), accidentally commented this out.
4966
4967         * report.cs (Debug): New public method to print debugging information,
4968         this is `[Conditional ("DEBUG")]'.
4969
4970 2002-07-26  Martin Baulig  <martin@gnome.org>
4971
4972         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4973         (switch_statement): Push the current_block to the switch_stack and
4974         pop it again when we're done with the switch.
4975         (switch_section): The new block is a child of the current_block.
4976         Fixes bug #24007, added test-152.cs.
4977
4978 2002-07-27  Martin Baulig  <martin@gnome.org>
4979
4980         * expression.cs (Invocation.EmitArguments): When calling a varargs
4981         function with only its fixed arguments, we need to pass an empty
4982         array.
4983
4984 2002-07-27  Martin Baulig  <martin@gnome.org>
4985
4986         Mono 0.13 has been released.
4987
4988 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
4989
4990         * driver.cs: Rename --resource to --linkres, because that is what
4991         we do currently, we dont support --resource yet.
4992
4993         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4994
4995 2002-07-25  Martin Baulig  <martin@gnome.org>
4996
4997         * class.cs (MethodData): New public class.  This is a `method builder'
4998         class for a method or one accessor of a Property/Indexer/Event.
4999         (MethodData.GetMethodFlags): Moved here from MemberBase.
5000         (MethodData.ApplyAttributes): Likewise.
5001         (MethodData.ApplyObsoleteAttribute): Likewise.
5002         (MethodData.ApplyConditionalAttribute): Likewise.
5003         (MethodData.ApplyDllImportAttribute): Likewise.
5004         (MethodData.CheckAbstractAndExternal): Likewise.
5005         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
5006         (MethodData.Emit): Formerly known as Method.Emit().
5007         (MemberBase): Moved everything which was specific to a single
5008         accessor/method to MethodData.
5009         (Method): Create a new MethodData and call Define() and Emit() on it.
5010         (Property, Indexer, Event): Create a new MethodData objects for each
5011         accessor and call Define() and Emit() on them.
5012
5013 2002-07-25  Martin Baulig  <martin@gnome.org>
5014
5015         Made MethodCore derive from MemberBase to reuse the code from there.
5016         MemberBase now also checks for attributes.
5017
5018         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
5019         (MemberBase.GetMethodFlags): Moved here from class Method and marked
5020         as virtual.
5021         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
5022         `CallingConventions cc' and `Attributes opt_attrs' arguments.
5023         (MemberBase.ApplyAttributes): New virtual method; applies the
5024         attributes to a method or accessor.
5025         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
5026         (MemberBase.ApplyConditionalAttribute): Likewise.
5027         (MemberBase.ApplyDllImportAttribute): Likewise.
5028         (MemberBase.CheckAbstractAndExternal): Likewise.
5029         (MethodCore.ParameterTypes): This is now a property instead of a
5030         method, it's initialized from DoDefineParameters().
5031         (MethodCore.ParameterInfo): Removed the set accessor.
5032         (MethodCore.DoDefineParameters): New protected virtual method to
5033         initialize ParameterTypes and ParameterInfo.
5034         (Method.GetReturnType): We can now simply return the MemberType.
5035         (Method.GetMethodFlags): Override the MemberBase version and add
5036         the conditional flags.
5037         (Method.CheckBase): Moved some code from Define() here, call
5038         DoDefineParameters() here.
5039         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
5040         here to avoid some larger code duplication.
5041         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
5042         ensure that abstract and external accessors don't declare a body.
5043
5044         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
5045         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
5046         lookup in the attribute's parent classes, so we need to abort as soon
5047         as we found the first match.
5048         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
5049         the attribute has no arguments.
5050
5051         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
5052         of a Method.
5053
5054 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5055
5056         * cs-parser.jay: reverted previous patch.
5057
5058 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5059
5060         * cs-parser.jay: fixed bug #22119.
5061
5062 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5063
5064         * attribute.cs: fixed compilation. The error was:
5065         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
5066         be assigned to before control leaves the current method."
5067         [FIXME:  Filed as bug #28186: MCS must report this error.]
5068
5069 2002-07-25  Martin Baulig  <martin@gnome.org>
5070
5071         * attribute.cs (Attribute.Conditional_GetConditionName): New static
5072         method to pull the condition name ouf of a Conditional attribute.
5073         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
5074         the obsolete message and error flag out of an Obsolete attribute.
5075
5076         * class.cs (Method.GetMethodFlags): New public method to get the
5077         TypeManager.MethodFlags for this method.
5078         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
5079         private methods.
5080         (Method.Define): Get and apply the Obsolete and Conditional attributes;
5081         if we're overriding a virtual function, set the new private variable
5082         `parent_method'; call the new TypeManager.AddMethod().
5083
5084         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
5085         the MethodBuilder and the Method in a PtrHashtable.
5086         (TypeManager.builder_to_method): Added for this purpose.
5087         (TypeManager.MethodFlags): Added IsObsoleteError.
5088         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
5089         Obsolete and Conditional arguments in MethodBuilders.  If we discover
5090         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
5091         the message from the attribute.
5092
5093 2002-07-24  Martin Baulig  <martin@gnome.org>
5094
5095         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
5096         preprocessor directives, ensure that the argument to #define/#undef is
5097         exactly one identifier and that it's actually an identifier.
5098
5099         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
5100         did not work ....
5101
5102 2002-07-24  Martin Baulig  <martin@gnome.org>
5103
5104         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
5105         initialize it to TypeManager.object_type in the constructor.
5106         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
5107         of the `hm.get_current' method if we're using the collection pattern.
5108         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
5109         for the explicit conversion to make it work when we're using the collection
5110         pattern and the `Current' property has a different return type than `object'.
5111         Fixes #27713.
5112
5113 2002-07-24  Martin Baulig  <martin@gnome.org>
5114
5115         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
5116         does not match, but don't report any errors.  This method is called in
5117         order for all methods in a MethodGroupExpr until a matching method is
5118         found, so we don't want to bail out if the first method doesn't match.
5119         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
5120         matches, report the 123.  Fixes #28070.
5121
5122 2002-07-24  Martin Baulig  <martin@gnome.org>
5123
5124         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
5125         TypeManager.TypeToCoreType() to the top of the method so the
5126         following equality checks will work.  Fixes #28107.
5127
5128 2002-07-24  Martin Baulig  <martin@gnome.org>
5129
5130         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
5131         operand is of type uint, and the other operand is of type sbyte,
5132         short or int, the operands are converted to type long." -
5133         Actually do what this comment already told us.  Fixes bug #28106,
5134         added test-150.cs.
5135
5136 2002-07-24  Martin Baulig  <martin@gnome.org>
5137
5138         * class.cs (MethodBase): New abstract class.  This is now a base
5139         class for Property, Indexer and Event to avoid some code duplication
5140         in their Define() and DefineMethods() methods.
5141         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
5142         generic methods for Define() and DefineMethods().
5143         (FieldBase): Derive from MemberBase, not MemberCore.
5144         (Property): Derive from MemberBase, not MemberCore.
5145         (Property.DefineMethod): Moved all the code from this method to the
5146         new MethodBase.DefineAccessor(), just call it with appropriate
5147         argumetnts.
5148         (Property.Define): Call the new Property.DoDefine(), this does some
5149         sanity checks and we don't need to duplicate the code everywhere.
5150         (Event): Derive from MemberBase, not MemberCore.
5151         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
5152         accessors, this will also make them work with interface events.
5153         (Indexer): Derive from MemberBase, not MemberCore.
5154         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
5155         (Indexer.Define): Use the new MethodBase functions.
5156
5157         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
5158         argument to the constructor.
5159         (Interface.FindMembers): Added support for interface events.
5160         (Interface.PopluateEvent): Implemented.
5161
5162         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
5163
5164 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
5165
5166         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
5167         but this is required to check for a method name being the same as
5168         the containing class.  
5169
5170         Handle this now.
5171
5172 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5173
5174         * interface.cs: initialize variable.
5175
5176 2002-07-23  Martin Baulig  <martin@gnome.org>
5177
5178         Implemented the IndexerName attribute in interfaces.
5179
5180         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
5181         name if this is an explicit interface implementation.
5182         (Indexer.InterfaceIndexerName): New public variable.  If we're
5183         implementing an interface indexer, this is the IndexerName in that
5184         interface.  Otherwise, it's the IndexerName.
5185         (Indexer.DefineMethod): If we're implementing interface indexer,
5186         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
5187         and Pending.ImplementIndexer methods.
5188         (Indexer.Define): Also define the PropertyBuilder if we're
5189         implementing an interface indexer and this is neither an explicit
5190         interface implementation nor do the IndexerName match the one in
5191         the interface.
5192
5193         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
5194         If a method is defined here, then we always need to create a proxy
5195         for it.  This is used when implementing interface indexers.
5196         (Pending.IsInterfaceIndexer): New public method.
5197         (Pending.ImplementIndexer): New public method.
5198         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
5199         This is used when implementing interface indexers to define a proxy
5200         if necessary.
5201         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
5202         define a proxy if necessary.
5203
5204         * interface.cs (Interface.IndexerName): New public variable.
5205         (Interface.PopulateIndexer): Set the IndexerName.
5206         (Interface.DefineIndexers): New private method.  Populate all the
5207         indexers and make sure their IndexerNames match.
5208
5209         * typemanager.cs (IndexerPropertyName): Added support for interface
5210         indexers.
5211
5212 2002-07-22  Martin Baulig  <martin@gnome.org>
5213
5214         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
5215         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
5216         ret if HasReturnLabel.
5217         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
5218         variables.
5219
5220         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
5221         and set the ec.LoopBeginTryCatchLevel.
5222         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
5223         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
5224         the current ec.TryCatchLevel, the branch goes out of an exception
5225         block.  In this case, we need to use Leave and not Br.
5226
5227 2002-07-22  Martin Baulig  <martin@gnome.org>
5228
5229         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
5230         block unless the block does not always return or it is contained in
5231         another try { ... } catch { ... } block.  Fixes bug #26506.
5232         Added verify-1.cs to the test suite.
5233
5234 2002-07-22  Martin Baulig  <martin@gnome.org>
5235
5236         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
5237         then we do not always return.  Fixes bug #24985.
5238
5239 2002-07-22  Martin Baulig  <martin@gnome.org>
5240
5241         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
5242         lookup on a per-class level; ie. walk up the class hierarchy until we
5243         found at least one applicable method, then choose the best among them.
5244         Fixes bug #24463 and test-29.cs.
5245
5246 2002-07-22  Martin Baulig  <martin@gnome.org>
5247
5248         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
5249         return types of the methods.  The return type is not part of the
5250         signature and we must not check it to make the `new' modifier work.
5251         Fixes bug #27999, also added test-147.cs.
5252         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
5253
5254         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
5255         on the method's return type.
5256
5257 2002-07-21  Martin Baulig  <martin@gnome.org>
5258
5259         * assign.cs: Make this work if the rightmost source is a constant and
5260         we need to do an implicit type conversion.  Also adding a few more tests
5261         to test-38.cs which should have caught this.
5262
5263         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
5264         target in the makefile for this.  The makefile.gnu is primarily intended
5265         for end-users who don't want to debug the compiler.
5266
5267 2002-07-21  Martin Baulig  <martin@gnome.org>
5268
5269         * assign.cs: Improved the Assign class so it can now handle embedded
5270         assignments (X = Y = Z = something).  As a side-effect this'll now also
5271         consume less local variables.  test-38.cs now passes with MCS, added
5272         a few new test cases to that test.
5273
5274 2002-07-20  Martin Baulig  <martin@gnome.org>
5275
5276         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
5277         instructions.  Fixes bug #27977, also added test-146.cs.
5278
5279 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5280
5281         * cs-tokenizer.cs: fixed getHex ().
5282
5283 2002-07-19  Martin Baulig  <martin@gnome.org>
5284
5285         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
5286         not Type.GetType() to lookup the array type.  This is needed when
5287         we're constructing an array of a user-defined type.
5288         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
5289         single-dimensional arrays, but also for single-dimensial arrays of
5290         type decimal.
5291
5292 2002-07-19  Martin Baulig  <martin@gnome.org>
5293
5294         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
5295         this function is called, it's not allowed to share LocalBuilders
5296         among ILGenerators.
5297
5298 2002-07-19  Martin Baulig  <martin@gnome.org>
5299
5300         * expression.cs (Argument.Resolve): Report an error 118 when trying
5301         to pass a type as argument.
5302
5303 2002-07-18  Martin Baulig  <martin@gnome.org>
5304
5305         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
5306         Conv_R_Un for the signed `long' type.
5307
5308 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
5309
5310         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
5311         `expr' for the temporary result, as that will fail if we do
5312         multiple resolves on the same expression.
5313
5314 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
5315
5316         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
5317         ec.TypeContainer for looking up aliases. 
5318
5319         * class.cs (TypeContainer): Remove LookupAlias from here.
5320
5321         * decl.cs (DeclSpace); Move here.
5322
5323 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
5324
5325         * class.cs (FindMembers): Only call filter if the constructor
5326         bulider is not null.
5327
5328         Also handle delegates in `NestedTypes' now.  Now we will perform
5329         type lookups using the standard resolution process.  This also
5330         fixes a bug.
5331
5332         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
5333         This uses Expressions (the limited kind that can be parsed by the
5334         tree) instead of strings.
5335
5336         * expression.cs (ComposedCast.ToString): Implement, used to flag
5337         errors since now we have to render expressions.
5338
5339         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
5340         FormArrayType. 
5341
5342         * ecore.cs (SimpleName.ToString): ditto.
5343
5344         * cs-parser.jay: Instead of using strings to assemble types, use
5345         Expressions to assemble the type (using SimpleName, ComposedCast,
5346         MemberAccess).  This should fix the type lookups in declarations,
5347         because we were using a different code path for this.
5348
5349         * statement.cs (Block.Resolve): Continue processing statements
5350         even when there is an error.
5351
5352 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
5353
5354         * class.cs (Event.Define): Also remove the `remove' method from
5355         the list of pending items.
5356
5357         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
5358         generate more compact code. 
5359
5360 2002-07-17  Martin Baulig  <martin@gnome.org>
5361
5362         * const.cs (Const.LookupConstantValue): Add support for constant
5363         `unchecked' and `checked' expressions.
5364         Also adding test case test-140.cs for this.
5365
5366 2002-07-17  Martin Baulig  <martin@gnome.org>
5367
5368         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
5369         check whether mi.ReturnType implements the IEnumerator interface; the
5370         `==' and the IsAssignableFrom() will fail in this situation.
5371
5372 2002-07-16  Ravi Pratap  <ravi@ximian.com>
5373
5374         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
5375         here too.
5376
5377 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5378
5379         * expression.cs: fixed bug #27811.
5380
5381 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
5382
5383         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
5384         Molaro: when we are a ref, the value already contains a pointer
5385         value, do not take the address of it.
5386
5387 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5388         * removed mb-parser.jay and mb-tokenizer.cs
5389
5390 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5391
5392         * expression.cs: check against the building corlib void type.
5393
5394 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
5395
5396         * ecore.cs: fix for valuetype static readonly fields: when 
5397         initializing them, we need their address, not the address of a copy.
5398
5399 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
5400
5401         * typemanager.cs: register also enum_type in corlib.
5402
5403 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5404
5405         * class.cs: allow calling this (but not base) initializers in structs.
5406
5407 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
5408
5409         * ecore.cs: make sure we compare against the building base types
5410         in GetTypeSize ().
5411
5412 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
5413
5414         * typemanager.cs: fix TypeToCoreType() to handle void and object
5415         (corlib gets no more typerefs after this change).
5416
5417 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
5418
5419         * expression.cs (ArrayCreation.EmitArrayArguments): use
5420         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
5421
5422         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
5423         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
5424         array indexes, the runtime actually forbids them.
5425
5426         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
5427         for array arguments here.
5428
5429         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
5430         instead of the default for ValueTypes.
5431
5432         (New.DoEmit): Use IsValueType instead of
5433         IsSubclassOf (value_type)
5434         (New.DoResolve): ditto.
5435         (Invocation.EmitCall): ditto.
5436
5437         * assign.cs (Assign): ditto.
5438
5439         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
5440         Statements *are* currently doing part of their resolution during
5441         Emit.  
5442
5443         Expressions do always resolve during resolve, but statements are
5444         only required to propagate resolution to their children.
5445
5446 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
5447
5448         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
5449
5450         (LoadAssembly): Do not add the dll if it is already specified
5451         
5452         (MainDriver): Add the System directory to the link path at the end,
5453         after all the other -L arguments. 
5454
5455         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
5456         wrong opcode for loading bytes and bools (ldelem.i1 instead of
5457         ldelem.u1) and using the opposite for sbytes.
5458
5459         This fixes Digger, and we can finally run it.
5460
5461         * driver.cs (UnixParseOption): Move the option parsing here.  
5462         (CSCParseOption): Implement CSC-like parsing of options.
5463
5464         We now support both modes of operation, the old Unix way, and the
5465         new CSC-like way.  This should help those who wanted to make cross
5466         platform makefiles.
5467
5468         The only thing broken is that /r:, /reference: and /lib: are not
5469         implemented, because I want to make those have the same semantics
5470         as the CSC compiler has, and kill once and for all the confussion
5471         around this.   Will be doing this tomorrow.
5472
5473         * statement.cs (Unsafe.Resolve): The state is checked during
5474         resolve, not emit, so we have to set the flags for IsUnsfe here.
5475
5476 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
5477
5478         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
5479         not catch the Error_ObjectRefRequired in SimpleName (as it is
5480         possible to have a class/instance variable name that later gets
5481         deambiguated), we have to check this here.      
5482
5483 2002-07-10  Ravi Pratap  <ravi@ximian.com>
5484
5485         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
5486         make static and put into Expression.
5487
5488         (Event.Define): Register the private field of the event with the 
5489         TypeManager so that GetFieldFromEvent can get at it.
5490
5491         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
5492         keep track of the private field associated with an event which
5493         has no accessors.
5494
5495         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
5496         private field.
5497
5498         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
5499         
5500 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
5501
5502         * expression.cs (Binary.EmitBranchable): this routine emits the
5503         Binary expression in a branchable context.  This basically means:
5504         we need to branch somewhere, not just get the value on the stack.
5505
5506         This works together with Statement.EmitBoolExpression.
5507
5508         * statement.cs (Statement.EmitBoolExpression): Use
5509         EmitBranchable. 
5510
5511 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
5512
5513         * statement.cs (For): Reduce the number of jumps in loops.
5514
5515         (For): Implement loop inversion for the For statement.
5516
5517         (Break): We can be breaking out of a Try/Catch controlled section
5518         (foreach might have an implicit try/catch clause), so we need to
5519         use Leave instead of Br.
5520
5521         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
5522         now).  If the instace expression supports IMemoryLocation, we use
5523         the AddressOf method from the IMemoryLocation to extract the
5524         address instead of emitting the instance.
5525
5526         This showed up with `This', as we were emitting the instance
5527         always (Emit) instead of the Address of This.  Particularly
5528         interesting when This is a value type, as we dont want the Emit
5529         effect (which was to load the object).
5530         
5531 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
5532
5533         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5534
5535         * statement.cs (Checked): Set the CheckedState during the resolve
5536         process too, as the ConvCast operations track the checked state on
5537         the resolve process, and not emit.
5538
5539         * cs-parser.jay (namespace_member_declaration): Flag that we have
5540         found a declaration when we do.  This is used to flag error 1529
5541
5542         * driver.cs: Report ok when we display the help only.
5543
5544 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
5545
5546         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5547
5548 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
5549
5550         * cs-tokenizer.cs (define): We also have to track locally the
5551         defines.  AllDefines is just used for the Conditional Attribute,
5552         but we also need the local defines for the current source code. 
5553
5554 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
5555
5556         * statement.cs (While, For, Do): These loops can exit through a
5557         Break statement, use this information to tell whether the
5558         statement is the last piece of code.
5559
5560         (Break): Flag that we break.
5561
5562         * codegen.cs (EmitContexts): New `Breaks' state variable.
5563
5564 2002-07-03  Martin Baulig  <martin@gnome.org>
5565
5566         * class.cs (TypeContainer.MethodModifiersValid): Allow override
5567         modifiers in method declarations in structs.  Otherwise, you won't
5568         be able to override things like Object.Equals().
5569
5570 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5571
5572         * class.cs (Method, Property, Indexer): Do not allow the public
5573         modifier to be used in explicit interface implementations.
5574
5575         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5576         override modifiers in method declarations in structs
5577
5578 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
5579
5580         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5581         integer or real overflow, report an error
5582
5583 2002-07-02  Martin Baulig  <martin@gnome.org>
5584
5585         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5586         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5587         to tell the runtime about our newly created System.Object and
5588         System.ValueType types.
5589
5590 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5591
5592         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5593         struct instead of Ldarg/Starg.
5594
5595 2002-07-02  Martin Baulig  <martin@gnome.org>
5596
5597         * expression.cs (Indirection.Indirection): Call
5598         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5599
5600 2002-07-02  Martin Baulig  <martin@gnome.org>
5601
5602         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5603         ValueType, call TypeManager.TypeToCoreType() on it.
5604         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5605         the OpCodes.Newarr argument.
5606
5607 2002-07-02  Martin Baulig  <martin@gnome.org>
5608
5609         * expression.cs (Invocation.EmitCall): When compiling corlib,
5610         replace all calls to the system's System.Array type to calls to
5611         the newly created one.
5612
5613         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5614         System.Array methods.
5615         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5616         from the system's System.Array type which must be replaced.
5617
5618 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5619
5620         * typemanager.cs: load unverifiable_code_ctor so we can build
5621         corlib using the correct type. Avoid using GetTypeCode() with
5622         TypeBuilders.
5623         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5624         TypeManager.object_type to allow building corlib.
5625
5626 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5627
5628         * ecore.cs: handle System.Enum separately in LoadFromPtr().
5629
5630 2002-07-01  Martin Baulig  <martin@gnome.org>
5631
5632         * class.cs: Make the last change actually work, we need to check
5633         whether `ifaces != null' to avoid a crash.
5634
5635 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5636
5637         * class.cs: when we build structs without fields that implement
5638         interfaces, we need to add the interfaces separately, since there is
5639         no API to both set the size and add the interfaces at type creation
5640         time.
5641
5642 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5643
5644         * expression.cs: the dimension arguments to the array constructors
5645         need to be converted if they are a long.
5646
5647 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5648
5649         * class.cs: don't emit ldarg.0 if there is no parent constructor
5650         (fixes showstopper for corlib).
5651
5652 2002-06-29  Martin Baulig  <martin@gnome.org>
5653
5654         MCS now compiles corlib on GNU/Linux :-)
5655
5656         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5657         ie. check for MethodImplOptions.InternalCall.
5658
5659         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5660         and TypeManager.attribute_type are null, so we must explicitly check
5661         whether parent is not null to find out whether it's an attribute type.
5662         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5663         and SetBuilder, not only if the property is neither abstract nor external.
5664         This is necessary to set the MethodImplOptions on the accessor methods.
5665         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5666         SetBuilder, see Property.Emit().
5667
5668         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5669         populate "System.Object", "System.ValueType" and "System.Attribute" since
5670         they've already been populated from BootCorlib_PopulateCoreTypes().
5671
5672 2002-06-29  Martin Baulig  <martin@gnome.org>
5673
5674         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5675         is the NullLiteral, we also need to make sure that target_type is not
5676         an enum type.   
5677
5678 2002-06-29  Martin Baulig  <martin@gnome.org>
5679
5680         * rootcontext.cs (RootContext.ResolveCore): We must initialize
5681         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5682         before calling BootstrapCorlib_ResolveDelegate ().
5683
5684 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5685
5686         * statement.cs: fixed build-breaker. All tests passed ok.
5687
5688 2002-06-27  Martin Baulig  <martin@gnome.org>
5689
5690         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5691         for System.Decimal when compiling corlib.
5692
5693 2002-06-27  Martin Baulig  <martin@gnome.org>
5694
5695         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5696         switch blocks which contain nothing but a default clause.
5697
5698 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
5699
5700        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5701
5702 2002-06-27  Martin Baulig  <martin@gnome.org>
5703
5704         * ecore.cs (PropertyExpr.PropertyExpr): Call
5705         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5706
5707         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5708         is already a TypeBuilder.
5709
5710 2002-06-27  Martin Baulig  <martin@gnome.org>
5711
5712         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5713         `target_type == TypeManager.array_type', not IsAssignableFrom() in
5714         the "from an array-type to System.Array" case.  This makes it work
5715         when compiling corlib.
5716
5717 2002-06-27  Martin Baulig  <martin@gnome.org>
5718
5719         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5720         non-static PropertyExpr, set its InstanceExpression.  This makes
5721         the `ICollection.Count' property work in System/Array.cs.
5722
5723 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
5724
5725         * driver.cs: Made error handling more consistent.  Errors now
5726         tracked by Report class, so many methods which used to return int
5727         now return void.  Main() now prints success/failure and 
5728         errors/warnings message.
5729
5730         Renamed '--probe' compiler argument to '--expect-error'.  Removed
5731         the magic number return values (123 and 124).  Now, if the
5732         expected error occurs, the compiler exits with success (exit value
5733         0).  If the compilation completes without seeing that particular
5734         error, the compiler exits with failure (exit value 1).  The
5735         makefile in mcs/errors has been changed to handle the new behaviour.
5736
5737         * report.cs: Made 'expected error' number a property and renamed
5738         it from 'Probe' to 'ExpectedError'.
5739
5740         * genericparser.cs: Removed error handling support, since it is
5741         now all done by Report class.
5742
5743         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5744         class, so parse() no longer returns an int.
5745
5746         * namespace.cs: Use Report.Error instead of GenericParser.error
5747
5748 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
5749
5750         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5751         TypeContainer.AddOperator): At the front of the list put the
5752         explicit implementations, so they get resolved/defined first. 
5753
5754 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
5755
5756         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5757         interface type is implemented by this TypeContainer.  Used during
5758         explicit interface implementation.
5759
5760         (Property.Define, Indexer.Define, Method.Define): Validate that
5761         the given interface in the explicit implementation is one of the
5762         base classes for the containing type.
5763
5764         Also if we are explicitly implementing an interface, but there is
5765         no match in the pending implementation table, report an error.
5766
5767         (Property.Define): Only define the property if we are
5768         not explicitly implementing a property from an interface.  Use the
5769         correct name also for those properties (the same CSC uses,
5770         although that is really not needed).
5771         
5772         (Property.Emit): Do not emit attributes for explicitly implemented
5773         properties, as there is no TypeBuilder.
5774
5775         (Indexer.Emit): ditto.
5776
5777         Hiding then means that we do not really *implement* a pending
5778         implementation, which makes code fail.
5779
5780 2002-06-22  Martin Baulig  <martin@gnome.org>
5781
5782         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5783         the return value of Object.GetType().  [FIXME: we need to do this whenever
5784         we get a type back from the reflection library].
5785
5786 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5787
5788         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5789
5790 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
5791
5792         * attribute.cs: Return null if we can not look up the type.
5793
5794         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5795         the interface types found.
5796
5797         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5798         interface types found.
5799
5800         * typemanager.cs (GetInterfaces): Make this routine returns alll
5801         the interfaces and work around the lame differences between
5802         System.Type and System.Reflection.Emit.TypeBuilder in the results
5803         result for GetInterfaces.
5804         
5805         (ExpandInterfaces): Given an array of interface types, expand and
5806         eliminate repeated ocurrences of an interface.  This expands in
5807         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5808         be IA, IB, IC.
5809         
5810 2002-06-21  Martin Baulig  <martin@gnome.org>
5811
5812         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5813         on System.Enum.
5814
5815 2002-06-21  Martin Baulig  <martin@gnome.org>
5816
5817         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
5818         and called with one of the core types, return the corresponding typebuilder for
5819         that type.
5820
5821         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5822         element type.
5823
5824 2002-06-21  Martin Baulig  <martin@gnome.org>
5825
5826         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5827         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5828         (Expression.ConvertReferenceExplicit): Likewise.
5829
5830         * expression.cs (ElementAccess.DoResolve): Likewise.
5831         (ElementAccess.DoResolveLValue): Likewise.
5832
5833 2002-06-10  Martin Baulig  <martin@gnome.org>
5834
5835         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5836         add the "value" parameter to the parameter list.
5837
5838         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5839         to our caller.
5840
5841 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
5842
5843         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5844         the argument to an int, uint, long or ulong, per the spec.  Also
5845         catch negative constants in array creation.
5846
5847 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5848
5849         * class.cs: do not allow the same interface to appear twice in
5850         the definition list.
5851
5852 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5853
5854         * ecore.cs: don't use ldlen with System.Array.
5855
5856 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5857
5858         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5859
5860 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5861
5862         * modifiers.cs: produce correct field attributes for protected
5863         internal. Easy fix so miguel can work on ther harder stuff:-)
5864
5865 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
5866
5867         * pending.cs: New file.  Move the code from class.cs here.
5868         Support clearning the pending flag for all methods (when not doing
5869         explicit interface implementation).
5870
5871 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5872
5873         * rootcontext.cs: added a couple more types needed to bootstrap.
5874
5875 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
5876
5877         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5878         constructor in the type, instead of any constructor in the type
5879         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
5880         a bug in the Mono runtime when applying the params attribute). 
5881
5882 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
5883         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5884
5885 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
5886
5887         * expression.cs (Unary.ResolveOperator): Use TypeManager
5888         to resolve the type.
5889         
5890 2002-06-13  Ravi Pratap  <ravi@ximian.com>
5891
5892         * cs-parser.jay (enum_member_declaration): Pass in the attributes
5893         attached.
5894
5895         * enum.cs (AddEnumMember): Add support to store the attributes associated 
5896         with each member too.
5897
5898         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5899         field builders too - this takes care of the enum member case.
5900
5901 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
5902
5903         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5904         address-of operator on both value types and pointers.
5905         
5906 2002-06-10  Martin Baulig  <martin@gnome.org>
5907
5908         * interface.cs (Interface.PopulateIndexer): Add the indexer's
5909         PropertyBuilder to the `property_builders' list.
5910
5911         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5912         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5913         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
5914         find any indexers which are inherited from an interface.
5915
5916 2002-06-09  Martin Baulig  <martin@gnome.org>
5917
5918         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5919         the same type as the constant if necessary.  There's also a test-130.cs
5920         for this.
5921
5922         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5923
5924         * typemanager.cs (TypeManager.ChangeType): Previously known as
5925         Enum.ChangeEnumType().
5926
5927 2002-06-09  Martin Baulig  <martin@gnome.org>
5928
5929         * expression.cs (Cast.TryReduce): Added support for consts.
5930
5931 2002-06-08  Ravi Pratap  <ravi@ximian.com>
5932
5933         * class.cs (Accessor): Hold attributes information so we can pass
5934         it along.
5935
5936         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5937         Modify to pass in attributes attached to the methods.
5938
5939         (add_accessor_declaration, remove_accessor_declaration): Ditto.
5940
5941         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5942         to handle the Accessor kind :-)
5943
5944         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5945         
5946 2002-06-08  Martin Baulig  <martin@gnome.org>
5947
5948         * expression.cs (Unary.TryReduceNegative): Added support for
5949         ULongConstants.
5950
5951 2002-06-08  Martin Baulig  <martin@gnome.org>
5952
5953         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5954         name can't be found in the `defined_names' - the caller will do a
5955         MemberLookup in this case and thus find methods in System.Enum
5956         such as Enum.IsDefined().
5957
5958 2002-06-08  Martin Baulig  <martin@gnome.org>
5959
5960         * enum.cs (Enum.ChangeEnumType): This is a custom version of
5961         Convert.ChangeType() which works with TypeBuilder created types.
5962         (Enum.LookupEnumValue, Enum.Define): Use it here.
5963
5964         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5965         `TypeBuilder.BaseType != null' check.
5966         (TypeContainer.FindMembers): Only lookup parent members if we
5967         actually have a parent.
5968         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5969         (ConstructorInitializer.Resolve): Likewise.
5970
5971         * interface.cs (Interface.FindMembers): Added
5972         `TypeBuilder.BaseType != null' check.
5973
5974         * rootcontext.cs (RootContext.ResolveCore): Added
5975         "System.Runtime.CompilerServices.IndexerNameAttribute" to
5976         classes_second_stage.
5977
5978         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5979         debug_type and trace_type when compiling with --nostdlib.       
5980
5981 2002-06-07  Martin Baulig  <martin@gnome.org>
5982
5983         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5984         (AddField): Set it to true when adding a non-static field.
5985         (DefineType): Use `have_nonstatic_fields' to find out whether we
5986         have non-static fields, not `Fields != null'.
5987
5988 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
5989
5990         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5991         dereferencing a null on the static-field code path)
5992
5993 2002-05-30  Martin Baulig  <martin@gnome.org>
5994
5995         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5996         to take command line arguments.  Use reflection to call the new
5997         custom `Initialize' function on the symbol writer and pass it the
5998         command line arguments.
5999
6000         * driver.cs (--debug-args): New command line argument to pass command
6001         line arguments to the symbol writer.
6002
6003 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
6004
6005         * assign.cs (DoResolve): Forgot to do the implicit conversion to
6006         the target type for indexers and properties.  Thanks to Joe for
6007         catching this.
6008
6009 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
6010
6011         * typemanager.cs (MethodFlags): returns the method flags
6012         (Obsolete/ShouldIgnore) that control warning emission and whether
6013         the invocation should be made, or ignored. 
6014
6015         * expression.cs (Invocation.Emit): Remove previous hack, we should
6016         not do this on matching a base type, we should do this based on an attribute
6017
6018         Only emit calls to System.Diagnostics.Debug and
6019         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
6020         on the command line.
6021
6022         * rootcontext.cs: Global settings for tracing and debugging.
6023
6024         * cs-tokenizer.cs (define): New utility function to track
6025         defines.   Set the global settings for TRACE and DEBUG if found.
6026
6027 2002-05-25  Ravi Pratap  <ravi@ximian.com>
6028
6029         * interface.cs (Populate*): Pass in the TypeContainer as well as
6030         the DeclSpace as parameters so that we can create EmitContexts and
6031         then use that to apply attributes etc.
6032
6033         (PopulateMethod, PopulateEvent, PopulateProperty)
6034         (PopulateIndexer): Apply attributes everywhere.
6035
6036         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
6037         etc.
6038
6039         (ApplyAttributes): Update accordingly.
6040
6041         We now apply interface attributes for all members too.
6042
6043 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
6044
6045         * class.cs (Indexer.Define); Correctly check if we are explicit
6046         implementation (instead of checking the Name for a ".", we
6047         directly look up if the InterfaceType was specified).
6048
6049         Delay the creation of the PropertyBuilder.
6050
6051         Only create the PropertyBuilder if we are not an explicit
6052         interface implementation.   This means that explicit interface
6053         implementation members do not participate in regular function
6054         lookups, and hence fixes another major ambiguity problem in
6055         overload resolution (that was the visible effect).
6056
6057         (DefineMethod): Return whether we are doing an interface
6058         implementation. 
6059         
6060         * typemanager.cs: Temporary hack until we get attributes in
6061         interfaces (Ravi is working on that) and we get IndexerName
6062         support in interfaces.
6063
6064         * interface.cs: Register the indexers as properties.
6065
6066         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
6067         warning, I have verified that this is a bug in the .NET runtime
6068         (JavaScript suffers of the same problem).
6069
6070         * typemanager.cs (MemberLookup): When looking up members for
6071         interfaces, the parent of an interface is the implicit
6072         System.Object (so we succeed in searches of Object methods in an
6073         interface method invocation.  Example:  IEnumerable x;  x.ToString
6074         ()) 
6075
6076 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
6077
6078         * class.cs (Event): Events should also register if they do
6079         implement the methods that an interface requires.
6080
6081         * typemanager.cs (MemberLookup); use the new GetInterfaces
6082         method. 
6083
6084         (GetInterfaces): The code used to lookup interfaces for a type is
6085         used in more than one place, factor it here. 
6086
6087         * driver.cs: Track the errors at the bottom of the file, we kept
6088         on going.
6089
6090         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
6091         instance if the method we are calling is static!
6092
6093 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
6094
6095         * attribute.cs (ApplyAttributes): Make this function filter out
6096         the IndexerName attribute (as that attribute in reality is never
6097         applied) and return the string constant for the IndexerName
6098         attribute. 
6099
6100         * class.cs (TypeContainer.Emit): Validate that all the indexers
6101         have the same IndexerName attribute, and if so, set the
6102         DefaultName attribute on the class. 
6103
6104         * typemanager.cs: The return value might contain other stuff (not
6105         only methods).  For instance, consider a method with an "Item"
6106         property and an Item method.
6107
6108         * class.cs: If there is a problem with the parameter types,
6109         return. 
6110
6111 2002-05-24  Ravi Pratap  <ravi@ximian.com>
6112
6113         * ecore.cs (ImplicitConversionExists): Wrapper function which also
6114         looks at user defined conversion after making a call to 
6115         StandardConversionExists - we need this for overload resolution.
6116
6117         * expression.cs : Update accordingly the various method calls.
6118
6119         This fixes 2 bugs filed against implicit user defined conversions 
6120
6121 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
6122
6123         * statement.cs: Track the result of the assignment.
6124
6125 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
6126
6127         * expression.cs (MemberAccess): Improved error reporting for
6128         inaccessible members.
6129
6130 2002-05-22  Martin Baulig  <martin@gnome.org>
6131
6132         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
6133         itself with debugging support.
6134
6135 2002-05-22  Martin Baulig  <martin@gnome.org>
6136
6137         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
6138         Removed, this isn't needed anymore.
6139
6140 2002-05-20  Martin Baulig  <martin@gnome.org>
6141
6142         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
6143         be underlying type for an enum.
6144
6145 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
6146
6147         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
6148         that splits out the loading of just the core types.
6149
6150         * rootcontext.cs (ResolveCore): Split the struct resolution in
6151         two, so we can load the enumeration underlying types before any
6152         enums are used.
6153
6154         * expression.cs (Is): Bandaid until we fix properly Switch (see
6155         bug #24985 for details).
6156
6157         * typemanager.cs (ImplementsInterface): The hashtable will contain
6158         a null if there are no interfaces implemented.
6159
6160 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
6161
6162         * cs-parser.jay (indexer_declarator): It is fine to have array
6163         parameters
6164
6165 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
6166
6167         * typemanager.cs: (RegisterBuilder): New function used to register
6168         TypeBuilders that implement interfaces.  Since
6169         TypeBuilder.GetInterfaces (as usual) does not work with lame
6170         Reflection.Emit. 
6171         (AddUserType): register interfaces.
6172
6173         (ImplementsInterface): Use the builder_to_ifaces hash if we are
6174         dealing with TypeBuilder.  Also, arrays are showing up as
6175         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
6176         methods can not be invoked on them!
6177
6178         * ecore.cs (ExplicitReferenceConversionExists): Made public.
6179         (ImplicitReferenceConversionExists): Split out from
6180         StandardConversionExists. 
6181
6182         * expression.cs (As): We were only implementing one of the three
6183         cases for the as operator.  We now implement them all.
6184         (Is): Implement the various other cases for Is as well.
6185
6186         * typemanager.cs (CACHE): New define used to control if we want or
6187         not the FindMembers cache.  Seems to have a negative impact on
6188         performance currently
6189
6190         (MemberLookup): Nested types have full acess to
6191         enclosing type members
6192
6193         Remove code that coped with instance/static returns for events, we
6194         now catch this in RealFindMembers.
6195
6196         (RealFindMembers): only perform static lookup if the instance
6197         lookup did not return a type or an event.  
6198
6199 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
6200
6201         * assign.cs (CompoundAssign): We pass more semantic information
6202         now to Compound Assignments than we did before: now we have all
6203         the information at hand, and now we resolve the target *before* we
6204         do the expression expansion, which allows the "CacheValue" method
6205         to have the effect we intended (before, a [x] += 1 would generate
6206         two differen ArrayAccess expressions from the ElementAccess,
6207         during the resolution process).
6208
6209         (CompoundAssign.DoResolve): Resolve target and original_source here.
6210
6211 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
6212
6213         * expression.cs (ArrayAccess): dropped debugging information. 
6214
6215         * typemanager.cs: Small bug fix: I was always returning i_members,
6216         instead of one of i_members or s_members (depending on which had
6217         the content).
6218
6219         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
6220         method is invoked before any code generation takes place, and it
6221         is a mechanism to inform that the expression will be invoked more
6222         than once, and that the method should use temporary values to
6223         avoid having side effects
6224
6225         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
6226         
6227         * ecore.cs (Expression.CacheTemporaries): Provide empty default
6228         implementation.
6229
6230         * expression.cs (Indirection, ArrayAccess): Add support for
6231         CacheTemporaries in these two bad boys. 
6232
6233         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
6234         ldobj or ldind_ref.  
6235         (StoreFromPtr): Handle stobj as well.
6236
6237         * expression.cs (UnaryMutator): Share more code.
6238         
6239         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
6240         down: I was not tracking the Filter function as well, which
6241         was affecting the results of the cache.
6242
6243 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
6244
6245         * attribute.cs: Remove the hack to handle the CharSet property on
6246         StructLayouts. 
6247
6248 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
6249
6250         * attribute.cs (DoResolve): More uglyness, we now only try to
6251         resolve the attribute partially, to extract the CharSet
6252         information (only if we are a StructLayout attribute).  Otherwise 
6253
6254         (GetExtraTypeInfo): Add some code to conditionally kill in the
6255         future this.   I am more and more convinced that the .NET
6256         framework has special code to handle the attribute setting on
6257         certain elements.
6258
6259         * expression.cs (IsParamsMethodApplicable): Revert my previous
6260         foreach change here, it was wrong.
6261
6262 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
6263
6264         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
6265         (pp_expr): do not abort on unknown input, just return.
6266         (eval): abort if there are pending chars.
6267
6268         * attribute.cs (Attribute.Resolve): Positional parameters are
6269         optional.  Deal with that case.
6270
6271         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
6272         the Ansi/Unicode/Auto information for the type.
6273
6274         (TypeContainer.DefineType): instantiate the EmitContext here, as
6275         we will be using it during the type definition (to resolve
6276         attributes) and during the emit phase.
6277
6278         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
6279         to pull type information out of the attributes
6280
6281         (Attribute.Resolve): track the constructor builder, and allow for
6282         multiple invocations (structs and classes will use this).
6283
6284         * ecore.cs (MemberLookupFinal): new version with all the
6285         parameters customizable.
6286
6287         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
6288         constructors.  Return if the result value is null (as the error
6289         would have been flagged already by MemberLookupFinal)
6290
6291         Do not allow instances of abstract classes or interfaces to be
6292         created.
6293         
6294         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
6295         We have to compare the assembly property here when dealing with
6296         FamANDAssem and Assembly access modifiers, because we might be
6297         creating an assembly from *modules* (that means that we are not
6298         getting TypeBuilders for types defined in other modules that are
6299         part of this assembly).
6300
6301         (Method.Emit): If the method is marked abstract and has a body,
6302         emit an error. 
6303
6304         (TypeContainer.DefineMembers): If both the defined member and the
6305         parent name match are methods, then do not emit any warnings: let
6306         the Method.Define routine take care of flagging warnings.  But if
6307         there is a mismatch (method overrides something else, or method is
6308         overriwritten by something, then emit warning).
6309
6310         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
6311         set to null, this means `do not check for the return type on the
6312         signature'. 
6313
6314         (Method.Define): set the return type for the method signature to
6315         null, so that we get methods with the same name and parameters and
6316         different return types.  This is used to flag warning 114 (you are
6317         hiding a method, and you probably want to use the new/override
6318         keywords instead).
6319
6320         * typemanager.cs (MemberLookup): Implemented proper access
6321         control, closing a long standing set of bug reports.  The problem
6322         was that the Framework only has two bits: Public and NonPublic,
6323         and NonPublic includes private and protected methods, but we need
6324         to enforce the FamANDAssem, FamOrAssem and Family. 
6325
6326 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
6327
6328         * statement.cs (GotoCase): Return true: Ammounts to giving up
6329         knowledge on whether we return or not, and letting the other case
6330         be responsible for it.
6331
6332 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
6333
6334         * driver.cs: Do not load directories for each file processed, only
6335         do it if there is a pattern.
6336
6337         * ecore.cs: Report readonly assigns here as well, as we might have
6338         been resolved only by MemberAccess.
6339
6340         (SimpleName.SimpleNameResolve): Also be useful for LValue
6341         resolution.   We need this to propagate assign to local readonly variables
6342
6343         * typemanager.cs: Use a ptrhashtable for the criteria, because we
6344         do not want to reuse potential criteria memory.
6345
6346         * class.cs (MyEventBuilder): Set reflected_type;
6347
6348         * ecore.cs (Constantify): Added support for constifying bools.
6349
6350         (RootContext.LookupType): Added a cache for values looked up in
6351         the declaration space.
6352
6353         * typemanager.cs (FindMembers): Now is a front-end to
6354         RealFindMembers, and provides a two-level hashtable-based cache to
6355         the request.  
6356
6357         15% performance improvement: from 22.5 to 19.2 seconds.
6358
6359         * expression.cs (IsParamsMethodApplicable): use foreach.
6360         (Invocation.DoResolve): ditto.
6361         (New.DoResolve): ditto.
6362         (ArrayCreation.DoResolve): ditto.
6363
6364         * ecore.cs (FindMostEncompassingType): use foreach.
6365
6366         * delegate.cs (NewDelegate.DoResolve): Use foreach
6367
6368         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
6369         (RemoveMethods): use foreach.
6370
6371         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
6372         nested foreach statements instead of for, and also break out of
6373         the inner loop once a match is found.
6374         
6375         (Invocation.OverloadResolve): Use foreach, simplify the code. 
6376
6377 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
6378
6379         * cfold.cs (BinaryFold): During an enumeration evaluation context,
6380         we actually unwrap the expression to allow for extra information
6381         to be extracted. 
6382
6383         * expression.cs: Use Shr_Un on unsigned operations. 
6384
6385 2002-05-08  Ravi Pratap  <ravi@ximian.com>
6386
6387         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
6388         applicable operators was not being considered correctly. This closes
6389         the bug Miguel reported.
6390
6391 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
6392
6393         * attribute.cs: check that the type derives from System.Attribute
6394         and report the correct error in that case (moved the duplicate code to
6395         its own method, too).
6396
6397 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
6398
6399         * attribute.cs: lookup attribute type name as the spec says: first the
6400         bare attribute name and then name + "Attribute" (nant compiles with
6401         mcs after this fix).
6402
6403 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
6404
6405         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
6406         Because of the way we parse things, we should try to see if a
6407         UIntConstant can fit in an integer.
6408
6409 2002-05-07  Ravi Pratap  <ravi@ximian.com>
6410
6411         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
6412         when we are in an explicit context.
6413
6414         (ConvertReferenceExplicit): When converting from Iface type S to Class
6415         T make sure the rules are implemented as an OR.
6416
6417         * parameter.cs (ParameterType): Make it a property for now although the
6418         purpose really isn't anything immediate.
6419         
6420         * expression.cs (Is*Applicable): Do better checking on the parameter type
6421         of a ref/out parameter. The ones from the system assemblies are already 
6422         marked with the correct type so we don't need to do any correction.
6423
6424         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
6425         the object type is standard too so include that.
6426
6427 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6428
6429         * ecore.cs (StandardConversionExists): Augment with missing code:
6430         deal with IntConstant, LongConstants and Enumerations.
6431
6432         * assign.cs: Report the error, instead of failing silently
6433
6434         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
6435         typecontainer that they are declared, because the
6436         typecontainer/namespace will have the list of using clauses that
6437         need to be applied.
6438
6439         Assembly Attributes were escaping the normal registration
6440         mechanism. 
6441
6442         (EmitCode): Apply attributes within an EmitContext that represents
6443         the container they were declared on.
6444         
6445         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
6446
6447 2002-05-06  Ravi Pratap  <ravi@ximian.com>
6448
6449         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
6450         Revamp completely - make much cleaner as we now operate only
6451         on a set of Types.
6452
6453         (FindMostSpecificSource, FindMostSpecificTarget): New methods
6454         to implement the logic detailed in the spec more correctly.
6455
6456         (UserDefinedConversion): Update accordingly.
6457
6458 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6459
6460         * statement.cs: Return flow analysis information up.
6461
6462         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
6463         and the default.
6464
6465         (token): Do not consume an extra character before calling
6466         decimal_digits.
6467
6468 2002-05-06  Piers Haken <piersh@friskit.com>
6469
6470         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
6471
6472 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6473
6474         * class.cs (Constructor.Emit): Set the IsStatic flag in the
6475         EmitContext during the instance constructor initializer
6476         resolution, to stop access to instance variables.
6477
6478         This is mandated by the spec, last paragraph of the `constructor
6479         initializers' section. 
6480
6481 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
6482
6483         * cs-parser.jay, class.cs (Accessor): new class used to represent
6484         an accessor (get or set).  In the past we used `null' to represent
6485         a missing accessor.  But this is ambiguous because there was no
6486         way to tell in abstract indexers/properties if one of them was
6487         specified.
6488
6489         Now there is a way of addressing that.
6490
6491         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
6492         instead of FindMembers.
6493
6494         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
6495         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
6496
6497         * attribute.cs: Treat indexers and properties as the same in terms
6498         of applying attributes
6499
6500         * ecore.cs (FindMostEncompassedType): Use statically initialized
6501         EmptyExpressions()s like we do elsewhere to avoid creating useless
6502         objects (and we take this out of the tight loop).
6503
6504         (GetConversionOperators): Move the code to extract the actual
6505         operators to a separate routine to clean things up.
6506
6507 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
6508
6509         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
6510         events are always registered FieldBuilders.
6511         
6512         * class.cs (FieldBase): New class shared by Fields 
6513
6514         * delegate.cs: If we are a toplevel delegate, use our full name.
6515         If we are a nested delegate, then only use our tail name.
6516
6517 2002-05-02  Ravi Pratap  <ravi@ximian.com>
6518
6519         * expression.cs (IsApplicable): Ensure that we add the "&" to
6520         ref/out types before comparing it with the type of the argument.
6521
6522         (IsParamsMethodApplicable): Ditto.
6523
6524         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
6525         silly me ;-)
6526
6527         * delegate.cs : Handle the case when we have more than one applicable
6528         method. Flag an error only when we finish checking all.
6529
6530 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
6531
6532         * expression.cs: Add support for boolean static initializers.
6533
6534 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
6535
6536         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6537
6538         * parameter.cs (ComputeParameterTypes,
6539         ComputeAndDefineParameterTypes): Better error handling: now we
6540         clear the `types' cache if we fail during any of the type lookups.
6541         We also return the status code correctly to our caller
6542
6543         * delegate.cs: If we fail to define a delegate, abort the extra
6544         steps. 
6545
6546         * expression.cs (Binary.ResolveOperator): for
6547         operator==(object,object) and operator !=(object, object) we also
6548         have to verify that there is an implicit conversion from one to
6549         the other.
6550
6551         (ArrayAccess.DoResolve): Array Access can operate on
6552         non-variables. 
6553
6554 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
6555
6556         * assign.cs (CompoundAssign): A new class used as a "flag" that
6557         the assignment actually is happening as part of a compound
6558         assignment operator.
6559
6560         During compound assignment, a few new rules exist to enable things
6561         like:
6562
6563         byte b |= 1 + 2
6564
6565         From the spec:
6566         
6567         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6568         to the type of x) if y is implicitly convertible to the type of x,
6569         and the operator is a builtin operator and the return type of the
6570         operator is explicitly convertible to the type of x. 
6571
6572         * rootcontext.cs: Reset warning level to 2.  4 catches various
6573         "interesting" features in mcs, we must clean this up at some
6574         point, but currently am trying to kill other bugs ;-)
6575
6576         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6577         in container classes as well.  
6578
6579         * expression.cs (Binary.ResolveOperator): Handle string case
6580         before anything else (as operator overloading does emit an error
6581         before doing anything else).
6582
6583         This code could go away when we move to a table driven model, but
6584         i could not come up with a good plan last night.
6585         
6586 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
6587
6588         * typemanager.cs (CSharpName): reimplementation using regex.
6589         * class.cs: added null check for fields in Emit
6590         * rootcontext.cs: set warninglevel to 4
6591
6592 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
6593
6594         * typemanager.cs (CSharpName): reimplemented with Lupus
6595         suggestion.
6596
6597 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
6598
6599         * statement.cs (If): correclty implement Resolve, because we were
6600         not catching sem errors in there.  The same process is needed
6601         everywhere else. 
6602         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6603         
6604
6605         (Statement.Warning_DeadCodeFound): Factorize code.
6606         (While): Report dead code here too.
6607
6608         (Statement): Added Resolve virtual method to allow
6609         for resolution split from the emit code.
6610
6611 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6612
6613         * statement.cs (EmitBoolExpression): No longer try to resolve the
6614         expression here.    
6615         (MakeBoolean): New utility function that resolve, implicitly
6616         converts to boolean and tags the expression. 
6617         
6618
6619         (If, Do): Implement dead code elimination.
6620         (While): Implement loop inversion
6621
6622         (Do, While, For, If): Resolve the expression prior to calling our
6623         code generation.
6624
6625 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
6626
6627         * class.cs:
6628           - added method Report28 (warning: program has more than one entry point)
6629           - added method IsEntryPoint, implements paragraph 10.1 of the spec
6630           - modified method Method.Define, the part at the end of the method
6631
6632         * rootcontext.cs: added static public Location EntryPointLocation;
6633           
6634         * ../errors/cs0028.cs : Add test case for the above warning.              
6635
6636         * typemanager.cs:
6637           - modified method CSharpName to allow arrays of primitive type to
6638             be printed nicely (e.g. instead of System.Int32[][] it now prints
6639             int[][])
6640           - added method CSharpSignature: returns the signature of a method
6641             in string format to be used in reporting errors, warnings, etc.
6642
6643         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6644         with String.Empty.
6645         
6646 2002-04-26  Ravi Pratap  <ravi@ximian.com>
6647
6648         * delegate.cs (Define): Fix extremely silly bug where I was
6649         setting the type of the 'object' parameter of the BeginInvoke
6650         method to System.IAsyncResult instead of System.Object ;-)
6651
6652 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6653
6654         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6655         here. 
6656
6657         (Constructor.Emit): return if we fail to initialize the
6658         constructor.  Another door closed!  
6659
6660         * expression.cs (New.DoResolve): Improve error message (from -6 to
6661         1501).  Use DeclaredOnly lookup to find the exact constructor.
6662
6663         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6664         loop.  This is useful.
6665
6666         * cs-parser.jay: Adjust the default parameters so that destructors
6667         have the proper signature.
6668
6669 2002-04-26  Martin Baulig  <martin@gnome.org>
6670
6671         * driver.cs (LoadAssembly): If `assembly' contains any characters
6672         which are only valid in path names and not in assembly names
6673         (currently slash, backslash and point), use Assembly.LoadFrom ()
6674         instead of Assembly.Load () on the `assembly' (before iteration
6675         over the link_paths).
6676
6677 2002-04-26  Martin Baulig  <martin@gnome.org>
6678
6679         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6680
6681 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
6682
6683         * class.cs (Property): use the new typemanager.MemberLookup
6684
6685         (TypeContainer.MemberLookup): Implement using the
6686         TypeManager.MemberLookup now. 
6687         
6688         * typemanager.cs: Make MemberLookup a function of the TypeManager,
6689         and return MemberInfos, so that these can be used without an
6690         EmitContext (what we had before).
6691
6692 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
6693
6694         * expression.cs: Fix the case where the argument to params if the
6695         type of the params.  I omitted handling this before.   Fixed
6696
6697 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6698
6699         * driver.cs: Call BootCorlib_PopulateCoreType
6700
6701         * class.cs (Property.CheckBase): Check for properties only, not
6702         for all members. 
6703
6704         * interface.cs: Temporary hack: try/catch around the
6705         CustomAttributeBuilder, because I am getting an exception that I
6706         do not understand.
6707
6708         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6709         types whose definitions are required to be there (attributes are
6710         defined before standard types).
6711
6712         Compute definitions as we boot the various types, as they are used
6713         immediately (value_type class will need object_type, but if we do
6714         not initialize object_type, we will pass a null, which will let
6715         the runtime pick the System.Object from the existing corlib, which
6716         is not what we want).
6717
6718 2002-04-22  Patrik Torstensson <totte@labs2.com>
6719
6720         * cs-tokenizer.cs: fixed a number of trim() issues.
6721
6722 2002-04-22  Ravi Pratap  <ravi@ximian.com>
6723
6724         * expression.cs (Argument.Type): Ensure that we return the correct
6725         type when we have out or ref parameters [in which case we 
6726         append a "&"].
6727         
6728 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6729
6730         * class.cs (Property, Indexer): Allow extern modifier in there. 
6731
6732         * typemanager.cs (InitBaseTypes): Initializes object_type and
6733         value_type, since those will be used early on during the bootstrap
6734         process to compile corlib.
6735
6736         (InitCoreTypes): Move code from here to InitBaseTypes.
6737
6738 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
6739
6740         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6741         single-dimension arrays as using the ldlen opcode.  
6742
6743         Daniel Lewis discovered this optimization.  
6744
6745         * typemanager.cs: Add signature for System.Array::get_Length
6746
6747 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6748
6749         * statement.cs: report the error when the foreach does not apply to an
6750         array nor a collection.
6751
6752 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
6753
6754         * expression.cs: Add implicit conversions to the operator ~.
6755
6756         * constant.cs (DecimalConstant.Emit): Emit decimal value.
6757
6758         * typemanager.cs: Locate the decimal constructor.
6759
6760 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6761
6762         * attribute.cs: use the new property of TypeOf.
6763         * expression.cs: added 'get' property around typearg.
6764
6765         These changes fix a build breaker reported by NickD. Is this the
6766         correct way to fix?  If not, please, revert my changes and make it
6767         work :-).
6768
6769 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
6770
6771         * attribute.cs: Add support for typeof in attribute invocations.
6772         I am not sure that this is right though.
6773
6774 2002-04-14  Duncan Mak  <duncan@ximian.com>
6775
6776         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6777         Binary.Operator.Division case.
6778
6779 2002-04-13  Ravi Pratap  <ravi@ximian.com>
6780
6781         * class.cs (DefineType): Ensure that we do a proper check on
6782         attribute types and also register it with the TypeManager.
6783
6784         (TypeContainer.Targets): The default for attribute types is
6785         AttributeTargets.All.
6786         
6787         * attribute.cs (ApplyAttributes): Registering the attribute type
6788         is done elsewhere, not when we discover we have a Usage attribute.
6789
6790 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6791
6792         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6793         and get rid of is_delegate parameter.
6794
6795         * everywhere : update.
6796         
6797 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6798
6799         * cs-parser.jay (compilation_unit): Revamp completely to use
6800         some new ideas that I got from Rhys' grammar to solve the problems
6801         with assembly level attributes.
6802
6803         (outer_declaration): New grammar production.
6804
6805         (attribute_sections): Add.
6806
6807         (opt_attributes): Base on attribute_sections
6808
6809         (namespace_declaration): Allow opt_attributes to tackle the case
6810         when we have assembly level attributes - we are clever in this
6811         regard now ;-)
6812
6813         * attribute.cs (ApplyAttributes): Do not worry about assembly 
6814         attributes in the non-global context.
6815
6816         * rootcontext.cs (AddGlobalAttributes): Go back to using this
6817         instead of SetGlobalAttributes.
6818
6819         * class.cs, rootcontext.cs : Ensure we define and generate 
6820         attribute types before anything else.
6821
6822         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6823         and flag the new error -20 for the case when the attribute type
6824         does not have valid targets specified. csc does not catch this.
6825
6826         * ../errors/errors.txt : update for error # -20
6827
6828 2002-04-11  Ravi Pratap  <ravi@ximian.com>
6829
6830         * support.cs (InternalParameters.ParameterModifier): Do some null
6831         checking and return sane values.
6832
6833         * class.cs (Method.Define): If we are a PInvoke method, ensure
6834         that we are static and extern. Report error # 601
6835
6836         * ../errors/cs0601.cs : Add test case for the above error.
6837
6838 2002-04-07  Ravi Pratap  <ravi@ximian.com>
6839
6840         * rootcontext.cs (attribute_types): We need to keep type of
6841         all attribute types separately and emit code for them first.
6842
6843         (RegisterAttribute) : Implement.
6844
6845         * class.cs (DefineType): Check if the current Type is a custom
6846         attribute type and register it accordingly.
6847
6848         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6849         adding the first attribute twice and rename to
6850
6851         (SetGlobalAttributes): this.
6852
6853         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6854         lookups.
6855
6856         * attribute.cs (ApplyAttributes): Take an additional argument telling us
6857         if we are processing global arguments. Hmm, I am unsure of this.
6858
6859 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6860
6861         * expression.cs: added static array of strings to avoid calling
6862         Enum.ToString () for Operator in Binary. Significant recover of
6863         performance.
6864
6865 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
6866
6867         * class.cs (FindMembers): Allow the Builders of the various
6868         members to be null.  If they are skip them.  This only happens
6869         during the PInvoke declaration.
6870
6871 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
6872
6873         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6874         failure, so we do not keep going afterwards.
6875
6876         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6877         wanted to pass `false' as the `is_delegate' argument.  If this is
6878         the case, why not use delegate_type == null to mean `is_delegate =
6879         false' and anything else as is_delegate = true.
6880
6881 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
6882
6883         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6884         code for the section, not the beginning of the tests.
6885
6886 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
6887
6888         * cfold.cs: Handle operator + (Enum x, Underlying x) 
6889
6890         * expression.cs (Binary): same.  Warn about errors where we have
6891         Enum/Enum in operator + as well.
6892
6893 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
6894
6895         * statement.cs:
6896                 - added support for switch(bool)
6897                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6898                 - add TableSwitchEmit() to handle table-based switch statements
6899
6900 2002-04-05  Ravi Pratap  <ravi@ximian.com>
6901
6902         * expression.cs (Invocation.OverloadResolve): Factor out code which
6903         does parameter compatibility checking with arguments so that we can 
6904         re-use the code even from Delegate.VerifyApplicability
6905
6906         (VerifyArgumentsCompat): Move above code here.
6907
6908         * delegate.cs (VerifyApplicability): Get rid of duplicate code
6909         and instead make a call to the above method.
6910
6911 2002-03-31  Ravi Pratap  <ravi@ximian.com>
6912
6913         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6914         We use it to keep track of classes which are attribute types.
6915
6916 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
6917
6918         * delegate.cs (Delegate.Define): Correctly define the types in the
6919         presence of fixed and array parameters.
6920
6921         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6922         doing FindMembers.
6923
6924         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6925         include NonPublic after the first iteration.
6926
6927         * class.cs (Indexer.CheckBase): Only check if both parents are
6928         non-null. 
6929         
6930         * cs-parser.jay (accessor_body): If empty, set to null.
6931
6932         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6933         same code path here to resolve constants names that we did have in
6934         MemberAccess.DoResolve.  There is too much code duplicated here.
6935
6936 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
6937
6938         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6939
6940         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6941         to MakeUnionSet.
6942
6943         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6944         tokens, numbers and strings.
6945
6946         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6947         parenthesis.
6948
6949         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6950         asyncronous parameters and the regular parameters.  
6951
6952         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6953         specify the target directory.
6954
6955         * expression.cs: (This.DoResolve): Simplify
6956         (As.Emit): Optimize, do not generate IsInst if the expression is
6957         always of the given type.
6958
6959         (Is.DoResolve): Bug fix, we were reporting both always/never for
6960         the is expression.
6961
6962         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6963         creating too many unnecessary arrays.
6964
6965 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
6966
6967         * class.cs (EmitFieldInitializer): Use Assign expression to assign
6968         fields instead of rolling our own initializer.   Takes care of all
6969         implicit conversions, and drops unnecessary static checks/argument.
6970
6971 2002-03-31  Dick Porter  <dick@ximian.com>
6972
6973         * driver.cs: use the GetDirectories() return values properly, and
6974         use "/" as path separator.
6975
6976 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
6977
6978         * expression.cs (Unary): Optimize - - expr into expr.
6979         (Binary): Optimize a + (-b) into a -b.
6980
6981         * codegen.cs (CodeGen): Made all methods static.
6982
6983 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
6984
6985         * rootcontext.cs: 
6986
6987         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6988         TypeBuilder property.
6989
6990         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6991         instead. 
6992
6993         * tree.cs: Removed the various RecordXXXX, and replaced with a
6994         single RecordDecl.  Removed all the accessor methods, and just
6995         left a single access point Type 
6996
6997         * enum.cs: Rename DefineEnum to DefineType.
6998
6999         * decl.cs: New abstract method `DefineType' used to unify the
7000         Defines for Enumerations, Interfaces, TypeContainers and
7001         Delegates.
7002
7003         (FindType): Moved LookupInterfaceOrClass here.  Moved the
7004         LookupBaseClasses method that used to live in class.cs and
7005         interface.cs here, and renamed to FindType.
7006         
7007         * delegate.cs: Implement DefineType.  Take advantage of the
7008         refactored pattern for locating the parent builder without taking
7009         the parent_builder argument (which we know does not work if we are
7010         nested, and triggering a toplevel definition).
7011
7012 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
7013
7014         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
7015         accessibility of a member has changed during override and report
7016         an error if so.
7017
7018         * class.cs (Method.Define, Property.Define): Only complain on
7019         overrides if the method is private, any other accessibility is
7020         fine (and since we just checked the permission is the same, we are
7021         good to go).
7022
7023         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
7024         and elif are processed always.  The other pre-processing
7025         directives are only processed if we are "taking" the path
7026
7027 2002-03-29  Martin Baulig  <martin@gnome.org>
7028
7029         * class.cs (Method.Emit): Only emit symbolic debugging info if the
7030         current location is not Null.
7031
7032         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
7033         a separate method so we can profile it.
7034
7035         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
7036         `span.Seconds' are just seconds, but no minutes or hours.
7037         (MainDriver): Profile the CodeGen.SaveSymbols calls.
7038
7039 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
7040
7041         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
7042         Remove the gratuitous set of Final:
7043
7044                                 // If an interface implementation, then we can set Final.
7045                                 if (((flags & MethodAttributes.Abstract) == 0) &&
7046                                     implementing.DeclaringType.IsInterface)
7047                                         flags |= MethodAttributes.Final;
7048
7049         I do not know what I was smoking when I used that.
7050         
7051
7052         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
7053         step into fixing the name resolution issues for delegates and
7054         unifying the toplevel name resolution.
7055
7056 2002-03-28  Martin Baulig  <martin@gnome.org>
7057
7058         * class.cs (Method.Emit): If we have a symbol writer, call its
7059         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
7060         tell it about the current method.
7061
7062         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
7063         writer that we're going to emit the first byte of IL code for a new
7064         statement (a new source line).
7065         (EmitContext.EmitTopBlock): If we have a symbol writer, call
7066         EmitContext.Mark() before emitting any code.
7067
7068         * location.cs (SymbolDocument): Return null when we're Null.
7069
7070         * statement.cs (Statement): Moved the `Location loc' variable here.
7071         (Statement.EmitBoolExpression): If we have a symbol writer, call
7072         ec.Mark() before emitting any code to tell it that we're at the
7073         beginning of a new statement.
7074         (StatementExpression): Added `Location' argument to the constructor.
7075         (Block): Added public readonly variable `StartLocation' and public
7076         variable `EndLocation'.  The latter is to be set using SetEndLocation().
7077         (Block): Added constructor which takes a start and end location.
7078         (Block.SetEndLocation): New method. This sets the end location.
7079         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
7080         local variables we create.
7081         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
7082         each statement and do also mark the begin and end of the block.
7083
7084         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
7085         tell it the current lexer.Location, use Location.Null for the end of the
7086         block.
7087         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
7088         current block, set its end location using SetEndLocation().
7089         (statement_expression): StatementExpression constructor now takes the
7090         lexer.Location as additional argument.
7091         (for_statement, declare_local_variables): Likewise.
7092         (declare_local_variables): When creating a new implicit block, use the
7093         new Block constructor and pass it the lexer.Location.
7094
7095 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
7096
7097         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
7098         members also on the parent interfaces recursively.
7099
7100 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
7101
7102         * report.cs: Use new formats, since Gonzalo finished the missing
7103         bits. 
7104
7105         * expression.cs (Binary.ResolveOperator): added missing operator|
7106         operator& and operator^ for bool/bool.
7107
7108         * cs-parser.jay: CheckDef now takes a Location argument that is
7109         used to report errors more precisly (instead of reporting the end
7110         of a definition, we try to track something which is a lot closer
7111         to the source of the problem).
7112
7113         * cs-tokenizer.cs: Track global token use, so we can properly flag
7114         the use of #define/#undef after the first token has been seen.
7115
7116         Also, rename the reportXXXX to Error_DescriptiveName
7117
7118         * decl.cs (DeclSpace.IsTopLevel): Move property here from
7119         TypeContainer, so that Enum and Interface can use this too.
7120
7121         * class.cs (TypeContainer.LookupInterfaceOrClass,
7122         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
7123         `builder' argument.  Typically this was used to pass the parent
7124         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
7125         the definition).  
7126
7127         The problem is that a nested class could trigger the definition of
7128         a toplevel class, and the builder would be obviously wrong in that
7129         case. 
7130
7131         So we drop this argument, and we compute dynamically the
7132         TypeBuilder/ModuleBuilder (the correct information was available
7133         to us anyways from DeclSpace.Parent)
7134
7135         * interface.cs (Interface.DefineInterface): Drop builder
7136         parameter cleanup like class.cs
7137
7138         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
7139         like class.cs
7140
7141         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
7142         values. 
7143
7144         (Try.Emit): Propagate the returns value from the statement.
7145
7146         (Return.Emit): Even if we are leavning 
7147
7148         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
7149
7150         * modifiers.cs: Fix the computation of MethodAttributes flags.
7151
7152 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
7153
7154         * driver.cs: allow compilation of files that start with '/'.
7155         Add a default case when checking the argument of --target.
7156
7157 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
7158
7159         * interface.cs: Implement the same search algorithm for types in
7160         the interface code.
7161
7162         * delegate.cs: Do not allow multiple definition.
7163
7164         * Recovered ChangeLog that got accidentally amputated
7165
7166         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
7167
7168         * rootcontext.cs: Load manually enum to allow core classes to
7169         contain enumerations.
7170
7171         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
7172         Update to new static methods in TypeManager.
7173
7174         * typemanager.cs (GetMethod, GetConstructor): Use our
7175         implementation of FindMembers to find the members, since during
7176         corlib compilation, the types are TypeBuilders and GetMethod and
7177         GetConstructor do not work.
7178
7179         Make all methods in TypeManager static.
7180
7181         (InitCodeHelpers): Split the functionality from
7182         the InitCodeTypes function.
7183
7184         * driver.cs: Call InitCodeHelpers after we have populated the
7185         types. 
7186
7187         * cs-parser.jay (delegate_declaration): we did not used to compute
7188         the delegate name correctly for void delegates.
7189
7190 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
7191
7192         * rootcontext.cs (RootContext): Init the interface_resolve_order
7193         and type_container_resolve_order always.
7194
7195         (ResolveCore, BootstrapCorlib_ResolveClass,
7196         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
7197         compiler when compiling with --nostdlib
7198
7199         * class.cs (TypeContainer.DefineType): Check that our parent is
7200         not null.  This test is most important when we are bootstraping
7201         the core types.
7202
7203         * codegen.cs: Split out the symbol writing code.
7204
7205 2002-03-25  Martin Baulig  <martin@gnome.org>
7206
7207         * driver.cs (-g): Made -g an alias for --debug.
7208
7209 2002-03-24  Martin Baulig  <martin@gnome.org>
7210
7211         * codegen.cs (SymbolWriter): New public variable. Returns the
7212         current symbol writer.
7213         (CodeGen): Added `bool want_debugging_support' argument to the
7214          constructor. If true, tell the ModuleBuild that we want debugging
7215         support and ask it for the ISymbolWriter.
7216         (Save): If we have a symbol writer, call it's Close() method after
7217         saving the assembly.
7218
7219         * driver.c (--debug): New command line argument to create a
7220         debugger information file.
7221
7222         * location.cs (SymbolDocument): New public property. Returns an
7223         ISymbolDocumentWriter object for the current source file or null
7224         if we don't have a symbol writer.
7225
7226 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
7227
7228         * driver.cs (LoadAssembly): Correctly return when all the paths
7229         have been tried and not before.
7230
7231         * statement.cs (Switch.Emit): return the actual coverage for this
7232         statement (returns/not-returns)
7233
7234         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
7235         switch of the statement if we are the last switch section.  That
7236         kills two problems: try/catch problems (we used to emit an empty
7237         nop at the end) and switch statements where all branches would
7238         return. 
7239
7240 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
7241
7242         * driver.cs: Add default assemblies (the equivalent to the
7243         Microsoft CSC.RSP file)
7244
7245         * cs-tokenizer.cs: When updating `cols and setting it to zero,
7246         also update tokens_seen and set it to false.
7247
7248         * driver.cs: Implement --recurse for Mike.
7249
7250         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
7251         correctly splitting out the paths.
7252
7253 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
7254
7255         * interface.cs (Interface.PopulateProperty): Instead of using
7256         `parent' as the declaration space for the set parameters, use
7257         `this' 
7258
7259         * support.cs (InternalParameters): InternalParameters constructor
7260         takes a DeclSpace instead of a TypeContainer.
7261
7262         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
7263         types are being initialized, load the address of it before calling
7264         the function.  
7265
7266         (New): Provide a mechanism to disable the generation of local
7267         value type temporaries when the caller will be providing us with
7268         an address to store it.
7269
7270         (ArrayCreation.EmitDynamicInitializers): Use it.
7271
7272 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
7273
7274         * expression.cs (Invocation.EmitArguments): Only probe for array
7275         property if there is more than one argument.  Sorry about that.
7276
7277         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
7278         empty param arrays.
7279         
7280         * class.cs (Method.LabelParameters): Fix incorrect code path that
7281         prevented the `ParamArrayAttribute' from being applied to the
7282         params attribute.
7283
7284 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
7285
7286         * support.cs (ReflectionParameters): Correctly compute whether the
7287         last argument is a params array.  Fixes the problem with
7288         string.Split ('a')
7289
7290         * typemanager.cs: Make the assemblies array always be non-null
7291         (empty, but non-null)
7292
7293         * tree.cs (RecordDecl): New function that abstracts the recording
7294         of names.  This reports error 101, and provides a pointer to the
7295         previous declaration.  Fixes a crash in the compiler.
7296
7297         * cs-parser.jay (constructor_declaration): Update to new grammar,
7298         and provide a constructor_body that can be empty.
7299
7300 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
7301
7302         * driver.cs: Add support for --resources.
7303
7304         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
7305         Make all types for the various array helper methods be integer.
7306
7307         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
7308         CheckState to ConvCast.
7309
7310         (ConvCast): Now it takes a `checked' state argument, to avoid
7311         depending on the emit context for the conversion, and just using
7312         the resolve time setting.
7313
7314         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
7315         instead of Invocation.EmitArguments.  We do not emit the original
7316         arguments, instead we emit those which have been converted to
7317         unsigned int expressions.
7318
7319         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
7320
7321         * codegen.cs: ditto.
7322
7323         * expression.cs (LocalVariableReference): Drop the use of the
7324         Store function that depended on the variable index.
7325
7326         * statement.cs (VariableInfo): Drop the `Idx' property from this
7327         class, as this is not taking into account the indexes for
7328         temporaries tat we generate during the execution, getting the
7329         indexes wrong.
7330
7331         * class.cs: First emit class initializers, then call the parent
7332         constructor. 
7333
7334         * expression.cs (Binary): Fix opcode emision.
7335         (UnaryMutator.EmitCode): Support checked code generation
7336
7337         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
7338         matches for events for both the Static and Instance scans,
7339         pointing to the same element.   Fix that.
7340
7341 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
7342
7343         * rootcontext.cs (ResolveTree): Always set the
7344         interface_resolve_order, because nested interfaces will be calling
7345         into us.
7346
7347         * class.cs (GetInterfaceOrClass): Track the same resolution
7348         process used by TypeManager.LookupType.  This fixes the nested
7349         type lookups in class declarations (separate path from
7350         LookupType). 
7351
7352         (TypeContainer.DefineType): Also define nested interfaces.
7353         (TypeContainer.RegisterOrder): New public function used to
7354         register the order in which child interfaces need to be closed.
7355
7356         Nested interfaces need to be closed after their parents have been
7357         created. 
7358         
7359         * interface.cs (InterfaceAttr): Put all the logic for computing
7360         the interface attribute here. 
7361
7362         (DefineInterface): Register our interface order with the
7363         RootContext or with the TypeContainer depending on the case.
7364
7365 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
7366
7367         * cs-parser.jay: rework foreach statement to work with the new
7368         changes to the policy on SimpleNames.
7369         
7370         * report.cs: support Stacktrace on warnings as well.
7371
7372         * makefile: drop --unsafe and /unsafe from the compile.
7373
7374 2002-03-13  Ravi Pratap  <ravi@ximian.com>
7375
7376         * ecore.cs (StandardConversionExists): Modify to take an Expression
7377         as the first parameter. Ensure we do null -> reference type conversion
7378         checking.
7379
7380         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
7381         temporary Expression objects.
7382
7383 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
7384
7385         * interface.cs: workaround bug in method overloading resolution
7386         (there is already a bugzilla bug for it).
7387
7388 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
7389
7390         We could also solve this problem by having a separate path for
7391         performing type lookups, instead of DoResolve, we could have a
7392         ResolveType entry point, and only participating pieces of the
7393         production (simplename, deref, array) would implement this. 
7394         
7395         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
7396         signal SimpleName to only resolve type names and not attempt to
7397         resolve anything else.
7398
7399         * expression.cs (Cast): Set the flag.
7400
7401         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
7402
7403         * class.cs: Only report 108 if there is no `new' modifier.
7404
7405         * cs-parser.jay: rework foreach statement to work with the new
7406         changes to the policy on SimpleNames.
7407         
7408         * report.cs: support Stacktrace on warnings as well.
7409
7410         * makefile: drop --unsafe and /unsafe from the compile.
7411
7412 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
7413
7414         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7415         lookups here, instead of doing that at parse time.  This means
7416         that our grammar will not introduce `LocalVariableReferences' as
7417         expressions at this point.  That solves the problem of code like
7418         this:
7419
7420         class X {
7421            static void Main ()
7422            { int X = 1;
7423             { X x = null }}}
7424
7425         This is only half the fix.  The full fix requires parameters to
7426         also be handled in this way.
7427
7428         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
7429         makes the use more obvious of the DeclSpace.  The
7430         ec.TypeContainer.TypeBuilder is now only used to pull the
7431         TypeBuilder for it.
7432
7433         My theory is that I can get rid of the TypeBuilder completely from
7434         the EmitContext, and have typecasts where it is used (from
7435         DeclSpace to where it matters).  
7436
7437         The only pending problem is that the code that implements Aliases
7438         is on TypeContainer, and probably should go in DeclSpace.
7439
7440         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7441         lookups here, instead of doing that at parse time.  This means
7442         that our grammar will not introduce `LocalVariableReferences' as
7443         expressions at this point.  That solves the problem of code like
7444         this:
7445
7446         class X {
7447            static void Main ()
7448            { int X = 1;
7449             { X x = null }}}
7450
7451         This is only half the fix.  The full fix requires parameters to
7452         also be handled in this way.
7453
7454         * class.cs (Property.DefineMethod): When implementing an interface
7455         method, set newslot, when implementing an abstract method, do not
7456         set the flag (before we tried never setting it, or always setting
7457         it, which is the difference).
7458         (Indexer.DefineMethod): same.
7459         (Method.DefineMethod): same.
7460
7461         * ecore.cs: Only set the status used flag if we get back a Field.
7462
7463         * attribute.cs: Temporary hack, so Paolo can keep working.
7464
7465 2002-03-08  Ravi Pratap  <ravi@ximian.com>
7466
7467         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
7468         the unmanaged type in the case we have a MarshalAs attribute.
7469
7470         (Resolve): Handle the case when we are parsing the special MarshalAs
7471         attribute [we need to store the unmanaged type to use later]
7472         
7473         * typemanager.cs (marshal_as_attr_type): Built in type for the 
7474         MarshalAs Attribute.
7475
7476         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
7477         on parameters and accordingly set the marshalling info.
7478         
7479 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
7480
7481         * class.cs: Optimizing slightly by removing redundant code after
7482         we switched to the `NoTypes' return value.
7483         (Property.DefineMethod): use NoTypes here too.
7484
7485         This fixes the bug I introduced in my last batch of changes.
7486
7487 2002-03-05  Ravi Pratap  <ravi@ximian.com>
7488
7489         * tree.cs (RecordEnum): Add. We now keep track of enums too.
7490
7491         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
7492         Enums since those are types too. 
7493
7494         * cs-parser.jay (enum_declaration): Record enums as we parse them.
7495         
7496         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
7497         thanks to a call during the lookup process.
7498
7499 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
7500
7501         * statement.cs (Foreach): Lots of work to accomodate a particular
7502         kind of foreach statement that I had not kept in mind.  It is
7503         possible to have foreachs on classes that provide a GetEnumerator
7504         method that return objects that implement the "pattern" for using
7505         a foreach, there is no need to support GetEnumerator
7506         specifically. 
7507
7508         This is needed to compile nant.
7509
7510         * decl.cs: Only report 114 if the member is not `Finalize' and if
7511         the warning level is at least 2.
7512
7513         * class.cs: Moved the compare function from Method to
7514         MethodSignature. 
7515
7516         (MethodSignature.InheritableMemberSignatureCompare): Add new
7517         filter function that is used to extract inheritable methods from a
7518         class. 
7519
7520         (Method.Define): Use the new `inheritable_method_signature_filter'
7521         delegate
7522
7523         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
7524         command. 
7525
7526 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
7527
7528         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
7529
7530         * cs-parser.jay: Add opt_semicolon to the interface declaration.
7531
7532         * expression.cs: Pass location information to
7533         ConvertImplicitStandard. 
7534
7535         * class.cs: Added debugging code to track return values from
7536         interfaces. 
7537
7538 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
7539
7540         * expression.cs (Is.DoResolve): If either side of the `is' is an
7541         interface, do not flag the warning.
7542
7543         * ecore.cs (ImplicitReferenceConversion): We need a separate test
7544         for interfaces
7545
7546         * report.cs: Allow for --fatal to be used with --probe.
7547         
7548         * typemanager.cs (NoTypes): Move the definition for the empty Type
7549         array here. 
7550
7551         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7552         properties. 
7553         (TypeContainer.DefineProxy): New function used to proxy to parent
7554         implementations when implementing interfaces.
7555         (TypeContainer.ParentImplements): used to lookup if our parent
7556         implements a public function that is required by an interface.
7557         (TypeContainer.VerifyPendingMethods): Hook this up.
7558
7559         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7560         `modules' and `assemblies' arraylists into arrays.  We only grow
7561         these are the very early start up of the program, so this improves
7562         the speedof LookupType (nicely measured).
7563
7564         * expression.cs (MakeByteBlob): Replaced unsafe code with
7565         BitConverter, as suggested by Paolo.
7566
7567         * cfold.cs (ConstantFold.Binary): Special case: perform constant
7568         folding of string concatenation, but if either side is a string,
7569         and the other is not, then return null, and let the runtime use
7570         the concatenation on the string plus the object (using
7571         `Object.ToString'). 
7572
7573 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
7574
7575         Constant Folding has been implemented now.
7576         
7577         * expression.cs (Unary.Reduce): Do not throw an exception, catch
7578         the error instead on types that are not supported in one's
7579         complement. 
7580
7581         * constant.cs (Constant and all children): New set of functions to
7582         perform implict and explicit conversions.
7583         
7584         * ecore.cs (EnumConstant): Implement the new functions to perform
7585         conversion by proxying to the child expression.
7586
7587         * codegen.cs: (ConstantCheckState): Constant evaluation has its
7588         own separate setting that can not be turned off from the command
7589         line using --unchecked or --checked and is only controlled using
7590         the checked/unchecked statements and expressions.  This setting is
7591         used by the constant folder to flag errors.
7592
7593         * expression.cs (CheckedExpr, UncheckedExpr): Set the
7594         ConstantCheckState as well.   
7595
7596         During Resolve, they also have to flag the state, because the
7597         constant folder runs completely in the Resolve phase.
7598
7599         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7600         well.
7601
7602 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7603
7604         * cfold.cs: New file, this file contains the constant folder.
7605         
7606         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7607         argument to track whether we are using the resulting address to
7608         load or store a value and provide better error messages. 
7609
7610         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7611         new AddressOf arguments.
7612
7613         * statement.cs (Foreach.EmitCollectionForeach): Update
7614
7615         * expression.cs (Argument.Emit): Call AddressOf with proper
7616         arguments to track usage.
7617
7618         (New.DoEmit): Call AddressOf with new arguments.
7619
7620         (Unary.Emit): Adjust AddressOf call.
7621
7622 2002-03-01  Ravi Pratap  <ravi@ximian.com>
7623
7624         * cs-parser.jay (member_access): Change the case for pre-defined types
7625         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
7626         this suggestion.
7627
7628         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7629         a method body.
7630
7631         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7632         essentially like methods and apply attributes like MethodImplOptions to them too.
7633
7634         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7635         not being null.
7636
7637         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7638         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7639         is the DeclSpace.
7640
7641         * Update code everywhere accordingly.
7642
7643         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7644
7645         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7646
7647 2002-02-28  Ravi Pratap  <ravi@ximian.com>
7648
7649         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7650         try performing lookups against those instead of jumping straight into using
7651         the 'using' clauses.
7652
7653         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7654
7655         (LookupType): Perform lookups in implicit parents too.
7656
7657         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7658         sequence as RootContext.LookupType. 
7659
7660         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
7661         the various cases of namespace lookups into this method.
7662
7663 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7664
7665         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7666         in positional arguments)
7667
7668         * class.cs (Operator): Update the AllowedModifiers to contain
7669         extern. 
7670
7671         * cs-parser.jay: Update operator declaration to allow for the
7672         operator body to be empty.
7673
7674         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7675         values. 
7676
7677 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
7678
7679         * class.cs (Method.Emit): Label parameters.
7680
7681         * driver.cs: Return 1 or 0 as the program exit code.
7682
7683 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
7684
7685         * expression.cs: Special case the `null' object when trying to
7686         auto-compute the type, as anything can be explicitly converted to
7687         that. 
7688
7689         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7690         spotting this Paolo.
7691
7692         (Expression.ImplicitNumericConversion): Perform comparissions of
7693         the type using the underlying type in the case of an enumeration
7694         rather than using the enumeration type for the compare.
7695
7696         Cope with the underlying == type case, which is not possible to
7697         catch before. 
7698
7699         (Expression.ConvertNumericExplicit): Perform comparissions of
7700         the type using the underlying type in the case of an enumeration
7701         rather than using the enumeration type for the compare.
7702
7703         * driver.cs: If the user does not supply an extension, assume .exe
7704
7705         * cs-parser.jay (if_statement): Rewrote so that we can track the
7706         location for the if statement.
7707
7708         * expression.cs (Binary.ConstantFold): Only concat strings when
7709         the operation is "+", not everything ;-)
7710
7711         * statement.cs (Statement.EmitBoolExpression): Take a location
7712         argument. 
7713         (If, While, Do): Track location.
7714
7715         * expression.cs (Binary.ResolveOperator): In the object + string
7716         case, I was missing a call to ConvertImplicit
7717
7718 2002-02-25  Ravi Pratap  <ravi@ximian.com>
7719
7720         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7721         Location arguments. Ensure we use RootContext.LookupType to do our work
7722         and not try to do a direct Type.GetType and ModuleBuilder.GetType
7723
7724         * interface.cs (PopulateMethod): Handle the type of the parameter being
7725         null gracefully.
7726
7727         * expression.cs (Invocation.BetterFunction): Handle the case when we 
7728         have a params method with no fixed arguments and a call is made with no
7729         arguments.
7730
7731 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
7732
7733         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7734         the verbatim-string-literal
7735
7736         * support.cs (InternalParameters.ParameterModifier): handle null
7737         fixed parameters.
7738         (InternalParameters.ParameterType): ditto.
7739
7740         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7741         duplicating the name of the variable parameter.
7742         (GetParameterByName): Fix bug where we were not looking up array
7743         paramters if they were the only present (thanks Paolo!).
7744         (GetParameterInfo): We only have an empty set of types if both
7745         fixed and array are set to null.
7746         (GetParameterInfo-idx): Handle FixedParameter == null
7747
7748         * cs-parser.jay: Handle the case where there is no catch
7749         statements (missing null test).
7750
7751 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
7752
7753         * driver.cs (MainDriver): Be conservative on our command line
7754         handling.
7755
7756         Catch DirectoryNotFoundException when calling GetFiles.
7757         
7758         (SplitPathAndPattern): Used to split the input specification into
7759         a path and a pattern that we can feed to Directory.GetFiles.
7760
7761 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
7762
7763         * statement.cs (Fixed): Implement the last case of the Fixed
7764         statement (string handling).
7765
7766         * expression.cs (StringPtr): New class used to return a char * to
7767         a string;  Used by the Fixed statement.
7768
7769         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
7770
7771         * expression.cs (Binary.ResolveOperator): Remove redundant
7772         MemberLookup pn parent type.
7773         Optimize union call, we do not need a union if the types are the same.
7774         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7775         type.
7776
7777         Specialize the use of MemberLookup everywhere, instead of using
7778         the default settings. 
7779
7780         (StackAlloc): Implement stackalloc keyword.
7781
7782         * cs-parser.jay: Add rule to parse stackalloc.
7783         
7784         * driver.cs: Handle /h, /help, /?
7785
7786         * expression.cs (MakeByteBlob): Removed the hacks we had in place
7787         before we supported unsafe code.
7788         
7789         * makefile: add --unsafe to the self compilation of mcs.
7790
7791 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
7792
7793         * expression.cs (PointerArithmetic): New class that is used to
7794         perform pointer arithmetic.
7795         (Binary.Resolve): Handle pointer arithmetic
7796         Handle pointer comparission.
7797         (ArrayPtr): Utility expression class that is used to take the
7798         address of an array.
7799
7800         (ElementAccess): Implement array access for pointers
7801         
7802         * statement.cs (Fixed): Implement fixed statement for arrays, we
7803         are missing one more case before we are done.
7804
7805         * expression.cs (Indirection): Implement EmitAssign and set the
7806         ExprClass to Variable.  This allows pointer dereferences to be
7807         treated as variables, and to have values assigned to them.
7808         
7809         * ecore.cs (Expression.StoreFromPtr): New utility function to
7810         store values dereferencing.
7811
7812 2002-02-20  Ravi Pratap  <ravi@ximian.com>
7813
7814         * expression.cs (Binary.ResolveOperator): Ensure that we are
7815         not trying to operate on a void type - this fixes the reported
7816         bug.
7817
7818         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7819         the parent implementation is sealed.
7820
7821         * ../errors/cs0239.cs : Add.
7822
7823         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7824
7825         * typemanager.cs (unverifiable_code_type): Corresponds to 
7826         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7827         which have unsafe code in them.
7828
7829         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
7830         unsafe context.
7831
7832 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
7833
7834         * cs-tokenizer.cs: Add support for @"litreal strings"
7835
7836         Make tokenizer accept pre-processor directives
7837         on any column (remove the old C-like limitation). 
7838
7839         * rootcontext.cs (EmitCode): Emit any global attributes.
7840         (AddGlobalAttributes): Used to keep track of assembly attributes. 
7841
7842         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7843
7844         * cs-parser.jay: Add support for global attributes.  
7845
7846 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
7847
7848         * expression.cs (Indirection): New helper class.  Unary will
7849         create Indirection classes to be able to implement the
7850         IMemoryLocation interface on it.
7851
7852 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
7853
7854         * cs-parser.jay (fixed_statement): reference the right statement.
7855
7856         * statement.cs (Fixed.Emit): Finish implementing the fixed
7857         statement for the &x case.
7858
7859 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
7860
7861         * class.cs (Property.Define, Method.Define): Remove newslot when
7862         `implementing'.  
7863
7864         * modifiers.cs: My use of NewSlot when `Abstract' was set was
7865         wrong.  NewSlot should only be used if the `new' keyword is present.
7866
7867         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7868         locating our system dir.  Sorry about this.
7869
7870 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7871
7872         * driver.cs (GetSystemDir): Compute correctly the location of our
7873         system assemblies.  I was using the compiler directory instead of
7874         the library directory.
7875
7876 2002-02-13  Ravi Pratap  <ravi@ximian.com>
7877
7878         * expression.cs (BetterFunction): Put back in what Miguel commented out
7879         since it is the correct fix. The problem is elsewhere ;-)
7880
7881         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7882         parameters of the parms method are themselves compatible or not !
7883
7884         (StandardConversionExists): Fix very dangerous bug where we were forgetting
7885         to check that a class implements an interface before saying that an implicit
7886         conversion was allowed. Use ImplementsInterface to do the checking.
7887
7888 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7889
7890         * class.cs (Method.Define): Track whether we are an explicit
7891         implementation or not.  And only call DefineMethodOverride if we
7892         are an explicit implementation.
7893
7894         (Property.DefineMethod): Ditto.
7895
7896 2002-02-11  Ravi Pratap  <ravi@ximian.com>
7897
7898         * expression.cs (BetterFunction): Catch hideous bug which was
7899          preventing us from detecting ambiguous calls due to implicit casts i.e
7900         cs0121.
7901
7902 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
7903
7904         * support.cs (Pair): Remove un-needed method.  I figured why I was
7905         getting the error in cs-parser.jay, the variable in a foreach loop
7906         is readonly, and the compiler does not really treat this as a variable.
7907
7908         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
7909         instead of EQUALS in grammar.  
7910
7911         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7912
7913         * expression.cs (Unary.DoResolve): Check whether the argument is
7914         managed or not.
7915
7916 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
7917
7918         * support.cs: Api for Pair to set a value.  Despite the fact that
7919         the variables are public the MS C# compiler refuses to compile
7920         code that accesses the field if the variable is part of a foreach
7921         statement. 
7922
7923         * statement.cs (Fixed): Begin implementation of the fixed
7924         statement.
7925
7926         (Block.AddVariable): Return the VariableInfo on success and null
7927         on failure instead of true/false. 
7928
7929         * cs-parser.jay (foreach): Catch errors on variables already
7930         defined (we were ignoring this value before) and properly unwind
7931         the block hierarchy
7932
7933         (fixed_statement): grammar for the fixed statement.
7934
7935 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
7936
7937         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7938         pointer types to be incretemented.
7939
7940         (SizeOf): Implement.
7941
7942         * cs-parser.jay (pointer_member_access): Implement
7943         expr->IDENTIFIER production.
7944
7945         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7946         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7947         on safe contexts.
7948
7949         (Unary): Implement indirection.
7950
7951         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7952         use in non-unsafe context).
7953
7954         (SimpleName.DoResolve): Check for pointers in field access on safe
7955         contexts. 
7956
7957         (Expression.LoadFromPtr): Factor the load-indirect code in this
7958         function.  This was duplicated in UnboxCast and ParameterReference
7959
7960 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
7961
7962         * expression.cs (ComposedCast): report an error if a pointer cast
7963         is used in a safe region.
7964
7965         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7966         pointer type casts in unsafe context.
7967
7968         * codegen.cs (EmitContext): Set up IsUnsafe.
7969
7970         * cs-parser.jay (non_expression_type): Add productions for pointer
7971         casts. 
7972
7973         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7974         code.  We should not use force into static mode if the method is
7975         not virtual.  Fixes bug in MIS
7976
7977         * statement.cs (Do.Emit, While.Emit, For.Emit,
7978         Statement.EmitBoolExpression): Add support to Do and While to
7979         propagate infinite loop as `I do return' semantics.
7980
7981         Improve the For case to also test for boolean constants.
7982
7983         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7984         to the list of attributes we can add.
7985
7986         Remove `EmitContext' argument.
7987
7988         * class.cs (Method.Define): Apply parameter attributes.
7989         (Constructor.Define): Apply parameter attributes.
7990         (MethodCore.LabelParameters): Move here the core of labeling
7991         parameters. 
7992
7993         * support.cs (ReflectionParameters.ParameterModifier,
7994         InternalParameters.ParameterModifier): Use IsByRef on the type and
7995         only return the OUT bit for these parameters instead of in/out/ref
7996         flags.
7997
7998         This is because I miss-understood things.  The ParameterInfo.IsIn
7999         and IsOut represent whether the parameter has the [In] and [Out]
8000         attributes set.  
8001
8002 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
8003
8004         * ecore.cs (FieldExpr.Emit): Release temporaries.
8005
8006         * assign.cs (LocalTemporary.Release): new function.
8007
8008         * codegen.cs (EmitContext.GetTemporaryStorage,
8009         EmitContext.FreeTemporaryStorage): Rework the way we deal with
8010         temporary storage.  Now we can "put back" localbuilders when we
8011         are done with them
8012
8013 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
8014
8015         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
8016         need to make a copy of the variable to generate verifiable code.
8017
8018 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
8019
8020         * driver.cs: Compute dynamically the system directory.
8021
8022         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
8023         Slower, but more generally useful.  Used by the abstract
8024         registering implementation. 
8025
8026         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
8027         the rules for the special rule on Type/instances.  First check if
8028         we have the same name, and if so, try that special static path
8029         rather than the instance path.
8030         
8031 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
8032
8033         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
8034         for, while and if.
8035
8036         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
8037         Enum, ValueType, Delegate or Array for non-corlib compiles.
8038
8039         * cs-tokenizer.cs: Catch long identifiers (645)
8040
8041         * typemanager.cs (IndexerPropetyName): Ravi never tested this
8042         piece of code.
8043
8044         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
8045         fix, we were returning too early, so we were not registering
8046         pending methods from abstract classes.
8047
8048         Do not register pending methods if the class is abstract.
8049
8050         * expression.cs (Conditional.DoResolve): Report circular implicit
8051         conversions when we neecd to compute it for conditional
8052         expressions. 
8053
8054         (Is.DoResolve): If the expression is always of the provided type,
8055         flag warning 183.  If the expression can not ever be of the
8056         provided type flag warning 184.
8057
8058         * class.cs: Catch 169 as well.
8059
8060         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
8061         read. 
8062
8063 2002-01-18  Nick Drochak  <ndrochak@gol.com>
8064
8065         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
8066
8067 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
8068
8069         * interface.cs: (PopulateMethod): Check for pointers being defined
8070         only if the unsafe context is active.
8071         (PopulateProperty): ditto.
8072         (PopulateIndexer): ditto.
8073
8074         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
8075         specified.  If pointers are present, make sure that they are
8076         present in an unsafe context.
8077         (Constructor, Constructor.Define): ditto.
8078         (Field, Field.Define): ditto.
8079         (Property, Property.Define): ditto.
8080         (Event, Event.Define): ditto.
8081
8082         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
8083         hashtable if there are classes or structs defined.
8084
8085         * expression.cs (LocalVariableReference.DoResolve): Simplify this
8086         code, as the constant resolution moved.
8087
8088         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
8089         the metadata, so we can flag error 133. 
8090
8091         * decl.cs (MemberCore.UnsafeOK): New function to test that a
8092         pointer is being declared in an unsafe context.
8093
8094 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
8095
8096         * modifiers.cs (Modifiers.Check): Require a Location argument.
8097         Report error 227 for Unsafe use.
8098
8099         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
8100
8101         * statement.cs (For.Emit): If the test is null, then report that
8102         we do `return', as we wont reach anything afterwards.
8103
8104         (Switch.SwitchGoverningType): Track the expression that matched
8105         the conversion.
8106
8107         * driver.cs: Allow negative numbers as an error code to flag.
8108
8109         * cs-parser.jay: Handle 1551.
8110
8111         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
8112
8113 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
8114
8115         * cs-parser.jay: Report 1518 (type declaration can only contain
8116         class, struct, interface, enum or delegate)
8117
8118         (switch_label): Report 1523 (keywords `case' or `default' must
8119         preced code)
8120
8121         (opt_switch_sections): Report 1522 (empty switch)
8122
8123         * driver.cs: Report 1515 (response file specified multiple times)
8124         Report 1516 (Source file specified multiple times).
8125
8126         * expression.cs (Argument.Resolve): Signal 1510
8127
8128         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
8129         access not allowed in static code)
8130
8131 2002-01-11  Ravi Pratap  <ravi@ximian.com>
8132
8133         * typemanager.cs (IsPointerType): Utility method which we are going
8134         to need a lot.
8135
8136         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
8137         the object type, so we take care of that.
8138
8139         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
8140         
8141         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
8142         added to non-params parameters :-)
8143
8144         * typemanager.cs (CSharpName): Include 'void' type too. 
8145
8146         (void_ptr_type): Include in the set of core types.
8147
8148         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
8149         duplicating code.
8150
8151         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
8152         an unsafe context.
8153
8154         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
8155         completely forgotten about it.
8156
8157 2002-01-10  Ravi Pratap  <ravi@ximian.com>
8158
8159         * cs-parser.jay (pointer_type): Add. This begins our implementation
8160         of parsing rules for unsafe code.
8161
8162         (unsafe_statement): Implement.
8163
8164         (embedded_statement): Modify to include the above.
8165
8166         * statement.cs (Unsafe): Implement new class for unsafe blocks.
8167
8168         * codegen.cs (EmitContext.InUnsafe): Add. This determines
8169         if the current context is an unsafe one.
8170
8171         * cs-parser.jay (local_variable_pointer_type): Since local variable types
8172         are handled differently, we need separate rules for them.
8173
8174         (local_variable_declaration): Update to use local_variable_pointer_type
8175         to allow variable declarations of unmanaged pointer types.
8176
8177         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
8178         in unsafe contexts.
8179
8180         * ../errors/cs0214.cs : Add.
8181
8182 2002-01-16  Nick Drochak  <ndrochak@gol.com>
8183
8184         * makefile: remove 'response' file when cleaning.
8185
8186 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
8187
8188         * cs-parser.jay: Report 1524.
8189
8190 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
8191
8192         * typemanager.cs (RegisterMethod): drop checking if we have
8193         registered this from here
8194
8195 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
8196
8197         * class.cs (Method.EmitDestructor): Implement calling our base
8198         destructor. 
8199
8200         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
8201         value of InFinally.
8202
8203         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
8204         this routine and will wrap the call in a try/catch block.  Deal
8205         with the case.
8206
8207 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
8208
8209         * ecore.cs (Expression.MemberLookup): instead of taking a
8210         parameter `same_type' that was used to tell whether we could
8211         access private members we compute our containing type from the
8212         EmitContext.
8213
8214         (FieldExpr): Added partial support for volatile fields.  This does
8215         not work for volatile fields exposed from assemblies, as I can not
8216         figure out how to extract the modreq from it.
8217
8218         Updated all the source files to use this.
8219
8220         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
8221         because it is referenced by MemberLookup very often. 
8222
8223 2002-01-09  Ravi Pratap  <ravi@ximian.com>
8224
8225         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
8226         TypeBuilder.GetCustomAttributes to retrieve what we need.
8227
8228         Get rid of redundant default_member_attr_type as this is the same as
8229         default_member_type which already exists.
8230
8231         * interface.cs, attribute.cs : Update accordingly.
8232         
8233 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
8234
8235         * typemanager.cs: Enable IndexerPropertyName again.  It does not
8236         work for TYpeBuilders though.  Ravi, can you please fix this?
8237
8238         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
8239
8240         * expression.cs (Argument.Emit): Handle the case of ref objects
8241         being passed to ref functions;  
8242
8243         (ParameterReference.EmitLoad): Loads the content of the pointer
8244         without dereferencing.
8245
8246 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8247
8248         * cs-tokenizer.cs: Implemented the pre-processing expressions.
8249
8250 2002-01-08  Ravi Pratap  <ravi@ximian.com>
8251
8252         * class.cs (Indexer.DefineMethod): Incorporate the interface
8253         type in the name of the method if we are doing explicit interface
8254         implementation.
8255
8256         * expression.cs (ConversionExists): Remove as it is completely obsolete.
8257
8258         (BetterConversion): Fix extremely trivial bug where we were referring to
8259         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
8260         again !
8261
8262         * ../errors/bug16.cs : Add although we have fixed it.
8263
8264 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8265
8266         * expression.cs (BaseIndexer): Begin implementation.
8267
8268         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
8269
8270         * cs-parser.jay (indexer_declarator): Use qualified_identifier
8271         production directly to remove a shift/reduce, and implement
8272         explicit interface implementation.
8273
8274         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
8275         after a floating point suffix.
8276
8277         * expression.cs (DoNumericPromotions): Improved the conversion for
8278         uint/uint.  If we have a constant, we avoid doing a typecast to a
8279         larger type.
8280
8281         * class.cs (Indexer): Implement explicit interface implementation
8282         for indexers.
8283         
8284 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
8285
8286         * class.cs: make the default instance constructor public and hidebysig.
8287
8288 2001-01-03  Ravi Pratap  <ravi@ximian.com>
8289
8290         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
8291         so we can call it from elsewhere.
8292
8293         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
8294         we emit it internally if the class has a defined indexer; otherwise the user
8295         emits it by decorating the class definition with the DefaultMemberAttribute.
8296
8297         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
8298         attribute is not used on a type which defines an indexer.
8299
8300         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
8301         character when we skip whitespace.
8302
8303         * ../errors/cs0646.cs : Add.
8304
8305 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
8306
8307         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
8308         again. 
8309
8310         * makefile: Add practical target `mcs3.exe' which builds the third
8311         generation compiler. 
8312
8313         * expression.cs (New): Fix structures constructor calling.
8314
8315         * class.cs (Property, Method, Indexer): Emit Final flag on the
8316         method if we are an interface implementation and we are not
8317         abstract. 
8318
8319         * ecore.cs (PropertyExpr): New public field `IsBase', tells
8320         whether this property is referencing a `base' method.
8321
8322         * expression.cs (Invocation.EmitCall): take an extra argument:
8323         is_base, this is used to determine whether the `call' or
8324         `callvirt' opcode should be used.
8325
8326         
8327         * delegate.cs: update EmitCall.
8328
8329         * class.cs (Method.Define): Set NewSlot for the cases where we are
8330         not implementing an interface method.
8331
8332         (Property.Define): ditto.
8333
8334 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
8335
8336         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
8337         'r'.  Allows mcs to parse itself fully.
8338
8339 2002-01-02  Ravi Pratap  <ravi@ximian.com>
8340
8341         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
8342         of the number of initializers that require the InitializeArray method.
8343
8344         (CheckIndices): Store the Expression in all cases - not the plain value. Also
8345         update the above field where necessary.
8346
8347         (MakeByteBlob): Update accordingly.
8348
8349         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
8350         greater than 2.
8351
8352         (EmitDynamicInitializers): Update in accordance with the new optimization.
8353
8354         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
8355         same OpCode applies.
8356
8357         * cs-parser.jay : Fix some glaring errors I introduced.
8358
8359 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
8360
8361         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
8362         so that we can check for name clashes there too.
8363
8364         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
8365         for interface indexers.
8366
8367         * interfaces.cs (Define): Emit the default member attribute.
8368
8369         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
8370         variable was being referred to while setting the value ;-)
8371
8372 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
8373
8374         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
8375         byte-by-byte information when we know the data is zero.
8376
8377         Make the block always a multiple of 4, because
8378         DefineInitializedData has a bug.
8379
8380         * assign.cs: Fix, we should assign from the temporary, not from
8381         the source. 
8382
8383         * expression.cs (MakeByteBlob): Fix my incorrect code.
8384
8385 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
8386
8387         * typemanager.cs (EnumToUnderlying): This function is used to get
8388         the underlying type from an enumeration, because it does not
8389         always work. 
8390
8391         * constant.cs: Use the I4_S form for values between -128 and 127.
8392
8393         * statement.cs (Block.LookupLabel): Looks up a label.
8394         (Block): Drop support for labeled blocks.
8395
8396         (LabeledStatement): New kind of statement that represents a label
8397         only.
8398
8399         (Goto): Finally implement this bad boy.
8400         
8401         * cs-parser.jay: Update to reflect new mechanism to implement
8402         labels.
8403
8404 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
8405
8406         * codegen.cs (EmitContext.This): a codegen property that keeps the
8407         a single instance of this instead of creating many different this
8408         instances. 
8409
8410         * delegate.cs (Delegate.DoResolve): Update to use the property;
8411
8412         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
8413
8414         * expression.cs (BaseAccess.DoResolve): Ditto.
8415
8416 2001-12-29  Ravi Pratap  <ravi@ximian.com>
8417
8418         * typemanager.cs (methodimpl_attr_type): Add to hold the type
8419         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
8420
8421         (InitCoreTypes): Update accordingly.
8422
8423         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
8424         so we can quickly store the state.
8425
8426         (ApplyAttributes): Set the correct implementation flags
8427         for InternalCall methods.
8428
8429 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
8430
8431         * expression.cs (EmitCall): if a method is not virtual, then do
8432         not use callvirt on it.
8433
8434         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
8435         user defined stuff) requires the use of stobj, which takes an
8436         address on the stack instead of an array and an index.  So emit
8437         the Ldelema operation for it.
8438
8439         (EmitStoreOpcode): Use stobj for valuetypes.
8440
8441         (UnaryMutator.EmitCode): Use the right 1 value depending on
8442         whether we are dealing with int64/uint64, float or doubles.
8443
8444         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
8445         constructors that I implemented last night.
8446
8447         (Constructor.IsDefault): Fix to work properly for static
8448         constructors.
8449
8450         * cs-parser.jay (CheckDef): report method signature errors.
8451         Update error number 103 to be 132.
8452
8453         * decl.cs: New AdditionResult enumeration value: MethodExists.
8454         Although we do this check for methods later on in the semantic
8455         analysis, catching repeated default constructors is so easy that
8456         we catch these here. 
8457         
8458         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
8459         promotions code.
8460
8461         (ParameterReference.EmitAssign, Emit): handle
8462         bools as bytes.
8463
8464         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
8465         (ArrayAccess.EmitStoreOpcode): ditto.
8466
8467         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
8468
8469         * expression.cs (MakeByteBlob): Complete all the missing types
8470         (uint, short, ushort, byte, sbyte)
8471
8472         * class.cs: Only init instance field initializers on instance
8473         constructors. 
8474
8475         Rename `constructors' to instance_constructors. 
8476
8477         (TypeContainer.AddConstructor): Only add constructors to the list
8478         if it is not static.
8479
8480         Make sure that we handle default_static_constructor independently
8481         everywhere where we handle instance_constructors
8482
8483 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
8484
8485         * class.cs: Do not lookup or create a base initializer for a
8486         static constructor.
8487
8488         (ConstructorInitializer.Resolve): use the proper type to lookup
8489         for constructors.
8490
8491         * cs-parser.jay: Report error 1585 (modifiers between type and name).
8492
8493         * enum.cs, interface.cs: Remove CloseType, this is taken care by
8494         in DeclSpace. 
8495
8496         * decl.cs: CloseType is now an virtual method, the default
8497         implementation just closes this type.
8498         
8499 2001-12-28  Ravi Pratap  <ravi@ximian.com>
8500
8501         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
8502         to PreserveSig by default. Also emit HideBySig on such methods.
8503
8504         Basically, set the defaults to standard values.
8505
8506         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
8507         argument, if candidate is better, it can't be worse than the best !
8508
8509         (Invocation): Re-write bits to differentiate between methods being
8510         applicable in their expanded form and their normal form - for params
8511         methods of course.
8512
8513         Get rid of use_standard everywhere as only standard conversions are allowed
8514         in overload resolution. 
8515
8516         More spec conformance.
8517         
8518 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
8519
8520         * driver.cs: Add --timestamp, to see where the compiler spends
8521         most of its time.
8522
8523         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
8524         `this' in static code.
8525
8526         (SimpleName.DoResolve): Implement in terms of a helper function
8527         that allows static-references to be passed upstream to
8528         MemberAccess.
8529
8530         (Expression.ResolveWithSimpleName): Resolve specially simple
8531         names when called by MemberAccess to implement the special
8532         semantics. 
8533
8534         (Expression.ImplicitReferenceConversion): Handle conversions from
8535         Null to reference types before others, as Null's type is
8536         System.Object. 
8537
8538         * expression.cs (Invocation.EmitCall): Handle the special case of
8539         calling methods declared on a reference type from a ValueType
8540         (Base classes System.Object and System.Enum)
8541
8542         (MemberAccess.Resolve): Only perform lookups on Enumerations if
8543         the left hand side is a TypeExpr, not on every enumeration. 
8544
8545         (Binary.Resolve): If types are reference types, then do a cast to
8546         object on operators != and == of both arguments.
8547         
8548         * typemanager.cs (FindMembers): Extract instance and static
8549         members if requested.
8550
8551         * interface.cs (PopulateProperty): Use void_type instead of null
8552         as the return type for the setter method.
8553
8554         (PopulateIndexer): ditto.
8555
8556 2001-12-27  Ravi Pratap  <ravi@ximian.com>
8557
8558         * support.cs (ReflectionParameters): Fix minor bug where we
8559         were examining the wrong parameter for the ParamArray attribute.
8560
8561         Cope with requests for the type of the parameter at position
8562         greater than the params parameter's. We now return the element
8563         type of the params array as that makes more sense.
8564
8565         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
8566         accordingly as we no longer have to extract the element type
8567         ourselves.
8568
8569         (Invocation.OverloadResolve): Update.
8570
8571 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
8572
8573         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8574         against IEnumerator, test whether the return value is a descendant
8575         of the IEnumerator interface.
8576
8577         * class.cs (Indexer.Define): Use an auxiliary method to implement
8578         the other bits of the method definition.  Begin support for
8579         explicit interface implementation.
8580
8581         (Property.DefineMethod): Use TypeManager.void_type instead of null
8582         for an empty return value.
8583
8584 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
8585
8586         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8587         dealing with a FieldExpr which is composed of a FieldBuilder, in
8588         the code path we did extract the constant, but we should have
8589         obtained the underlying value to be able to cast it (otherwise we
8590         end up in an infinite loop, this is what Ravi was running into).
8591
8592         (ArrayCreation.UpdateIndices): Arrays might be empty.
8593
8594         (MemberAccess.ResolveMemberAccess): Add support for section
8595         14.5.4.1 that deals with the special case of E.I when E is a type
8596         and something else, that I can be a reference to a static member.
8597
8598         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8599         handle a particular array type to create byte blobs, it is just
8600         something we dont generate byteblobs for.
8601
8602         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8603         arguments. 
8604
8605         * location.cs (Push): remove the key from the hashtable that we
8606         are about to add.   This happens for empty files.
8607
8608         * driver.cs: Dispose files after we have parsed them.
8609
8610         (tokenize): new function that only runs the tokenizer on its
8611         input, for speed testing.
8612
8613 2001-12-26  Ravi Pratap  <ravi@ximian.com>
8614
8615         * class.cs (Event.Define): Define the private field only if there
8616         are no accessors defined.
8617
8618         * expression.cs (ResolveMemberAccess): If there is no associated
8619         field with the event, that means we have an event defined with its
8620         own accessors and we should flag error cs0070 since transforming
8621         ourselves into a field is not valid in that case.
8622
8623         * ecore.cs (SimpleName.DoResolve): Same as above.
8624
8625         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8626         and charset to sane values.
8627
8628 2001-12-25  Ravi Pratap  <ravi@ximian.com>
8629
8630         * assign.cs (DoResolve): Perform check on events only if they 
8631         are being accessed outside the declaring type.
8632
8633         * cs-parser.jay (event_declarations): Update rules to correctly
8634         set the type of the implicit parameter etc.
8635
8636         (add_accessor, remove_accessor): Set current local parameters.
8637
8638         * expression.cs (Binary): For delegate addition and subtraction,
8639         cast the return value from the method into the appropriate delegate
8640         type.
8641
8642 2001-12-24  Ravi Pratap  <ravi@ximian.com>
8643
8644         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8645         of these as the workaround is unnecessary.
8646
8647         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8648         delegate data - none of that is needed at all.
8649
8650         Re-write bits to extract the instance expression and the delegate method
8651         correctly.
8652
8653         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
8654         on delegates too.
8655
8656         * attribute.cs (ApplyAttributes): New method to take care of common tasks
8657         of attaching attributes instead of duplicating code everywhere.
8658
8659         * everywhere : Update code to do attribute emission using the above method.
8660
8661 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8662
8663         * expression.cs (IsParamsMethodApplicable): if there are not
8664         parameters, return immediately.
8665
8666         * ecore.cs: The 0 literal can be implicity converted to an enum
8667         type. 
8668
8669         (SimpleName.DoResolve): First lookup the type, then lookup the
8670         members. 
8671
8672         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8673         want to get its address.  If the InstanceExpression is not
8674         addressable, store the result in a temporary variable, then get
8675         the address of it.
8676
8677         * codegen.cs: Only display 219 errors on warning level or above. 
8678
8679         * expression.cs (ArrayAccess): Make it implement the
8680         IMemoryLocation interface.
8681
8682         (Binary.DoResolve): handle the operator == (object a, object b)
8683         and operator != (object a, object b) without incurring into a
8684         BoxedCast (because 5 != o should never be performed).
8685
8686         Handle binary enumerator operators.
8687
8688         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8689         value type, otherwise use Ldelem_ref.
8690
8691         Use precomputed names;
8692
8693         (AddressOf): Implement address of
8694
8695         * cs-parser.jay (labeled_statement): Fix recursive block
8696         addition by reworking the production.
8697
8698         * expression.cs (New.DoEmit): New has a special case:
8699                 
8700                  If we are dealing with a ValueType, we have a few
8701                  situations to deal with:
8702                 
8703                     * The target of New is a ValueType variable, that is
8704                       easy, we just pass this as the variable reference
8705                 
8706                     * The target of New is being passed as an argument,
8707                       to a boxing operation or a function that takes a
8708                       ValueType.
8709                 
8710                       In this case, we need to create a temporary variable
8711                       that is the argument of New.
8712
8713
8714 2001-12-23  Ravi Pratap  <ravi@ximian.com>
8715
8716         * rootcontext.cs (LookupType): Check that current_type is not null before
8717         going about looking at nested types.
8718
8719         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8720         not implement the IAssignMethod interface any more.
8721
8722         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8723         where we tranform them into FieldExprs if they are being resolved from within
8724         the declaring type.
8725
8726         * ecore.cs (SimpleName.DoResolve): Do the same here.
8727
8728         * assign.cs (DoResolve, Emit): Clean up code considerably. 
8729
8730         * ../errors/bug10.cs : Add.
8731
8732         * ../errors/cs0070.cs : Add.
8733
8734         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8735
8736         * assign.cs : Get rid of EventIsLocal everywhere.
8737         
8738 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8739
8740         * ecore.cs (ConvertIntLiteral): finished the implementation.
8741
8742         * statement.cs (SwitchLabel): Convert the value we are using as a
8743         key before looking up the table.
8744
8745 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8746
8747         * codegen.cs (EmitTopBlock): Require a Location argument now.
8748
8749         * cs-parser.jay (constructor_declarator): We need to setup
8750         current_local_parameters before we parse the
8751         opt_constructor_initializer, to allow the variables to be bound
8752         to the constructor arguments.
8753
8754         * rootcontext.cs (LookupType): First lookup nested classes in our
8755         class and our parents before we go looking outside our class.
8756
8757         * expression.cs (ConstantFold): Extract/debox the values at the
8758         beginnning. 
8759
8760         * rootcontext.cs (EmitCode): Resolve the constants first before we
8761         resolve the types.  This is not really needed, but it helps debugging.
8762
8763         * statement.cs: report location.
8764         
8765         * cs-parser.jay: pass location to throw statement.
8766
8767         * driver.cs: Small bug fix.
8768
8769         * report.cs: Updated format to be 4-zero filled digits.
8770
8771 2001-12-22  Ravi Pratap  <ravi@ximian.com>
8772
8773         * expression.cs (CheckIndices): Fix minor bug where the wrong
8774         variable was being referred to ;-)
8775
8776         (DoEmit): Do not call EmitStaticInitializers when the 
8777         underlying type is System.Object.
8778
8779 2001-12-21  Ravi Pratap  <ravi@ximian.com>
8780
8781         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8782         and do the usual workaround for SRE.
8783
8784         * class.cs (MyEventBuilder.EventType): New member to get at the type
8785         of the event, quickly.
8786
8787         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8788
8789         * assign.cs (Assign.DoResolve): Handle the case when the target
8790         is an EventExpr and perform the necessary checks.
8791
8792         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8793         interface.
8794
8795         (SimpleName.MemberStaticCheck): Include check for EventExpr.
8796
8797         (EventExpr): Set the type in the constructor itself since we 
8798         are meant to be born fully resolved.
8799
8800         (EventExpr.Define): Revert code I wrote earlier.
8801                 
8802         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8803         instance expression is null. The instance expression is a This in that case
8804         or a null, depending on whether it is a static method or not.
8805
8806         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8807         refers to more than one method.
8808
8809         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8810         and accordingly flag errors.
8811
8812 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8813
8814         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8815
8816 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8817
8818         * location.cs (ToString): Provide useful rutine.
8819
8820 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8821
8822         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8823         objects, return the actual integral boxed.
8824
8825         * statement.cs (SwitchLabel): define an ILLabel for each
8826         SwitchLabel. 
8827         
8828         (Switch.CheckSwitch): If the value is a Literal, extract
8829         the underlying literal.
8830         
8831         Also in the unused hashtable we had, add the SwitchLabel so we can
8832         quickly look this value up.
8833
8834         * constant.cs: Implement a bunch of new constants.  Rewrite
8835         Literal based on this.  Made changes everywhere to adapt to this.
8836         
8837         * expression.cs (Expression.MakeByteBlob): Optimize routine by
8838         dereferencing array only once, and also copes with enumrations.
8839
8840         bytes are two bytes wide, not one.
8841
8842         (Cast): Perform constant conversions.
8843         
8844         * ecore.cs (TryImplicitIntConversion): Return literals instead of
8845         wrappers to the literals here.
8846
8847         * expression.cs (DoNumericPromotions): long literals can converted
8848         to ulong implicity (this is taken care of elsewhere, but I was
8849         missing this spot).
8850
8851         * ecore.cs (Expression.Literalize): Make the return type Literal,
8852         to improve type checking.
8853
8854         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8855
8856 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8857
8858         * literal.cs: Revert code from ravi that checked the bounds.  The
8859         bounds are sane by the definition of the type itself. 
8860
8861         * typemanager.cs: Fix implementation of ImplementsInterface.  We
8862         need to actually look up in our parent hierarchy for interfaces
8863         implemented. 
8864
8865         * const.cs: Use the underlying type for enumerations
8866
8867         * delegate.cs: Compute the basename for the delegate creation,
8868         that should fix the delegate test case, and restore the correct
8869         Type Lookup semantics in rootcontext
8870
8871         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
8872         referencing a nested type with the Reflection API is using the "+"
8873         sign. 
8874
8875         * cs-parser.jay: Do not require EOF token at the end.
8876
8877 2001-12-20  Ravi Pratap  <ravi@ximian.com>
8878
8879         * rootcontext.cs (LookupType): Concatenate type names with
8880         a '.' instead of a '+' The test suite passes again.
8881
8882         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8883         field of the enumeration.
8884
8885         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8886         the case when the member is an EventExpr.
8887
8888         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8889         static has an associated instance expression.
8890
8891         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8892
8893         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8894
8895         * class.cs (Event.Define): Register event and perform appropriate checks
8896         for error #111.
8897
8898         We define the Add and Remove methods even if the use provides none because
8899         in that case, we provide default implementations ourselves.
8900
8901         Define a private field of the type of the event. This is done by the CSC compiler
8902         and we should be doing it too ;-)
8903
8904         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8905         More methods we use in code we generate.
8906
8907         (multicast_delegate_type, delegate_type): Two separate types since the distinction
8908         is important.
8909
8910         (InitCoreTypes): Update accordingly for the above.
8911
8912         * class.cs (Event.Emit): Generate code for default accessors that we provide
8913
8914         (EmitDefaultMethod): Do the job in the above.
8915
8916         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
8917         appropriate place.
8918
8919 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8920
8921         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8922         builders even if we were missing one.
8923
8924         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8925         pass the Basename as our class name instead of the Name.  The
8926         basename will be correctly composed for us.
8927
8928         * parameter.cs (Paramters): Now takes a Location argument.
8929
8930         * decl.cs (DeclSpace.LookupType): Removed convenience function and
8931         make all the code call directly LookupType in RootContext and take
8932         this chance to pass the Location information everywhere.
8933
8934         * Everywhere: pass Location information.
8935
8936 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
8937
8938         * class.cs (Constructor.Define): Updated way of detecting the
8939         length of the parameters.
8940
8941         (TypeContainer.DefineType): Use basename as the type name for
8942         nested types.
8943
8944         (TypeContainer.Define): Do not recursively define types here, as
8945         definition is taken care in order by the RootContext.
8946
8947         * tree.cs: Keep track of namespaces in a per-file basis.
8948
8949         * parameter.cs (Parameter.ComputeSignature): Update to use
8950         DeclSpace. 
8951
8952         (Parameters.GetSignature): ditto.
8953
8954         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8955         instead of a TypeContainer.
8956
8957         (Interface.SemanticAnalysis): Use `this' instead of our parent to
8958         resolve names.  Because we need to be resolve in our context, not
8959         our parents.
8960         
8961         * driver.cs: Implement response files.
8962
8963         * class.cs (TypeContainer.DefineType): If we are defined, do not
8964         redefine ourselves.
8965         
8966         (Event.Emit): Emit the code for add/remove handlers.
8967         (Event.Define): Save the MethodBuilders for add/remove.
8968
8969         * typemanager.cs: Use pair here too.
8970
8971         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8972         DictionaryEntry requires the first argument to be non-null.  
8973         
8974         (enum_declaration): Compute full name for registering the
8975         enumeration.
8976         
8977         (delegate_declaration): Instead of using
8978         formal_parameter_list, use opt_formal_parameter_list as the list
8979         can be empty.
8980
8981         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8982         (EventParsing): New property that controls whether `add' and
8983         `remove' are returned as tokens or identifiers (for events);
8984
8985 2001-12-19  Ravi Pratap  <ravi@ximian.com>
8986
8987         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8988         use MyEventBuilder only and let it wrap the real builder for us.
8989
8990         (MyEventBuilder): Revamp constructor etc.
8991
8992         Implement all operations that we perform on EventBuilder in precisely the same
8993         way here too.
8994
8995         (FindMembers): Update to use the EventBuilder member.
8996
8997         (Event.Emit): Update accordingly.
8998
8999 2001-12-18  Ravi Pratap  <ravi@ximian.com>
9000
9001         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
9002         by calling the appropriate methods.
9003
9004         (GetCustomAttributes): Make stubs as they cannot possibly do anything
9005         useful.
9006
9007         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
9008
9009 2001-12-17  Ravi Pratap  <ravi@ximian.com>
9010
9011         * delegate.cs (Delegate.Populate): Check that the return type
9012         and various parameters types are indeed accessible.
9013
9014         * class.cs (Constructor.Define): Same here.
9015
9016         (Field.Define): Ditto.
9017
9018         (Event.Define): Ditto.
9019
9020         (Operator.Define): Check that the underlying Method defined itself
9021         correctly - so it's MethodBuilder should not be null.
9022
9023         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
9024         expression happens to be null.
9025
9026         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
9027         members but as of now we don't seem to be able to do anything really useful with it.
9028
9029         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
9030         not the EventBuilder.
9031
9032 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
9033
9034         * cs-tokenizer.cs: Add support for defines.
9035         Add support for #if, #elif, #else, #endif
9036         
9037         (eval_var): evaluates a variable.
9038         (eval): stubbed for evaluating functions.
9039
9040         * cs-parser.jay: Pass the defines information
9041
9042         * driver.cs: Add --define command line option.
9043
9044         * decl.cs: Move MemberCore here.
9045
9046         Make it the base class for DeclSpace.  This allows us to catch and
9047         report 108 and 109 for everything now.
9048
9049         * class.cs (TypeContainer.Define): Extract all the members
9050         before populating and emit the warning 108 (new keyword required
9051         to override) instead of having each member implement this.
9052
9053         (MemberCore.Define): New abstract method, we will be using this in
9054         the warning reporting engine in Populate.
9055         
9056         (Operator.Define): Adjust to new MemberCore protocol. 
9057
9058         * const.cs (Const): This does not derive from Expression, it is a
9059         temporary object we use to create fields, it is a MemberCore. 
9060
9061         * class.cs (Method.Define): Allow the entry point to be in a
9062         specific class.
9063
9064         * driver.cs: Rewrite the argument handler to clean it up a bit.
9065
9066         * rootcontext.cs: Made it just an auxiliary namespace feature by
9067         making everything static.
9068
9069         * driver.cs: Adapt code to use RootContext type name instead of
9070         instance variable.
9071
9072         * delegate.cs: Remove RootContext argument.
9073
9074         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
9075         argument. 
9076
9077         * class.cs (Event.Define): The lookup can fail.
9078         
9079         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
9080
9081         * expression.cs: Resolve the this instance before invoking the code.
9082
9083 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
9084
9085         * cs-parser.jay: Add a production in element_access that allows
9086         the thing to become a "type" reference.  This way we can parse
9087         things like "(string [])" as a type.
9088
9089         Note that this still does not handle the more complex rules of
9090         casts. 
9091         
9092
9093         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
9094
9095         * ecore.cs: (CopyNewMethods): new utility function used to
9096         assemble the list of methods from running FindMembers.
9097
9098         (MemberLookup): Rework FindMembers so that 
9099
9100 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
9101
9102         * class.cs (TypeContainer): Remove Delegates who fail to be
9103         defined.
9104
9105         * delegate.cs (Populate): Verify that we dont get null return
9106         values.   TODO: Check for AsAccessible.
9107
9108         * cs-parser.jay: Use basename to emit error 574 (destructor should
9109         have the same name as container class), not the full name.
9110
9111         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
9112         possible representation.  
9113
9114         Also implements integer type suffixes U and L.
9115
9116 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
9117
9118         * expression.cs (ArrayCreation.DoResolve): We need to do the
9119         argument resolution *always*.
9120
9121         * decl.cs: Make this hold the namespace.  Hold the root context as
9122         well.
9123         (LookupType): Move here.
9124
9125         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
9126
9127         * location.cs (Row, Name): Fixed the code, it was always returning
9128         references to the first file.
9129
9130         * interface.cs: Register properties defined through interfaces.
9131
9132         * driver.cs: Add support for globbing on the command line
9133
9134         * class.cs (Field): Make it derive from MemberCore as well.
9135         (Event): ditto.
9136
9137 2001-12-15  Ravi Pratap  <ravi@ximian.com>
9138
9139         * class.cs (Event::Define): Check that the type of the event is a delegate
9140         type else flag error #66.
9141
9142         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
9143         same.
9144
9145         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
9146         values of EntryPoint, CharSet etc etc.
9147
9148         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
9149
9150         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
9151         be null and we should ignore this. I am not sure if this is really clean. Apparently,
9152         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
9153         which needs this to do its work.
9154
9155         * ../errors/cs0066.cs : Add.
9156
9157 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
9158
9159         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
9160         helper functions.
9161
9162         * class.cs: (MethodSignature.MethodSignature): Removed hack that
9163         clears out the parameters field.
9164         (MemberSignatureCompare): Cleanup
9165
9166         (MemberCore): New base class used to share code between MethodCore
9167         and Property.
9168
9169         (RegisterRequiredImplementations) BindingFlags.Public requires
9170         either BindingFlags.Instace or Static.  Use instance here.
9171
9172         (Property): Refactored code to cope better with the full spec.
9173
9174         * parameter.cs (GetParameterInfo): Return an empty array instead
9175         of null on error.
9176
9177         * class.cs (Property): Abstract or extern properties have no bodies.
9178
9179         * parameter.cs (GetParameterInfo): return a zero-sized array.
9180
9181         * class.cs (TypeContainer.MethodModifiersValid): Move all the
9182         method modifier validation to the typecontainer so we can reuse
9183         this on properties.
9184
9185         (MethodCore.ParameterTypes): return an empty sized array of types.
9186
9187         (Property.Define): Test property modifier validity.
9188
9189         Add tests for sealed/override too.
9190
9191         (Method.Emit): abstract or extern methods have no bodies.
9192
9193 2001-12-14  Ravi Pratap  <ravi@ximian.com>
9194
9195         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
9196         thing.
9197
9198         (Method::Define, ::Emit): Modify accordingly.
9199
9200         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
9201
9202         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
9203
9204         * makefile: Pass in /unsafe.
9205
9206 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
9207
9208         * class.cs (MakeKey): Kill routine.
9209         
9210         * class.cs (TypeContainer.Define): Correctly define explicit
9211         method implementations (they require the full interface name plus
9212         the method name).
9213
9214         * typemanager.cs: Deply the PtrHashtable here and stop using the
9215         lame keys.  Things work so much better.
9216
9217         This of course broke everyone who depended on `RegisterMethod' to
9218         do the `test for existance' test.  This has to be done elsewhere.
9219
9220         * support.cs (PtrHashtable): A hashtable that avoid comparing with
9221         the object stupid Equals method (because, that like fails all over
9222         the place).  We still do not use it.
9223
9224         * class.cs (TypeContainer.SetRequiredInterface,
9225         TypeContainer.RequireMethods): Killed these two routines and moved
9226         all the functionality to RegisterRequiredImplementations.
9227
9228         (TypeContainer.RegisterRequiredImplementations): This routine now
9229         registers all the implementations required in an array for the
9230         interfaces and abstract methods.  We use an array of structures
9231         which can be computed ahead of time to reduce memory usage and we
9232         also assume that lookups are cheap as most classes will not
9233         implement too many interfaces.
9234
9235         We also avoid creating too many MethodSignatures.
9236
9237         (TypeContainer.IsInterfaceMethod): Update and optionally does not
9238         clear the "pending" bit if we find that there are problems with
9239         the declaration.
9240
9241         (TypeContainer.VerifyPendingMethods): Update to report errors of
9242         methods that look like implementations but are not.
9243
9244         (TypeContainer.Define): Add support for explicit interface method
9245         implementation. 
9246         
9247 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
9248
9249         * typemanager.cs: Keep track of the parameters here instead of
9250         being a feature of the TypeContainer.
9251
9252         * class.cs: Drop the registration of parameters here, as
9253         InterfaceMethods are also interface declarations.
9254
9255         * delegate.cs: Register methods with the TypeManager not only with
9256         the TypeContainer.  This code was buggy.
9257
9258         * interface.cs: Full registation here.
9259
9260 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
9261
9262         * expression.cs: Remove reducer for binary expressions, it can not
9263         be done this way.
9264
9265         * const.cs: Put here the code that used to go into constant.cs
9266
9267         * constant.cs: Put here the code for constants, this is a new base
9268         class for Literals.
9269
9270         * literal.cs: Make Literal derive from Constant.
9271
9272 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
9273
9274         * statement.cs (Return.Emit): Report error 157 if the user
9275         attempts to return from a finally block.
9276
9277         (Return.Emit): Instead of emitting a return, jump to the end of
9278         the function.
9279
9280         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
9281         LocalBuilder to store the result of the function.  ReturnLabel is
9282         the target where we jump.
9283         
9284
9285 2001-12-09  Radek Doulik  <rodo@ximian.com>
9286
9287         * cs-parser.jay: remember alias in current namespace
9288
9289         * ecore.cs (SimpleName::DoResolve): use aliases for types or
9290         namespaces
9291
9292         * class.cs (LookupAlias): lookup alias in my_namespace
9293
9294         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
9295         aliases hashtable
9296         (LookupAlias): lookup alias in this and if needed in parent
9297         namespaces
9298
9299 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
9300
9301         * support.cs: 
9302
9303         * rootcontext.cs: (ModuleBuilder) Made static, first step into
9304         making things static.  I need this to avoid passing the
9305         TypeContainer when calling ParameterType.
9306
9307         * support.cs (InternalParameters.ParameterType): Remove ugly hack
9308         that did string manipulation to compute the type and then call
9309         GetType.  Use Parameter.ParameterType instead.
9310
9311         * cs-tokenizer.cs: Consume the suffix for floating values.
9312
9313         * expression.cs (ParameterReference): figure out whether this is a
9314         reference parameter or not.  Kill an extra variable by computing
9315         the arg_idx during emission.
9316
9317         * parameter.cs (Parameters.GetParameterInfo): New overloaded
9318         function that returns whether a parameter is an out/ref value or not.
9319
9320         (Parameter.ParameterType): The type of the parameter (base,
9321         without ref/out applied).
9322         
9323         (Parameter.Resolve): Perform resolution here.
9324         (Parameter.ExternalType): The full type (with ref/out applied).
9325
9326         * statement.cs (Using.Emit, Using.EmitExpression): Implement
9327         support for expressions on the using statement.
9328
9329 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
9330
9331         * statement.cs (Using.EmitLocalVariableDecls): Split the
9332         localvariable handling of the using statement.
9333
9334         (Block.EmitMeta): Keep track of variable count across blocks.  We
9335         were reusing slots on separate branches of blocks.
9336
9337         (Try.Emit): Emit the general code block, we were not emitting it. 
9338
9339         Check the type of the declaration to be an IDisposable or
9340         something that can be implicity converted to it. 
9341
9342         Emit conversions if required.
9343
9344         * ecore.cs (EmptyExpression): New utility class.
9345         (Expression.ImplicitConversionExists): New utility function.
9346
9347 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
9348
9349         * statement.cs (Using): Implement.
9350
9351         * expression.cs (LocalVariableReference): Support read only variables.
9352
9353         * statement.cs: Remove the explicit emit for the Leave opcode.
9354         (VariableInfo): Add a readonly field.
9355
9356 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
9357
9358         * ecore.cs (ConvCast): new class used to encapsulate the various
9359         explicit integer conversions that works in both checked and
9360         unchecked contexts.
9361
9362         (Expression.ConvertNumericExplicit): Use new ConvCast class to
9363         properly generate the overflow opcodes.
9364
9365 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
9366
9367         * statement.cs: The correct type for the EmptyExpression is the
9368         element_type, not the variable type.  Ravi pointed this out.
9369
9370 2001-12-04  Ravi Pratap  <ravi@ximian.com>
9371
9372         * class.cs (Method::Define): Handle PInvoke methods specially
9373         by using DefinePInvokeMethod instead of the usual one.
9374
9375         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
9376         above to do the task of extracting information and defining the method.
9377         
9378 2001-12-04  Ravi Pratap  <ravi@ximian.com>
9379
9380         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
9381         of the condition for string type.
9382
9383         (Emit): Move that here. 
9384
9385         (ArrayCreation::CheckIndices): Keep string literals in their expression
9386         form.
9387
9388         (EmitDynamicInitializers): Handle strings appropriately.
9389
9390 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
9391
9392         * codegen.cs (EmitContext): Replace multiple variables with a
9393         single pointer to the current Switch statement.
9394
9395         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
9396         EmitContext.
9397
9398 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
9399
9400         * statement.cs 
9401
9402         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
9403         default'.
9404         
9405         (Foreach.Emit): Foreach on arrays was not setting
9406         up the loop variables (for break/continue).
9407
9408         (GotoCase): Semi-implented.
9409         
9410 2001-12-03  Ravi Pratap  <ravi@ximian.com>
9411
9412         * attribute.cs (CheckAttribute): Handle system attributes by using
9413         Attribute.GetAttributes to examine information we need.
9414
9415         (GetValidPlaces): Same here.
9416
9417         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
9418
9419         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
9420
9421         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
9422
9423         (Method::Define): Set appropriate flags if we have a DllImport attribute.
9424
9425         (Method::Emit): Handle the case when we are a PInvoke method.
9426
9427 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
9428
9429         * expression.cs: Use ResolveWithSimpleName on compound names.
9430
9431 2001-12-02  Ravi Pratap  <ravi@ximian.com>
9432
9433         * constant.cs (EmitConstant): Make sure we resolve the associated expression
9434         before trying to reduce it.
9435
9436         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
9437
9438         * constant.cs (LookupConstantValue): Implement.
9439
9440         (EmitConstant): Use the above in emitting the constant.
9441
9442         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
9443         that are user-defined by doing a LookupConstantValue on them.
9444
9445         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
9446         too, like above.
9447
9448 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
9449
9450         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
9451
9452         (BaseAccess.DoResolve): Implement.
9453
9454         (MemberAccess.DoResolve): Split this routine into a
9455         ResolveMemberAccess routine that can be used independently
9456
9457 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
9458
9459         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
9460         As that share bits of the implementation.  Is returns a boolean,
9461         while As returns the Type that is being probed.
9462
9463 2001-12-01  Ravi Pratap  <ravi@ximian.com>
9464
9465         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
9466         instead of a Literal - much easier.
9467
9468         (EnumInTransit): Remove - utterly useless :-)
9469
9470         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
9471
9472         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
9473
9474         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
9475         chain when we have no associated expression.
9476
9477 2001-11-30  Ravi Pratap  <ravi@ximian.com>
9478
9479         * constant.cs (Define): Use Location while reporting the errror.
9480
9481         Also emit a warning when 'new' is used and there is no inherited
9482         member to hide.
9483
9484         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
9485         populated.
9486
9487         (LookupEnumValue): Implement to lookup an enum member's value and define it
9488         if necessary.
9489
9490         (Populate): Re-write accordingly to use the above routine.
9491
9492 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
9493
9494         * expression.cs (This): Fix prototype for DoResolveLValue to
9495         override the base class DoResolveLValue.
9496
9497         * cs-parser.cs: Report errors cs574 and cs575 (destructor
9498         declarations) 
9499
9500         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
9501         (we need to load the address of the field here).  This fixes
9502         test-22. 
9503         
9504         (FieldExpr.DoResolveLValue): Call the DoResolve
9505         function to initialize the Instance expression.
9506         
9507         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
9508         correctly the GetEnumerator operation on a value type.
9509
9510         * cs-parser.jay: Add more simple parsing error catches.
9511
9512         * statement.cs (Switch): Add support for string switches.
9513         Handle null specially.
9514
9515         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
9516
9517 2001-11-28  Ravi Pratap  <ravi@ximian.com>
9518
9519         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
9520
9521         (declare_local_constant): New helper function.
9522
9523         * statement.cs (AddConstant): Keep a separate record of constants
9524
9525         (IsConstant): Implement to determine if a variable is a constant.
9526
9527         (GetConstantExpression): Implement.
9528
9529         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
9530
9531         * statement.cs (IsVariableDefined): Re-write.
9532
9533 2001-11-27  Ravi Pratap  <ravi@ximian.com>
9534
9535         * class.cs (TypeContainer::FindMembers): Look for constants
9536         in the case when we are looking for MemberTypes.Field
9537
9538         * expression.cs (MemberAccess::DoResolve): Check that in the
9539         case we are a FieldExpr and a Literal, we are not being accessed
9540         by an instance reference.
9541
9542         * cs-parser.jay (local_constant_declaration): Implement.
9543
9544         (declaration_statement): Implement for constant declarations.
9545
9546 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
9547
9548         * statement.cs (Switch): Catch double defaults.
9549
9550         (Switch): More work on the switch() statement
9551         implementation.  It works for integral values now, need to finish
9552         string support.
9553
9554
9555 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9556
9557         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9558         integer literals into other integer literals.  To be used by
9559         switch. 
9560
9561 2001-11-24  Ravi Pratap  <ravi@ximian.com>
9562
9563         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9564         some memory.
9565
9566         (EmitDynamicInitializers): Cope with the above since we extract data
9567         directly from ArrayData now.
9568
9569         (ExpectInitializers): Keep track of whether initializers are mandatory
9570         or not.
9571
9572         (Bounds): Make it a hashtable to prevent the same dimension being 
9573         recorded for every element in that dimension.
9574
9575         (EmitDynamicInitializers): Fix bug which prevented the Set array method
9576         from being found.
9577
9578         Also fix bug which was causing the indices to be emitted in the reverse
9579         order.
9580
9581 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9582
9583         * expression.cs (ArrayCreation): Implement the bits that Ravi left
9584         unfinished.  They do not work, because the underlying code is
9585         sloppy.
9586
9587 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9588
9589         * cs-parser.jay: Remove bogus fixme.
9590
9591         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9592         on Switch statement.
9593         
9594 2001-11-23  Ravi Pratap  <ravi@ximian.com>
9595
9596         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9597         the same. 
9598         
9599         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9600         parameter. Apparently, any expression is allowed. 
9601
9602         (ValidateInitializers): Update accordingly.
9603
9604         (CheckIndices): Fix some tricky bugs thanks to recursion.
9605
9606         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
9607         I was being completely brain-dead.
9608
9609         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9610         and re-write acordingly.
9611
9612         (DelegateInvocation): Re-write accordingly.
9613
9614         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9615
9616         (MakeByteBlob): Handle types more correctly.
9617
9618         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9619         initialization from expressions but it is incomplete because I am a complete
9620         Dodo :-|
9621
9622 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9623
9624         * statement.cs (If.Emit): Fix a bug that generated incorrect code
9625         on If.  Basically, we have to return `true' (ie, we do return to
9626         our caller) only if both branches of the if return.
9627
9628         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9629         short-circuit operators, handle them as short circuit operators. 
9630
9631         (Cast.DoResolve): Resolve type.
9632         (Cast.Cast): Take an expression as the target type.
9633
9634         * cs-parser.jay (cast_expression): Remove old hack that only
9635         allowed a limited set of types to be handled.  Now we take a
9636         unary_expression and we resolve to a type during semantic
9637         analysis.
9638
9639         Use the grammar productions from Rhys to handle casts (this is
9640         not complete like Rhys syntax yet, we fail to handle that corner
9641         case that C# has regarding (-x), but we will get there.
9642         
9643 2001-11-22  Ravi Pratap  <ravi@ximian.com>
9644
9645         * class.cs (EmitFieldInitializer): Take care of the case when we have a
9646         field which is an array type.
9647
9648         * cs-parser.jay (declare_local_variables): Support array initialization too.
9649
9650         * typemanager.cs (MakeKey): Implement.
9651
9652         (everywhere): Use the above appropriately.
9653
9654         * cs-parser.jay (for_statement): Update for array initialization while
9655         declaring variables.
9656
9657         * ecore.cs : The error message was correct, it's the variable's names that
9658         were misleading ;-) Make the code more readable.
9659
9660         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9661         the correct type etc.
9662
9663         (ConvertExplicit): Handle Enum types by examining the underlying type.
9664
9665 2001-11-21  Ravi Pratap  <ravi@ximian.com>
9666
9667         * parameter.cs (GetCallingConvention): Always return
9668         CallingConventions.Standard for now.
9669
9670 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9671
9672         * expression.cs (Binary.ResolveOperator): Update the values of `l'
9673         and `r' after calling DoNumericPromotions.
9674
9675         * ecore.cs: Fix error message (the types were in the wrong order).
9676
9677         * statement.cs (Foreach.ProbeCollectionType): Need to pass
9678         BindingFlags.Instance as well 
9679
9680         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9681         implicit int literal conversion in an empty cast so that we
9682         propagate the right type upstream.
9683
9684         (UnboxCast): new class used to unbox value types.
9685         (Expression.ConvertExplicit): Add explicit type conversions done
9686         by unboxing.
9687
9688         (Expression.ImplicitNumericConversion): Oops, forgot to test for
9689         the target type before applying the implicit LongLiterals to ULong
9690         literal cast.
9691
9692 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
9693
9694         * cs-parser.jay (for_statement): Reworked the way For works: now
9695         we declare manually any variables that are introduced in
9696         for_initializer to solve the problem of having out-of-band code
9697         emition (that is what got for broken).
9698
9699         (declaration_statement): Perform the actual variable declaration
9700         that used to be done in local_variable_declaration here.
9701
9702         (local_variable_declaration): Do not declare anything, just pass
9703         the information on a DictionaryEntry
9704
9705 2001-11-20  Ravi Pratap  <ravi@ximian.com>
9706
9707         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9708         re-write of the logic to now make it recursive.
9709
9710         (UpdateIndices): Re-write accordingly.
9711
9712         Store element data in a separate ArrayData list in the above methods.
9713
9714         (MakeByteBlob): Implement to dump the array data into a byte array.
9715
9716 2001-11-19  Ravi Pratap  <ravi@ximian.com>
9717
9718         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9719         into CheckIndices.
9720
9721         * constant.cs (Define): Implement.
9722
9723         (EmitConstant): Re-write fully.
9724
9725         Pass in location info.
9726
9727         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9728         respectively.
9729
9730         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9731         DictionaryEntry since we need location info too.
9732
9733         (constant_declaration): Update accordingly.
9734
9735         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9736         code into another method : UpdateIndices.
9737
9738 2001-11-18  Ravi Pratap  <ravi@ximian.com>
9739
9740         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9741         some type checking etc.
9742
9743 2001-11-17  Ravi Pratap  <ravi@ximian.com>
9744
9745         * expression.cs (ArrayCreation::ValidateInitializers): Implement
9746         bits to provide dimension info if the user skips doing that.
9747
9748         Update second constructor to store the rank correctly.
9749
9750 2001-11-16  Ravi Pratap  <ravi@ximian.com>
9751
9752         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9753         and try to implement.
9754
9755         * ../errors/cs0150.cs : Add.
9756
9757         * ../errors/cs0178.cs : Add.
9758
9759 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
9760
9761         * statement.cs: Implement foreach on multi-dimensional arrays. 
9762
9763         * parameter.cs (Parameters.GetParameterByName): Also lookup the
9764         name of the params argument.
9765
9766         * expression.cs: Use EmitStoreOpcode to get the right opcode while
9767         initializing the array.
9768
9769         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9770         we can use this elsewhere.
9771
9772         * statement.cs: Finish implementation of foreach for single
9773         dimension arrays.
9774
9775         * cs-parser.jay: Use an out-of-band stack to pass information
9776         around, I wonder why I need this.
9777
9778         foreach_block: Make the new foreach_block the current_block.
9779
9780         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9781         function used to return a static Parameters structure.  Used for
9782         empty parameters, as those are created very frequently.
9783
9784         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9785
9786 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9787
9788         * interface.cs : Default modifier is private, not public. The
9789         make verify test passes again.
9790
9791 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9792
9793         * support.cs (ReflectionParameters): Fix logic to determine
9794         whether the last parameter is a params one. Test 9 passes again.
9795
9796         * delegate.cs (Populate): Register the builders we define with
9797         RegisterParameterForBuilder. Test 19 passes again.
9798
9799         * cs-parser.jay (property_declaration): Reference $6 instead
9800         of $$ to get at the location.
9801
9802         (indexer_declaration): Similar stuff.
9803
9804         (attribute): Ditto.
9805
9806         * class.cs (Property): Register parameters for the Get and Set methods
9807         if they exist. Test 23 passes again.
9808
9809         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9810         call to EmitArguments as we are sure there aren't any params arguments. 
9811         Test 32 passes again.
9812
9813         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9814         IndexOutOfRangeException. 
9815
9816         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9817         Test 33 now passes again.
9818         
9819 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
9820
9821         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9822         broke a bunch of things.  Will have to come up with a better way
9823         of tracking locations.
9824
9825         * statement.cs: Implemented foreach for single dimension arrays.
9826
9827 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
9828
9829         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9830         an error.  This removes the lookup from the critical path.
9831
9832         * cs-parser.jay: Removed use of temporary_loc, which is completely
9833         broken. 
9834
9835 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
9836
9837         * support.cs (ReflectionParameters.ParameterModifier): Report
9838         whether the argument is a PARAMS argument or not.
9839
9840         * class.cs: Set the attribute `ParamArrayAttribute' on the
9841         parameter argument.
9842
9843         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9844         and cons_param_array_attribute (ConstructorInfo for
9845         ParamArrayAttribute)., 
9846
9847         * codegen.cs: Emit the return using the `Return' statement, that
9848         way we can report the error correctly for missing return values. 
9849
9850         * class.cs (Method.Emit): Clean up.
9851
9852         * expression.cs (Argument.Resolve): Take another argument: the
9853         location where this argument is used.  Notice that this is not
9854         part of the "Argument" class as to reduce the size of the
9855         structure (we know the approximate location anyways).
9856
9857         Test if the argument is a variable-reference, if not, then
9858         complain with a 206.
9859
9860         (Argument.Emit): Emit addresses of variables.
9861
9862         (Argument.FullDesc): Simplify.
9863
9864         (Invocation.DoResolve): Update for Argument.Resolve.
9865
9866         (ElementAccess.DoResolve): ditto.
9867
9868         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9869         method should be virtual, as this method is always virtual.
9870
9871         (NewDelegate.DoResolve): Update for Argument.Resolve.
9872
9873         * class.cs (ConstructorInitializer.DoResolve): ditto.
9874         
9875         * attribute.cs (Attribute.Resolve): ditto.
9876
9877 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
9878
9879         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9880
9881         * expression.cs (ParameterReference): Drop IStackStorage and implement
9882         IAssignMethod instead. 
9883
9884         (LocalVariableReference): ditto.
9885         
9886         * ecore.cs (FieldExpr): Drop IStackStorage and implement
9887         IAssignMethod instead. 
9888
9889 2001-11-13  Miguel de Icaza <miguel@ximian.com>
9890
9891         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9892         enumerations that are used in heavily used structures derive from
9893         byte in a laughable and pathetic attempt to reduce memory usage.
9894         This is the kind of pre-optimzations that you should not do at
9895         home without adult supervision.
9896
9897         * expression.cs (UnaryMutator): New class, used to handle ++ and
9898         -- separatedly from the other unary operators.  Cleans up the
9899         code, and kills the ExpressionStatement dependency in Unary.
9900
9901         (Unary): Removed `method' and `Arguments' from this class, making
9902         it smaller, and moving it all to SimpleCall, so I can reuse this
9903         code in other locations and avoid creating a lot of transient data
9904         strucutres when not required.
9905
9906         * cs-parser.jay: Adjust for new changes.
9907
9908 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
9909
9910         * enum.cs (Enum.Populate): If there is a failure during
9911         definition, return
9912
9913         * cs-parser.jay (opt_enum_base): we used to catch type errors
9914         here, but this is really incorrect.  The type error should be
9915         catched during semantic analysis.
9916
9917 2001-12-11  Ravi Pratap  <ravi@ximian.com>
9918
9919         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9920         current_local_parameters as expected since I, in my stupidity, had forgotten
9921         to do this :-)
9922
9923         * attribute.cs (GetValidPlaces): Fix stupid bug.
9924
9925         * class.cs (Method::Emit): Perform check on applicability of attributes.
9926
9927         (Constructor::Emit): Ditto.
9928
9929         (Field::Emit): Ditto.
9930
9931         (Field.Location): Store location information.
9932
9933         (Property, Event, Indexer, Operator): Ditto.
9934
9935         * cs-parser.jay (field_declaration): Pass in location for each field.
9936
9937         * ../errors/cs0592.cs : Add.
9938
9939 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9940
9941         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9942
9943         (InitCoreTypes): Update accordingly.
9944
9945         (RegisterAttrType, LookupAttr): Implement.
9946
9947         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9948         info about the same.
9949
9950         (Resolve): Update to populate the above as necessary.
9951
9952         (Error592): Helper.
9953
9954         (GetValidPlaces): Helper to the above.
9955
9956         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9957
9958         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9959
9960 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9961
9962         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9963
9964         * ../errors/cs0617.cs : Add.
9965
9966 2001-11-11  Ravi Pratap  <ravi@ximian.com>
9967
9968         * enum.cs (Emit): Rename to Populate to be more consistent with what
9969         we expect it to do and when exactly it is called.
9970
9971         * class.cs, rootcontext.cs : Update accordingly.
9972
9973         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9974         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9975
9976         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9977
9978         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9979         of a fieldinfo using the above, when dealing with a FieldBuilder.
9980
9981 2001-11-10  Ravi Pratap  <ravi@ximian.com>
9982
9983         * ../errors/cs0031.cs : Add.
9984
9985         * ../errors/cs1008.cs : Add.
9986
9987         * ../errrors/cs0543.cs : Add.
9988
9989         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9990         enum type.
9991
9992         (FindMembers): Implement.
9993
9994         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9995         enums and delegates too.
9996
9997         (enum_types): Rename to builder_to_enum.
9998
9999         (delegate_types): Rename to builder_to_delegate.
10000
10001         * delegate.cs (FindMembers): Implement.
10002
10003 2001-11-09  Ravi Pratap  <ravi@ximian.com>
10004
10005         * typemanager.cs (IsEnumType): Implement.
10006
10007         * enum.cs (Emit): Re-write parts to account for the underlying type
10008         better and perform checking etc.
10009
10010         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
10011         of the underlying type.
10012
10013         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
10014         value
10015
10016         * enum.cs (error31): Helper to report error #31.
10017
10018         * cs-parser.jay (enum_declaration): Store location of each member too.
10019
10020         * enum.cs (member_to_location): New hashtable. 
10021
10022         (AddEnumMember): Update location hashtable.
10023
10024         (Emit): Use the location of each member while reporting errors.
10025
10026 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
10027
10028         * cs-parser.jay: A for_initializer if is a
10029         local_variable_declaration really ammount to have an implicit
10030         block with the variable declaration and no initializer for for.
10031
10032         * statement.cs (For.Emit): Cope with null initializers.
10033
10034         This fixes the infinite loop on for initializers.
10035
10036 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
10037
10038         * enum.cs: More cleanup.
10039
10040         * ecore.cs: Remove dead code.
10041
10042         * class.cs (Property.Emit): More simplification.
10043         (Event.Emit): ditto.
10044
10045         Reworked to have less levels of indentation.
10046         
10047 2001-11-08  Ravi Pratap  <ravi@ximian.com>
10048
10049         * class.cs (Property): Emit attributes.
10050
10051         (Field): Ditto.
10052         
10053         (Event): Ditto.
10054
10055         (Indexer): Ditto.
10056
10057         (Operator): Ditto.
10058
10059         * enum.cs (Emit): Ditto.
10060
10061         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
10062         Enums too.
10063
10064         * class.cs (Field, Event, etc.): Move attribute generation into the
10065         Emit method everywhere.
10066
10067         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
10068         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
10069         as we had no way of defining nested enums !
10070
10071         * rootcontext.cs : Adjust code accordingly.
10072
10073         * typemanager.cs (AddEnumType): To keep track of enum types separately.
10074
10075 2001-11-07  Ravi Pratap  <ravi@ximian.com>
10076
10077         * expression.cs (EvalConstantExpression): Move into ecore.cs
10078         
10079         * enum.cs (Enum): Rename some members and make them public and readonly
10080         according to our convention.
10081
10082         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
10083         nothing else.
10084
10085         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
10086
10087         (Enum::Emit): Write a simple version for now which doesn't try to compute
10088         expressions. I shall modify this to be more robust in just a while.
10089
10090         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
10091
10092         (TypeContainer::CloseType): Create the Enum types too.
10093
10094         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
10095
10096         * expression.cs (EvalConstantExpression): Get rid of completely.
10097
10098         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
10099         user-defined values and other cases.
10100
10101         (IsValidEnumLiteral): Helper function.
10102
10103         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
10104         out there in the case we had a literal FieldExpr.
10105
10106         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
10107
10108         (Literalize): Revamp a bit to take two arguments.
10109         
10110         (EnumLiteral): New class which derives from Literal to wrap enum literals.
10111         
10112 2001-11-06  Ravi Pratap  <ravi@ximian.com>
10113
10114         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
10115
10116         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
10117
10118         (Resolve): Use the above to ensure we have proper initializers.
10119
10120 2001-11-05  Ravi Pratap  <ravi@ximian.com>
10121
10122         * expression.cs (Expression::EvalConstantExpression): New method to 
10123         evaluate constant expressions.
10124
10125         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
10126
10127 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
10128
10129         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
10130         in an array.
10131
10132         (Binary.ResolveOperator): Handle operator != (object a, object b)
10133         and operator == (object a, object b);
10134
10135         (Binary.DoNumericPromotions): Indicate whether the numeric
10136         promotion was possible.
10137
10138         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
10139         Implement.  
10140
10141         Made the ArrayAccess implement interface IAssignMethod instead of
10142         IStackStore as the order in which arguments are passed reflects
10143         this.
10144
10145         * assign.cs: Instead of using expr.ExprClass to select the way of
10146         assinging, probe for the IStackStore/IAssignMethod interfaces.
10147
10148         * typemanager.cs: Load InitializeArray definition.
10149
10150         * rootcontext.cs (RootContext.MakeStaticData): Used to define
10151         static data that can be used to initialize arrays. 
10152
10153 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
10154
10155         * expression.cs: Handle operator== and operator!= for booleans.
10156
10157         (Conditioal.Reduce): Implement reducer for the ?: operator.
10158
10159         (Conditional.Resolve): Implement dead code elimination.
10160
10161         (Binary.Resolve): Catch string literals and return a new
10162         concatenated string.
10163
10164         (Unary.Reduce): Implement reduction of unary expressions.
10165
10166         * ecore.cs: Split out the expression core handling here.
10167
10168         (Expression.Reduce): New method used to perform constant folding
10169         and CSE.  This is needed to support constant-expressions. 
10170         
10171         * statement.cs (Statement.EmitBoolExpression): Pass true and false
10172         targets, and optimize for !x.
10173
10174 2001-11-04  Ravi Pratap  <ravi@ximian.com>
10175
10176         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
10177         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
10178         set custom atttributes.
10179
10180         * literal.cs (Literal::GetValue): New abstract method to return the actual
10181         value of the literal, cast as an object.
10182
10183         (*Literal): Implement GetValue method.
10184
10185         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
10186         expressions to the arraylist but objects of type Argument.
10187
10188         * class.cs (TypeContainer::Emit): Emit our attributes too.
10189
10190         (Method::Emit, Constructor::Emit): Ditto.
10191
10192         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
10193         to be ignoring earlier.
10194
10195 2001-11-03  Ravi Pratap  <ravi@ximian.com>
10196
10197         * attribute.cs (AttributeSection::Define): Implement to do the business
10198         of constructing a CustomAttributeBuilder.
10199
10200         (Attribute): New trivial class. Increases readability of code.  
10201
10202         * cs-parser.jay : Update accordingly.
10203
10204         (positional_argument_list, named_argument_list, named_argument): New rules
10205
10206         (attribute_arguments): Use the above so that we are more correct.
10207         
10208 2001-11-02  Ravi Pratap  <ravi@ximian.com>
10209         
10210         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
10211         to perform all checks for a method with a params parameter.
10212
10213         (Invocation::OverloadResolve): Update to use the above method and therefore
10214         cope correctly with params method invocations.
10215
10216         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
10217         params too.
10218
10219         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
10220         constructors in our parent too because we can't afford to miss out on 
10221         protected ones ;-)
10222
10223         * attribute.cs (AttributeSection): New name for the class Attribute
10224
10225         Other trivial changes to improve readability.
10226
10227         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
10228         use the new class names.
10229         
10230 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10231
10232         * class.cs (Method::Define): Complete definition for params types too
10233
10234         (Indexer::Define): Ditto.
10235
10236         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
10237         Cope everywhere with a request for info about the array parameter.
10238
10239 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10240
10241         * tree.cs (RecordNamespace): Fix up to check for the correct key.
10242
10243         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
10244         local_variable_type to extract the string corresponding to the type.
10245
10246         (local_variable_type): Fixup the action to use the new helper method.
10247
10248         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
10249         go.
10250
10251         * expression.cs : Clean out code which uses the above.
10252
10253 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10254         
10255         * typemanager.cs (RegisterMethod): Check if we already have an existing key
10256         and bale out if necessary by returning a false.
10257
10258         (RegisterProperty): Ditto.
10259
10260         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
10261         and print out appropriate error messages.
10262
10263         * interface.cs (everywhere): Ditto.
10264
10265         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
10266         location to constructor.
10267
10268         * class.cs (Property, Event, Indexer): Update accordingly.
10269
10270         * ../errors/cs111.cs : Added.
10271
10272         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
10273         of a method, as laid down by the spec.
10274
10275         (Invocation::OverloadResolve): Use the above method.
10276
10277 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10278
10279         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
10280         now take a TypeContainer and a Parameters object.
10281
10282         (ParameterData): Modify return type of ParameterModifier method to be 
10283         Parameter.Modifier and not a string.
10284
10285         (ReflectionParameters, InternalParameters): Update accordingly.
10286
10287         * expression.cs (Argument::GetParameterModifier): Same here.
10288
10289         * support.cs (InternalParameters::ParameterType): Find a better way of determining
10290         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
10291         symbol in it at all so maybe this is only for now.
10292
10293 2001-10-30  Ravi Pratap  <ravi@ximian.com>
10294
10295         * support.cs (InternalParameters): Constructor now takes an extra argument 
10296         which is the actual Parameters class.
10297
10298         (ParameterDesc): Update to provide info on ref/out modifiers.
10299
10300         * class.cs (everywhere): Update call to InternalParameters to pass in
10301         the second argument too.
10302
10303         * support.cs (ParameterData): Add ParameterModifier, which is a method 
10304         to return the modifier info [ref/out etc]
10305
10306         (InternalParameters, ReflectionParameters): Implement the above.
10307
10308         * expression.cs (Argument::ParameterModifier): Similar function to return
10309         info about the argument's modifiers.
10310
10311         (Invocation::OverloadResolve): Update to take into account matching modifiers 
10312         too.
10313
10314         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
10315         a new SetFormalParameters object which we pass to InternalParameters.
10316
10317 2001-10-30  Ravi Pratap  <ravi@ximian.com>
10318
10319         * expression.cs (NewArray): Merge into the ArrayCreation class.
10320
10321 2001-10-29  Ravi Pratap  <ravi@ximian.com>
10322
10323         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
10324         NewUserdefinedArray into one as there wasn't much of a use in having
10325         two separate ones.
10326
10327         * expression.cs (Argument): Change field's name to ArgType from Type.
10328
10329         (Type): New readonly property which returns the proper type, taking into 
10330         account ref/out modifiers.
10331
10332         (everywhere): Adjust code accordingly for the above.
10333
10334         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
10335         whether we are emitting for a ref or out parameter.
10336
10337         * expression.cs (Argument::Emit): Use the above field to set the state.
10338
10339         (LocalVariableReference::Emit): Update to honour the flag and emit the
10340         right stuff.
10341
10342         * parameter.cs (Attributes): Set the correct flags for ref parameters.
10343
10344         * expression.cs (Argument::FullDesc): New function to provide a full desc.
10345
10346         * support.cs (ParameterData): Add method ParameterDesc to the interface.
10347
10348         (ReflectionParameters, InternalParameters): Implement the above method.
10349
10350         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
10351         reporting errors.
10352
10353         (Invocation::FullMethodDesc): Ditto. 
10354
10355 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
10356
10357         * cs-parser.jay: Add extra production for the second form of array
10358         creation. 
10359
10360         * expression.cs (ArrayCreation): Update to reflect the above
10361         change. 
10362
10363         * Small changes to prepare for Array initialization.
10364
10365 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
10366
10367         * typemanager.cs (ImplementsInterface): interface might be null;
10368         Deal with this problem;
10369
10370         Also, we do store negative hits on the cache (null values), so use
10371         this instead of calling t.GetInterfaces on the type everytime.
10372
10373 2001-10-28  Ravi Pratap  <ravi@ximian.com>
10374
10375         * typemanager.cs (IsBuiltinType): New method to help determine the same.
10376
10377         * expression.cs (New::DoResolve): Get rid of array creation code and instead
10378         split functionality out into different classes.
10379
10380         (New::FormArrayType): Move into NewBuiltinArray.
10381
10382         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
10383         quite useless.
10384
10385         (NewBuiltinArray): New class to handle creation of built-in arrays.
10386
10387         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
10388         account creation of one-dimensional arrays.
10389
10390         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
10391
10392         (NewUserdefinedArray::DoResolve): Implement.
10393
10394         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
10395
10396         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
10397         we maintain inside the TypeManager. This is necessary to perform lookups on the
10398         module builder.
10399
10400         (LookupType): Update to perform GetType on the module builders too.     
10401
10402         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
10403
10404         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
10405
10406 2001-10-23  Ravi Pratap  <ravi@ximian.com>
10407
10408         * expression.cs (New::DoResolve): Implement guts of array creation.
10409
10410         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
10411         
10412 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
10413
10414         * expression.cs: Fix bug I introduced lsat night that broke
10415         Delegates. 
10416
10417         (Expression.Resolve): Report a 246 error (can not resolve name)
10418         if we find a SimpleName in the stream.
10419         
10420         (Expression.ResolveLValue): Ditto.
10421         
10422         (Expression.ResolveWithSimpleName): This function is a variant of
10423         ResolveName, this one allows SimpleNames to be returned without a
10424         warning.  The only consumer of SimpleNames is MemberAccess
10425
10426 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
10427
10428         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
10429         might arrive here.  I have my doubts that this is correct.
10430
10431         * statement.cs (Lock): Implement lock statement.
10432
10433         * cs-parser.jay: Small fixes to support `lock' and `using'
10434
10435         * cs-tokenizer.cs: Remove extra space
10436
10437         * driver.cs: New flag --checked, allows to turn on integer math
10438         checking. 
10439
10440         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
10441         Threading.Monitor.Exit 
10442         
10443 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
10444
10445         * expression.cs (IndexerAccess::DoResolveLValue): Set the
10446         Expression Class to be IndexerAccess.
10447
10448         Notice that Indexer::DoResolve sets the eclass to Value.
10449
10450 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
10451
10452         * class.cs (TypeContainer::Emit): Emit code for indexers.
10453
10454         * assign.cs (IAssignMethod): New interface implemented by Indexers
10455         and Properties for handling assignment.
10456
10457         (Assign::Emit): Simplify and reuse code. 
10458         
10459         * expression.cs (IndexerAccess, PropertyExpr): Implement
10460         IAssignMethod, clean up old code. 
10461
10462 2001-10-22  Ravi Pratap  <ravi@ximian.com>
10463
10464         * typemanager.cs (ImplementsInterface): New method to determine if a type
10465         implements a given interface. Provides a nice cache too.
10466
10467         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
10468         method.
10469
10470         (ConvertReferenceExplicit): Ditto.
10471
10472         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
10473         various methods, with correct names etc.
10474
10475         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
10476         Operator.UnaryNegation.
10477
10478         * cs-parser.jay (operator_declarator): Be a little clever in the case where
10479         we have a unary plus or minus operator.
10480
10481         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
10482         UnaryMinus.
10483
10484         * everywhere : update accordingly.
10485
10486         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
10487         respectively.
10488
10489         * class.cs (Method::Define): For the case where we are implementing a method
10490         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
10491         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
10492         
10493 2001-10-21  Ravi Pratap  <ravi@ximian.com>
10494
10495         * interface.cs (FindMembers): Implement to work around S.R.E
10496         lameness.
10497
10498         * typemanager.cs (IsInterfaceType): Implement.
10499
10500         (FindMembers): Update to handle interface types too.
10501
10502         * expression.cs (ImplicitReferenceConversion): Re-write bits which
10503         use IsAssignableFrom as that is not correct - it doesn't work.
10504
10505         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
10506         and accordingly override EmitStatement.
10507
10508         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
10509         using the correct logic :-)
10510
10511 2001-10-19  Ravi Pratap  <ravi@ximian.com>
10512
10513         * ../errors/cs-11.cs : Add to demonstrate error -11 
10514
10515 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
10516
10517         * assign.cs (Assign::Resolve): Resolve right hand side first, and
10518         then pass this as a hint to ResolveLValue.
10519         
10520         * expression.cs (FieldExpr): Add Location information
10521
10522         (FieldExpr::LValueResolve): Report assignment to readonly
10523         variable. 
10524         
10525         (Expression::ExprClassFromMemberInfo): Pass location information.
10526
10527         (Expression::ResolveLValue): Add new method that resolves an
10528         LValue. 
10529
10530         (Expression::DoResolveLValue): Default invocation calls
10531         DoResolve. 
10532
10533         (Indexers): New class used to keep track of indexers in a given
10534         Type. 
10535
10536         (IStackStore): Renamed from LValue, as it did not really describe
10537         what this did.  Also ResolveLValue is gone from this interface and
10538         now is part of Expression.
10539
10540         (ElementAccess): Depending on the element access type
10541         
10542         * typemanager.cs: Add `indexer_name_type' as a Core type
10543         (System.Runtime.CompilerServices.IndexerNameAttribute)
10544
10545         * statement.cs (Goto): Take a location.
10546         
10547 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10548
10549         * delegate.cs (Delegate::VerifyDelegate): New method to verify
10550         if two delegates are compatible.
10551
10552         (NewDelegate::DoResolve): Update to take care of the case when
10553         we instantiate a delegate from another delegate.
10554
10555         * typemanager.cs (FindMembers): Don't even try to look up members
10556         of Delegate types for now.
10557
10558 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10559
10560         * delegate.cs (NewDelegate): New class to take care of delegate
10561         instantiation.
10562
10563         * expression.cs (New): Split the delegate related code out into 
10564         the NewDelegate class.
10565
10566         * delegate.cs (DelegateInvocation): New class to handle delegate 
10567         invocation.
10568
10569         * expression.cs (Invocation): Split out delegate related code into
10570         the DelegateInvocation class.
10571
10572 2001-10-17  Ravi Pratap  <ravi@ximian.com>
10573
10574         * expression.cs (New::DoResolve): Implement delegate creation fully
10575         and according to the spec.
10576
10577         (New::DoEmit): Update to handle delegates differently.
10578
10579         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10580         because of which we were printing out arguments in reverse order !
10581
10582         * delegate.cs (VerifyMethod): Implement to check if the given method
10583         matches the delegate.
10584
10585         (FullDelegateDesc): Implement.
10586
10587         (VerifyApplicability): Implement.
10588
10589         * expression.cs (Invocation::DoResolve): Update to accordingly handle
10590         delegate invocations too.
10591
10592         (Invocation::Emit): Ditto.
10593
10594         * ../errors/cs1593.cs : Added.
10595
10596         * ../errors/cs1594.cs : Added.
10597
10598         * delegate.cs (InstanceExpression, TargetMethod): New properties.
10599
10600 2001-10-16  Ravi Pratap  <ravi@ximian.com>
10601
10602         * typemanager.cs (intptr_type): Core type for System.IntPtr
10603
10604         (InitCoreTypes): Update for the same.
10605
10606         (iasyncresult_type, asynccallback_type): Ditto.
10607
10608         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10609         correct.
10610
10611         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10612         too.
10613
10614         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10615         the builders for the 4 members of a delegate type :-)
10616
10617         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10618         type.
10619
10620         * expression.cs (New::DoResolve): Implement guts for delegate creation.
10621
10622         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10623
10624 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
10625
10626         * statement.cs (Break::Emit): Implement.   
10627         (Continue::Emit): Implement.
10628
10629         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10630         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10631         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10632         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
10633         end loop
10634         
10635         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10636         properties that track the label for the current loop (begin of the
10637         loop and end of the loop).
10638
10639 2001-10-15  Ravi Pratap  <ravi@ximian.com>
10640
10641         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10642         use of emitting anything at all.
10643
10644         * class.cs, rootcontext.cs : Get rid of calls to the same.
10645
10646         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10647
10648         (Populate): Define the constructor correctly and set the implementation
10649         attributes.
10650
10651         * typemanager.cs (delegate_types): New hashtable to hold delegates that
10652         have been defined.
10653
10654         (AddDelegateType): Implement.
10655
10656         (IsDelegateType): Implement helper method.
10657
10658         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10659
10660         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10661         and accordingly handle it.
10662
10663         * delegate.cs (Populate): Take TypeContainer argument.
10664         Implement bits to define the Invoke method. However, I still haven't figured out
10665         how to take care of the native int bit :-(
10666
10667         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
10668         Qualify the name of the delegate, not its return type !
10669
10670         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10671         conversion.
10672
10673         (StandardConversionExists): Checking for array types turns out to be recursive.
10674
10675         (ConvertReferenceExplicit): Implement array conversion.
10676
10677         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10678         
10679 2001-10-12  Ravi Pratap  <ravi@ximian.com>
10680
10681         * cs-parser.jay (delegate_declaration): Store the fully qualified
10682         name as it is a type declaration.
10683
10684         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
10685         readonly.
10686
10687         (DefineDelegate): Renamed from Define. Does the same thing essentially,
10688         as TypeContainer::DefineType.
10689
10690         (Populate): Method in which all the definition of the various methods (Invoke)
10691         etc is done.
10692
10693         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10694         see.
10695         
10696         (CloseDelegate): Finally creates the delegate.
10697
10698         * class.cs (TypeContainer::DefineType): Update to define delegates.
10699         (Populate, Emit and CloseType): Do the same thing here too.
10700
10701         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10702         delegates in all these operations.
10703
10704 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
10705
10706         * expression.cs: LocalTemporary: a new expression used to
10707         reference a temporary that has been created.
10708
10709         * assign.cs: Handle PropertyAccess back here, so that we can
10710         provide the proper semantic access to properties.
10711
10712         * expression.cs (Expression::ConvertReferenceExplicit): Implement
10713         a few more explicit conversions. 
10714
10715         * modifiers.cs: `NEW' modifier maps to HideBySig.
10716
10717         * expression.cs (PropertyExpr): Make this into an
10718         ExpressionStatement, and support the EmitStatement code path. 
10719
10720         Perform get/set error checking, clean up the interface.
10721
10722         * assign.cs: recognize PropertyExprs as targets, and if so, turn
10723         them into toplevel access objects.
10724
10725 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
10726
10727         * expression.cs: PropertyExpr::PropertyExpr: use work around the
10728         SRE.
10729
10730         * typemanager.cs: Keep track here of our PropertyBuilders again to
10731         work around lameness in SRE.
10732
10733 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
10734
10735         * expression.cs (LValue::LValueResolve): New method in the
10736         interface, used to perform a second resolution pass for LValues. 
10737         
10738         (This::DoResolve): Catch the use of this in static methods.
10739
10740         (This::LValueResolve): Implement.
10741
10742         (This::Store): Remove warning, assigning to `this' in structures
10743         is 
10744
10745         (Invocation::Emit): Deal with invocation of
10746         methods on value types.  We need to pass the address to structure
10747         methods rather than the object itself.  (The equivalent code to
10748         emit "this" for structures leaves the entire structure on the
10749         stack instead of a pointer to it). 
10750
10751         (ParameterReference::DoResolve): Compute the real index for the
10752         argument based on whether the method takes or not a `this' pointer
10753         (ie, the method is static).
10754
10755         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10756         value types returned from functions when we need to invoke a
10757         method on the sturcture.
10758         
10759
10760 2001-10-11  Ravi Pratap  <ravi@ximian.com>
10761
10762         * class.cs (TypeContainer::DefineType): Method to actually do the business of
10763         defining the type in the Modulebuilder or Typebuilder. This is to take
10764         care of nested types which need to be defined on the TypeBuilder using
10765         DefineNestedMethod.
10766
10767         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
10768         methods in RootContext, only ported to be part of TypeContainer.
10769
10770         (TypeContainer::GetInterfaceOrClass): Ditto.
10771
10772         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10773
10774         * interface.cs (Interface::DefineInterface): New method. Does exactly
10775         what RootContext.CreateInterface did earlier, only it takes care of nested types 
10776         too.
10777
10778         (Interface::GetInterfaces): Move from RootContext here and port.
10779
10780         (Interface::GetInterfaceByName): Same here.
10781
10782         * rootcontext.cs (ResolveTree): Re-write.
10783
10784         (PopulateTypes): Re-write.
10785
10786         * class.cs (TypeContainer::Populate): Populate nested types too.
10787         (TypeContainer::Emit): Emit nested members too.
10788
10789         * typemanager.cs (AddUserType): Do not make use of the FullName property,
10790         instead just use the name argument passed in as it is already fully
10791         qualified.
10792
10793         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10794         to TypeContainer mapping to see if a type is user-defined.
10795
10796         * class.cs (TypeContainer::CloseType): Implement. 
10797
10798         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10799         the default constructor.
10800         
10801         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10802         twice.
10803
10804         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10805
10806         * interface.cs (CloseType): Create the type here.
10807         
10808         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10809         the hierarchy.
10810
10811         Remove all the methods which are now in TypeContainer.
10812
10813 2001-10-10  Ravi Pratap  <ravi@ximian.com>
10814
10815         * delegate.cs (Define): Re-write bits to define the delegate
10816         correctly.
10817
10818 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
10819
10820         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10821
10822         * expression.cs (ImplicitReferenceConversion): handle null as well
10823         as a source to convert to any reference type.
10824
10825         * statement.cs (Return): Perform any implicit conversions to
10826         expected return type.  
10827
10828         Validate use of return statement.  
10829
10830         * codegen.cs (EmitContext): Pass the expected return type here.
10831
10832         * class.cs (Method, Constructor, Property): Pass expected return
10833         type to EmitContext.
10834
10835 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
10836
10837         * expression.cs: Make DoResolve take an EmitContext instead of a
10838         TypeContainer.
10839
10840         Replaced `l' and `location' for `loc', for consistency.
10841         
10842         (Error, Warning): Remove unneeded Tc argument.
10843
10844         * assign.cs, literal.cs, constant.cs: Update to new calling
10845         convention. 
10846         
10847         * codegen.cs: EmitContext now contains a flag indicating whether
10848         code is being generated in a static method or not.
10849
10850         * cs-parser.jay: DecomposeQI, new function that replaces the old
10851         QualifiedIdentifier.  Now we always decompose the assembled
10852         strings from qualified_identifier productions into a group of
10853         memberaccesses.
10854
10855 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
10856
10857         * rootcontext.cs: Deal with field-less struct types correctly now
10858         by passing the size option to Define Type.
10859
10860         * class.cs: Removed hack that created one static field. 
10861
10862 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10863
10864         * statement.cs: Moved most of the code generation here. 
10865
10866 2001-10-09  Ravi Pratap  <ravi@ximian.com>
10867
10868         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10869         seem very right.
10870
10871         (ElementAccess): Remove useless bits for now - keep checks as the spec
10872         says.
10873
10874 2001-10-08  Ravi Pratap  <ravi@ximian.com>
10875
10876         * expression.cs (ElementAccess::DoResolve): Remove my crap code
10877         and start performing checks according to the spec.
10878
10879 2001-10-07  Ravi Pratap  <ravi@ximian.com>
10880
10881         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10882         rank_specifiers instead.
10883
10884         (rank_specifiers): Change the order in which the rank specifiers are stored
10885
10886         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10887
10888         * expression.cs (ElementAccess): Implement the LValue interface too.
10889         
10890 2001-10-06  Ravi Pratap  <ravi@ximian.com>
10891         
10892         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10893         except that user defined conversions are not included.
10894
10895         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
10896         perform the conversion of the return type, if necessary.
10897
10898         (New::DoResolve): Check whether we are creating an array or an object
10899         and accordingly do the needful.
10900
10901         (New::Emit): Same here.
10902
10903         (New::DoResolve): Implement guts of array creation.
10904
10905         (New::FormLookupType): Helper function.
10906
10907 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10908
10909         * codegen.cs: Removed most of the code generation here, and move the
10910         corresponding code generation bits to the statement classes. 
10911
10912         Added support for try/catch/finalize and throw.
10913         
10914         * cs-parser.jay: Added support for try/catch/finalize.
10915
10916         * class.cs: Catch static methods having the flags override,
10917         virtual or abstract.
10918
10919         * expression.cs (UserCast): This user cast was not really doing
10920         what it was supposed to do.  Which is to be born in fully resolved
10921         state.  Parts of the resolution were being performed at Emit time! 
10922
10923         Fixed this code.
10924
10925 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10926
10927         * expression.cs: Implicity convert the result from UserCast.
10928
10929 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10930
10931         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10932         prevented it from working correctly. 
10933
10934         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10935         merely ConvertImplicit.
10936
10937 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10938
10939         * typemanager.cs: Make the LookupTypeContainer function static,
10940         and not per-instance.  
10941
10942         * class.cs: Make static FindMembers (the one that takes a Type
10943         argument). 
10944
10945         * codegen.cs: Add EmitForeach here.
10946
10947         * cs-parser.jay: Make foreach a toplevel object instead of the
10948         inline expansion, as we need to perform semantic analysis on it. 
10949
10950 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10951
10952         * expression.cs (Expression::ImplicitUserConversion): Rename to
10953         UserDefinedConversion.
10954
10955         (Expression::UserDefinedConversion): Take an extra argument specifying 
10956         whether we look for explicit user conversions too.
10957
10958         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10959
10960         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10961
10962         (ExplicitUserConversion): Make it a call to UserDefinedConversion
10963         with the appropriate arguments.
10964
10965         * cs-parser.jay (cast_expression): Record location too.
10966
10967         * expression.cs (Cast): Record location info.
10968
10969         (Expression::ConvertExplicit): Take location argument.
10970
10971         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10972         to determine if we are doing explicit conversions.
10973
10974         (UserCast::Emit): Update accordingly.
10975
10976         (Expression::ConvertExplicit): Report an error if everything fails.
10977
10978         * ../errors/cs0030.cs : Add.
10979
10980 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
10981
10982         * modifiers.cs: If the ABSTRACT keyword is present, also set the
10983         virtual and newslot bits. 
10984
10985         * class.cs (TypeContainer::RegisterRequiredImplementations):
10986         Record methods we need.
10987
10988         (TypeContainer::MakeKey): Helper function to make keys for
10989         MethodBases, since the Methodbase key is useless.
10990
10991         (TypeContainer::Populate): Call RegisterRequiredImplementations
10992         before defining the methods.   
10993
10994         Create a mapping for method_builders_to_methods ahead of time
10995         instead of inside a tight loop.
10996
10997         (::RequireMethods):  Accept an object as the data to set into the
10998         hashtable so we can report interface vs abstract method mismatch.
10999
11000 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
11001
11002         * report.cs: Make all of it static.
11003
11004         * rootcontext.cs: Drop object_type and value_type computations, as
11005         we have those in the TypeManager anyways.
11006
11007         Drop report instance variable too, now it is a global.
11008
11009         * driver.cs: Use try/catch on command line handling.
11010
11011         Add --probe option to debug the error reporting system with a test
11012         suite. 
11013
11014         * report.cs: Add support for exiting program when a probe
11015         condition is reached.
11016
11017 2001-10-03  Ravi Pratap  <ravi@ximian.com>
11018
11019         * expression.cs (Binary::DoNumericPromotions): Fix the case when
11020         we do a forcible conversion regardless of type, to check if 
11021         ForceConversion returns a null.
11022
11023         (Binary::error19): Use location to report error.
11024
11025         (Unary::error23): Use location here too.
11026
11027         * ../errors/cs0019.cs : Check in.
11028
11029         * ../errors/cs0023.cs : Check in.
11030
11031         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
11032         case of a non-null MethodInfo object with a length of 0 !
11033
11034         (Binary::ResolveOperator): Flag error if overload resolution fails to find
11035         an applicable member - according to the spec :-)
11036         Also fix logic to find members in base types.
11037
11038         (Unary::ResolveOperator): Same here.
11039
11040         (Unary::report23): Change name to error23 and make first argument a TypeContainer
11041         as I was getting thoroughly confused between this and error19 :-)
11042         
11043         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
11044         (::FindMostEncompassedType): Implement.
11045         (::FindMostEncompassingType): Implement.
11046         (::StandardConversionExists): Implement.
11047
11048         (UserImplicitCast): Re-vamp. We now need info about most specific
11049         source and target types so that we can do the necessary conversions.
11050
11051         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
11052         mathematical union with no duplicates.
11053
11054 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
11055
11056         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
11057         in order from base classes to child classes, so that we can in
11058         child classes look up in our parent for method names and
11059         attributes (required for handling abstract, virtual, new, override
11060         constructs: we need to instrospect our base class, and if we dont
11061         populate the classes in order, the introspection might be
11062         incorrect.  For example, a method could query its parent before
11063         the parent has any methods and would determine that the parent has
11064         no abstract methods (while it could have had them)).
11065
11066         (RootContext::CreateType): Record the order in which we define the
11067         classes.
11068
11069 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
11070
11071         * class.cs (TypeContainer::Populate): Also method definitions can
11072         fail now, keep track of this.
11073
11074         (TypeContainer::FindMembers): Implement support for
11075         DeclaredOnly/noDeclaredOnly flag.
11076
11077         (Constructor::Emit) Return the ConstructorBuilder.
11078
11079         (Method::Emit) Return the MethodBuilder. 
11080         Check for abstract or virtual methods to be public.
11081
11082         * rootcontext.cs (RootContext::CreateType): Register all the
11083         abstract methods required for the class to be complete and the
11084         interface methods that must be implemented. 
11085
11086         * cs-parser.jay: Report error 501 (method requires body if it is
11087         not marked abstract or extern).
11088
11089         * expression.cs (TypeOf::Emit): Implement.
11090
11091         * typemanager.cs: runtime_handle_type, new global type.
11092
11093         * class.cs (Property::Emit): Generate code for properties.
11094
11095 2001-10-02  Ravi Pratap  <ravi@ximian.com>
11096
11097         * expression.cs (Unary::ResolveOperator): Find operators on base type
11098         too - we now conform exactly to the spec.
11099
11100         (Binary::ResolveOperator): Same here.
11101
11102         * class.cs (Operator::Define): Fix minor quirk in the tests.
11103
11104         * ../errors/cs0215.cs : Added.
11105
11106         * ../errors/cs0556.cs : Added.
11107
11108         * ../errors/cs0555.cs : Added.
11109
11110 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
11111
11112         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
11113         single integer which is really efficient
11114
11115 2001-10-01  Ravi Pratap  <ravi@ximian.com>
11116
11117         *  expression.cs (Expression::ImplicitUserConversion): Use location
11118         even in the case when we are examining True operators.
11119  
11120         * class.cs (Operator::Define): Perform extensive checks to conform
11121         with the rules for operator overloading in the spec.
11122
11123         * expression.cs (Expression::ImplicitReferenceConversion): Implement
11124         some of the other conversions mentioned in the spec.
11125
11126         * typemanager.cs (array_type): New static member for the System.Array built-in
11127         type.
11128
11129         (cloneable_interface): For System.ICloneable interface.
11130
11131         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
11132         we start resolving the tree and populating types.
11133
11134         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
11135  
11136 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
11137
11138         * expression.cs (Expression::ExprClassFromMemberInfo,
11139         Expression::Literalize): Create literal expressions from
11140         FieldInfos which are literals.
11141
11142         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
11143         type casts, because they were wrong.  The test suite in tests
11144         caught these ones.
11145
11146         (ImplicitNumericConversion): ushort to ulong requires a widening
11147         cast. 
11148
11149         Int32 constant to long requires widening cast as well.
11150
11151         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
11152         for integers because the type on the stack is not i4.
11153
11154 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
11155
11156         * expression.cs (report118): require location argument. 
11157
11158         * parameter.cs: Do not dereference potential null value.
11159
11160         * class.cs: Catch methods that lack the `new' keyword when
11161         overriding a name.  Report warnings when `new' is used without
11162         anything being there to override.
11163
11164         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
11165
11166         * class.cs: Only add constructor to hashtable if it is non-null
11167         (as now constructors can fail on define).
11168
11169         (TypeManager, Class, Struct): Take location arguments.
11170
11171         Catch field instance initialization in structs as errors.
11172
11173         accepting_filter: a new filter for FindMembers that is static so
11174         that we dont create an instance per invocation.
11175
11176         (Constructor::Define): Catch errors where a struct constructor is
11177         parameterless 
11178
11179         * cs-parser.jay: Pass location information for various new
11180         constructs. 
11181         
11182         * delegate.cs (Delegate): take a location argument.
11183
11184         * driver.cs: Do not call EmitCode if there were problesm in the
11185         Definition of the types, as many Builders wont be there. 
11186
11187         * decl.cs (Decl::Decl): Require a location argument.
11188
11189         * cs-tokenizer.cs: Handle properly hex constants that can not fit
11190         into integers, and find the most appropiate integer for it.
11191
11192         * literal.cs: Implement ULongLiteral.
11193
11194         * rootcontext.cs: Provide better information about the location of
11195         failure when CreateType fails.
11196         
11197 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
11198
11199         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
11200         as well.
11201
11202         * expression.cs (Binary::CheckShiftArguments): Add missing type
11203         computation.
11204         (Binary::ResolveOperator): Add type to the logical and and logical
11205         or, Bitwise And/Or and Exclusive Or code paths, it was missing
11206         before.
11207
11208         (Binary::DoNumericPromotions): In the case where either argument
11209         is ulong (and most signed types combined with ulong cause an
11210         error) perform implicit integer constant conversions as well.
11211
11212 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
11213
11214         * expression.cs (UserImplicitCast): Method should always be
11215         non-null. 
11216         (Invocation::BetterConversion): Simplified test for IntLiteral.
11217
11218         (Expression::ImplicitNumericConversion): Split this routine out.
11219         Put the code that performs implicit constant integer conversions
11220         here. 
11221
11222         (Expression::Resolve): Become a wrapper around DoResolve so we can
11223         check eclass and type being set after resolve.
11224
11225         (Invocation::Badness): Remove this dead function
11226
11227         (Binary::ResolveOperator): Do not compute the expensive argumnets
11228         unless we have a union for it.
11229
11230         (Probe::Emit): Is needs to do an isinst and then
11231         compare against null.
11232
11233         (::CanConvert): Added Location argument.  If the Location argument
11234         is null (Location.Null), then we do not report errors.  This is
11235         used by the `probe' mechanism of the Explicit conversion.  We do
11236         not want to generate an error for something that the user
11237         explicitly requested to be casted.  But the pipeline for an
11238         explicit cast first tests for potential implicit casts.
11239
11240         So for now, if the Location is null, it means `Probe only' to
11241         avoid adding another argument.   Might have to revise this
11242         strategy later.
11243
11244         (ClassCast): New class used to type cast objects into arbitrary
11245         classes (used in Explicit Reference Conversions).
11246
11247         Implement `as' as well.
11248
11249         Reverted all the patches from Ravi below: they were broken:
11250
11251                 * The use of `level' as a mechanism to stop recursive
11252                   invocations is wrong.  That was there just to catch the
11253                   bug with a strack trace but not as a way of addressing
11254                   the problem.
11255
11256                   To fix the problem we have to *understand* what is going
11257                   on and the interactions and come up with a plan, not
11258                   just get things going.
11259
11260                 * The use of the type conversion cache that I proposed
11261                   last night had an open topic: How does this work across
11262                   protection domains.  A user defined conversion might not
11263                   be public in the location where we are applying the
11264                   conversion, a different conversion might be selected
11265                   (ie, private A->B (better) but public B->A (worse),
11266                   inside A, A->B applies, but outside it, B->A will
11267                   apply).
11268
11269                 * On top of that (ie, even if the above is solved),
11270                   conversions in a cache need to be abstract.  Ie, `To
11271                   convert from an Int to a Short use an OpcodeCast', not
11272                   `To convert from an Int to a Short use the OpcodeCast on
11273                   the variable 5' (which is what this patch was doing).
11274         
11275 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11276
11277         * expression.cs (Invocation::ConversionExists): Re-write to use
11278         the conversion cache
11279         
11280         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
11281         cache all conversions done, not just user-defined ones.
11282
11283         (Invocation::BetterConversion): The real culprit. Use ConversionExists
11284         to determine if a conversion exists instead of acutually trying to 
11285         perform the conversion. It's faster too.
11286
11287         (Expression::ConvertExplicit): Modify to use ConversionExists to check
11288         and only then attempt the implicit conversion.
11289
11290 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11291
11292         * expression.cs (ConvertImplicit): Use a cache for conversions
11293         already found. Check level of recursion and bail out if necessary.
11294         
11295 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
11296
11297         * typemanager.cs (string_concat_string_string, string_concat_object_object):
11298         Export standard methods that we expect for string operations.
11299         
11300         * statement.cs (Block::UsageWarning): Track usage of variables and
11301         report the errors for not used variables.
11302
11303         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
11304         operator. 
11305
11306 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
11307
11308         * codegen.cs: remove unnneded code 
11309
11310         * expression.cs: Removed BuiltinTypeAccess class
11311
11312         Fix the order in which implicit conversions are
11313         done.  
11314
11315         The previous fixed dropped support for boxed conversions (adding a
11316         test to the test suite now)
11317
11318         (UserImplicitCast::CanConvert): Remove test for source being null,
11319         that code is broken.  We should not feed a null to begin with, if
11320         we do, then we should track the bug where the problem originates
11321         and not try to cover it up here.
11322
11323         Return a resolved expression of type UserImplicitCast on success
11324         rather than true/false.  Ravi: this is what I was talking about,
11325         the pattern is to use a static method as a "constructor" for
11326         objects. 
11327
11328         Also, do not create arguments until the very last minute,
11329         otherwise we always create the arguments even for lookups that
11330         will never be performed. 
11331
11332         (UserImplicitCast::Resolve): Eliminate, objects of type
11333         UserImplicitCast are born in a fully resolved state. 
11334         
11335         * typemanager.cs (InitCoreTypes): Init also value_type
11336         (System.ValueType). 
11337
11338         * expression.cs (Cast::Resolve): First resolve the child expression.
11339
11340         (LValue): Add new method AddressOf to be used by
11341         the `&' operator.  
11342
11343         Change the argument of Store to take an EmitContext instead of an
11344         ILGenerator, because things like FieldExpr need to be able to call
11345         their children expression to generate the instance code. 
11346
11347         (Expression::Error, Expression::Warning): Sugar functions for
11348         reporting errors.
11349
11350         (Expression::MemberLookup): Accept a TypeContainer instead of a
11351         Report as the first argument.
11352
11353         (Expression::ResolvePrimary): Killed.  I still want to improve
11354         this as currently the code is just not right.
11355
11356         (Expression::ResolveMemberAccess): Simplify, but it is still
11357         wrong. 
11358
11359         (Unary::Resolve): Catch errors in AddressOf operators.
11360
11361         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
11362         index to a byte for the short-version, or the compiler will choose
11363         the wrong Emit call, which generates the wrong data.
11364
11365         (ParameterReference::Emit, ::Store): same.
11366
11367         (FieldExpr::AddressOf): Implement.
11368         
11369         * typemanager.cs: TypeManager: made public variable instead of
11370         property.
11371         
11372         * driver.cs: document --fatal.
11373
11374         * report.cs (ErrorMessage, WarningMessage): new names for the old
11375         Error and Warning classes.
11376
11377         * cs-parser.jay (member_access): Turn built-in access to types
11378         into a normal simplename
11379
11380 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11381
11382         * expression.cs (Invocation::BetterConversion): Fix to cope
11383         with q being null, since this was introducing a bug.
11384
11385         * expression.cs (ConvertImplicit): Do built-in conversions first.
11386
11387 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11388
11389         * expression.cs (UserImplicitCast::Resolve): Fix bug.
11390
11391 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11392
11393         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
11394         I had introduced long ago (what's new ?).
11395
11396         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
11397         the work of all the checking. 
11398         (ConvertImplicit): Call CanConvert and only then create object if necessary.
11399         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
11400
11401         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
11402         that is the right way. 
11403
11404         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
11405         overloading resolution. Use everywhere instead of cutting and pasting code.
11406
11407         (Binary::ResolveOperator): Use MakeUnionSet.
11408
11409         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
11410         we have to convert to bool types. Not complete yet.
11411         
11412 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
11413
11414         * typemanager.cs (TypeManager::CSharpName): support ushort.
11415
11416         * expression.cs (Expression::TryImplicitIntConversion): Attempts
11417         to provide an expression that performsn an implicit constant int
11418         conversion (section 6.1.6).
11419         (Expression::ConvertImplicitRequired): Reworked to include
11420         implicit constant expression conversions.
11421
11422         (Expression::ConvertNumericExplicit): Finished.
11423
11424         (Invocation::Emit): If InstanceExpression is null, then it means
11425         that we perform a call on this.
11426         
11427 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
11428
11429         * expression.cs (Unary::Emit): Remove some dead code.
11430         (Probe): Implement Resolve and Emit for `is'.
11431         (Expression::ConvertImplicitRequired): Attempt to do constant
11432         expression conversions here.  Maybe should be moved to
11433         ConvertImplicit, but I am not sure.
11434         (Expression::ImplicitLongConstantConversionPossible,
11435         Expression::ImplicitIntConstantConversionPossible): New functions
11436         that tell whether is it possible to apply an implicit constant
11437         expression conversion.
11438
11439         (ConvertNumericExplicit): Started work on explicit numeric
11440         conversions.
11441
11442         * cs-parser.jay: Update operator constants.
11443
11444         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
11445         (Parameters::GetSignature): Hook up VerifyArgs here.
11446         (Parameters::VerifyArgs): Verifies that no two arguments have the
11447         same name. 
11448
11449         * class.cs (Operator): Update the operator names to reflect the
11450         ones that the spec expects (as we are just stringizing the
11451         operator names).
11452         
11453         * expression.cs (Unary::ResolveOperator): Fix bug: Use
11454         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
11455         previous usage did only work for our methods.
11456         (Expression::ConvertImplicit): Handle decimal implicit numeric
11457         conversions as well.
11458         (Expression::InternalTypeConstructor): Used to invoke constructors
11459         on internal types for default promotions.
11460
11461         (Unary::Emit): Implement special handling for the pre/post
11462         increment/decrement for overloaded operators, as they need to have
11463         the same semantics as the other operators.
11464
11465         (Binary::ResolveOperator): ditto.
11466         (Invocation::ConversionExists): ditto.
11467         (UserImplicitCast::Resolve): ditto.
11468         
11469 2001-09-26  Ravi Pratap  <ravi@ximian.com>
11470
11471         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
11472         operator, return after emitting body. Regression tests pass again !
11473
11474         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
11475         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
11476         (Invocation::OverloadResolve): Ditto.
11477         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
11478
11479         * everywhere : update calls to the above methods accordingly.
11480
11481 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
11482
11483         * assign.cs (Assign): Make it inherit from ExpressionStatement.
11484
11485         * expression.cs (ExpressionStatement): New base class used for
11486         expressions that can appear in statements, so that we can provide
11487         an alternate path to generate expression that do not leave a value
11488         on the stack.
11489
11490         (Expression::Emit, and all the derivatives): We no longer return
11491         whether a value is left on the stack or not.  Every expression
11492         after being emitted leaves a single value on the stack.
11493
11494         * codegen.cs (EmitContext::EmitStatementExpression): Use the
11495         facilties of ExpressionStatement if possible.
11496
11497         * cs-parser.jay: Update statement_expression.
11498
11499 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
11500
11501         * driver.cs: Change the wording of message
11502
11503 2001-09-25  Ravi Pratap  <ravi@ximian.com>
11504
11505         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
11506         the type of the expression to the return type of the method if
11507         we have an overloaded operator match ! The regression tests pass again !
11508         (Unary::ResolveOperator): Ditto.
11509
11510         * expression.cs (Invocation::ConversionExists): Correct the member lookup
11511         to find "op_Implicit", not "implicit" ;-)
11512         (UserImplicitCast): New class to take care of user-defined implicit conversions.
11513         (ConvertImplicit, ForceConversion): Take TypeContainer argument
11514
11515         * everywhere : Correct calls to the above accordingly.
11516
11517         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
11518         (ConvertImplicit): Do user-defined conversion if it exists.
11519
11520 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
11521
11522         * assign.cs: track location.
11523         (Resolve): Use implicit conversions on assignment.
11524
11525         * literal.cs: Oops.  Not good, Emit of short access values should
11526         pass (Bytes) or the wrong argument will be selected.
11527
11528         * expression.cs (Unary::Emit): Emit code for -expr.
11529         
11530         (Unary::ResolveOperator): Handle `Substract' for non-constants
11531         (substract from zero from the non-constants).
11532         Deal with Doubles as well. 
11533         
11534         (Expression::ConvertImplicitRequired): New routine that reports an
11535         error if no implicit conversion exists. 
11536
11537         (Invocation::OverloadResolve): Store the converted implicit
11538         expressions if we make them
11539         
11540 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11541
11542         * class.cs (ConstructorInitializer): Take a Location argument.
11543         (ConstructorBaseInitializer): Same here.
11544         (ConstructorThisInitializer): Same here.
11545
11546         * cs-parser.jay : Update all calls accordingly.
11547
11548         * expression.cs (Unary, Binary, New): Take location argument.
11549         Update accordingly everywhere.
11550
11551         * cs-parser.jay : Update all calls to the above to take a location
11552         argument.
11553
11554         * class.cs : Ditto.
11555
11556 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11557
11558         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11559         (Invocation::BetterConversion): Same here
11560         (Invocation::ConversionExists): Ditto.
11561
11562         (Invocation::ConversionExists): Implement.
11563
11564 2001-09-22  Ravi Pratap  <ravi@ximian.com>
11565
11566         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11567         Also take an additional TypeContainer argument.
11568
11569         * All over : Pass in TypeContainer as argument to OverloadResolve.
11570
11571         * typemanager.cs (CSharpName): Update to check for the string type and return
11572         that too.
11573
11574         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11575         a given method.
11576         
11577 2001-09-21  Ravi Pratap  <ravi@ximian.com>
11578
11579         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11580         (Invocation::BetterFunction): Implement.
11581         (Invocation::BetterConversion): Implement.
11582         (Invocation::ConversionExists): Skeleton, no implementation yet.
11583
11584         Okay, things work fine !
11585
11586 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
11587
11588         * typemanager.cs: declare and load enum_type, delegate_type and
11589         void_type. 
11590
11591         * expression.cs (Expression::Emit): Now emit returns a value that
11592         tells whether a value is left on the stack or not.  This strategy
11593         might be reveted tomorrow with a mechanism that would address
11594         multiple assignments.
11595         (Expression::report118): Utility routine to report mismatches on
11596         the ExprClass.
11597
11598         (Unary::Report23): Report impossible type/operator combination
11599         utility function.
11600
11601         (Unary::IsIncrementableNumber): Whether the type can be
11602         incremented or decremented with add.
11603         (Unary::ResolveOperator): Also allow enumerations to be bitwise
11604         complemented. 
11605         (Unary::ResolveOperator): Implement ++, !, ~,
11606
11607         (Invocation::Emit): Deal with new Emit convetion.
11608         
11609         * All Expression derivatives: Updated their Emit method to return
11610         whether they leave values on the stack or not.
11611         
11612         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11613         stack for expressions that are statements. 
11614
11615 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11616
11617         * expression.cs (LValue): New interface.  Must be implemented by
11618         LValue objects.
11619         (LocalVariableReference, ParameterReference, FieldExpr): Implement
11620         LValue interface.
11621         
11622         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11623         interface for generating code, simplifies the code.
11624
11625 2001-09-20  Ravi Pratap  <ravi@ximian.com>
11626
11627         * expression.cs (everywhere): Comment out return statements in ::Resolve
11628         methods to avoid the warnings.
11629
11630 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11631
11632         * driver.cs (parse): Report error 2001 if we can not open the
11633         source file.
11634
11635         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11636         not resolve it.
11637
11638         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11639         object. 
11640
11641         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11642         otherwise nested blocks end up with the same index.
11643
11644         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11645
11646         * expression.cs:  Instead of having FIXMEs in the Resolve
11647         functions, throw exceptions so it is obvious that we are facing a
11648         bug. 
11649
11650         * cs-parser.jay (invocation_expression): Pass Location information.
11651
11652         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11653         Use a basename for those routines because .NET does not like paths
11654         on them. 
11655
11656         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11657         already defined.
11658
11659 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
11660
11661         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11662         are loading the correct data types (throws an exception if not).
11663         (TypeManager::InitCoreTypes): Use CoreLookupType
11664
11665         * expression.cs (Unary::ResolveOperator): return the child
11666         expression for expressions which are just +expr.
11667         (Unary::ResolveOperator): Return negative literals for -LITERAL
11668         expressions (otherwise they are Unary {Literal}).
11669         (Invocation::Badness): Take into account `Implicit constant
11670         expression conversions'.
11671
11672         * literal.cs (LongLiteral): Implement long literal class.
11673         (IntLiteral): export the `Value' of the intliteral. 
11674
11675 2001-09-19  Ravi Pratap  <ravi@ximian.com>
11676
11677         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11678
11679         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
11680         instead of 'Operator'
11681
11682         * expression.cs (Binary::ResolveOperator): Update accordingly.
11683         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11684         and 'Minus'
11685
11686         * cs-parser.jay (unary_expression): Update to use the new names.
11687
11688         * gen-treedump.cs (GetUnary): Same here.
11689
11690         * expression.cs (Unary::Resolve): Implement.
11691         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
11692         operators are found instead of making noise ;-)
11693         (Unary::ResolveOperator): New method to do precisely the same thing which
11694         Binary::ResolveOperator does for Binary expressions.
11695         (Unary.method, .Arguments): Add.
11696         (Unary::OperName): Implement.   
11697         (Unary::ForceConversion): Copy and Paste !
11698
11699         * class.cs (Operator::Define): Fix a small bug for the case when we have 
11700         a unary operator.
11701
11702         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11703         for the inbuilt operators. Only overloading works for now ;-)
11704
11705 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
11706
11707         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11708         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11709
11710         * expression.cs (This::Emit): Implement. 
11711         (This::Resolve): Implement.
11712         (TypeOf:Resolve): Implement.
11713         (Expression::ResolveSimpleName): Add an implicit this to instance
11714         field references. 
11715         (MemberAccess::Resolve): Deal with Parameters and Fields. 
11716         Bind instance variable to Field expressions.
11717         (FieldExpr::Instance): New field used to track the expression that
11718         represents the object instance.
11719         (FieldExpr::Resolve): Track potential errors from MemberLookup not
11720         binding 
11721         (FieldExpr::Emit): Implement.
11722
11723         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11724         the last instruction contains a return opcode to avoid generating
11725         the last `ret' instruction (this generates correct code, and it is
11726         nice to pass the peverify output).
11727
11728         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11729         initializer for static and instance variables.
11730         (Constructor::Emit): Allow initializer to be null in the case of
11731         static constructors.  Only emit initializer for instance
11732         constructors. 
11733
11734         (TypeContainer::FindMembers): Return a null array if there are no
11735         matches.
11736
11737         Also fix the code for the MemberTypes.Method branch, as it was not
11738         scanning that for operators (or tried to access null variables before).
11739
11740         * assign.cs (Assign::Emit): Handle instance and static fields. 
11741
11742         * TODO: Updated.
11743
11744         * driver.cs: Stop compilation if there are parse errors.
11745
11746         * cs-parser.jay (constructor_declaration): Provide default base
11747         initializer for non-static constructors.
11748         (constructor_declarator): Do not provide a default base
11749         initializers if none was specified.
11750         Catch the fact that constructors should not have parameters.
11751
11752         * class.cs: Do not emit parent class initializers for static
11753         constructors, that should be flagged as an error.
11754
11755 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11756
11757         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11758         Move back code into TypeContainer::Populate.
11759
11760 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11761
11762         * class.cs (TypeContainer::AddConstructor): Fix the check to
11763         compare against Name, not Basename. 
11764         (Operator::OpType): Change Plus and Minus to Add and Subtract.
11765
11766         * cs-parser.jay : Update accordingly.
11767
11768         * class.cs (TypeContainer::FindMembers): For the case where we are searching
11769         for methods, don't forget to look into the operators too.
11770         (RegisterMethodBuilder): Helper method to take care of this for
11771         methods, constructors and operators.
11772         (Operator::Define): Completely revamp.
11773         (Operator.OperatorMethod, MethodName): New fields.
11774         (TypeContainer::Populate): Move the registering of builders into
11775         RegisterMethodBuilder.
11776         (Operator::Emit): Re-write.
11777
11778         * expression.cs (Binary::Emit): Comment out code path to emit method
11779         invocation stuff for the case when we have a user defined operator. I am
11780         just not able to get it right !
11781         
11782 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11783
11784         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11785         argument. 
11786
11787         (Expression::MemberLookup): Provide a version that allows to
11788         specify the MemberTypes and BindingFlags. 
11789
11790         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11791         so it was not fetching variable information from outer blocks.
11792
11793         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11794         Beforefieldinit as it was buggy.
11795
11796         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11797         that Ravi put here.  
11798
11799         * class.cs (Constructor::Emit): Only emit if block is not null.
11800         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11801         deal with this by semantically definining it as if the user had
11802         done it.
11803
11804         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11805         constructors as we now "emit" them at a higher level.
11806
11807         (TypeContainer::DefineDefaultConstructor): Used to define the
11808         default constructors if none was provided.
11809
11810         (ConstructorInitializer): Add methods Resolve and Emit. 
11811         
11812         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11813
11814 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11815
11816         * class.cs (TypeContainer::EmitDefaultConstructor): Register
11817         the default constructor builder with our hashtable for methodbuilders
11818         to methodcores.
11819
11820         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11821         and argument_count is 0 in which case we have a match.
11822         (Binary::ResolveOperator): More null checking and miscellaneous coding
11823         style cleanup.
11824
11825 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11826
11827         * rootcontext.cs (IsNameSpace): Compare against null.
11828
11829         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11830
11831         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11832         and Unary::Operator.
11833
11834         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11835         accordingly.
11836
11837         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11838         we have overloaded operators.
11839         (Binary::ResolveOperator): Implement the part which does the operator overload
11840         resolution.
11841
11842         * class.cs (Operator::Emit): Implement.
11843         (TypeContainer::Emit): Emit the operators we have too.
11844
11845         * expression.cs (Binary::Emit): Update to emit the appropriate code for
11846         the case when we have a user-defined operator.
11847         
11848 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11849
11850         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11851
11852 2001-09-16  Ravi Pratap  <ravi@ximian.com>
11853
11854         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11855         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11856         (Constructor::Emit): Implement.
11857         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11858         if we have no work to do. 
11859         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
11860         Emit method.
11861
11862         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11863         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11864
11865         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11866         of parent.parent.
11867
11868 2001-09-15  Ravi Pratap  <ravi@ximian.com>
11869
11870         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11871         in the source.
11872         (Tree::RecordNamespace): Method to do what the name says ;-)
11873         (Tree::Namespaces): Property to get at the namespaces hashtable.
11874
11875         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
11876         keep track.
11877
11878         * rootcontext.cs (IsNamespace): Fixed it :-)
11879
11880 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11881
11882         * class.cs (TypeContainer::FindMembers): Add support for
11883         constructors. 
11884         (MethodCore): New class that encapsulates both the shared aspects
11885         of a Constructor and a Method.  
11886         (Method, Constructor): Factored pieces into MethodCore.
11887
11888         * driver.cs: Added --fatal which makes errors throw exceptions.
11889         Load System assembly as well as part of the standard library.
11890
11891         * report.cs: Allow throwing exceptions on errors for debugging.
11892
11893         * modifiers.cs: Do not use `parent', instead use the real type
11894         container to evaluate permission settings.
11895
11896         * class.cs: Put Ravi's patch back in.  He is right, and we will
11897         have to cope with the
11898
11899 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11900
11901         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11902         FamORAssem, not FamANDAssem.
11903         
11904 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11905
11906         * driver.cs: Added --parse option that only parses its input files
11907         and terminates.
11908
11909         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
11910         incorrect.  IsTopLevel is not used to tell whether an object is
11911         root_types or not (that can be achieved by testing this ==
11912         root_types).  But to see if this is a top-level *class* (not
11913         necessarly our "toplevel" container). 
11914
11915 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11916
11917         * enum.cs (Enum::Define): Modify to call the Lookup method on the
11918         parent instead of a direct call to GetType.
11919
11920 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11921
11922         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11923         Modifiers.TypeAttr. This should just be a call to that method.
11924
11925         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11926         object so that we can determine if we are top-level or not.
11927
11928         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
11929         TypeContainer too.
11930
11931         * enum.cs (Enum::Define): Ditto.
11932
11933         * modifiers.cs (FieldAttr): Re-write.
11934
11935         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11936         (TypeContainer::HaveStaticConstructor): New property to provide access
11937         to precisely that info.
11938
11939         * modifiers.cs (MethodAttr): Re-write.
11940         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11941
11942         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11943         of top-level types as claimed.
11944         
11945 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11946
11947         * expression.cs (MemberLookup): Fruitless attempt to lookup
11948         constructors.  Maybe I need to emit default constructors?  That
11949         might be it (currently .NET emits this for me automatically).
11950         (Invocation::OverloadResolve): Cope with Arguments == null.
11951         (Invocation::EmitArguments): new function, shared by the new
11952         constructor and us.
11953         (Invocation::Emit): Handle static and instance methods.  Emit
11954         proper call instruction for virtual or non-virtual invocations.
11955         (New::Emit): Implement.
11956         (New::Resolve): Implement.
11957         (MemberAccess:Resolve): Implement.
11958         (MethodGroupExpr::InstanceExpression): used conforming to the spec
11959         to track instances.
11960         (FieldExpr::Resolve): Set type.
11961
11962         * support.cs: Handle empty arguments.
11963                 
11964         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11965         SimpleLookup): Auxiliary routines to help parse a qualifier
11966         identifier.  
11967
11968         Update qualifier_identifier rule.
11969
11970         * codegen.cs: Removed debugging messages.
11971
11972         * class.cs: Make this a global thing, this acts just as a "key" to
11973         objects that we might have around.
11974
11975         (Populate): Only initialize method_builders_to_methods once.
11976
11977         * expression.cs (PropertyExpr): Initialize type from the
11978         PropertyType. 
11979
11980         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11981         Resolve pattern.  Attempt to implicitly convert value to boolean.
11982         Emit code.
11983
11984         * expression.cs: Set the type for the int32/int32 argument case.
11985         (Binary::ResolveOperator): Set the return type to boolean for
11986         comparission operators
11987
11988         * typemanager.cs: Remove debugging print code.
11989
11990         (Invocation::Resolve): resolve type.
11991
11992         * class.cs: Allocate a MemberInfo of the correct size, as the code
11993         elsewhere depends on the test to reflect the correct contents.
11994
11995         (Method::) Keep track of parameters, due to System.Reflection holes
11996
11997         (TypeContainer::Populate): Keep track of MethodBuilders to Method
11998         mapping here.
11999
12000         (TypeContainer::FindMembers): Use ArrayList and then copy an array
12001         of the exact size and return that.
12002
12003         (Class::LookupMethodByBuilder): New function that maps
12004         MethodBuilders to its methods.  Required to locate the information
12005         on methods because System.Reflection bit us again.
12006
12007         * support.cs: New file, contains an interface ParameterData and
12008         two implementations: ReflectionParameters and InternalParameters
12009         used to access Parameter information.  We will need to grow this
12010         as required.
12011
12012         * expression.cs (Invocation::GetParameterData): implement a cache
12013         and a wrapper around the ParameterData creation for methods. 
12014         (Invocation::OverloadResolve): Use new code.
12015
12016 2001-09-13  Ravi Pratap  <ravi@ximian.com>
12017
12018         * class.cs (TypeContainer::EmitField): Remove and move into 
12019         (Field::Define): here and modify accordingly.
12020         (Field.FieldBuilder): New member.
12021         (TypeContainer::Populate): Update accordingly.
12022         (TypeContainer::FindMembers): Implement.
12023
12024 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
12025
12026         * statement.cs: (VariableInfo::VariableType): New field to be
12027         initialized with the full type once it is resolved. 
12028
12029 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
12030
12031         * parameter.cs (GetParameterInfo): Use a type cache to compute
12032         things only once, and to reuse this information
12033
12034         * expression.cs (LocalVariableReference::Emit): Implement.
12035         (OpcodeCast::Emit): fix.
12036
12037         (ParameterReference::Resolve): Implement.
12038         (ParameterReference::Emit): Implement.
12039
12040         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
12041         that are expressions need to stay as Expressions.
12042
12043         * typemanager.cs (CSharpName): Returns the C# name of a type if
12044         possible. 
12045
12046         * expression.cs (Expression::ConvertImplicit): New function that
12047         implements implicit type conversions.
12048
12049         (Expression::ImplicitReferenceConversion): Implements implicit
12050         reference conversions.
12051
12052         (EmptyCast): New type for transparent casts.
12053
12054         (OpcodeCast): New type for casts of types that are performed with
12055         a sequence of bytecodes.
12056         
12057         (BoxedCast): New type used for casting value types into reference
12058         types.  Emits a box opcode.
12059
12060         (Binary::DoNumericPromotions): Implements numeric promotions of
12061         and computation of the Binary::Type.
12062
12063         (Binary::EmitBranchable): Optimization.
12064
12065         (Binary::Emit): Implement code emission for expressions.
12066         
12067         * typemanager.cs (TypeManager): Added two new core types: sbyte
12068         and byte.
12069
12070 2001-09-12  Ravi Pratap  <ravi@ximian.com>
12071
12072         * class.cs (TypeContainer::FindMembers): Method which does exactly
12073         what Type.FindMembers does, only we don't have to use reflection. No
12074         implementation yet.
12075
12076         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
12077         typecontainer objects as we need to get at them.
12078         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
12079
12080         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
12081         typecontainer object.
12082
12083         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
12084         of just a Report object.
12085
12086 2001-09-11  Ravi Pratap  <ravi@ximian.com>
12087
12088         * class.cs (Event::Define): Go back to using the prefixes "add_" and
12089         "remove_"
12090         (TypeContainer::Populate): Now define the delegates of the type too.
12091         (TypeContainer.Delegates): Property to access the list of delegates defined
12092         in the type.
12093
12094         * delegates.cs (Delegate::Define): Implement partially.
12095
12096         * modifiers.cs (TypeAttr): Handle more flags.
12097
12098 2001-09-11  Ravi Pratap  <ravi@ximian.com>
12099
12100         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
12101         and not <=
12102         (Operator::Define): Re-write logic to get types by using the LookupType method
12103         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
12104         (Indexer::Define): Ditto.
12105         (Event::Define): Ditto.
12106         (Property::Define): Ditto.
12107         
12108 2001-09-10  Ravi Pratap  <ravi@ximian.com>
12109
12110         * class.cs (TypeContainer::Populate): Now define operators too. 
12111         (TypeContainer.Operators): New property to access the list of operators
12112         in a type.
12113         (Operator.OperatorMethodBuilder): New member to hold the method builder
12114         for the operator we are defining.
12115         (Operator::Define): Implement.
12116
12117 2001-09-10  Ravi Pratap  <ravi@ximian.com>
12118
12119         * class.cs (Event::Define): Make the prefixes of the accessor methods
12120         addOn_ and removeOn_ 
12121
12122         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
12123         of the location being passed in too. Ideally, this should go later since all
12124         error reporting should be done through the Report object.
12125
12126         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
12127         (Populate): Iterate thru the indexers we have and define them too.
12128         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
12129         for the get and set accessors.
12130         (Indexer::Define): Implement.
12131         
12132 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
12133
12134         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
12135         my previous implementation, did not work.
12136
12137         * typemanager.cs: Add a couple of missing types (the longs).
12138
12139         * literal.cs: Use TypeManager.bool_type instead of getting it.
12140
12141         * expression.cs (EventExpr): New kind of expressions.
12142         (Expressio::ExprClassFromMemberInfo): finish
12143
12144 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
12145
12146         * assign.cs: Emit stores to static fields differently.
12147
12148 2001-09-08  Ravi Pratap  <ravi@ximian.com>
12149
12150         * Merge in changes and adjust code to tackle conflicts. Backed out my
12151         code in Assign::Resolve ;-) 
12152
12153 2001-09-08  Ravi Pratap  <ravi@ximian.com>
12154
12155         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
12156         instead Report.Error and also pass in the location.
12157         (CSharpParser::Lexer): New readonly property to return the reference
12158         to the Tokenizer object.
12159         (declare_local_variables): Use Report.Error with location instead of plain 
12160         old error.
12161         (CheckDef): Ditto.
12162
12163         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
12164         (Operator.CheckBinaryOperator): Ditto.
12165
12166         * cs-parser.jay (operator_declarator): Update accordingly.
12167
12168         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
12169         (CheckBinaryOperator): Same here.
12170
12171         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
12172         on the name without any prefixes of namespace names etc. This is because we
12173         already might have something already fully qualified like 
12174         'System.Console.WriteLine'
12175
12176         * assign.cs (Resolve): Begin implementation. Stuck ;-)
12177
12178 2001-09-07  Ravi Pratap  <ravi@ximian.com>
12179
12180         * cs-tokenizer.cs (location): Return a string which also contains
12181         the file name.
12182
12183         * expression.cs (ElementAccess): New class for expressions of the
12184         type 'element access.'
12185         (BaseAccess): New class for expressions of the type 'base access.'
12186         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
12187         respectively.
12188         
12189         * cs-parser.jay (element_access): Implement action.
12190         (base_access): Implement actions.
12191         (checked_expression, unchecked_expression): Implement.
12192
12193         * cs-parser.jay (local_variable_type): Correct and implement.
12194         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
12195
12196         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
12197
12198         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
12199         name and the specifiers.
12200
12201         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
12202         
12203         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
12204         making them all public ;-)
12205
12206         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
12207         class anyways.
12208         
12209 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
12210
12211         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
12212         PropertyExprs.
12213         (FieldExpr, PropertyExprs): New resolved expressions.
12214         (SimpleName::MemberStaticCheck): Perform static checks for access
12215         to non-static fields on static methods. Maybe this should be
12216         generalized for MemberAccesses. 
12217         (SimpleName::ResolveSimpleName): More work on simple name
12218         resolution. 
12219
12220         * cs-parser.jay (primary_expression/qualified_identifier): track
12221         the parameter index.
12222
12223         * codegen.cs (CodeGen::Save): Catch save exception, report error.
12224         (EmitContext::EmitBoolExpression): Chain to expression generation
12225         instead of temporary hack.
12226         (::EmitStatementExpression): Put generic expression code generation.
12227
12228         * assign.cs (Assign::Emit): Implement variable assignments to
12229         local variables, parameters and fields.
12230
12231 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
12232
12233         * statement.cs (Block::GetVariableInfo): New method, returns the
12234         VariableInfo for a variable name in a block.
12235         (Block::GetVariableType): Implement in terms of GetVariableInfo
12236
12237         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
12238         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
12239
12240 2001-09-06  Ravi Pratap  <ravi@ximian.com>
12241
12242         * cs-parser.jay (operator_declaration): Continue on my quest : update
12243         to take attributes argument.
12244         (event_declaration): Ditto.
12245         (enum_declaration): Ditto.
12246         (indexer_declaration): Ditto.
12247         
12248         * class.cs (Operator::Operator): Update constructor accordingly.
12249         (Event::Event): Ditto.
12250
12251         * delegate.cs (Delegate::Delegate): Same here.
12252
12253         * enum.cs (Enum::Enum): Same here.
12254         
12255 2001-09-05  Ravi Pratap  <ravi@ximian.com>
12256
12257         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
12258
12259         * ../tests/cs0658.cs : New file to demonstrate error 0658.
12260
12261         * attribute.cs (Attributes): New class to encapsulate all attributes which were
12262         being passed around as an arraylist.
12263         (Attributes::AddAttribute): Method to add attribute sections.
12264
12265         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
12266         (struct_declaration): Update accordingly.
12267         (constant_declaration): Update.
12268         (field_declaration): Update.
12269         (method_header): Update.
12270         (fixed_parameter): Update.
12271         (parameter_array): Ditto.
12272         (property_declaration): Ditto.
12273         (destructor_declaration): Ditto.
12274         
12275         * class.cs (Struct::Struct): Update constructors accordingly.
12276         (Class::Class): Ditto.
12277         (Field::Field): Ditto.
12278         (Method::Method): Ditto.
12279         (Property::Property): Ditto.
12280         (TypeContainer::OptAttribute): update property's return type.
12281         
12282         * interface.cs (Interface.opt_attributes): New member.
12283         (Interface::Interface): Update to take the extra Attributes argument.
12284
12285         * parameter.cs (Parameter::Parameter): Ditto.
12286
12287         * constant.cs (Constant::Constant): Ditto.
12288
12289         * interface.cs (InterfaceMemberBase): New OptAttributes field.
12290         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
12291         the attributes as a parameter.
12292         (InterfaceProperty): Update constructor call.
12293         (InterfaceEvent): Ditto.
12294         (InterfaceMethod): Ditto.
12295         (InterfaceIndexer): Ditto.
12296
12297         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
12298         pass the attributes too.
12299         (interface_event_declaration): Ditto.
12300         (interface_property_declaration): Ditto.
12301         (interface_method_declaration): Ditto.
12302         (interface_declaration): Ditto.
12303
12304 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
12305
12306         * class.cs (Method::Define): Track the "static Main" definition to
12307         create an entry point. 
12308
12309         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
12310         EntryPoint if we find it. 
12311
12312         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
12313         (EmitContext::ig): Make this variable public.
12314
12315         * driver.cs: Make the default output file be the first file name
12316         with the .exe extension.  
12317
12318         Detect empty compilations
12319
12320         Handle various kinds of output targets.  Handle --target and
12321         rename -t to --dumper.
12322
12323         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
12324         methods inherited from Expression return now an Expression.  This
12325         will is used during the tree rewriting as we resolve them during
12326         semantic analysis.
12327
12328         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
12329         the spec.  Missing entirely is the information about
12330         accessability of elements of it.
12331
12332         (Expression::ExprClassFromMemberInfo): New constructor for
12333         Expressions that creates a fully initialized Expression based on
12334         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
12335         a Type.
12336
12337         (Invocation::Resolve): Begin implementing resolution of invocations.
12338         
12339         * literal.cs (StringLiteral):  Implement Emit.
12340
12341 2001-09-05  Ravi Pratap  <ravi@ximian.com>
12342
12343         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
12344         member.
12345         
12346 2001-09-04  Ravi Pratap  <ravi@ximian.com>
12347
12348         * cs-parser.jay (attribute_arguments): Implement actions.
12349         (attribute): Fix bug in production. Implement action.
12350         (attribute_list): Implement.
12351         (attribute_target): Implement.
12352         (attribute_target_specifier, opt_target_specifier): Implement
12353         (CheckAttributeTarget): New method to check if the attribute target
12354         is valid.
12355         (attribute_section): Implement.
12356         (opt_attributes): Implement.
12357
12358         * attribute.cs : New file to handle attributes.
12359         (Attribute): Class to hold attribute info.
12360
12361         * cs-parser.jay (opt_attribute_target_specifier): Remove production
12362         (attribute_section): Modify production to use 2 different rules to 
12363         achieve the same thing. 1 s/r conflict down !
12364         Clean out commented, useless, non-reducing dimension_separator rules.
12365         
12366         * class.cs (TypeContainer.attributes): New member to hold list
12367         of attributes for a type.
12368         (Struct::Struct): Modify to take one more argument, the attribute list.
12369         (Class::Class): Ditto.
12370         (Field::Field): Ditto.
12371         (Method::Method): Ditto.
12372         (Property::Property): Ditto.
12373         
12374         * cs-parser.jay (struct_declaration): Update constructor call to
12375         pass in the attributes too.
12376         (class_declaration): Ditto.
12377         (constant_declaration): Ditto.
12378         (field_declaration): Ditto.
12379         (method_header): Ditto.
12380         (fixed_parameter): Ditto.
12381         (parameter_array): Ditto.
12382         (property_declaration): Ditto.
12383
12384         * constant.cs (Constant::Constant): Update constructor similarly.
12385         Use System.Collections.
12386
12387         * parameter.cs (Parameter::Parameter): Update as above.
12388
12389 2001-09-02  Ravi Pratap  <ravi@ximian.com>
12390
12391         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
12392         (TypeContainer.delegates): New member to hold list of delegates.
12393
12394         * cs-parser.jay (delegate_declaration): Implement the action correctly 
12395         this time as I seem to be on crack ;-)
12396
12397 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
12398
12399         * rootcontext.cs (RootContext::IsNamespace): new function, used to
12400         tell whether an identifier represents a namespace.
12401
12402         * expression.cs (NamespaceExpr): A namespace expression, used only
12403         temporarly during expression resolution.
12404         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
12405         utility functions to resolve names on expressions.
12406
12407 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
12408
12409         * codegen.cs: Add hook for StatementExpressions. 
12410
12411         * class.cs: Fix inverted test for static flag in methods.
12412
12413 2001-09-02  Ravi Pratap  <ravi@ximian.com>
12414
12415         * class.cs (Operator::CheckUnaryOperator): Correct error number used
12416         to make it coincide with MS' number.
12417         (Operator::CheckBinaryOperator): Ditto.
12418
12419         * ../errors/errors.txt : Remove error numbers added earlier.
12420
12421         * ../errors/cs1019.cs : Test case for error # 1019
12422
12423         * ../errros/cs1020.cs : Test case for error # 1020
12424
12425         * cs-parser.jay : Clean out commented cruft.
12426         (dimension_separators, dimension_separator): Comment out. Ostensibly not
12427         used anywhere - non-reducing rule.
12428         (namespace_declarations): Non-reducing rule - comment out.
12429
12430         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
12431         with TypeContainer::AddEnum.
12432
12433         * delegate.cs : New file for delegate handling classes.
12434         (Delegate): Class for declaring delegates.
12435
12436         * makefile : Update.
12437
12438         * cs-parser.jay (delegate_declaration): Implement.
12439
12440 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
12441
12442         * class.cs (Event::Define): Implement.
12443         (Event.EventBuilder): New member.
12444
12445         * class.cs (TypeContainer::Populate): Update to define all enums and events
12446         we have.
12447         (Events): New property for the events arraylist we hold. Shouldn't we move to using
12448         readonly fields for all these cases ?
12449
12450 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
12451
12452         * class.cs (Property): Revamp to use the convention of making fields readonly.
12453         Accordingly modify code elsewhere.
12454
12455         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
12456         the Define method of the Property class.
12457
12458         * class.cs : Clean up applied patch and update references to variables etc. Fix 
12459         trivial bug.
12460         (TypeContainer::Populate): Update to define all the properties we have. Also
12461         define all enumerations.
12462
12463         * enum.cs (Define): Implement.
12464         
12465 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
12466
12467         * cs-parser.jay (overloadable_operator): The semantic value is an
12468         enum of the Operator class.
12469         (operator_declarator): Implement actions.
12470         (operator_declaration): Implement.
12471
12472         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
12473         validity of definitions.
12474         (Operator::CheckBinaryOperator): Static method to check for binary operators
12475         (TypeContainer::AddOperator): New method to add an operator to a type.
12476
12477         * cs-parser.jay (indexer_declaration): Added line to actually call the
12478         AddIndexer method so it gets added ;-)
12479
12480         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
12481         already taken care of by the MS compiler ?  
12482
12483 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
12484
12485         * class.cs (Operator): New class for operator declarations.
12486         (Operator::OpType): Enum for the various operators.
12487
12488 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
12489
12490         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
12491         ostensibly handle this in semantic analysis.
12492
12493         * cs-parser.jay (general_catch_clause): Comment out
12494         (specific_catch_clauses, specific_catch_clause): Ditto.
12495         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
12496         (catch_args, opt_catch_args): New productions.
12497         (catch_clause): Rewrite to use the new productions above
12498         (catch_clauses): Modify accordingly.
12499         (opt_catch_clauses): New production to use in try_statement
12500         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
12501         and re-write the code in the actions to extract the specific and
12502         general catch clauses by being a little smart ;-)
12503
12504         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
12505         Hooray, try and catch statements parse fine !
12506         
12507 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12508
12509         * statement.cs (Block::GetVariableType): Fix logic to extract the type
12510         string from the hashtable of variables.
12511
12512         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
12513         I end up making that mistake ;-)
12514         (catch_clauses): Fixed gross error which made Key and Value of the 
12515         DictionaryEntry the same : $1 !!
12516
12517 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12518
12519         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
12520
12521         * cs-parser.jay (event_declaration): Correct to remove the semicolon
12522         when the add and remove accessors are specified. 
12523
12524 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12525
12526         * cs-parser.jay (IndexerDeclaration): New helper class to hold
12527         information about indexer_declarator.
12528         (indexer_declarator): Implement actions.
12529         (parsing_indexer): New local boolean used to keep track of whether
12530         we are parsing indexers or properties. This is necessary because 
12531         implicit_parameters come into picture even for the get accessor in the 
12532         case of an indexer.
12533         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12534
12535         * class.cs (Indexer): New class for indexer declarations.
12536         (TypeContainer::AddIndexer): New method to add an indexer to a type.
12537         (TypeContainer::indexers): New member to hold list of indexers for the
12538         type.
12539
12540 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12541
12542         * cs-parser.jay (add_accessor_declaration): Implement action.
12543         (remove_accessor_declaration): Implement action.
12544         (event_accessors_declaration): Implement
12545         (variable_declarators): swap statements for first rule - trivial.
12546
12547         * class.cs (Event): New class to hold information about event
12548         declarations.
12549         (TypeContainer::AddEvent): New method to add an event to a type
12550         (TypeContainer::events): New member to hold list of events.
12551
12552         * cs-parser.jay (event_declaration): Implement actions.
12553
12554 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12555
12556         * cs-parser.jay (dim_separators): Implement. Make it a string
12557         concatenating all the commas together, just as they appear.
12558         (opt_dim_separators): Modify accordingly
12559         (rank_specifiers): Update accordingly. Basically do the same
12560         thing - instead, collect the brackets here.
12561         (opt_rank_sepcifiers): Modify accordingly.
12562         (array_type): Modify to actually return the complete type string
12563         instead of ignoring the rank_specifiers.
12564         (expression_list): Implement to collect the expressions
12565         (variable_initializer): Implement. We make it a list of expressions
12566         essentially so that we can handle the array_initializer case neatly too.
12567         (variable_initializer_list): Implement.
12568         (array_initializer): Make it a list of variable_initializers
12569         (opt_array_initializer): Modify accordingly.
12570
12571         * expression.cs (New::NType): Add enumeration to help us
12572         keep track of whether we have an object/delegate creation
12573         or an array creation.
12574         (New:NewType, New::Rank, New::Indices, New::Initializers): New
12575         members to hold data about array creation.
12576         (New:New): Modify to update NewType
12577         (New:New): New Overloaded contructor for the array creation
12578         case.
12579
12580         * cs-parser.jay (array_creation_expression): Implement to call
12581         the overloaded New constructor.
12582         
12583 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
12584
12585         * class.cs (TypeContainer::Constructors): Return member
12586         constructors instead of returning null.
12587
12588 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
12589
12590         * typemanager.cs (InitCoreTypes): Initialize the various core
12591         types after we have populated the type manager with the user
12592         defined types (this distinction will be important later while
12593         compiling corlib.dll)
12594
12595         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12596         on Expression Classification.  Now all expressions have a method
12597         `Resolve' and a method `Emit'.
12598
12599         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12600         generation from working.     Also add some temporary debugging
12601         code. 
12602         
12603 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
12604
12605         * codegen.cs: Lots of code generation pieces.  This is only the
12606         beginning, will continue tomorrow with more touches of polish.  We
12607         handle the fundamentals of if, while, do, for, return.  Others are
12608         trickier and I need to start working on invocations soon.
12609         
12610         * gen-treedump.cs: Bug fix, use s.Increment here instead of
12611         s.InitStatement. 
12612
12613         * codegen.cs (EmitContext): New struct, used during code
12614         emission to keep a context.   Most of the code generation will be
12615         here. 
12616
12617         * cs-parser.jay: Add embedded blocks to the list of statements of
12618         this block.  So code generation proceeds in a top down fashion.
12619
12620 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
12621
12622         * statement.cs: Add support for multiple child blocks.
12623
12624 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
12625
12626         * codegen.cs (EmitCode): New function, will emit the code for a
12627         Block of code given a TypeContainer and its ILGenerator. 
12628
12629         * statement.cs (Block): Standard public readonly optimization.
12630         (Block::Block constructors): Link children. 
12631         (Block::Child): Child Linker.
12632         (Block::EmitVariables): Emits IL variable declarations.
12633
12634         * class.cs: Drop support for MethodGroups here, delay until
12635         Semantic Analysis.
12636         (Method::): Applied the same simplification that I did before, and
12637         move from Properties to public readonly fields.
12638         (Method::ParameterTypes): Returns the parameter types for the
12639         function, and implements a cache that will be useful later when I
12640         do error checking and the semantic analysis on the methods is
12641         performed.
12642         (Constructor::GetCallingConvention): Renamed from CallingConvetion
12643         and made a method, optional argument tells whether this is a class
12644         or a structure to apply the `has-this' bit.
12645         (Method::GetCallingConvention): Implement, returns the calling
12646         convention. 
12647         (Method::Define): Defines the type, a second pass is performed
12648         later to populate the methods.
12649
12650         (Constructor::ParameterTypes): implement a cache similar to the
12651         one on Method::ParameterTypes, useful later when we do semantic
12652         analysis. 
12653
12654         (TypeContainer::EmitMethod):  New method.  Emits methods.
12655
12656         * expression.cs: Removed MethodGroup class from here.
12657         
12658         * parameter.cs (Parameters::GetCallingConvention): new method.
12659
12660 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
12661
12662         * class.cs (TypeContainer::Populate): Drop RootContext from the
12663         argument. 
12664
12665         (Constructor::CallingConvention): Returns the calling convention.
12666         (Constructor::ParameterTypes): Returns the constructor parameter
12667         types. 
12668         
12669         (TypeContainer::AddConstructor): Keep track of default constructor
12670         and the default static constructor.
12671
12672         (Constructor::) Another class that starts using `public readonly'
12673         instead of properties. 
12674
12675         (Constructor::IsDefault): Whether this is a default constructor. 
12676
12677         (Field::) use readonly public fields instead of properties also.
12678
12679         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12680         track of static constructors;  If none is used, turn on
12681         BeforeFieldInit in the TypeAttributes. 
12682
12683         * cs-parser.jay (opt_argument_list): now the return can be null
12684         for the cases where there are no arguments. 
12685
12686         (constructor_declarator): If there is no implicit `base' or
12687         `this', then invoke the default parent constructor. 
12688         
12689         * modifiers.cs (MethodAttr): New static function maps a set of
12690         modifiers flags into a MethodAttributes enum
12691         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
12692         MethodAttr, TypeAttr to represent the various mappings where the
12693         modifiers are used.
12694         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
12695
12696 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
12697
12698         * parameter.cs (GetParameterInfo): Fix bug where there would be no
12699         method arguments.
12700
12701         * interface.cs (PopulateIndexer): Implemented the code generator
12702         for interface indexers.
12703
12704 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
12705
12706         * interface.cs (InterfaceMemberBase): Now we track the new status
12707         here.  
12708
12709         (PopulateProperty): Implement property population.  Woohoo!  Got
12710         Methods and Properties going today. 
12711
12712         Removed all the properties for interfaces, and replaced them with
12713         `public readonly' fields. 
12714
12715 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
12716
12717         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12718         initialize their hashtables/arraylists only when they are needed
12719         instead of doing this always.
12720
12721         * parameter.cs: Handle refs and out parameters.
12722
12723         * cs-parser.jay: Use an ArrayList to construct the arguments
12724         instead of the ParameterCollection, and then cast that to a
12725         Parameter[] array.
12726
12727         * parameter.cs: Drop the use of ParameterCollection and use
12728         instead arrays of Parameters.
12729
12730         (GetParameterInfo): Use the Type, not the Name when resolving
12731         types. 
12732
12733 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
12734
12735         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12736         and instead use public readonly fields.
12737
12738         * class.cs: Put back walking code for type containers.
12739
12740 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
12741
12742         * class.cs (MakeConstant): Code to define constants.
12743
12744         * rootcontext.cs (LookupType): New function.  Used to locate types 
12745
12746         
12747 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
12748
12749         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
12750         this System.Reflection code is.  Kudos to Microsoft
12751         
12752         * typemanager.cs: Implement a type cache and avoid loading all
12753         types at boot time.  Wrap in LookupType the internals.  This made
12754         the compiler so much faster.  Wow.  I rule!
12755         
12756         * driver.cs: Make sure we always load mscorlib first (for
12757         debugging purposes, nothing really important).
12758
12759         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
12760         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
12761
12762         * rootcontext.cs: Lookup types on their namespace;  Lookup types
12763         on namespaces that have been imported using the `using' keyword.
12764
12765         * class.cs (TypeContainer::TypeAttr): Virtualize.
12766         (Class::TypeAttr): Return attributes suitable for this bad boy.
12767         (Struct::TypeAttr): ditto.
12768         Handle nested classes.
12769         (TypeContainer::) Remove all the type visiting code, it is now
12770         replaced with the rootcontext.cs code
12771
12772         * rootcontext.cs (GetClassBases): Added support for structs. 
12773
12774 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
12775
12776         * interface.cs, statement.cs, class.cs, parameter.cs,
12777         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12778         Drop use of TypeRefs, and use strings instead.
12779
12780 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
12781
12782         * rootcontext.cs: 
12783
12784         * class.cs (Struct::Struct): set the SEALED flags after
12785         checking the modifiers.
12786         (TypeContainer::TypeAttr): new property, returns the
12787         TypeAttributes for a class.  
12788
12789         * cs-parser.jay (type_list): Oops, list production was creating a
12790         new list of base types.
12791
12792         * rootcontext.cs (StdLib): New property.
12793         (GetInterfaceTypeByName): returns an interface by type name, and
12794         encapsulates error handling here.
12795         (GetInterfaces): simplified.
12796         (ResolveTree): Encapsulated all the tree resolution here.
12797         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12798         types. 
12799         
12800         * driver.cs: Add support for --nostdlib, to avoid loading the
12801         default assemblies.
12802         (Main): Do not put tree resolution here. 
12803
12804         * rootcontext.cs: Beginning of the class resolution.
12805
12806 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
12807
12808         * rootcontext.cs: Provide better error reporting. 
12809
12810         * cs-parser.jay (interface_base): set our $$ to be interfaces.
12811
12812         * rootcontext.cs (CreateInterface): Handle the case where there
12813         are no parent interfaces.
12814         
12815         (CloseTypes): Routine to flush types at the end.
12816         (CreateInterface): Track types.
12817         (GetInterfaces): Returns an array of Types from the list of
12818         defined interfaces.
12819
12820         * typemanager.c (AddUserType): Mechanism to track user types (puts
12821         the type on the global type hash, and allows us to close it at the
12822         end). 
12823         
12824 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
12825
12826         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12827         RecordInterface instead.
12828
12829         * cs-parser.jay: Updated to reflect changes above.
12830
12831         * decl.cs (Definition): Keep track of the TypeBuilder type that
12832         represents this type here.  Not sure we will use it in the long
12833         run, but wont hurt for now.
12834
12835         * driver.cs: Smaller changes to accomodate the new code.
12836
12837         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12838         when done. 
12839
12840         * rootcontext.cs (CreateInterface):  New method, used to create
12841         the System.TypeBuilder type for interfaces.
12842         (ResolveInterfaces): new entry point to resolve the interface
12843         hierarchy. 
12844         (CodeGen): Property, used to keep track of the code generator.
12845
12846 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
12847
12848         * cs-parser.jay: Add a second production for delegate_declaration
12849         with `VOID'.
12850
12851         (enum_body): Put an opt_comma here instead of putting it on
12852         enum_body or enum_member_declarations so we can handle trailing
12853         commas on enumeration members.  Gets rid of a shift/reduce.
12854         
12855         (type_list): Need a COMMA in the middle.
12856
12857         (indexer_declaration): Tell tokenizer to recognize get/set
12858
12859         * Remove old targets.
12860
12861         * Re-add the parser target.
12862
12863 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12864
12865         * cs-parser.jay: Add precendence rules for a number of operators
12866         ot reduce the number of shift/reduce conflicts in the grammar.
12867         
12868 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
12869
12870         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12871         and put it here.
12872
12873         Get rid of old crufty code.
12874
12875         * rootcontext.cs: Use this to keep track of the parsed
12876         representation and the defined types available to the program. 
12877
12878         * gen-treedump.cs: adjust for new convention.
12879
12880         * type.cs: Split out the type manager, and the assembly builder
12881         from here. 
12882
12883         * typemanager.cs: the type manager will live here now.
12884
12885         * cil-codegen.cs: And the code generator here. 
12886
12887 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
12888
12889         * makefile: Fixed up for easy making.
12890
12891 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12892
12893         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12894         the 
12895
12896         (unary_expression): Expand pre_increment_expression and
12897         post_decrement_expression to reduce a shift/reduce.
12898
12899 2001-07-11  Simon Cozens
12900
12901         * cs-tokenizer.cs: Hex numbers should begin with a 0.
12902
12903         Improve allow_keyword_as_indent name.
12904
12905 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
12906
12907         * Adjustments for Beta2. 
12908
12909 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
12910
12911         * decl.cs: Added `Define' abstract method.
12912         (InTransit): new property, used to catch recursive definitions. 
12913
12914         * interface.cs: Implement `Define'. 
12915
12916         * modifiers.cs: Map Modifiers.constants to
12917         System.Reflection.TypeAttribute flags.
12918
12919         * class.cs: Keep track of types and user-defined types.
12920         (BuilderInit): New method for creating an assembly
12921         (ResolveType): New function to launch the resolution process, only
12922         used by interfaces for now.
12923
12924         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12925         that are inserted into the name space. 
12926
12927 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
12928
12929         * ARGH.  I have screwed up my tree so many times due to the use of
12930         rsync rather than using CVS.  Going to fix this at once. 
12931
12932         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
12933         load types.
12934
12935 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
12936
12937         * Experiment successful: Use System.Type rather that our own
12938         version of Type.  
12939
12940 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
12941
12942         * cs-parser.jay: Removed nsAliases from here.
12943
12944         Use new namespaces, handle `using XXX;' 
12945
12946         * namespace.cs: Reimplemented namespace handling, use a recursive
12947         definition of the class.  Now we can keep track of using clauses
12948         and catch invalid using clauses.
12949
12950 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
12951
12952         * gen-treedump.cs: Adapted for all the renaming.
12953
12954         * expression.cs (Expression): this class now has a Type property
12955         which returns an expression Type.
12956
12957         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12958         `Type', as this has a different meaning now in the base
12959
12960 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
12961
12962         * interface.cs, class.cs: Removed from all the sources the
12963         references to signature computation, as we can not do method
12964         signature computation during the parsing time, as we are not
12965         trying to solve at that point distinguishing:
12966
12967         class X {
12968                 void a (Blah x) {}
12969                 void a (NS.Blah x) {}
12970         }
12971
12972         Which depending on the context might be valid or not, as we do not
12973         know if Blah is the same thing as NS.Blah at that point.
12974
12975         * Redid everything so the code uses TypeRefs now instead of
12976         Types.  TypeRefs are just temporary type placeholders, that need
12977         to be resolved.  They initially have a pointer to a string and the
12978         current scope in which they are used.  This is used later by the
12979         compiler to resolve the reference to an actual Type. 
12980
12981         * DeclSpace is no longer a CIR.Type, and neither are
12982         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
12983         are all DeclSpaces, but no Types. 
12984
12985         * type.cs (TypeRefManager): This implements the TypeRef manager,
12986         which keeps track of all the types that need to be resolved after
12987         the parsing has finished. 
12988
12989 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
12990
12991         * ARGH.  We are going to have to store `foreach' as a class rather
12992         than resolving it, as we need to verify error 1579 after name
12993         resolution.   *OR* we could keep a flag that says `This request to
12994         IEnumerator comes from a foreach statement' which we can then use
12995         to generate the error.
12996
12997 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
12998
12999         * class.cs (TypeContainer.AddMethod): we now add methods to the
13000         MethodGroup instead of the method hashtable.  
13001
13002         * expression.cs: Add MethodGroup abstraction, which gets us one
13003         step closer to the specification in the way we handle method
13004         declarations.  
13005
13006         * cs-parser.jay (primary_expression): qualified_identifier now
13007         tried to match up an identifier to a local variable reference or
13008         to a parameter reference.
13009
13010         current_local_parameters is now a parser global variable that
13011         points to the current parameters for the block, used during name
13012         lookup.
13013
13014         (property_declaration): Now creates an implicit `value' argument to
13015         the set accessor.
13016
13017 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
13018
13019         * parameter.cs: Do not use `param' arguments as part of the
13020         signature, per the spec.
13021
13022 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
13023
13024         * decl.cs: Base class for classes, structs and interfaces.  This
13025         is the "Declaration Space" 
13026
13027         * cs-parser.jay: Use CheckDef for checking declaration errors
13028         instead of having one on each function.
13029
13030         * class.cs: Factor out some code for handling error handling in
13031         accordance to the "Declarations" section in the "Basic Concepts"
13032         chapter in the ECMA C# spec.
13033
13034         * interface.cs: Make all interface member classes derive from
13035         InterfaceMemberBase.
13036
13037 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
13038
13039         * Many things: all interfaces are parsed and generated in
13040         gen-treedump.  Support for member variables, constructors,
13041         destructors, properties, constants is there.
13042
13043         Beginning of the IL backend, but very little done, just there for
13044         testing purposes. 
13045
13046 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
13047
13048         * cs-parser.jay: Fix labeled statement.
13049
13050         * cs-tokenizer.cs (escape): Escape " and ' always.
13051         ref_line, ref_name: keep track of the line/filename as instructed
13052         by #line by the compiler.
13053         Parse #line.
13054
13055 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
13056
13057         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
13058         to match the values in System.CodeDOM.
13059
13060         Divid renamed to Divide.
13061
13062         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
13063         statements. 
13064         (Statements.set): remove.
13065
13066         * System.CodeDOM/CodeCatchClause.cs: always have a valid
13067         statements. 
13068
13069         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
13070         falseStatements always have valid values. 
13071
13072         * cs-parser.jay: Use System.CodeDOM now.
13073