2004-02-14 Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>
[mono.git] / mcs / gmcs / ChangeLog
1 2004-02-05  Martin Baulig  <martin@ximian.com>
2
3         * ecore.cs (FieldExpr.DoResolveLValue): If we have an
4         `ec.TypeContainer.CurrentType', use it instead of
5         `ec.ContainerType' to check whether we're in the type's ctor.
6
7 2004-01-29  Martin Baulig  <martin@ximian.com>
8
9         * expression.cs (Invocation.DoResolve): If we're a
10         `ConstructedType', then we're actually a generic method, so
11         rewrite the expr as a GenericMemberAccess.
12
13         * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
14         here; manually parse it into a string.
15
16 2004-01-28  Martin Baulig  <martin@ximian.com>
17
18         * typemanager.cs (TypeManager.IsEqual): New static method.
19         (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
20         check for equality instead of using `=='.
21
22 2004-01-26  Martin Baulig  <martin@ximian.com>
23
24         * decl.cs (DeclSpace.CurrentType): New public field.
25
26         * expression.cs (This.ResolveBase): If we have an
27         `ec.TypeContainer.CurrentType', use it instead of
28         `ec.ContainerType'.
29
30         * class.cs (TypeContainer.DefineType): If we're a generic type,
31         create the `CurrentType' (unresolved).
32         (TypeContainer.GenericType): New private field.
33         (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
34         it and store it in `GenericType' before creating the MemberCache.
35         (TypeContainer.GetMembers): If we have a `GenericType', call
36         TypeManager.FindMembers() on it.
37
38         * interface.cs (Interface.GenericType): New private field.
39         (Interface.DefineType): If we're a generic type, create the
40         `CurrentType' (unresolved).
41         (Interface.DefineMembers): If we have a `CurrentType', resolve it
42         and store it in `GenericType' before creating the MemberCache.
43         (Interface.GetMembers): If we have a `GenericType', call
44         TypeManager.FindMembers() on it.
45
46 2004-01-22  Martin Baulig  <martin@ximian.com>
47
48         * cs-parser.jay (namespace_or_type_name): Return an Expression,
49         not a QualifiedIdentifier.  This is what `type_name_expression'
50         was previously doing.
51         (type_name_expression): Removed; the code is now in
52         `namespace_or_type_name'.
53         (qualified_identifier): Removed, use `namespace_or_type_name'
54         instead.
55         (QualifiedIdentifier): Removed this class.      
56
57 2004-01-22  Martin Baulig  <martin@ximian.com>
58
59         * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
60         not a string as alias name.
61
62 2004-01-21  Miguel de Icaza  <miguel@ximian.com>
63
64         * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
65         #52730 bug, and instead compute correctly the need to use a
66         temporary variable when requesting an address based on the
67         static/instace modified of the field and the constructor.
68  
69 2004-01-21  Martin Baulig  <martin@ximian.com>
70
71         * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
72         class and namespace before looking up aliases.  Fixes #52517.
73
74 2004-01-21  Martin Baulig  <martin@ximian.com>
75
76         * flowanalysis.cs (UsageVector.Merge): Allow variables being
77         assinged in a 'try'; fixes exception4.cs.
78
79 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
80         * class.cs : Implemented parameter-less constructor for TypeContainer
81         
82         * decl.cs: Attributes are now stored here. New property OptAttributes
83         
84         * delegate.cs, enum.cs, interface.cs: Removed attribute member.
85         
86         * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
87
88 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
89
90         * typemanager.cs (CSharpSignature): Now reports also inner class name.
91           (CSharpSignature): New method for indexer and property signature.
92
93 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
94
95         * pending.cs (IsVirtualFilter): Faster implementation.
96
97 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
98
99         * typemanager.cs: Avoid inclusion of same assembly more than once.
100
101 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
102
103         * cs-parser.jay: Fixed problem where the last assembly attribute
104           has been applied also to following declaration (class, struct, etc.)
105           
106 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
107
108         * class.cs: Added error CS0538, CS0539 reporting.
109         Fixed crash on Microsoft runtime when field type is void.
110
111         * cs-parser.jay: Added error CS0537 reporting.
112
113         * pending.cs: Added error CS0535 reporting.
114         Improved error report for errors CS0536, CS0534.
115
116 2004-01-20  Miguel de Icaza  <miguel@ximian.com>
117
118         Merge a few bits from the Anonymous Method MCS tree.
119         
120         * statement.cs (ToplevelBlock): New class for toplevel methods,
121         will hold anonymous methods, lifted variables.
122
123         * cs-parser.jay: Create toplevel blocks for delegates and for
124         regular blocks of code. 
125
126 2004-01-20  Martin Baulig  <martin@ximian.com>
127
128         * codegen.cs (EmitContext): Removed `InTry', `InCatch',
129         `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
130         and `NeedExplicitReturn'; added `IsLastStatement'.
131         (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
132         have a `ReturnLabel' or we're not unreachable.
133
134         * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
135         child's reachability; don't just override ours with it.  Fixes
136         #58058 (lluis's example).
137         (FlowBranching): Added public InTryOrCatch(), InCatch(),
138         InFinally(), InLoop(), InSwitch() and
139         BreakCrossesTryCatchBoundary() methods.
140
141         * statement.cs (Return): Do all error checking in Resolve().
142         Unless we are the last statement in a top-level block, always
143         create a return label and jump to it.
144         (Break, Continue): Do all error checking in Resolve(); also make
145         sure we aren't leaving a `finally'.
146         (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
147         statement in a top-level block.
148         (Block.Flags): Added `IsDestructor'.
149         (Block.IsDestructor): New public property.
150
151 2004-01-20  Martin Baulig  <martin@ximian.com>
152
153         * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
154
155 2004-01-20  Martin Baulig  <martin@ximian.com>
156
157         * statement.cs (Statement.ResolveUnreachable): New public method.
158         (If, While): Do the dead-code elimination in Resolve(), not in Emit().
159         (Block.Resolve): Resolve unreachable statements.
160
161 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
162
163         * expression.cs: We need to fix the case where we do
164         not have a temp variable here.
165
166         * assign.cs: Only expression compound assignments need
167         temporary variables.
168
169 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
170
171         * flowanalysis.cs: Reduce memory allocation in a few ways:
172           - A block with no variables should not allocate a bit
173             vector for itself.
174           - A method with no out parameters does not need any tracking
175             for assignment of the parameters, so we need not allocate
176             any data for it.
177           - The arrays:
178                 public readonly Type[] VariableTypes;
179                 public readonly string[] VariableNames;
180             Are redundant. The data is already stored in the variable
181             map, so we need not allocate another array for it.
182           - We need to add alot of checks for if (params | locals) == null
183             due to the first two changes.
184
185 2004-01-18  Miguel de Icaza  <miguel@ximian.com>
186
187         * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
188         implement IMemoryLocation, we store a copy on a local variable and
189         take the address of it.  Patch from Benjamin Jemlich
190
191         * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
192         to use a special "type_name_expression" rule which reduces the
193         number of "QualifiedIdentifier" classes created, and instead
194         directly creates MemberAccess expressions.
195
196 2004-01-17  Miguel de Icaza  <miguel@ximian.com>
197
198         * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
199         that fixes #52853.  Null literal assignment to ValueType
200
201         * class.cs (MethodData.Emit): Instead of checking the name of the
202         method to determine if its a destructor, create a new derived
203         class from Method called Destructor, and test for that.  
204
205         * cs-parser.jay: Create a Destructor object instead of a Method.  
206
207         Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
208
209         Fixes: 52933
210         
211 2004-01-16  Miguel de Icaza  <miguel@ximian.com>
212
213         * expression.cs (Binary.ResolveOperator): Perform an implicit
214         conversion from MethodGroups to their delegate types on the
215         Addition operation.
216
217         * delegate.cs: Introduce a new class DelegateCreation that is the
218         base class for `NewDelegate' and `ImplicitDelegateCreation',
219         factor some code in here.
220
221         * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
222         conversion from MethodGroups to compatible delegate types. 
223
224         * ecore.cs (Expression.Resolve): Do not flag error 654
225         (Methodgroupd needs parenthesis) if running on the V2 compiler, as
226         we allow conversions from MethodGroups to delegate types now.
227         
228         * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
229         assignments in v2 either.
230
231 2004-01-10  Miguel de Icaza  <miguel@ximian.com>
232
233         * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
234         static read-only fields in ctors.
235
236         Applied patch from Benjamin Jemlich 
237
238         * expression.cs (UnaryMutator): Avoid leaking local variables. 
239         
240 2004-01-09  Miguel de Icaza  <miguel@ximian.com>
241
242         * cs-tokenizer.cs (IsCastToken): Allow the various native types
243         here to return true, as they can be used like this:
244
245                 (XXX) int.MEMBER ()
246
247         Fixed 49836 and all the other dups
248         
249 2004-01-09  Zoltan Varga  <vargaz@freemail.hu>
250
251         * driver.cs: Implement /win32res and /win32icon.
252
253 2004-01-08  Miguel de Icaza  <miguel@ximian.com>
254
255         * cs-parser.jay: Add a rule to improve error handling for the
256         common mistake of placing modifiers after the type.
257
258 2004-01-07  Miguel de Icaza  <miguel@ximian.com>
259
260         * cs-parser.jay (interface_event_declaration): Catch
261         initialization of events on interfaces, and report cs0068
262
263         * cs-parser.jay (interface_event_declaration): Catch
264         initialization of events. 
265
266         * ecore.cs: Better report missing constructors.
267         
268         * expression.cs (Binary.ResolveOperator): My previous bug fix had
269         the error reporting done in the wrong place.  Fix.
270
271         * expression.cs (Binary.ResolveOperator): Catch the 
272         operator + (E x, E y) error earlier, and later allow for implicit
273         conversions in operator +/- (E e, U x) from U to the underlying
274         type of E.
275
276         * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
277         52596, if the container class is abstract, the default constructor
278         is protected otherwise its public (before, we were always public).
279
280         * statement.cs (Fixed.Resolve): Catch a couple more errors in the
281         fixed statement.
282
283         (Using.EmitLocalVariableDecls): Applied patch from Benjamin
284         Jemlich that fixes bug #52597, MCS was generating invalid code for
285         idisposable structs.   Thanks to Ben for following up with this
286         bug as well.
287         
288 2004-01-06  Miguel de Icaza  <miguel@ximian.com>
289
290         * driver.cs: Allow assemblies without code to be generated, fixes
291         52230.
292
293 2004-01-07  Nick Drochak <ndrochak@gol.com>
294
295         * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
296
297 2004-01-05  Miguel de Icaza  <miguel@ximian.com>
298
299         * cs-parser.jay: Add rules to improve error reporting if fields or
300         methods are declared at the namespace level (error 116)
301
302         * Add rules to catch event add/remove
303
304 2004-01-04  David Sheldon <dave-mono@earth.li>
305
306   * expression.cs: Added matching ")" to error message for 
307   CS0077
308
309 2004-01-03 Todd Berman <tberman@gentoo.org>
310         
311         * ecore.cs, attribute.cs:
312         Applying fix from #52429.
313
314 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
315
316         * ecore.cs, expression.cs, statement.cs:
317         Total rewrite of how we handle branching. We
318         now handle complex boolean expressions with fewer
319         jumps. As well if (x == 0) no longer emits a ceq.
320
321         if (x is Foo) is much faster now, because we generate
322         better code.
323
324         Overall, we get a pretty big improvement on our benchmark
325         tests. The code we generate is smaller and more readable.
326
327         I did a full two-stage bootstrap. The patch was reviewed
328         by Martin and Miguel.
329
330 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
331
332         * cs-parser.jay: Make primary_expression not take a QI.
333         we dont need this because the member_access rule covers
334         us here. So we replace the rule with just IDENTIFIER.
335
336         This has two good effects. First, we remove a s/r conflict.
337         Second, we allocate many fewer QualifiedIdentifier objects.
338
339 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
340
341         * attribute.cs: Handle MarshalAs attributes as pseudo, and
342         set the correct information via SRE. This prevents
343         hanging on the MS runtime. Fixes #29374.
344
345 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
346
347         * convert.cs: correctly handle conversions to value types
348         from Enum and ValueType as unboxing conversions.
349
350         Fixes bug #52569. Patch by Benjamin Jemlich.
351
352 2004-01-02  Ravi Pratap  <ravi@ximian.com>
353
354         * expression.cs (BetterConversion): Prefer int -> uint
355         over int -> ulong (csc's behaviour). This fixed bug #52046.
356
357 2004-01-02 Ben Maurer  <bmaurer@users.sourceforge.net>
358
359         * decl.cs (MemberCache.FindMembers): now returns a
360         MemberInfo [].
361
362         * typemanager.cs: In general, go with with ^^.
363         (CopyNewMethods): take an IList.
364         (RealMemberLookup): Only allocate an arraylist
365         if we copy from two sets of methods.
366
367         This change basically does two things:
368         1) Fewer array lists allocated due to CopyNewMethods.
369         2) the explicit cast in MemberList costed ALOT.
370
371 2004-01-02  Zoltan Varga  <vargaz@freemail.hu>
372
373         * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
374         a hashtable to avoid needless string allocations when an identifier is
375         used more than once (the common case).
376
377 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
378
379         * pending.cs: MS's TypeBuilder.GetInterfaces ()
380         is broken, it will not return anything. So, we
381         have to use the information we have in mcs to
382         do the task.
383
384         * typemanager.cs: Add a cache for GetInterfaces,
385         since this will now be used more often (due to ^^)
386
387         (GetExplicitInterfaces) New method that gets the
388         declared, not effective, interfaces on a type
389         builder (eg, if you have interface IFoo, interface
390         IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
391         { IBar }.
392
393         This patch makes MCS able to bootstrap itself on
394         Windows again.
395
396 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
397
398         * expression.cs: Remove the Nop's that Miguel put
399         in by mistake.
400
401 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
402
403         * report.cs, codegen.cs: Give the real stack trace to
404         the error when an exception is thrown.
405
406 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
407
408         * decl.cs: only allocate hashtables for ifaces if 
409         it is an iface!
410
411 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
412
413         * expression.cs: fix the error from cs0121-2.cs
414         (a parent interface has two child interfaces that
415         have a function with the same name and 0 params
416         and the function is called through the parent).
417
418 2003-12-30 Ben Maurer  <bmaurer@users.sourceforge.net>
419
420         * class.cs, rootcontext.cs, typmanager.cs: do not
421         leak pointers.
422
423 2003-12-28 Ben Maurer  <bmaurer@users.sourceforge.net>
424
425         * codegen.cs: remove stack for the ec flow branching.
426         It is already a linked list, so no need.
427
428 2003-12-27 Ben Maurer  <bmaurer@users.sourceforge.net>
429
430         * Makefile: Allow custom profiler here.
431
432 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
433
434         * typemanager.cs (LookupType):
435           - Use a static char [], because split takes
436             a param array for args, so it was allocating
437             every time.
438           - Do not store true in a hashtable, it boxes.
439
440 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
441
442         * flowanalysis.cs: bytify common enums.
443
444 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
445
446         * modifiers.cs: Add a new set of flags for the
447         flags allowed on explicit interface impls.
448         * cs-parser.jay: catch the use of modifiers in
449         interfaces correctly.
450         * class.cs: catch private void IFoo.Blah ().
451
452         All related to bug #50572.
453
454 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
455
456         * decl.cs: Rewrite the consistant accessability checking.
457         Accessability is not linear, it must be implemented in
458         a tableish way. Fixes #49704.
459
460 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
461
462         * expression.cs: Handle negation in a checked context.
463         We must use subtraction from zero. Fixes #38674.
464
465 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
466
467         * class.cs: Ignore static void main in DLLs.
468         * rootcontext.cs: Handle the target type here,
469         since we are have to access it from class.cs
470         * driver.cs: account for the above.
471
472 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
473
474         * report.cs: Give line numbers and files if available.
475
476 2003-12-20  Zoltan Varga  <vargaz@freemail.hu>
477
478         * driver.cs: Implement /addmodule.
479
480         * typemanager.cs:  Change 'modules' field so it now contains Modules not
481         ModuleBuilders.
482
483 2003-12-20  Martin Baulig  <martin@ximian.com>
484
485         * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
486         (FieldBase.IsAssigned): Removed this field.
487         (FieldBase.SetAssigned): New public method.
488         (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
489
490 2003-12-20  Martin Baulig  <martin@ximian.com>
491
492         * expression.cs (LocalVariableReference.DoResolve): Don't set
493         `vi.Used' if we're called from DoResolveLValue().
494
495         * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
496         returns the usage vector it just merged into the current one -
497         pass this one to UsageWarning().
498         (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
499         of the `EmitContext', don't call this recursively on our children.
500
501 2003-12-19  Zoltan Varga  <vargaz@freemail.hu>
502
503         * driver.cs: Implement /target:module.
504
505 2003-12-18  Zoltan Varga  <vargaz@freemail.hu>
506
507         * support.cs (CharArrayHashtable): New helper class.
508
509         * cs-tokenizer.cs: Store keywords in a hashtable indexed by 
510         char arrays, not strings, so we can avoid creating a string in
511         consume_identifier if the identifier is a keyword.
512
513 2003-12-16  Martin Baulig  <martin@ximian.com>
514
515         * statement.cs (LocalInfo.Assigned): Removed this property.
516         (LocalInfo.Flags): Removed `Assigned'.
517         (LocalInfo.IsAssigned): New public method; takes the EmitContext
518         and uses flow analysis.
519         (Block.UsageWarning): Made this method private.
520         (Block.Resolve): Call UsageWarning() if appropriate.
521
522         * expression.cs (LocalVariableReference.DoResolve): Always set
523         LocalInfo.Used here.
524
525 2003-12-13  Martin Baulig  <martin@ximian.com>
526
527         * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
528         any value here; we're now using flow analysis to figure out
529         whether a statement/block returns a value.
530
531 2003-12-13  Martin Baulig  <martin@ximian.com>
532
533         * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
534         working again.
535         (FlowBranching.MergeFinally): Don't call
536         `branching.CheckOutParameters()' here, this is called in
537         MergeTopBlock().
538         (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
539         when adding the `finally' vector.       
540
541 2003-12-13  Martin Baulig  <martin@ximian.com>
542
543         * flowanalysis.cs
544         (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
545         actually work and also fix #48962.
546
547 2003-12-12 Ben Maurer  <bmaurer@users.sourceforge.net>
548
549         * decl.cs: Do not check System.Object for nested types,
550         since we know it does not have any. Big bang for buck:
551
552         BEFORE:
553            Run 1:   8.35 seconds
554            Run 2:   8.32 seconds
555            corlib:  17.99 seconds
556         AFTER:
557            Run 1:   8.17 seconds
558            Run 2:   8.17 seconds
559            corlib:  17.39 seconds
560
561 2003-12-11 Ben Maurer  <bmaurer@users.sourceforge.net>
562
563         * class.cs (FindMembers): Allocate arraylists on demand. Most of the
564         time we are returning 0 members, so we save alot here.
565
566 2003-12-11  Martin Baulig  <martin@ximian.com>
567
568         * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
569         `MergeChild()', also just take the `FlowBranching' as argument;
570         call Merge() on it and return the result.
571         (FlowBranching.Merge): We don't need to do anything if we just
572         have one sibling.
573
574 2003-12-11  Martin Baulig  <martin@ximian.com>
575
576         * flowanalysis.cs: Use a list of `UsageVector's instead of storing
577         them in an `ArrayList' to reduce memory usage.  Thanks to Ben
578         Maurer for this idea.
579
580 2003-12-11  Martin Baulig  <martin@ximian.com>
581
582         * flowanalysis.cs (MergeResult): This class is now gone; we now
583         use the `UsageVector' for this.  The reason for this is that if a
584         branching just has one sibling, we don't need to "merge" them at
585         all - that's the next step to do.
586         (FlowBranching.Merge): We now return a `UsageVector' instead of a
587         `MergeResult'.
588
589 2003-12-11  Martin Baulig  <martin@ximian.com>
590
591         Reworked flow analyis and made it more precise and bug-free.  The
592         most important change is that we're now using a special `Reachability'
593         class instead of having "magic" meanings of `FlowReturns'.  I'll
594         do some more cleanups and optimizations and also add some more
595         documentation this week.
596
597         * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
598         largely reworked this class.
599         (FlowReturns): Removed `Unreachable' and `Exception'; we now use
600         the new `Reachability' class instead of having "magic" values here.
601         (FlowBranching): We're now using an instance of `Reachability'
602         instead of having separate `Returns', `Breaks' etc. fields.
603
604         * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
605         based on flow analysis; ignore the return value of block.Emit ().
606
607 2003-12-10  Zoltan Varga  <vargaz@freemail.hu>
608
609         * driver.cs typemanager.cs: Find the mono extensions to corlib even
610         if they are private.
611
612 2003-12-09  Martin Baulig  <martin@ximian.com>
613
614         * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
615         call them directly on the UsageVector.
616
617 2003-12-09  Martin Baulig  <martin@ximian.com>
618
619         * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
620         Changed return type from `FlowReturns' to `Reachability'.
621
622 2003-12-09  Martin Baulig  <martin@ximian.com>
623
624         * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
625         (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
626         `Reachable' fields with a single `Reachability' one.
627
628 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
629
630         * class.cs (FindMembers): Remove foreach's.
631
632         Bootstrap times:
633         
634         BEFORE
635                 Run 1:   8.74 seconds
636                 Run 2:   8.71 seconds
637         
638         AFTER
639                 Run 1:   8.64 seconds
640                 Run 2:   8.58 seconds
641         
642
643 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
644
645         * cs-parser.jay:
646         * gen-treedump.cs:
647         * statement.cs:
648         This patch does a few things:
649                 1. EmptyStatement is now a singleton, so it is never reallocated.
650                 2. All blah is EmptyStatement constructs have been changed to
651                    blah == EmptyStatement.Value, which is much faster and valid
652                    now that EmptyStatement is a singleton.
653                 3. When resolving a block, rather than allocating a new array for
654                    the non-empty statements, empty statements are replaced with
655                    EmptyStatement.Value
656                 4. Some recursive functions have been made non-recursive.
657         Mainly the performance impact is from (3), however (1) and (2) are needed for
658         this to work. (4) does not make a big difference in normal situations, however
659         it makes the profile look saner.
660
661         Bootstrap times:
662
663         BEFORE
664         9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
665         9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
666         Total memory allocated: 56397 KB
667         
668         AFTER
669         9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
670         8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
671         Total memory allocated: 55666 KB
672
673 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
674
675         * support.cs: Rewrite DoubleHash to use its own impl. Is faster
676         than the hashtable in a hashtable version
677
678         * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
679         we always end up concating a string. This results in a huge perf
680         loss, because many strings have to be tracked by the GC. In this
681         patch, we first use a hashtable that works with two keys, so that
682         the strings do not need to be concat'ed.
683
684         Bootstrap times:
685         BEFORE
686                 Run 1:   8.74 seconds
687                 Run 2:   8.71 seconds
688         
689         AFTER
690                 Run 1:   8.65 seconds
691                 Run 2:   8.56 seconds
692         
693 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
694
695         * Makefile: Add a new target `do-time' that does a quick and simple
696         profile, leaving easy to parse output.
697
698 2003-12-08  Zoltan Varga  <vargaz@freemail.hu>
699
700         * codegen.cs (Init): Create the dynamic assembly with 
701         AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
702
703 2003-12-02 Ben Maurer  <bmaurer@users.sourceforge.net>
704
705         * support.cs: Make the PtrHashtable use only one
706         instance of its comparer.
707
708 2003-11-30  Zoltan Varga  <vargaz@freemail.hu>
709
710         * typemanager.cs: Fix lookup of GetNamespaces.
711
712 2003-11-29  Miguel de Icaza  <miguel@ximian.com>
713
714         * expression.cs: Removed redundant line.
715
716         * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
717         ArrayLists, use for loops with bounds.  
718
719         * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
720         arraylist.
721
722         * expression.cs (Invocation.OverloadResolve): Avoid foreach on
723         arraylists, use for loop with bounds.
724
725         The above three changes give us a 0.071 second performance
726         improvement out of 3.294 seconds down to 3.223.  On my machine
727         the above changes reduced the memory usage by 1,387 KB during
728         compiler bootstrap.
729
730         * cs-parser.jay (QualifiedIdentifier): New class used to represent
731         QualifiedIdentifiers.  Before we created a new string through
732         concatenation, and mostly later on, the result would be
733         manipulated by DecomposeQI through string manipulation.
734
735         This reduced the compiler memory usage for bootstrapping from
736         59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
737         compile times in 0.05 seconds.
738
739 2003-11-28  Dick Porter  <dick@ximian.com>
740
741         * support.cs: Do string compares with the Invariant culture.
742
743         * rootcontext.cs: 
744         * gen-treedump.cs: 
745         * expression.cs: 
746         * driver.cs: 
747         * decl.cs: 
748         * codegen.cs: 
749         * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
750         the comparison is done with the Invariant culture.
751
752 2003-11-27  Miguel de Icaza  <miguel@ximian.com>
753
754         * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
755         GetEnumerator method.
756
757         (ProbeCollectionType): Iterate starting at the most specific type
758         upwards looking for a GetEnumerator
759
760         * expression.cs: Shift count can be up to 31 for int/uint and 63
761         for long/ulong.
762
763 2003-11-26  Miguel de Icaza  <miguel@ximian.com>
764
765         * statement.cs (Block.LookupLabel): Also look for the label on the
766         children blocks.  Use a hash table to keep track of visited
767         nodes. 
768
769         * cfold.cs (IntConstant to UIntConstant mapping): Only return if
770         we actually did transform the other operand, otherwise fall back
771         to the common codepath that casts to long.
772
773         * cs-tokenizer.cs: Use the same code pattern as the int case.
774         Maybe I should do the parsing myself, and avoid depending on the
775         Parse routines to get this done.
776
777 2003-11-25  Miguel de Icaza  <miguel@ximian.com>
778
779         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
780         which fixes bug 51347.  This time test it.
781         
782         * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
783         attributes for example can not tell the difference between these.
784         The difference was only a syntax feature of the language. 
785
786         * attribute.cs: Apply attributes to delegates.
787
788         * delegate.cs: Call the apply attributes method.
789
790 2003-11-24  Miguel de Icaza  <miguel@ximian.com>
791
792         * convert.cs (TryImplicitIntConversion): One line bug fix: we were
793         comparing 0 vs Byte.MinValue, not the value
794
795         (ImplicitConversionRequired): When reporting a conversion error,
796         use error 31 to print out the constant error instead of the
797         simpler 29.
798
799         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
800         which fixes bug 51347.
801         
802 2003-11-22  Miguel de Icaza  <miguel@ximian.com>
803
804         * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen) 
805         which fixes the -warnaserror command line option.
806         
807 2003-11-21  Miguel de Icaza  <miguel@ximian.com>
808
809         * cfold.cs (DoNumericPromotions): During constant folding of
810         additions on UIntConstant, special case intconstants with
811         IntConstants like we do on the expression binary operator. 
812
813 2003-11-12  Miguel de Icaza  <miguel@ximian.com>
814
815         * convert.cs (ImplicitReferenceConversion): We were missing a case
816         (System.Enum are not value types or class types, so we need to
817         classify them separatedly).
818
819         * driver.cs: We do not support error 2007.
820
821 2003-11-12 Jackson Harper <jackson@ximian.com>
822
823         * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
824         system directory. Also use the full file name so users can
825         libraries names mscorlib-o-tron.dll in a non system dir.
826         
827 2004-01-04  David Sheldon <dave-mono@earth.li>
828
829         * expression.cs: Added matching ")" to error message for CS0077.
830
831 2003-12-19  Martin Baulig  <martin@ximian.com>
832
833         * typemanager.cs (TypeManager.IsEqualGenericType): New public
834         static method; see documentation in the method.
835         (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
836
837         * convert.cs (Convert.ImplicitReferenceConversion,
838         Convert.ImplicitReferenceConversionExists): Add support for
839         generic type declarations; see gen-36.cs.
840
841 2003-12-19  Martin Baulig  <martin@ximian.com>
842
843         * pending.cs (Pending.InterfaceMethod): Use
844         `Type.IsAssignableFrom()' instead of `=='.
845
846 2003-12-18  Martin Baulig  <martin@ximian.com>
847
848         * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
849         byref types first.
850
851         * convert.cs (Convert.ImplicitStandardConversionExists): Use
852         `expr_type.Equals (target_type)' instead of `=='.
853
854 2003-12-08  Martin Baulig  <martin@ximian.com>
855
856         * generics.cs (Constraints.Types): Removed.
857         (Constraints.Resolve): Just resolve everything to TypeExpr's, not
858         to Type's.
859         (Constraints.ResolveTypes): New public method; resolves the
860         TypeExpr's to Type's.
861         (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
862         longer takes the constraints.
863         (TypeParameter.DefineMethod): Likewise.
864         (TypeParameter.DefineType): New public method.  Calls
865         `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
866         the constraints.
867
868 2003-12-08  Martin Baulig  <martin@ximian.com>
869
870         * convert.cs (Convert.ImplicitConversionStandard): Use
871         `expr_type.Equals (target_type)' instead of `=='.
872
873 2003-12-08  Martin Baulig  <martin@ximian.com>
874
875         * typemanager.cs (TypeManager.GetReferenceType): Call
876         `Type.MakeByRefType ()'.
877
878 2003-12-08  Martin Baulig  <martin@ximian.com>
879
880         * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
881         just has some special meaning in some situations.  For instance,
882         it is allowed to use `where' as the name of a variable etc.
883
884 2003-12-04  Martin Baulig  <martin@ximian.com>
885
886         * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
887         `Type.MakeArrayType()' for array types.
888
889 2003-11-18  Miguel de Icaza  <miguel@ximian.com>
890
891         * expression.cs (Invocation.VerifyArgumentsCompat): Remove
892         debugging message.
893
894         (SizeOf.DoResolve): assign the `type_queried' field.  This gets
895         corlib to compile.
896
897 2003-11-16  Martin Baulig  <martin@ximian.com>
898
899         * codegen.cs (EmitContext.IsGeneric): Removed.
900
901         * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
902         ResolveGeneric() on the DeclSpace.
903
904 2003-11-16  Martin Baulig  <martin@ximian.com>
905
906         * generic.cs (TypeArguments.Resolve):
907         `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
908         `ResolveType()' on it to get the Type.
909
910 2003-11-15  Martin Baulig  <martin@ximian.com>
911
912         * generic.cs (ConstructedType.GetInterfaces): Override this.
913
914 2003-11-14  Martin Baulig  <martin@ximian.com>
915
916         * interface.cs (Interface.DefineType): Define all type parameters
917         before adding the interfaces we inherit.
918
919 2003-11-11  Martin Baulig  <martin@ximian.com>
920
921         * generic.cs (ConstructedType.ResolveType): Always call
922         `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
923
924 2003-11-10  Martin Baulig  <martin@ximian.com>
925
926         * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
927         (TypeManager.InitCoreTypes): Initialize them here, but instead of
928         calling `ResolveType()' on them, directly assign their `Type'.
929
930 2003-11-08  Martin Baulig  <martin@ximian.com>
931
932         * generic.cs (ConstructedType): Override `IsClass' etc.
933
934 2003-11-08  Martin Baulig  <martin@ximian.com>
935
936         * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
937         return value and the `out parent' parameter.
938         (TypeContainer.DefineType): Moved the CS0644 check into
939         GetClassBases().  Don't pass the interface types to the
940         `builder.DefineType()'/`builder.DefineNestedType()', but resolve
941         them later and then call `TypeBuilder.AddInterfaceImplementation()'.
942
943         * ecore.cs (TypeExpr.IsAttribute): New property.
944         (TypeExpr.GetInterfaces): New method.
945
946         * interface.cs (Interface.GetInterfaceTypeByName): Return a
947         TypeExpr instead of a Type.
948         (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
949         (Interface.DefineType): Don't pass the interface types to the
950         `builder.Definetype()'/`builder.DefineNestedType()', but resolve
951         them later and then call `TypeBulider.AddInterfaceImplementation()'.
952
953         * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
954         instead of a `Type[]'.
955         (TypeManager.RegisterBuilder): Likewise.
956         (TypeManager.AddUserInterface): Likewise.
957         (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
958         `Type[]' and also return a `TypeExpr[]'.
959         (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
960
961 2003-11-08  Martin Baulig  <martin@ximian.com>
962
963         * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
964         Expression.     
965
966 2003-11-08  Martin Baulig  <martin@ximian.com>
967
968         * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
969         TypeManager.ResolveExpressionTypes().
970
971         * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
972         instead of an Expression.
973         (TypeExpr): This is now an abstract base class for `TypeExpression'.
974         (TypeExpression): New public class; formerly known as `TypeExpr'.
975
976         * expression.cs (ComposedCast): Derive from TypeExpr.
977
978         * typemanager.cs (TypeManager.system_*_expr): These are now
979         TypExpr's instead of Expression's.
980         (TypeManager.ResolveExpressionTypes): New public static function;
981         called from DeclSpace.GetTypeResolveEmitContext() to resolve all
982         of them.        
983
984 2003-11-06  Miguel de Icaza  <miguel@ximian.com>
985
986         * expression.cs (New.DoResolve): Do not dereference value that
987         might be a null return.
988
989         * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
990         sure that the constant value has the right type.  Fixes an
991         unreported bug, similar to 50425.
992
993         * const.cs (Const.LookupConstantValue): Call
994         ImplicitStandardConversionExists before doing a conversion to
995         avoid havng the TypeManager.ChangeType do conversions.
996
997         Reduced the number of casts used
998
999         (Const.ChangeType): New routine to enable reuse of the constant
1000         type changing code from statement.
1001
1002         * typemanager.cs (ChangeType): Move common initialization to
1003         static global variables.
1004
1005         Fixes #50425.
1006
1007         * convert.cs (ImplicitReferenceConversion): Somehow we allowed
1008         every value type to go through, even if it was void.  Fix that. 
1009
1010         * cs-tokenizer.cs: Use is_identifier_start_character on the start
1011         character of the define, and the is_identifier_part_character for
1012         the rest of the string.
1013
1014 2003-11-05  Miguel de Icaza  <miguel@ximian.com>
1015
1016         * expression.cs (UnaryMutator.EmitCode): When I updated
1017         LocalVariableReference.DoResolve, I overdid it, and dropped an
1018         optimization done on local variable references.
1019
1020 2003-11-04  Miguel de Icaza  <miguel@ximian.com>
1021
1022         * ecore.cs: Convert the return from Ldlen into an int.
1023
1024 2003-10-20  Miguel de Icaza  <miguel@ximian.com>
1025
1026         * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
1027         the accessibility, this is a special case for toplevel non-public
1028         classes (internal for instance).
1029
1030 2003-10-20  Nick Drochak <ndrochak@gol.com>
1031
1032         * ecore.cs: Fix typo and build.  Needed another right paren.
1033
1034 2003-10-19  Miguel de Icaza  <miguel@ximian.com>
1035
1036         * ecore.cs: Applied fix from Ben Maurer.   We were handling in the
1037         `internal' case regular and protected, but not allowing protected
1038         to be evaluated later.  Bug 49840
1039
1040 2003-10-15  Miguel de Icaza  <miguel@ximian.com>
1041
1042         * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
1043         to kb.Nlast, and not the kb.nFirst to isolate the switch
1044         statement.
1045
1046         Extract the underlying type, so enumerations of long/ulong are
1047         treated like long/ulong.
1048
1049 2003-10-14  Miguel de Icaza  <miguel@ximian.com>
1050
1051         * expression.cs (New): Overload the meaning of RequestedType to
1052         track the possible creation of the NewDelegate type, since
1053         DoResolve is invoked more than once for new constructors on field
1054         initialization.
1055
1056         See bugs: #48800 and #37014
1057
1058         * cs-parser.jay (declare_local_constants): Take an arraylist
1059         instead of a single constant.
1060
1061         (local_constant_declaration): It should take a
1062         constant_declarators, not a constant_declarator.  Fixes 49487
1063
1064         * convert.cs: Fix error report.
1065
1066 2003-10-13 Jackson Harper <jackson@ximian.com>
1067
1068         * typemanager.cs (TypeToCoreType): Add float and double this fixes
1069         bug #49611
1070         
1071 2003-11-03  Martin Baulig  <martin@ximian.com>
1072
1073         * expression.cs (ArrayAccess.GetStoreOpcode): Added
1074         `out bool has_type_arg'; if set, we need to pass the type to
1075         ig.Emit().
1076         (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
1077         Stelem_Any/Ldelem_Any for generic parameters.   
1078
1079 2003-11-02  Martin Baulig  <martin@ximian.com>
1080
1081         * expression.cs (Invocation.EmitCall): Use
1082         `TypeManager.IsValueType()' to check whether it's a value type.
1083         Don't set `struct_call' when calling a method on a type parameter.
1084
1085 2003-11-02  Martin Baulig  <martin@ximian.com>
1086
1087         * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
1088         and removed the TypeBuilder argument.
1089
1090         * typemanager.cs (TypeManager.IsValueType): Return
1091         `t.IsGenericParameter || t.IsValueType'.
1092
1093 2003-10-25  Martin Baulig  <martin@ximian.com>
1094
1095         * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
1096         call ConstructedType.Resolve() on it.
1097
1098         * generic.cs (ConstructedType.Resolve): Set `type' on success.
1099
1100 2003-10-25  Martin Baulig  <martin@ximian.com>
1101
1102         * class.cs (TypeContainer.GetClassBases): Changed
1103         `out Type parent' into `out TypeExpr parent'.  Moved CS0644 and
1104         CS8214 reporting here.
1105         (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
1106         instead of a `Type' for our parent.  In case of a recursive
1107         declaration (see tests/gen-23.cs for an example), our parent is a
1108         ConstructedType and it doesn't have its type set.  So, first
1109         create our own TypeBuilder, then call constructed.Resolve() to get
1110         the parent's type and finally TypeBuilder.SetParent() it.
1111
1112         * ecore.cs (TypeExpr.Name): New public virtual property.
1113
1114         * generic.cs
1115         (ConstructedType): We're now a TypeExpr and not just an Expression.
1116         (ConstructedType.ResolveAsTypeStep): Don't resolve our type
1117         arguments here; this is done later.
1118         (ConstructedType.Resolve): New public method to resolve the type
1119         arguments and bind them.
1120
1121 2003-10-21  Martin Baulig  <martin@ximian.com>
1122
1123         * convert.cs: Use `TypeManager.IsValueType' instead of
1124         'type.IsValueType' everywhere.
1125
1126         * typemanager.cs (TypeManager.IsValueType): Return true for type
1127         parameters.  The reason for this is that we need to box a type
1128         parameter when converting it to a reference type.
1129
1130         * cs-parser.jay: Added support for default value expressions.
1131
1132         * generics.cs (DefaultValueExpression): New public class.       
1133
1134 2003-10-17  Martin Baulig  <martin@ximian.com>
1135
1136         * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
1137         TypeContainer so we can also use this for Interfaces.
1138         (TypeParameter.Resolve): Likewise.
1139
1140         * interface.cs (Interface.DefineType): Added support for generic
1141         interfaces.
1142
1143         * cs-parser.jay: Added support for generic structs and interfaces.
1144
1145 2003-10-17  Martin Baulig  <martin@ximian.com>
1146
1147         * generic.cs (GenericMemberAccess.DoResolve): We can now actually
1148         call generic methods :-)
1149
1150 2003-10-16  Martin Baulig  <martin@ximian.com>
1151
1152         * cs-parser.jay (namespace_or_type_name): Only create a
1153         GenericMemberAccess if we actually have type arguments.
1154
1155 2003-10-13  Martin Baulig  <martin@ximian.com>
1156
1157         * class.cs (Method.Define): If we're a generic method, call
1158         TypeBuilder.DefineGenericMethod () before resolving
1159         the parameters.
1160         (MethodData): Added .ctor which takes an additional MethodBuilder
1161         argument; this is used for generic methods.
1162         (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
1163         we already have a MethodBuilder.
1164
1165 2003-10-10  Martin Baulig  <martin@ximian.com>
1166
1167         * class.cs (Method): Added .ctor which takes a `GenericMethod'
1168         instead of a `DeclSpace'.  This is used for generic methods.
1169
1170         * cs-parser.jay (method_header): Added support for generic
1171         methods; create a `GenericMethod' instance and pass it to the
1172         `Method's .ctor; it'll be used as the `DeclSpace' to lookup
1173         parameters and locals.
1174
1175         * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
1176         since we already have the location.  Check whether we're a generic
1177         type declaration or a generic method and create the correct type
1178         parameter.
1179
1180         * generic.cs (TypeParameter.DefineMethod): New public method.
1181         (GenericMethod): New public class; derives from DeclSpace and is
1182         used for generic methods.       
1183
1184 2003-10-09  Martin Baulig  <martin@ximian.com>
1185
1186         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
1187         to the .ctor.
1188         (MethodCore.DoDefineParameters): Removed the TypeContainer
1189         argument; use the DeclSpace which was passed to the .ctor instead.
1190         (MethodCore.CheckParameter): Take a DeclSpace instead of a
1191         TypeContainer; we only need a DeclSpace here.
1192
1193 2003-10-09  Martin Baulig  <martin@ximian.com>
1194
1195         * class.cs (MethodData): Added additional `DeclSpace ds' argument
1196         to the .ctor.
1197         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
1198         EmitContext's .ctor.    
1199
1200 2003-10-09  Martin Baulig  <martin@ximian.com>
1201
1202         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
1203         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
1204         AsAccessible(), moved them as well.
1205
1206         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
1207
1208 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
1209
1210         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
1211         generation for >=, as spotted by Paolo, bug 48679.  
1212         Patch from David Waite.
1213
1214         * cs-tokenizer.cs: Add handling for #pragma.
1215
1216         * cs-parser.jay: Allow for both yield and yield return in the
1217         syntax.  The anti-cobolization of C# fight will go on!
1218
1219         * class.cs (TypeBuilder.DefineType): Catch error condition here
1220         (Parent.DefineType erroring out and returning null).
1221
1222         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1223         coping with enumerations variables, we were mistakenly processing
1224         them as a regular value type instead of built-in types.  Fixes the
1225         bug #48063
1226
1227         * typemanager.cs (IsBuiltinOrEnum): New method.
1228
1229 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
1230
1231         * cs-parser.jay: Upgrade: yield now needs the return clause.
1232
1233 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
1234
1235         * cs-parser.jay : Renamed yyName to yyNames related to jay.
1236
1237 2003-09-29  Martin Baulig  <martin@ximian.com>
1238
1239         * typemanager.cs (TypeManager.GetMethodFlags): Added support for
1240         inflated generic methods.
1241
1242         * generics.cs (ConstructedType): Distinguish between open and
1243         closed constructed types; correctly resolve the arguments.
1244
1245 2003-09-22  Martin Baulig  <martin@ximian.com>
1246
1247         * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
1248         all type arguments meet their constraints.
1249
1250 2003-09-19  Martin Baulig  <martin@ximian.com>
1251
1252         * decl.cs (MemberCache.SetupCacheForInterface): Take a
1253         `MemberCache parent' argument.  Normally, an interface doesn't
1254         have a parent type except System.Object, but we use this in gmcs
1255         for generic type parameters.
1256
1257 2003-09-18  Martin Baulig  <martin@ximian.com>
1258
1259         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
1260         on `type.IsInterface'; don't check whether the type has a parent
1261         to determine whether it's an interface.
1262
1263 2003-09-17  Martin Baulig  <martin@ximian.com>
1264
1265         * generic.cs (ConstructedType.ToString): Always use `name' as the
1266         type name.
1267
1268 2003-09-15  Martin Baulig  <martin@ximian.com>
1269
1270         * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
1271
1272         * generic.cs (Constraints.Resolve): New public method; this is
1273         called to resolve the constraint types and to check whether all
1274         the constraints are correct.
1275         (Constraints.Types): New public property.
1276         (TypeParameter.Resolve): New public method; resolves all the
1277         type's constraints.
1278
1279         * class.cs (TypeContainer.DefineType): Call
1280         TypeParameter.Resolve() before actually defining the type.
1281
1282 2003-09-15  Martin Baulig  <martin@ximian.com>
1283
1284         * class.cs (TypeContainer.DefineType): Added an error flag to
1285         avoid reporting duplicate CS0146's ("class definition is
1286         circular.").
1287
1288         * driver.cs (Driver.MainDriver): Abort if
1289         RootContext.ResolveTree() reported any errors.
1290
1291 2003-09-07  Martin Baulig  <martin@ximian.com>
1292
1293         * report.cs (Error, Warning): Added overloaded versions which take
1294         a `params object[] args' and call String.Format().
1295
1296 2003-09-07  Martin Baulig  <martin@ximian.com>
1297
1298         * decl.cs (DeclSpace..ctor): Don't call
1299         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
1300         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
1301         (DeclSpace.RecordDecl): New method.
1302
1303         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
1304
1305 2003-09-02  Ravi Pratap  <ravi@ximian.com>
1306
1307         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
1308         value attributes to be applied to ParameterBuilders.
1309
1310         * class.cs (MethodCore.LabelParameters): Make static and more
1311         generic so that it can be used from other places - like interface
1312         methods, for instance.
1313
1314         * interface.cs (Interface.Emit): Call LabelParameters before
1315         emitting attributes on the InterfaceMethod.
1316
1317 2003-09-07  Martin Baulig  <martin@ximian.com>
1318
1319         * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
1320         if the number of type parameters doesn't match.
1321
1322 2003-09-04  Martin Baulig  <martin@ximian.com>
1323
1324         * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
1325         for arrays of generic type params (ie. `!0[]').
1326
1327 2003-09-04  Martin Baulig  <martin@ximian.com>
1328
1329         * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
1330         for the moment.
1331
1332 2003-09-04  Martin Baulig  <martin@ximian.com>
1333
1334         * decl.cs (DeclSpace.LookupGeneric): New method.
1335         (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
1336         moment.
1337
1338         * generic.cs (TypeParameterExpr): Take a TypeParameter as
1339         argument, not just a string.
1340         (TypeParameter.Define): New public method; this is called to
1341         actually define the generic parameter; after this, you can use the
1342         new `Type' property to get the type.
1343
1344 2003-09-04  Martin Baulig  <martin@ximian.com>
1345
1346         * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
1347         is now an ArrayList; initialize the result of the `TypeParameters'
1348         property here.
1349         (DeclSpace.GetGenericData): Removed.
1350         (DeclSpace.LookupGeneric): Temporarily removed; we need to
1351         implement this in a different way.
1352         (DeclSpace.GetTypeParameters): Removed; there's now a
1353         `TypeParameters' property.
1354         (DeclSpace.TypeParameters): New public property.
1355
1356         * generic.cs (Constraints): Make this class public.
1357         (TypeParameter): New public class.
1358
1359 2003-09-04  Martin Baulig  <martin@ximian.com>
1360
1361         * decl.cs (DeclSpace.GetTypeParameters): New method to return the
1362         generic parameters.
1363
1364         * class.cs (TypeContainer.DefineType): Call
1365         TypeBuilder.DefineGenericParameter () on all generic parameters if
1366         this is a generic type.
1367
1368 2003-08-28  Martin Baulig  <martin@ximian.com>
1369
1370         * sample-stack.il: Compile this with ilasm: "ilasm /dll
1371         sample-stack.il".
1372
1373         * sample-hello.cs: Compile this with gmcs: "gmcs
1374         /r:sample-stack.dll sample-hello.cs".
1375
1376 2003-08-28  Martin Baulig  <martin@ximian.com>
1377
1378         * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
1379         the parameters to the generic type.
1380
1381 2003-08-28  Martin Baulig  <martin@ximian.com>
1382
1383         * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
1384
1385 2003-08-28  Martin Baulig  <martin@ximian.com>
1386
1387         * cs-parser.jay (opt_type_argument_list): Use
1388         `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
1389         (primary_expression): Replace `qualified_identifier' with `type_name'.
1390         (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
1391
1392         * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
1393         parser to check whether it is syntactically a type parameter list;
1394         return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
1395         this case.
1396
1397 2003-08-26  Martin Baulig  <martin@ximian.com>
1398
1399         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
1400         resolving aliases; fixes #47927.
1401
1402 2003-08-26  Martin Baulig  <martin@ximian.com>
1403
1404         * statement.cs (Using.DoResolve): This is internally emitting a
1405         try/finally clause, so we need to set ec.NeedExplicitReturn if we
1406         do not always return.  Fixes #47681.
1407
1408 2003-08-26  Martin Baulig  <martin@ximian.com>
1409
1410         * decl.cs (MemberCore): Moved WarningNotHiding(),
1411         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
1412         into MemberBase.
1413         (AdditionResult): Make this nested in DeclSpace.
1414         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
1415         argument; call NamespaceEntry.Define() unless we're nested in a
1416         class or struct.
1417
1418         * namespace.cs (Namespace.DefineName): New public function.  This
1419         is called from DeclSpace's .ctor to add 
1420         (Namespace.Lookup): Include DeclSpaces in the lookup.
1421
1422         * class.cs (Operator): Derive from MemberBase, not MemberCore.
1423
1424         * const.cs (Const): Derive from MemberBase, not MemberCore.     
1425
1426 2003-08-25  Martin Baulig  <martin@ximian.com>
1427
1428         * convert.cs (Convert.ExplicitReferenceConversion): When
1429         converting from an interface type to a class, unbox if the target
1430         type is a struct type.  Fixes #47822.
1431
1432 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1433
1434         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
1435         #47854.
1436
1437 2003-08-22  Martin Baulig  <martin@ximian.com>
1438
1439         * class.cs (TypeManager.DefineType): When defining a nested type,
1440         call DefineType() on our parent; fixes #47801.
1441
1442 2003-08-22  Martin Baulig  <martin@ximian.com>
1443
1444         * class.cs (MethodData.Define): While checking if a method is an
1445         interface implementation, improve the test a bit more to fix #47654.
1446
1447 2003-08-22  Martin Baulig  <martin@ximian.com>
1448
1449         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
1450         correctly; fixes #47722.
1451
1452 2003-08-22  Martin Baulig  <martin@ximian.com>
1453
1454         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
1455         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
1456
1457         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
1458
1459 2003-08-22  Martin Baulig  <martin@ximian.com>
1460
1461         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
1462         can only be assigned in static constructors.  Fixes #47161.
1463
1464 2003-08-22  Martin Baulig  <martin@ximian.com>
1465
1466         Rewrote and improved the flow analysis code.
1467
1468         * flowbranching.cs (FlowBranching): Make this class abstract.
1469         (FlowBranching.CreateBranching): New static function to create a
1470         new flow branching.
1471         (FlowBranchingBlock, FlowBranchingException): New classes.
1472         (FlowBranching.UsageVector.Type): New public readonly field.
1473         (FlowBranching.UsageVector.Breaks): Removed the setter.
1474         (FlowBranching.UsageVector.Returns): Removed the setter.
1475         (FlowBranching.UsageVector): Added Break(), Return(),
1476         NeverReachable() and Throw() methods to modify the reachability.
1477         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
1478         done by FlowBranching.Merge().
1479         (FlowBranching.UsageVector.MergeChild): New method; merges the
1480         merge result into the current vector.
1481         (FlowBranching.Merge): New abstract method to merge a branching.
1482
1483 2003-08-12  Martin Baulig  <martin@ximian.com>
1484
1485         * expression.cs (Indirection.CacheTemporaries): Create the
1486         LocalTemporary with the pointer type, not its element type.
1487
1488 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
1489
1490         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
1491         token was a keyword or not.
1492
1493         Add `error' options where an IDENTIFIER was expected;  Provide
1494         CheckToken and CheckIdentifierToken convenience error reporting
1495         functions. 
1496
1497         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
1498
1499         * decl.cs: Rename `NamespaceEntry Namespace' public field into
1500         NameSpaceEntry NameSpaceEntry.
1501
1502         (LookupInterfaceOrClass): Avoid creating a full qualified name
1503         from namespace and name: avoid doing lookups when we know the
1504         namespace is non-existant.   Use new Tree.LookupByNamespace which
1505         looks up DeclSpaces based on their namespace, name pair.
1506
1507         * driver.cs: Provide a new `parser verbose' to display the
1508         exception thrown during parsing.  This is turned off by default
1509         now, so the output of a failure from mcs is more graceful.
1510
1511         * namespace.cs: Track all the namespaces defined in a hashtable
1512         for quick lookup.
1513         
1514         (IsNamespace): New method
1515
1516 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
1517
1518         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
1519         we know that we need to concatenate (full typename can never be
1520         null). 
1521
1522         * class.cs: ditto.
1523
1524         * statement.cs: Use a bitfield;  Do not initialize to null things
1525         which are done by the constructor by default.
1526
1527         * cs-parser.jay: bug fix, parameter was 4, not 3.
1528
1529         * expression.cs: Just use the property;
1530
1531         * statement.cs: No need for GetVariableInfo method.
1532
1533 2003-08-08  Martin Baulig  <martin@ximian.com>
1534
1535         * flowanalysis.cs (FlowReturns): This is now nested in the
1536         `FlowBranching' class.
1537         (MyBitVector): Moved this here from statement.cs.
1538         (FlowBranching.SiblingType): New enum type.
1539         (FlowBranching.CreateSibling): Added `SiblingType' argument.
1540
1541 2003-08-07  Martin Baulig  <martin@ximian.com>
1542
1543         * flowanalysis.cs (FlowBranchingType): This is now nested in the
1544         `FlowBranching' class and called `BranchingType'.
1545
1546 2003-08-07  Martin Baulig  <martin@ximian.com>
1547
1548         * flowanalysis.cs: Moved all the control flow analysis code into
1549         its own file.
1550
1551 2003-08-07  Martin Baulig  <martin@ximian.com>
1552
1553         * assign.cs (Assign.DoResolve): `target' must either be an
1554         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
1555         #37319.
1556
1557 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
1558
1559         * expression.cs (BinaryMethod): This kind of expression is created by the
1560         Binary class if it determines that the operator has to be handled
1561         by a method.
1562
1563         (BinaryDelegate): This kind of expression is created if we are
1564         dealing with a + or - operator on delegates.
1565
1566         (Binary): remove method, argumetns, and DelegateOperator: when
1567         dealing with methods, 
1568         
1569         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
1570
1571         * statement.cs (Block): use bitfields for the three extra booleans
1572         we had in use.   Remove unused topblock parameter.
1573
1574         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
1575
1576         * assign.cs: Drop extra unneeded tests.
1577
1578 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
1579
1580         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
1581
1582         * statement.cs (Foreach): Use VariableStorage instead of
1583         LocalBuilders.   
1584
1585         * codegen.cs (VariableStorage): New class used by clients that
1586         require a variable stored: locals or fields for variables that
1587         need to live across yield.
1588
1589         Maybe provide a convenience api for EmitThis+EmitLoad?
1590
1591         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
1592         these bad boys.
1593
1594 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
1595
1596         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
1597         RemapParameterLValue): New methods that are used to turn a
1598         precomputed FieldInfo into an expression like this:
1599
1600                 instance.FieldInfo
1601
1602         The idea is to use this instead of making LocalVariableReference
1603         have more than one meaning.
1604
1605         * cs-parser.jay: Add error production to BASE.
1606
1607         * ecore.cs: Deal with TypeManager.GetField returning null, which
1608         is now a valid return value.
1609
1610         (FieldExprNoAddress): New expression for Fields whose address can
1611         not be taken.
1612
1613         * expression.cs (LocalVariableReference): During the resolve
1614         phases, create new expressions if we are in a remapping context.
1615         Remove code that dealt with remapping here.
1616
1617         (ParameterReference): same.
1618
1619         (ProxyInstance): New expression, like the `This' expression, but
1620         it is born fully resolved.  We know what we are doing, so remove
1621         the errors that are targeted to user-provided uses of `this'.
1622
1623         * statement.cs (Foreach): our variable is now stored as an
1624         Expression;  During resolution, follow the protocol, dont just
1625         assume it will return this.
1626         
1627 2003-08-06  Martin Baulig  <martin@ximian.com>
1628
1629         * support.cs (SeekableStreamReader.cs): New public class.
1630
1631         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
1632         SeekableStreamReader instead of the normal StreamReader.
1633
1634 2003-08-04  Martin Baulig  <martin@ximian.com>
1635
1636         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
1637         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
1638         deambiguate casts and delegate invocations.
1639         (parenthesized_expression): Use the new tokens to ensure this is
1640         not a cast of method invocation.
1641
1642         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
1643         when reading a `)' and Deambiguate_CloseParens () was previously
1644         called.
1645
1646         * expression.cs (ParenthesizedExpression): New class.  This is
1647         just used for the CS0075 test.
1648         (Binary.DoResolve): Check for CS0075.   
1649
1650 2003-07-29  Ravi Pratap  <ravi@ximian.com>
1651
1652         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
1653         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
1654         reference comparison.
1655
1656         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
1657         examine the ReturnType for equality - this is necessary in the
1658         cases of implicit and explicit operators whose signature also
1659         includes the return type.
1660
1661 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
1662
1663         * namespace.cs: Cache the result of the namespace computation,
1664         instead of computing it every time.
1665
1666 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
1667
1668         * decl.cs: Use a global arraylist that we reuse over invocations
1669         to avoid excesive memory consumption.  Reduces memory usage on an
1670         mcs compile by one meg (45 average).
1671
1672         * typemanager.cs (LookupTypeReflection): In .NET pointers are
1673         private, work around that.
1674
1675 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
1676
1677         * literal.cs (IntLiteral): Define Zero and One static literals. 
1678
1679         * cs-parser.jay (integer_literal): use static literals to reduce
1680         memory usage for the most used literals (0, 1 and -1).  211kb
1681         reduced in memory usage.
1682
1683         Replace all calls to `new ArrayList' with `new
1684         ArrayList(4)' which is a good average number for most allocations,
1685         and also requires only 16 bytes of memory for its buffer by
1686         default. 
1687
1688         This reduced MCS memory usage in seven megabytes for the RSS after
1689         bootstrapping.
1690
1691 2003-07-28  Ravi Pratap  <ravi@ximian.com>
1692
1693         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
1694         handle params methods the correct way by forming only one
1695         applicable set with params and normal methods in them. Earlier we
1696         were looking at params methods only if we found no normal methods
1697         which was not the correct thing to do.
1698
1699         (Invocation.BetterFunction): Take separate arguments indicating
1700         when candidate and the best method are params methods in their
1701         expanded form.
1702
1703         This fixes bugs #43367 and #46199.
1704
1705         * attribute.cs: Documentation updates.
1706
1707         (CheckAttribute): Rename to CheckAttributeTarget.
1708         (GetValidPlaces): Rename to GetValidTargets.
1709
1710         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
1711         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
1712
1713         Fixes bug #44468.
1714
1715 2003-07-28  Miguel de Icaza  <miguel@ximian.com>
1716
1717         * codegen.cs: Compute IsGeneric correctly.
1718
1719         * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
1720         resolution. 
1721
1722         Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
1723         OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN.  There were too many
1724         regressions, and I was chasing more bugs than I required.
1725
1726         * interface.cs: Use expressions for base type names (like classes
1727         and structs have been doing for a while now), and resolve that.
1728         This patch should probably go into head as well.
1729
1730         This makes it one less user of FindType.
1731
1732 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
1733
1734         This compiler can not self host currently.  Need to fix that.
1735         
1736         * Makefile: compile to `gmcs.exe'
1737
1738         * driver.cs: Turn on v2 by default on gmcs.
1739
1740         * generic.cs (ConstructedType): Does no longer take a container
1741         type argument;  That will be taken care of later.
1742
1743         (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
1744         Use SimpleName to resolve for now, so we can continue the work on
1745         the parser, until we get Type.GetType that understands generics.
1746
1747         (ConstructedType.ToString): Implement
1748
1749         (TypeArguments.Resolve): Resolve the child expressions as types. 
1750         
1751         * cs-parser.jay: Rename interface_constraints to
1752         type_parameter_constraints
1753
1754         (namespace_or_type_name): Only use constructed types for the basic
1755         construction, we will deal with identifier<...> later.
1756
1757         (type/type_name): No longer call DecomposeQI, as
1758         namespace_or_type_name is always decoded now.
1759         
1760 2003-07-22  Ravi Pratap  <ravi@ximian.com>
1761
1762         * expression.cs (Invocation.OverloadResolve): Follow the spec more
1763         closely: we eliminate methods in base types when we have an
1764         applicable method in a top-level type.
1765
1766         Please see section 14.5.5.1 for an exact description of what goes
1767         on. 
1768
1769         This fixes bug #45127 and a host of other related to corlib compilation.
1770
1771         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
1772         array is the method corresponding to the top-level type (this is
1773         because of the changes made to icall.c) so we change this
1774         accordingly.
1775
1776         (MethodGroupExpr.Name): This too.
1777
1778         * typemanager.cs (GetElementType): New method which does the right
1779         thing when compiling corlib. 
1780
1781         * everywhere: Make use of the above in the relevant places.
1782
1783 2003-07-22  Martin Baulig  <martin@ximian.com>
1784
1785         * cs-parser.jay (invocation_expression): Moved
1786         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
1787         `cast_expression', but create a InvocationOrCast which later
1788         resolves to either an Invocation or a Cast.
1789
1790         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
1791         method; call this before EmitStatement() to make sure that this
1792         expression can be used as a statement.
1793
1794         * expression.cs (InvocationOrCast): New class; resolves to either
1795         an Invocation or a Cast.
1796
1797         * statement.cs (StatementExpression): Call ResolveStatement() on
1798         the ExpressionStatement before emitting it.
1799
1800 2003-07-21  Martin Baulig  <martin@ximian.com>
1801
1802         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
1803         `ref' and `out' attributes match; fixes #46220.
1804         (MemberAccess.ResolveMemberAccess): You can't reference a type
1805         through an expression; fixes #33180.
1806         (Indexers.GetIndexersForType): Don't return the indexers from
1807         interfaces the class implements; fixes #46502.
1808
1809 2003-07-21  Martin Baulig  <martin@ximian.com>
1810
1811         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
1812         CS0661 checks; fixes bug #30442.
1813
1814 2003-07-21  Martin Baulig  <martin@ximian.com>
1815
1816         * decl.cs (AdditionResult): Added `Error'.
1817
1818         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
1819
1820         * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
1821         cs0031.cs actually work.
1822
1823  2003-07-20  Miguel de Icaza  <miguel@ximian.com>
1824  
1825         * cs-parser.jay (namespace_name): do not use
1826         namespace_or_type_name, use qualified_identifier, because
1827         namespace_or_type_name will soon return a composed expression
1828         instead of a string.
1829  
1830         (namespace_or_type_name): Instead of returning a string, now this
1831         production returns an expression.
1832  
1833         * codegen.cs (EmitContext): Setup IsGeneric property based on
1834         whether our DeclSpace is generic, our the method is generic.
1835  
1836         * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
1837         the method is generic.
1838  
1839         * cs-parser.jay (type_arguments, opt_type_argument_list,
1840         type_parameters, type_parameter_list, opt_type_parameter_list,
1841         type_parameter,, opt_type_parameter_constraints_clauses,
1842         type_parameter_constraints_clauses,
1843         type_parameter_constraint_clause, type_parameter_constraint,
1844         interface_constraints): Add new production
1845  
1846         * decl.cs (DeclSpace): IsGeneric, flag to track whether this
1847         DeclSpace is generic or not.
1848  
1849         (DeclSpace.SetParameterInfo): New routine, used to set the
1850         parameter info for a type.
1851  
1852         (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
1853         returns a GenericTypeExpr
1854  
1855         * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
1856         generic, lookup the generic argument.
1857  
1858         * attribute.cs: Do not allow TypeParameterExpressions in
1859         Attributes.
1860  
1861         * class.cs: Do not allow the Main method to be defined in a
1862         Generic container.
1863  
1864         * expression.cs (SizeOf): Do not allow generic types to be used as
1865         arguments to sizeof.
1866  
1867         * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
1868         it: whether a type is generic or not.  Only works for types we are
1869         currently building for now.
1870         
1871 2003-07-20  Martin Baulig  <martin@ximian.com>
1872
1873         * namespace.cs: Fixed that bug which caused a crash when compiling
1874         the debugger's GUI.
1875
1876 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
1877
1878         * typemanager.cs (LookupTypeReflection): Never expose types which
1879         are NotPublic, NestedPrivate, NestedAssembly, or
1880         NestedFamANDAssem.  We used to return these, and later do a check
1881         that would report a meaningful error, but the problem is that we
1882         would not get the real match, if there was a name override.
1883
1884 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
1885
1886         * namespace.cs (Namespace, Name): Do not compute the namespace
1887         name dynamically, compute it in the constructor.  This reduced
1888         memory usage by 1697 KB.
1889
1890         * driver.cs: Use --pause to pause at the end.
1891
1892 2003-07-17  Peter Williams  <peter@newton.cx>
1893
1894         * Makefile: Change the name of the test target so that it doesn't
1895         conflict with the recursive test target.
1896
1897 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
1898
1899         * expression.cs (LocalVariableReference.Emit, EmitAssign,
1900         AddressOf): Do not use EmitThis, that was wrong, use the actual
1901         this pointer.
1902
1903 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
1904
1905         * class.cs (MethodData.Define): While checking if a method is an
1906         interface implementation, improve the test: If we are not public
1907         (use new test here: use the computed MethodAttributes directly,
1908         instead of the parsed modifier flags) check if the `implementing'
1909         method comes from an interface or not.
1910
1911         * pending.cs (VerifyPendingMethods): Slightly better error
1912         message.
1913
1914         * makefile: add test target that does the mcs bootstrap.
1915
1916 2003-07-16  Ravi Pratap  <ravi@ximian.com>
1917
1918         * interface.cs (Define): Do nothing here since there are no
1919         members to populate etc. Move the attribute emission out of here
1920         since this was just totally the wrong place to put it. Attribute
1921         application happens during the 'Emit' phase, not in the 'Define'
1922         phase.
1923
1924         (Emit): Add this method and move the attribute emission here
1925
1926         * rootcontext.cs (EmitCode): Call the Emit method on interface
1927         types too.
1928
1929 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
1930
1931         * expression.cs (OverloadResolve): Report error only if Location
1932         is not 'Null' which means that there was a probe going on.
1933
1934 2003-07-14  Martin Baulig  <martin@ximian.com>
1935
1936         * expression.cs (ConditionalLogicalOperator): New public class to
1937         implement user defined conditional logical operators.
1938         This is section 14.11.2 in the spec and bug #40505.
1939
1940 2003-07-14  Martin Baulig  <martin@ximian.com>
1941
1942         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
1943
1944 2003-07-14  Martin Baulig  <martin@ximian.com>
1945
1946         * codegen.cs (EmitContext.InFixedInitializer): New public field.
1947
1948         * ecore.cs (IVariable.VerifyFixed): New interface method.
1949
1950         * expression.cs (Unary.ResolveOperator): When resolving the `&'
1951         operator, check whether the variable is actually fixed.  Fixes bug
1952         #36055.  Set a variable definitely assigned when taking its
1953         address as required by the spec.
1954
1955         * statement.cs (LocalInfo.IsFixed): New field.
1956         (LocalInfo.MakePinned): Set `IsFixed' to true.
1957
1958 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
1959
1960         * attribute.cs (Attribute.Resolve): While doing a Member lookup
1961         for .ctors, ensure that we only ask for members declared in the
1962         attribute type (BindingFlags.DeclaredOnly).
1963
1964         Fixes bug #43632.
1965
1966         * expression.cs (Error_WrongNumArguments): Report error 1501
1967         correctly the way CSC does.
1968
1969 2003-07-13  Martin Baulig  <martin@ximian.com>
1970
1971         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
1972         lookup on the fully qualified name, to make things like "X.X" work
1973         where "X.X" is a fully qualified type name, but we also have a
1974         namespace "X" in the using list.  Fixes #41975.
1975
1976 2003-07-13  Martin Baulig  <martin@ximian.com>
1977
1978         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
1979         function. If we're a CompoundAssign, we need to create an embedded
1980         CompoundAssign, not an embedded Assign.
1981         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
1982         Fixes #45854.
1983
1984 2003-07-13  Martin Baulig  <martin@ximian.com>
1985
1986         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
1987         work to fix bug #46088.
1988
1989 2003-07-13  Ravi Pratap <ravi@ximian.com>
1990
1991         * class.cs (Operator.Emit): Do not emit attributes here - it is
1992         taken care of by the Method class that we delegate too. This takes
1993         care of bug #45876.
1994         
1995 2003-07-10  Martin Baulig  <martin@ximian.com>
1996
1997         * expression.cs (TypeOfVoid): New class.
1998         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
1999
2000 2003-07-10  Martin Baulig  <martin@ximian.com>
2001
2002         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
2003         bug #35957.
2004
2005 2003-07-10  Martin Baulig  <martin@ximian.com>
2006
2007         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
2008         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
2009
2010         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
2011
2012         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
2013
2014 2003-07-10  Martin Baulig  <martin@ximian.com>
2015
2016         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
2017         of decimal.  Fixes #42850.
2018
2019         NOTE: I also fixed the created byte blob, but this doesn't work on
2020         the MS runtime and csc never produces any byte blobs for decimal
2021         arrays.
2022
2023 2003-07-10  Martin Baulig  <martin@ximian.com>
2024
2025         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
2026         structs; fixes #32068.
2027         (Block.AddChildVariableNames): Fixed #44302.
2028
2029 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2030
2031         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
2032         
2033 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2034
2035         * attribute.cs: And this test is onger needed.
2036
2037 2003-07-08  Martin Baulig  <martin@ximian.com>
2038
2039         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
2040         inaccessible types.  Fixes #36313.
2041
2042         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
2043
2044         * namespace.cs (NamespaceEntry): Create implicit entries for all
2045         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
2046         implicit entries for N1.N2 and N1.
2047
2048 2003-07-08  Martin Baulig  <martin@ximian.com>
2049
2050         Rewrote the handling of namespaces to fix a lot of the issues
2051         wrt. `using' aliases etc.
2052
2053         * namespace.cs (Namespace): Splitted this class into a
2054         per-assembly `Namespace' and a per-file `NamespaceEntry'.
2055
2056         * typemanager.cs (TypeManager.IsNamespace): Removed.
2057         (TypeManager.ComputeNamespaces): Only compute namespaces from
2058         loaded assemblies here, not the namespaces from the assembly we're
2059         currently compiling.
2060
2061 2003-07-08  Martin Baulig  <martin@ximian.com>
2062
2063         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
2064
2065 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2066
2067         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
2068         already fixed it.  
2069
2070         I thought about the memory savings here, but LookupTypeReflection
2071         is used under already very constrained scenarios.  Compiling
2072         corlib or mcs only exposes one hit, so it would not really reduce
2073         any memory consumption.
2074
2075 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2076
2077         * typemanager.cs: fixes bug #45889 by only adding public types from
2078         other assemblies to the list of known types.
2079
2080 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2081
2082         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
2083         on the type we resolved.
2084
2085 2003-07-05  Martin Baulig  <martin@ximian.com>
2086
2087         * pending.cs (PendingImplementation.ParentImplements): Don't
2088         create the proxy if the parent is abstract.
2089
2090         * class.cs (TypeContainer.DefineIndexers): Process explicit
2091         interface implementations first.  Fixes #37714.
2092
2093 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
2094
2095         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
2096         defined recursively;  but since we modify the input parameters
2097         (left is set to `this' temporarily), we reset this value if the
2098         left_is_explicit is false, which gives the original semantics to
2099         the code.  
2100
2101         * literal.cs (NullPointer): new class used to represent a null
2102         literal in a pointer context.
2103
2104         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
2105         type is a pointer, use a NullPointer object instead of a
2106         NullLiteral.   Closes 43687
2107
2108         (ExplicitConversion): Convert pointer values using
2109         the conv opcode to the proper type.
2110
2111         * ecore.cs (New): change ValueTypeVariable property into a method,
2112         that returns whether the valuetype is suitable for being used.
2113
2114         * expression.cs (Binary.DoNumericPromotions): Only return if we
2115         the int constant was a valid uint, and we can return both left and
2116         right as uints.  If not, we continue processing, to trigger the
2117         type conversion.  This fixes 39018.
2118
2119         * statement.cs (Block.EmitMeta): During constant resolution, set
2120         the CurrentBlock property on the emitcontext, so that we resolve
2121         constants propertly.
2122
2123 2003-07-02  Martin Baulig  <martin@ximian.com>
2124
2125         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
2126         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
2127
2128         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
2129         than emitting it here.
2130
2131         * statement.cs: Fixed some more flow analysis bugs.
2132
2133 2003-07-02  Martin Baulig  <martin@ximian.com>
2134
2135         * class.cs (MethodData.Define): When implementing interface
2136         methods, set Final unless we're Virtual.
2137
2138         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
2139         check work for interface methods.
2140
2141 2003-07-01  Martin Baulig  <martin@ximian.com>
2142
2143         * ecore.cs (EmitContext.This): Replaced this property with a
2144         GetThis() method which takes a Location argument.  This ensures
2145         that we get the correct error location for a CS0188.
2146
2147 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
2148
2149         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
2150         ImplicitStandardConversion.
2151
2152         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
2153
2154 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
2155
2156         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
2157         optimization.
2158
2159 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
2160
2161         * class.cs (Constructor.Define): Turn off initlocals for unsafe
2162         constructors.
2163
2164         (MethodData.Define): Turn off initlocals for unsafe methods.
2165
2166 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
2167
2168         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
2169         complete;  Fixes #37521.
2170
2171         * delegate.cs: Use Modifiers.TypeAttr to compute the
2172         TypeAttributes, instead of rolling our own.  This makes the flags
2173         correct for the delegates.
2174
2175 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
2176
2177         * class.cs (Constructor.Define): Set the private flag for static
2178         constructors as well.
2179
2180         * cs-parser.jay (statement_expression): Set the return value to
2181         null, to avoid a crash when we catch an error.
2182
2183 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
2184
2185         * cs-parser.jay: Applied patch from Jackson that adds support for
2186         extern and unsafe modifiers to destructor declarations.
2187
2188         * expression.cs: Report error 21 if the user is trying to index a
2189         System.Array.
2190
2191         * driver.cs: Add an error message, suggested by the bug report.
2192
2193         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
2194         if we do not have a ": this ()" constructor initializer.  Fixes 45149
2195
2196 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
2197
2198         * namespace.cs: Add some information to reduce FAQs.
2199
2200 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
2201
2202         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
2203         underlying enumeration types.  Fixes #43915.
2204
2205         * expression.cs: Treat ushort/short as legal values to be used in
2206         bitwise operations.
2207
2208 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
2209
2210         * delegate.cs: transfer custom attributes for paramenters from
2211         the delegate declaration to Invoke and BeginInvoke.
2212
2213 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
2214
2215         * attribute.cs: handle custom marshalers and emit marshal info
2216         for fields, too.
2217
2218 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
2219
2220         * makefile.gnu: Added anonymous.cs to the compiler sources.
2221
2222 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
2223
2224         * iterators.cs: Change the name of the proxy class to include two
2225         underscores.
2226
2227         * cs-parser.jay: Update grammar to include anonymous methods.
2228         
2229         * anonymous.cs: new file.
2230
2231 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
2232
2233         * class.cs (Field.Define): Add missing test for pointers and
2234         safety. 
2235
2236 2003-05-27  Ravi Pratap  <ravi@ximian.com>
2237
2238         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
2239         we use the stobj opcode.
2240
2241         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
2242         since it wasn't the correct fix. 
2243
2244         It still is puzzling that we are required to use stobj for IntPtr
2245         which seems to be a ValueType.
2246
2247 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
2248
2249         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
2250         during regular simple name resolution.   Now, the trick is that
2251         instead of returning for processing the simplename, we do a
2252         TypeManager.LookupType (ie, a rooted lookup as opposed to a
2253         contextual lookup type).   If a match is found, return that, if
2254         not, return for further composition.
2255
2256         This fixes long-standing 30485.
2257
2258         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
2259         using the address to initialize an object, do an Stobj instead of
2260         using the regular Stelem.
2261
2262         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
2263         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
2264         Because if we are a BaseIndexerAccess that value will be true.
2265         Fixes 43643.
2266
2267         * statement.cs (GotoCase.Resolve): Return after reporting an
2268         error, do not attempt to continue. 
2269
2270         * expression.cs (PointerArithmetic.Emit): If our operand is a
2271         long, convert our constants to match the operand before
2272         multiplying.  Convert to I type before adding.   Fixes 43670.
2273         
2274 2003-05-14  Ravi Pratap  <ravi@ximian.com>
2275
2276         * enum.cs (ImplicitConversionExists) : Rename to
2277         ImplicitEnumConversionExists to remove ambiguity. 
2278
2279         * ecore.cs (NullCast): New type of cast expression class which
2280         basically is very similar to EmptyCast with the difference being
2281         it still is a constant since it is used only to cast a null to
2282         something else
2283         (eg. (string) null)
2284
2285         * convert.cs (ImplicitReferenceConversion): When casting a null
2286         literal, we return a NullCast.
2287
2288         * literal.cs (NullLiteralTyped): Remove - I don't see why this
2289         should be around anymore.
2290
2291         The renaming (reported was slightly wrong). Corrections:
2292
2293         ConvertImplicitStandard -> ImplicitConversionStandard
2294         ConvertExplicitStandard -> ExplicitConversionStandard
2295
2296         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
2297         before passing them in !
2298
2299         * convert.cs (ImplicitConversionStandard): When comparing for
2300         equal expr and target types, ensure that expr is not a
2301         NullLiteral.
2302
2303         In general, we must not be checking (expr_type ==
2304         target_type) in the top level conversion methods
2305         (ImplicitConversion, ExplicitConversion etc). This checking is
2306         done in the methods that they delegate to.
2307
2308 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
2309
2310         * convert.cs: Move Error_CannotConvertType,
2311         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
2312         ImplicitNumericConversion, ImplicitConversionExists,
2313         ImplicitUserConversionExists, StandardConversionExists,
2314         FindMostEncompassedType, FindMostSpecificSource,
2315         FindMostSpecificTarget, ImplicitUserConversion,
2316         ExplicitUserConversion, GetConversionOperators,
2317         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
2318         TryImplicitIntConversion, Error_CannotConvertImplicit,
2319         ConvertImplicitRequired, ConvertNumericExplicit,
2320         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
2321         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
2322         its own file.
2323
2324         Perform the following renames:
2325         
2326         StandardConversionExists -> ImplicitStandardConversionExists
2327         ConvertImplicit -> ImplicitConversion
2328         ConvertImplicitStandard -> ImplicitStandardConversion
2329         TryImplicitIntConversion -> ImplicitIntConversion
2330         ConvertImplicitRequired -> ImplicitConversionRequired
2331         ConvertNumericExplicit -> ExplicitNumericConversion
2332         ConvertReferenceExplicit -> ExplicitReferenceConversion
2333         ConvertExplicit -> ExplicitConversion
2334         ConvertExplicitStandard -> ExplicitStandardConversion
2335
2336 2003-05-19  Martin Baulig  <martin@ximian.com>
2337
2338         * statement.cs (TypeInfo.StructInfo): Made this type protected.
2339         (TypeInfo): Added support for structs having structs as fields.
2340
2341         * ecore.cs (FieldExpr): Implement IVariable.
2342         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
2343         VariableInfo for the field.
2344
2345 2003-05-18  Martin Baulig  <martin@ximian.com>
2346
2347         * expression.cs (This.DoResolve): Report a CS0027 if we're
2348         emitting a field initializer.
2349
2350 2003-05-18  Martin Baulig  <martin@ximian.com>
2351
2352         * expression.cs (This.ResolveBase): New public function.
2353         (This.DoResolve): Check for CS0188.
2354
2355         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
2356         This.Resolve().
2357
2358         * ecore.cs (MethodGroupExpr.DoResolve): Set the
2359         `instance_expression' to null if we don't have any non-static
2360         methods.
2361
2362 2003-05-18  Martin Baulig  <martin@ximian.com>
2363
2364         Reworked the way how local variables and parameters are handled by
2365         the flow analysis code.
2366
2367         * statement.cs (TypeInfo, VariableMap): New public classes.
2368         (VariableInfo): New public class.  This is now responsible for
2369         checking whether a variable has been assigned.  It is used for
2370         parameters and local variables.
2371         (Block.EmitMeta): Take the InternalParameters as argument; compute
2372         the layout of the flow vectors here.
2373         (Block.LocalMap, Block.ParameterMap): New public properties.
2374         (FlowBranching): The .ctor doesn't get the InternalParameters
2375         anymore since Block.EmitMeta() now computes the layout of the flow
2376         vector.
2377         (MyStructInfo): This class is now known as `StructInfo' and nested
2378         in `TypeInfo'; we don't access this directly anymore.
2379
2380         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
2381         property and removed IsAssigned(), IsFieldAssigned(),
2382         SetAssigned() and SetFieldAssigned(); we now call them on the
2383         VariableInfo so we don't need to duplicate this code everywhere.
2384
2385         * expression.cs (ParameterReference): Added `Block block' argument
2386         to the .ctor.
2387         (LocalVariableReference, ParameterReference, This): The new
2388         VariableInfo class is now responsible for all the definite
2389         assignment stuff.
2390
2391         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
2392         IsParameterAssigned, SetParameterAssigned): Removed.
2393
2394 2003-05-18  Martin Baulig  <martin@ximian.com>
2395
2396         * typemanager.cs (InitCoreTypes): Try calling
2397         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
2398         the 3-args-version.  Corlib now also needs our `void_type'.
2399         (GetMethod): Added overloaded version which takes an optional
2400         `bool report_errors' to allow lookups of optional methods.
2401
2402 2003-05-12  Martin Baulig  <martin@ximian.com>
2403
2404         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
2405         only used for locals and not for parameters.
2406
2407 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
2408
2409         * support.cs (InternalParameters.ParameterType): Return the
2410         ExternalType of the parameter.
2411
2412         * parameter.cs (Parameter.ExternalType): drop the two arguments,
2413         they were unused.
2414
2415 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
2416
2417         * class.cs (MethodData.Define): Do not set the `newslot' on
2418         interface members, if they are also flagged as "override".
2419
2420         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
2421         better code for ++i and i++.  This only works for static fields
2422         and local variables.
2423
2424         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
2425         want to pull the DeclSpace out of the builder_to_declspace instead
2426         of the TypeBuilder (like in TypeContainer.FindMembers).
2427
2428         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
2429         instead of LookupTypeContainer.  Fixes the crash on .NET for
2430         looking up interface members.
2431
2432         * const.cs: Create our own emit context during the Definition
2433         stage, so that constants are evaluated in the proper context, when
2434         a recursive definition happens.
2435
2436 2003-05-11  Martin Baulig  <martin@ximian.com>
2437
2438         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
2439         new block for a switch section.
2440         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
2441         the adding/lookup in the switch block.  Fixes #39828.
2442
2443 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
2444
2445         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
2446         functionality: I needed to convert the data after I had performed
2447         the add/sub operation into the operands type size.
2448
2449         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
2450         pass the type for the box operation, otherwise the resulting
2451         object would have been of type object.
2452
2453         (BoxedCast): Add constructor to specify the type to box as.
2454
2455 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
2456
2457         * iterators.cs: I was reusing the `count' variable inadvertently,
2458         take steps to not allow this to happen.
2459
2460 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
2461
2462         * attribute.cs (Attribute.Resolve): Params attributes are encoded
2463         by creating an array at the point where the params starts and
2464         putting all those arguments there, then adjusting the size of the
2465         array.
2466
2467 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
2468
2469         * expression.cs (New.AddressOf): Implement interface
2470         IMemoryLocation.  This is used when the `new' operator is used in
2471         the context of an invocation to a method on a value type.
2472
2473         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
2474         example. 
2475
2476         * namespace.cs: Also check the using aliases here.
2477
2478         * driver.cs: Move the test for using validity after the types have
2479         been entered, so we do a single pass that also includes the using
2480         aliases. 
2481
2482         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
2483         in the regular case.   CreateSiblingForFinally is doing extra
2484         error checking.
2485
2486         * attribute.cs (GetAttributeArgumentExpression): Store the result
2487         on an out value, and use the return value to indicate failure
2488         instead of using null (which is a valid return for Constant.GetValue).
2489
2490         * statement.cs: Perform the analysis flow for the increment
2491         portion after the statement, because this will be the real flow of
2492         execution.  Fixes #42385
2493
2494         * codegen.cs (EmitContext.EmitArgument,
2495         EmitContext.EmitStoreArgument): New helper functions when the
2496         RemapToProxy flag is set.
2497
2498         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
2499         function.
2500
2501         Add support for remapping parameters. 
2502
2503         * iterators.cs: Propagate parameter values;  Store parameter
2504         values in the proxy classes.
2505         
2506 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
2507
2508         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
2509         need a proxy reference;  I do not know what I was thinking
2510
2511         * cs-parser.jay (constructor_initializer): catch another error,
2512         and display nice message.
2513         
2514         (field_declaration): catch void field declaration
2515         to flag a better error. 
2516
2517         * class.cs (MemberBase.CheckBase): Report an error instead of a
2518         warning if a new protected member is declared in a struct. 
2519         (Field.Define): catch the error of readonly/volatile.
2520
2521         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
2522
2523         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
2524         volatile variable is taken
2525
2526 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
2527
2528         * statement.cs (Fixed.Resolve): Report an error if we are not in
2529         an unsafe context.
2530
2531 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
2532
2533         * typemanager.cs: reuse the code that handles type clashes for
2534         delegates and enumerations.
2535
2536         * class.cs (Report28): Always report.
2537
2538         * expression.cs (EncodeAsAttribute): Allow nulls here.
2539
2540 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
2541
2542         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
2543         the functionality for testing whether an expression is valid for
2544         an attribute here.  Also handle the case of arrays of elements
2545         being stored. 
2546
2547         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
2548         encoding a linear array into an array of objects that are suitable
2549         to be passed to an CustomAttributeBuilder.
2550
2551         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
2552
2553         * ecore.cs: (FieldExpr): Handle field remapping here.
2554
2555         * iteratators.cs: Pass the instance variable (if the method is an
2556         instance method) to the constructors, so we can access the field
2557         variables on the class.
2558
2559         TODO: Test this with structs.  I think the THIS variable on
2560         structs might have to be a pointer, and not a refenrece
2561
2562 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
2563
2564         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
2565         local variables to fields in a proxy class.
2566
2567         * iterators.cs (PopulateProxy): Rename our internal fields to
2568         <XXX>.  
2569         Create a <THIS> field if we are an instance method, so we can
2570         reference our parent container variables.
2571         (MapVariable): Called back from the EmitContext code to enter a
2572         new variable to field mapping into the proxy class (we just create
2573         a FieldBuilder).
2574
2575         * expression.cs
2576         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
2577         for using the remapped locals to fields.
2578
2579         I placed the code here, because that gives the same semantics to
2580         local variables, and only changes the Emit code.
2581
2582         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
2583         statements inside iterators.
2584         (VariableInfo): Add a FieldBuilder for the cases when we are
2585         remapping local variables to fields in a proxy class
2586
2587         * ecore.cs (SimpleNameResolve): Avoid testing two times for
2588         current_block != null.
2589
2590         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
2591         not cope with strings, as it has been moved to the
2592         TableSwitchEmit.  Fixed bug in switch generation.
2593
2594         * expression.cs (New.DoResolve): Provide more context for the user
2595         when reporting an error.
2596
2597         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
2598         pointers. 
2599
2600         * expression.cs (MemberAccess.DoResolve): When we get a type back,
2601         check the permissions for it.  Note than in a type-resolution
2602         context the check was already present in DeclSpace.ResolveType,
2603         but was missing from the MemberAccess.
2604
2605         (ArrayCreation.CheckIndices): warn if the user has
2606         more nested levels of expressions, but there are no more
2607         dimensions specified.  Avoids crash on bug 41906.
2608
2609 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
2610
2611         * statement.cs (Block): replace Implicit bool, for a generic
2612         flags.   
2613         New flag: `Unchecked'.  This is used during the EmitMeta phase
2614         (which is out-of-line with the regular Resolve/Emit process for a
2615         statement, as this is done ahead of time, but still gets a chance
2616         to call constant resolve).
2617         
2618         (Block.Flags): new enum for adding a new flag.
2619
2620         (Block.EmitMeta): track the state of unchecked.
2621         
2622         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
2623         to enable constant resolution to work there as well.
2624
2625 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
2626
2627         * typemanager.cs (ienumerable_type): Also look up
2628         System.Collections.IEnumerable. 
2629
2630 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
2631
2632         TODO: Test more than one conditional per method.
2633         
2634         * class.cs (Indexer.Define): Report the location where the user is
2635         referencing the unsupported feature.
2636
2637         (MethodData): Overload the use of `conditionals' to
2638         minimize the creation of needless ArrayLists.   This saves roughly
2639         212kb on my machine.
2640
2641         (Method): Implement the new IIteratorContainer interface.
2642         (Method.SetYields): Implement the method by setting the ModFlags
2643         to contain METHOD_YIELDS.
2644         
2645         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
2646         which just got set to null.
2647
2648         * iterators.cs: New file.
2649
2650         (Yield, YieldBreak): New statements.
2651
2652         * statement.cs (Return.Resolve): Flag an error if we are used in
2653         an iterator method.
2654
2655         * codegen.cs (InIterator): New flag set if the code is being
2656         compiled in an iterator method.
2657
2658         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
2659         internal modifier, and we just use it to avoid adding extra
2660         fields, as this is seldom used.  
2661
2662         * cs-parser.jay: Add yield_statement (yield and yield break).
2663
2664         * driver.cs: New flag -v2 to turn on version 2 features. 
2665
2666         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
2667         hashtable when v2 is enabled.
2668
2669 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
2670
2671         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
2672         there is already a namespace defined with this name.
2673
2674         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
2675         people upgraded their corlibs.
2676
2677         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
2678         always use fully qualified types, no need to use the compiler
2679         front end.
2680
2681         (TypeManager.IsNamespace): Use binarysearch.
2682         
2683         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
2684         AddDelegate): I did not quite use the new IsValid API properly: I
2685         have to pass the short-name and the fullname.  I was passing only
2686         the basename instead of the fullname sometimes. 
2687
2688         (TypeContainer.DefineType): call NamespaceClash.
2689
2690         * interface.cs (Interface.DefineType): use NamespaceClash before
2691         defining the type.
2692
2693         * delegate.cs (Delegate.DefineType): use NamespaceClash before
2694         defining the type.
2695
2696         * enum.cs: (Enum.DefineType): use NamespaceClash before
2697         defining the type.
2698
2699         * typemanager.cs (: 3-line patch that gives us some tasty 11%
2700         speed increase.  First, use the negative_hits cache when we get a
2701         negative.  Second, add the type with its full original name
2702         instead of the new . and + encoded name (reflection uses + to
2703         separate type from a nested type).  Use LookupTypeReflection
2704         directly which bypasses the type->name hashtable (that we already
2705         know does not contain the type.
2706         
2707         * decl.cs (DeclSpace.ResolveTypeExpr): track the
2708         location/container type. 
2709
2710         * driver.cs: When passing utf8, use directly the UTF8Encoding.
2711
2712 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
2713
2714         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
2715
2716         * delegate.cs (NewDelegate.Resolve): Test whether an instance
2717         method is being referenced in the method group from a static
2718         context, and report error 120 if so.
2719
2720         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
2721         Error118. 
2722
2723         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
2724         is created, we create the A namespace).
2725
2726         * cs-parser.jay: A namespace also introduces a DeclarationFound.
2727         Fixes #41591
2728
2729 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
2730
2731         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
2732         invocation to ModuleBuilder.GetType with the same values will
2733         return a new type instance, so we need to cache its return
2734         values. 
2735
2736         * expression.cs (Binary.ResolveOperator): Only allow the compare
2737         operators on enums if they are of the same type.
2738
2739         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
2740         types of ValueType on their own case.  Before we were giving them
2741         the same treatment as objects.
2742
2743         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
2744         fullname.  Short name is used to compare against container name.
2745         Fullname is used to check against defined namespace names.
2746         
2747         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
2748         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
2749
2750         (Method.CheckBase): Call parent.
2751         (MemberBase.CheckBase): Check for protected members on sealed
2752         classes.
2753         (PropertyBase.CheckBase): Call parent.
2754         (Field.Define): Call parent.
2755
2756         * report.cs: Negative error codes are now mapped to 8000 - code,
2757         so that the display is render more nicely.
2758
2759         * typemanager.cs: Do not use try/catch, instead report a regular
2760         error. 
2761
2762         (GetPointerType, GetReferenceType): These methods provide
2763         mechanisms to obtain the T* and T& from a T.  We had the code
2764         previously scattered around the code base, and it also used
2765         TypeManager.LookupType that would go through plenty of caches.
2766         This one goes directly to the type source.
2767
2768         In some places we did the Type.GetType followed by
2769         ModuleBuilder.GetType, but not in others, so this unifies the
2770         processing as well.
2771
2772         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
2773         statements now that we have namespace information.
2774
2775         * typemanager.cs (IsNamespace): New method, returns whether the
2776         string presented is a namespace or not.
2777
2778         (ComputeNamespaces): New public entry point, computes the list of
2779         available namespaces, using the GetNamespaces API call in Mono, or
2780         the slower version in MS.NET.   
2781
2782         Now before we start the semantic analysis phase, we have a
2783         complete list of namespaces including everything that the user has
2784         provided.
2785
2786         Deleted old code to cache namespaces in .nsc files.
2787
2788 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
2789
2790         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
2791         class/struct location definition Location for the implicit
2792         constructor location.
2793
2794         (Operator.Define): Use the location of the operator for the
2795         implicit Method definition.
2796
2797         (Constructor.Emit): use the constructor location for the implicit
2798         base initializer constructor.
2799
2800         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
2801         and the Expression class now contains two new methods:
2802
2803         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
2804         isolate type lookup from the rest of the resolution process.
2805
2806         Since we use Expressions to hold type definitions due to the way
2807         we parse the input we have historically overloaded Resolve to
2808         perform the Type lookups if a special flag is passed.  Now this is
2809         eliminated and two methods take their place. 
2810         
2811         The differences in the two methods between xStep and xTerminal is
2812         that xStep is involved in our current lookup system that uses
2813         SimpleNames to compose a name, while xTerminal is used just to
2814         catch the case where the simplename lookup failed.
2815         
2816 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
2817
2818         * expression.cs (ResolveMemberAccess): Remove redundant code.
2819         TypeExpr expressions are always born fully resolved.
2820
2821         * interface.cs (PopulateMethod): Do not lookup the types twice.
2822         We were doing it once during SemanticAnalysis and once during
2823         PopulateMethod.
2824
2825         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
2826         in local variable type definitions, were being returned as a
2827         SimpleName (we decomposed everything into a string), that is
2828         because primary_expression was being used instead of a type in the
2829         grammar (reduce/reduce conflicts).
2830
2831         The part that was wrong is that we converted the expression into a
2832         string (an oversimplification in one hand, compounded with primary
2833         expressions doing string concatenation).
2834
2835         So things like:
2836
2837         A.B.C [] x;
2838
2839         Would return "A.B.C[]" as a SimpleName.  This stopped things like
2840         using clauses from working on this particular context.  And a type
2841         was being matched directly against "A.B.C[]".
2842
2843         We now use the correct approach, and allow for ComposedCast to be
2844         part of the unary expression.  So the "A.B.C []" become a composed
2845         cast of "A.B.C" (as a nested group of MemberAccess with a
2846         SimpleName at the end) plus the rank composition "[]". 
2847
2848         Also fixes 35567
2849         
2850 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
2851
2852         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
2853         for the access level checking.
2854
2855         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
2856         `TypeContainer container', because I kept getting confused when I
2857         was debugging this code.
2858
2859         * expression.cs (Indexers): Instead of tracking getters/setters,
2860         we now track them in parallel.  We create one arraylist less, but
2861         most importantly it is possible now for the LValue code to find a
2862         matching get for a set.
2863
2864         (IndexerAccess.DoResolveLValue): Update the code.
2865         GetIndexersForType has been modified already to extract all the
2866         indexers from a type.  The code assumed it did not.
2867
2868         Also make the code set the correct return type for the indexer.
2869         This was fixed a long time ago for properties, but was missing for
2870         indexers.  It used to be void_type.
2871
2872         (Binary.Emit): Test first for doubles instead of
2873         floats, as they are more common.
2874
2875         (Binary.EmitBranchable): Use the .un version of the branch opcodes
2876         when dealing with floats and the <=, >= operators.  This fixes bug
2877         #39314 
2878
2879         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
2880         to load the array value by emitting a load on the foreach variable
2881         type.  This was incorrect.  
2882
2883         We now emit the code to load an element using the the array
2884         variable type, and then we emit the conversion operator.
2885
2886         Fixed #40176
2887
2888 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
2889
2890         * attribute.cs: Avoid allocation of ArrayLists in the common case.
2891
2892 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
2893
2894         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
2895         test for protection before we test for signatures. 
2896
2897         (MethodSignature.ToString): implement.
2898
2899         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
2900         to the case where we reduced into a LongConstant.
2901
2902         * decl.cs (CheckAccessLevel): If the type is an array, we can not
2903         depend on whether the information is acurrate, because the
2904         Microsoft runtime will always claim that the array type is public,
2905         regardless of the real state.
2906
2907         If the type is a pointer, another problem happens: the type is
2908         reported as non-public in Microsoft.  
2909
2910         In both cases we have to call CheckAccessLevel recursively with
2911         the underlying type as the argument to be tested.
2912
2913 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
2914
2915         * assign.cs (Assign.Emit): If we are dealing with a compound
2916         assignment expression, we should use the code path that stores the
2917         intermediate result in a temporary value.  This fixes #40903.
2918
2919         *expression.cs (Indirection.ToString): Provide ToString method for
2920         debugging. 
2921         
2922 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
2923
2924         * class.cs: Null out fields holding references to Block objects so
2925         they can be garbage collected.
2926
2927         * expression.cs (OverloadResolve): Remove unused local.
2928
2929 2003-04-07  Martin Baulig  <martin@ximian.com>
2930
2931         * codegen.cs (EmitContext.CurrentFile): New public field.
2932         (EmitContext.Mark): Use the CurrentFile to check whether the
2933         location is in the correct file.
2934         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
2935
2936 2003-04-07  Martin Baulig  <martin@ximian.com>
2937
2938         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
2939
2940         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
2941         location.  [FIXME: The location argument which gets passed to this
2942         method is sometimes wrong!]
2943
2944 2003-04-07  Nick Drochak <ndrochak@gol.com>
2945
2946         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
2947
2948 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
2949
2950         * expression.cs (Indirection.EmitAssign): We were using the
2951         temporary, but returning immediately instead of continuing the
2952         EmitAssing flow.
2953
2954 2003-04-06  Martin Baulig  <martin@ximian.com>
2955
2956         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
2957         if it's a nested child, but also deriving from the outer class.
2958         See test 190.cs.
2959
2960         * typemanager.cs (IsNestedChildOf): Make this work if it's a
2961         nested child, but also deriving from the outer class.  See
2962         test-190.cs.
2963         (FilterWithClosure): We may access private members of the outer
2964         class if we're a nested child and deriving from the outer class.
2965         (RealMemberLookup): Only set `closure_private_ok' if the
2966         `original_bf' contained BindingFlags.NonPublic.
2967
2968 2003-04-05  Martin Baulig  <martin@ximian.com>
2969
2970         * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
2971         probe if its a type parameter, and if so, flag an error.
2972
2973         * decl.cs: Move here the SetParameterInfo code from class.cs.
2974         Handle IsGeneric here.
2975
2976         Handle a variety of errors in the parameter info definition.
2977
2978         * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
2979         type parameters here.
2980
2981         * cs-parser.jay (class_declaration): report errors for parameters
2982         here as well.
2983
2984 2003-01-21  Miguel de Icaza  <miguel@ximian.com>
2985
2986         * generic.cs: New file, contains support code for generics.
2987
2988         * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
2989         OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
2990
2991         Update parser for the above removals.
2992
2993         * cs-tokenizer.cs: Do not handle <<= or >>= specially.  This is
2994         now taken care of in the parser.
2995
2996 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
2997
2998         * class.cs (Event.Define): Do not allow abstract events to have
2999         initializers. 
3000
3001 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
3002
3003         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
3004         block in event declarations.
3005
3006         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
3007         value type, get its address.
3008
3009         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
3010         leaving a class on the stack instead of a boolean value (int
3011         0/1).  Change the code so we compare against null, and then the
3012         result against zero.
3013
3014         * class.cs (TypeContainer.GetClassBases): We were checking for the
3015         parent class being sealed too late.
3016
3017         * expression.cs (Binary.Emit): For <= and >= when dealing with
3018         floating point values, use cgt.un and clt.un instead of cgt and
3019         clt alone.
3020
3021 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
3022
3023         * statement.cs: Apply the same optimization as MS: skip the 
3024         GetEnumerator returning an IEnumerator, and use the one returning a 
3025         CharEnumerator instead. This allows us to avoid the try-finally block 
3026         and the boxing.
3027
3028 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
3029
3030         * cs-parser.jay: Attributes cannot be applied to
3031                          namespaces. Fixes #40473
3032
3033 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3034
3035         * class.cs:
3036         (Add*): check if the name is valid using the full name for constants,
3037         fields, properties and events.
3038
3039 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
3040
3041         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
3042         char constants to be part of the enumeration.
3043
3044         * expression.cs (Conditional.DoResolve): Add support for operator
3045         true. Implements the missing functionality from 14.12
3046
3047         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
3048         operator true/false as required by the spec.
3049
3050         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
3051         implicit conversion to boolean.
3052
3053         * statement.cs (Statement.ResolveBoolean): A boolean expression is
3054         also one where the type implements `operator true'. 
3055
3056         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
3057         get an expression that will invoke operator true based on an
3058         expression.  
3059
3060         (GetConversionOperators): Removed the hack that called op_True
3061         here.  
3062
3063         (Expression.ResolveBoolean): Move this from Statement.
3064
3065 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
3066
3067         * ecore.cs (FieldExpr): do not allow initialization of initonly
3068         fields on derived classes
3069
3070 2003-03-13  Martin Baulig  <martin@ximian.com>
3071
3072         * statement.cs (Block.Emit): Call ig.BeginScope() and
3073         ig.EndScope() when compiling with debugging info; call
3074         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
3075
3076 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
3077
3078         * expression.cs (Indexers): Do not construct immediately, allow
3079         for new members to be appended as we go.  Fixes 38143
3080
3081 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3082
3083         * expression.cs: save/restore context when resolving an unchecked
3084         expression.
3085
3086 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
3087
3088         * cfold.cs: Catch division by zero in modulus operator during
3089         constant folding.
3090
3091 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
3092
3093         * interface.cs (Interface.DefineMembers): Avoid defining members
3094         twice. 
3095
3096 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
3097
3098         * driver.cs: handle the +/- options for -noconfig
3099
3100         * statement.cs (Unckeched.Resolve): Also track the state of
3101         unchecked in the Resolve phase.
3102
3103 2003-02-27  Martin Baulig  <martin@ximian.com>
3104
3105         * ecore.cs (Expression.MemberLookup): Don't create a
3106         MethodGroupExpr for something which is not a method.  Fixes #38291.
3107
3108 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
3109
3110         * class.cs (MemberBase.CheckParameters): Also check that the type
3111         is unmanaged if it is a pointer.
3112
3113         * expression.cs (SizeOf.Resolve): Add location information.
3114
3115         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
3116         a managed type is declared.
3117
3118         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
3119         parameter modifiers as well.  Fixes bug 38606
3120
3121         * class.cs: Very sad.  Am backing out the speed up changes
3122         introduced by the ArrayList -> Array in the TypeContainer, as they
3123         were not actually that much faster, and introduced a bug (no error
3124         reports on duplicated methods).
3125
3126         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
3127         source first, this will guarantee that we have a valid expression
3128         before calling in lower levels functions that will require a
3129         resolved object.  Then use this original_source in the
3130         target.ResolveLValue instead of the original source that was
3131         passed to us.
3132
3133         Another change.  Use target.Resolve instead of LValueResolve.
3134         Although we are resolving for LValues, we will let the Assign code
3135         take care of that (it will be called again from Resolve).  This
3136         basically allows code like this:
3137
3138         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
3139         class Y { void A (X x) { x [0] += o; }
3140
3141         The problem was that the indexer was trying to resolve for
3142         set_Item (idx, object o) and never finding one.  The real set_Item
3143         was set_Item (idx, X).  By delaying the process we get the right
3144         semantics. 
3145
3146         Fixes bug 36505
3147         
3148 2003-02-23  Martin Baulig  <martin@ximian.com>
3149
3150         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
3151         while calling DoEmit ().
3152
3153         * codegen.cs (EmitContext.Mark): Don't mark locations in other
3154         source files; if you use the #line directive inside a method, the
3155         compiler stops emitting line numbers for the debugger until it
3156         reaches the end of the method or another #line directive which
3157         restores the original file.
3158
3159 2003-02-23  Martin Baulig  <martin@ximian.com>
3160
3161         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
3162
3163 2003-02-23  Martin Baulig  <martin@ximian.com>
3164
3165         * statement.cs (Block.AddChildVariableNames): We need to call this
3166         recursively, not just for our immediate children.
3167
3168 2003-02-23  Martin Baulig  <martin@ximian.com>
3169
3170         * class.cs (Event.Define): Always make the field private, like csc does.
3171
3172         * typemanager.cs (TypeManager.RealMemberLookup): Make events
3173         actually work, fixes bug #37521.
3174
3175 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
3176
3177         * delegate.cs: When creating the various temporary "Parameters"
3178         classes, make sure that we call the ComputeAndDefineParameterTypes
3179         on those new parameters (just like we do with the formal ones), to
3180         allow them to be resolved in the context of the DeclSpace.
3181
3182         This fixes the bug that Dick observed in Bugzilla #38530.
3183
3184 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
3185
3186         * expression.cs (ResolveMemberAccess): When resolving a constant,
3187         do not attempt to pull a constant if the value was not able to
3188         generate a valid constant.
3189
3190         * const.cs (LookupConstantValue): Do not report more errors than required.
3191
3192 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3193
3194         * expression.cs: fixes bug #38328.
3195
3196 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
3197
3198         * class.cs: Changed all the various members that can be part of a
3199         class from being an ArrayList to be an Array of the right type.
3200         During the DefineType type_list, interface_list, delegate_list and
3201         enum_list are turned into types, interfaces, delegates and enums
3202         arrays.  
3203
3204         And during the member population, indexer_list, event_list,
3205         constant_list, field_list, instance_constructor_list, method_list,
3206         operator_list and property_list are turned into their real arrays.
3207
3208         Although we could probably perform this operation earlier, for
3209         good error reporting we need to keep the lists and remove the
3210         lists for longer than required.
3211
3212         This optimization was triggered by Paolo profiling the compiler
3213         speed on the output of `gen-sample-program.pl' perl script. 
3214
3215         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
3216         not crash in methods like MemberLookupFailed that use this field.  
3217
3218         This problem arises when the compiler fails to resolve a type
3219         during interface type definition for example.
3220
3221 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
3222
3223         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
3224         inherit from System.Object, so we have to stop at null, not only
3225         when reaching System.Object.
3226
3227 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
3228
3229         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
3230         DeclaredOnly because the parent indexer might have had a different
3231         name, but did not loop until the top of the hierarchy was reached.
3232
3233         The problem this one fixes is 35492: when a class implemented an
3234         indexer from an interface, we were getting the interface method
3235         (which was abstract) and we were flagging an error (can not invoke
3236         abstract method).
3237
3238         This also keeps bug 33089 functioning, and test-148 functioning.
3239
3240         * typemanager.cs (IsSpecialMethod): The correct way of figuring
3241         out if a method is special is to see if it is declared in a
3242         property or event, or whether it is one of the predefined operator
3243         names.   This should fix correctly #36804.
3244
3245 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
3246
3247         The goal here is to remove the dependency on EmptyCast.Peel ().
3248         Killing it completely.
3249         
3250         The problem is that currently in a number of places where
3251         constants are expected, we have to "probe" for an EmptyCast, and
3252         Peel, which is not the correct thing to do, as this will be
3253         repetitive and will likely lead to errors. 
3254
3255         The idea is to remove any EmptyCasts that are used in casts that
3256         can be reduced to constants, so we only have to cope with
3257         constants. 
3258
3259         This bug hunt was triggered by Bug 37363 and the desire to remove
3260         the duplicate pattern where we were "peeling" emptycasts to check
3261         whether they were constants.  Now constants will always be
3262         constants.
3263         
3264         * ecore.cs: Use an enumconstant here instead of wrapping with
3265         EmptyCast.  
3266
3267         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
3268         throwing me off.  By handling this we can get rid of a few hacks.
3269         
3270         * statement.cs (Switch): Removed Peel() code.
3271
3272 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
3273
3274         * class.cs: Location information for error 508
3275
3276         * expression.cs (New.DoResolve): Add a guard against double
3277         resolution of an expression.  
3278
3279         The New DoResolve might be called twice when initializing field
3280         expressions (see EmitFieldInitializers, the call to
3281         GetInitializerExpression will perform a resolve on the expression,
3282         and later the assign will trigger another resolution
3283
3284         This leads to bugs (#37014)
3285
3286         * delegate.cs: The signature for EndInvoke should contain any ref
3287         or out parameters as well.  We were not doing this in the past. 
3288
3289         * class.cs (Field.Define): Do not overwrite the type definition
3290         inside the `volatile' group.  Turns out that volatile enumerations
3291         were changing the type here to perform a validity test, which
3292         broke conversions. 
3293
3294 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
3295
3296         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
3297         and structs, we do not want to load the instance variable
3298
3299         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
3300         enum_type has to be handled like an object reference (implicit
3301         conversions exists from this to object), but the regular IsClass
3302         and IsValueType tests will never return true for this one.
3303
3304         Also we use TypeManager.IsValueType instead of type.IsValueType,
3305         just for consistency with the rest of the code (this is only
3306         needed if we ever use the construct exposed by test-180.cs inside
3307         corlib, which we dont today).
3308
3309 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
3310
3311         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
3312         just InternalCall.
3313
3314 2003-02-09  Martin Baulig  <martin@ximian.com>
3315
3316         * namespace.cs (Namespace..ctor): Added SourceFile argument.
3317         (Namespace.DefineNamespaces): New static public method; this is
3318         called when we're compiling with debugging to add all namespaces
3319         to the symbol file.
3320
3321         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
3322         pass it to the Namespace's .ctor.
3323
3324         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
3325         and MethodBase arguments; pass the namespace ID to the symwriter;
3326         pass the MethodBase instead of the token to the symwriter.
3327         (SymbolWriter.DefineNamespace): New method to add a namespace to
3328         the symbol file.
3329
3330 2003-02-09  Martin Baulig  <martin@ximian.com>
3331
3332         * symbolwriter.cs: New file.  This is a wrapper around
3333         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
3334         methods here in near future.
3335
3336 2003-02-09  Martin Baulig  <martin@ximian.com>
3337
3338         * codegen.cs (EmitContext.Mark): Just pass the arguments to
3339         ILGenerator.MarkSequencePoint() which are actually used by the
3340         symbol writer.
3341
3342 2003-02-09  Martin Baulig  <martin@ximian.com>
3343
3344         * location.cs (SourceFile): New public sealed class.  This
3345         contains the name and an index which is used in the location's token.
3346         (Location): Reserve an appropriate number of bits in the token for
3347         the source file instead of walking over that list, this gives us a
3348         really huge performance improvement when compiling with debugging.
3349
3350         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
3351         `SourceFile' argument instead of a string.
3352         (Driver.ProcessFile): Add all the files via Location.AddFile(),
3353         but don't parse/tokenize here, we need to generate the list of all
3354         source files before we do that.
3355         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
3356         the files.
3357
3358         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
3359         instead of a string.
3360
3361         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
3362         of a string.
3363
3364 2003-02-09  Martin Baulig  <martin@ximian.com>
3365
3366         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
3367         filename on `#line default'.
3368
3369 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
3370
3371         * statement.cs: don't clear the pinned var when the fixed statement
3372         returns from the method (fixes bug#37752).
3373
3374 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
3375
3376         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
3377         to IsValueType.
3378
3379 2003-02-07  Martin Baulig  <martin@ximian.com>
3380
3381         * driver.cs: Removed the `--debug-args' command line argument.
3382
3383         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
3384         automatically by the AsssemblyBuilder.
3385         (CodeGen.InitializeSymbolWriter): We don't need to call any
3386         initialization function on the symbol writer anymore.  This method
3387         doesn't take any arguments.
3388
3389 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
3390
3391         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
3392         from referenced assemblies as well.
3393
3394 2003-02-02  Martin Baulig  <martin@ximian.com>
3395
3396         * class.cs (MethodData.Emit): Generate debugging info for external methods.
3397
3398 2003-02-02  Martin Baulig  <martin@ximian.com>
3399
3400         * class.cs (Constructor.Emit): Open the symbol writer before
3401         emitting the constructor initializer.
3402         (ConstructorInitializer.Emit): Call ec.Mark() to allow
3403         single-stepping through constructor initializers.
3404
3405 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
3406
3407         * class.cs: Handle error 549: do not allow virtual methods in
3408         sealed classes. 
3409
3410 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
3411
3412         * decl.cs: Check access levels when resolving types
3413         
3414 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
3415
3416         * statement.cs: Add parameters and locals set in catch blocks that might 
3417         return to set vector
3418
3419 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
3420
3421         * class.cs (Operator): Set the SpecialName flags for operators.
3422         
3423         * expression.cs (Invocation.DoResolve): Only block calls to
3424         accessors and operators on SpecialName methods.
3425
3426         (Cast.TryReduce): Handle conversions from char constants.
3427
3428
3429 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
3430
3431         * statement.cs: small memory and time optimization in FlowBranching.
3432         
3433 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
3434
3435         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
3436         problem that the last fix but in the other sid (Set).
3437
3438         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
3439         access when there is no indexer in the hierarchy.
3440         
3441 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
3442
3443         * class.cs: Combine some if statements.
3444
3445 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3446
3447         * driver.cs: fixed bug #37187.
3448
3449 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
3450
3451         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
3452         any indexer, it's needed to build a list with all the indexers in the
3453         hierarchy (AllGetters), else we have problems. Fixes #35653.
3454
3455 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
3456
3457         * class.cs (MethodData.Define): It is wrong for an interface
3458         implementation to be static in both cases: explicit and implicit.
3459         We were only handling this in one case.
3460
3461         Improve the if situation there to not have negations.
3462         
3463         * class.cs (Field.Define): Turns out that we do not need to check
3464         the unsafe bit on field definition, only on usage.  Remove the test.
3465
3466 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3467
3468         * driver.cs: use assembly.Location instead of Codebase (the latest
3469         patch made mcs fail when using MS assemblies).
3470
3471 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
3472
3473         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
3474         get the path to *corlib.dll.
3475
3476 2003-01-21  Nick Drochak <ndrochak@gol.com>
3477
3478         * cs-tokenizer.cs:
3479         * pending.cs:
3480         * typemanager.cs: Remove compiler warnings
3481
3482 2003-01-20  Duncan Mak  <duncan@ximian.com>
3483
3484         * AssemblyInfo.cs: Bump the version number to 0.19.
3485         
3486 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3487
3488         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
3489
3490 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
3491
3492         * class.cs (Constructor::Emit): Emit debugging info for constructors.
3493
3494 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
3495
3496         * cs-parser.jay: Small fix: we were not comparing the constructor
3497         name correctly.   Thanks to Zoltan for the initial pointer.
3498
3499 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
3500
3501         * cs-tokenizer.cs: Set file name when specified with #line
3502
3503 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
3504
3505         * cs-parser.jay: Only perform the constructor checks here if we
3506         are named like the class;  This will help provider a better
3507         error.  The constructor path is taken when a type definition is
3508         not found, but most likely the user forgot to add the type, so
3509         report that rather than the constructor error.
3510
3511 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
3512
3513         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
3514         allocations.
3515
3516 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
3517
3518         * cs-parser.jay: Add cleanup call.
3519
3520 2003-01-13  Duncan Mak  <duncan@ximian.com>
3521
3522         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
3523         consistent with other methods.
3524
3525 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
3526
3527         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
3528         
3529 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
3530
3531         * attribute.cs: only set GuidAttr to true when we have a
3532         GuidAttribute.
3533
3534 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3535
3536         * ecore.cs:
3537         * expression.cs:
3538         * typemanager.cs: fixes to allow mcs compile corlib with the new
3539         Type.IsSubclassOf fix.
3540
3541 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
3542
3543         * expression.cs (LocalVariableReference.DoResolve): Classify a
3544         constant as a value, not as a variable.   Also, set the type for
3545         the variable.
3546
3547         * cs-parser.jay (fixed_statement): take a type instead of a
3548         pointer_type, so we can produce a better error message later.
3549         
3550         * statement.cs (Fixed.Resolve): Flag types that are not pointers
3551         as an error.  
3552         
3553         (For.DoEmit): Make inifinite loops have a
3554         non-conditional branch back.
3555
3556         (Fixed.DoEmit): First populate the pinned variables, then emit the
3557         statement, then clear the variables.  Before I was emitting the
3558         code once for each fixed piece.
3559
3560
3561 2003-01-08  Martin Baulig  <martin@ximian.com>
3562
3563         * statement.cs (FlowBranching.MergeChild): A break in a
3564         SWITCH_SECTION does not leave a loop.  Fixes #36155.
3565
3566 2003-01-08  Martin Baulig  <martin@ximian.com>
3567
3568         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
3569         lives in the same number space than `param_map'.  Fixes #36154.
3570
3571 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
3572
3573         * cs-parser.jay (constructor_declaration): Set the
3574         Constructor.ModFlags before probing for it.  This makes the
3575         compiler report 514, 515 and 132 (the code was there, but got
3576         broken). 
3577
3578         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
3579         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
3580         (GotoCase.Resolve): Set `Returns' to ALWAYS.
3581
3582 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
3583
3584         * enum.cs: create the enum static fields using the enum type.
3585
3586 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
3587
3588         * class.cs: don't try to create the ParamBuilder for the return
3589         type if it's not needed (and handle it breaking for the ms runtime
3590         anyway).
3591
3592 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
3593
3594         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
3595
3596 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
3597
3598         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
3599         the command.   This showed up while compiling the JANET source
3600         code, which used \r as its only newline separator.
3601
3602 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
3603
3604         * class.cs (Method.Define): If we are an operator (because it
3605         reuses our code), then set the SpecialName and HideBySig.  #36128
3606
3607 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
3608
3609         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
3610         exception, report error 120 `object reference required'.
3611
3612         * driver.cs: Add --pause option, used during to measure the size
3613         of the process as it goes with --timestamp.
3614
3615         * expression.cs (Invocation.DoResolve): Do not allow methods with
3616         SpecialName to be invoked.
3617
3618 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
3619
3620         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
3621         number before adding it.
3622
3623 2002-12-21  Ravi Pratap  <ravi@ximian.com>
3624
3625         * ecore.cs (StandardImplicitConversion): When in an unsafe
3626         context, we allow conversion between void * to any other pointer
3627         type. This fixes bug #35973.
3628
3629 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
3630
3631         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
3632         is not thrown when extensionless outputs are used 
3633
3634 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3635
3636         * rootcontext.cs: fixed compilation of corlib.
3637
3638 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
3639
3640         * attribute.cs (Attributes.Contains): Add new method.
3641
3642         * class.cs (MethodCore.LabelParameters): if the parameter is an
3643         `out' parameter, check that no attribute `[In]' has been passed.
3644
3645         * enum.cs: Handle the `value__' name in an enumeration.
3646
3647 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
3648
3649         * decl.cs: Added special case to allow overrides on "protected
3650         internal" methods
3651         
3652 2002-12-18  Ravi Pratap  <ravi@ximian.com>
3653
3654         * attribute.cs (Attributes.AddAttributeSection): Rename to this
3655         since it makes much more sense.
3656
3657         (Attributes.ctor): Don't require a Location parameter.
3658         
3659         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
3660
3661         * attribute.cs (ApplyAttributes): Remove extra Location parameters
3662         since we already have that information per attribute.
3663
3664         * everywhere : make appropriate changes.
3665
3666         * class.cs (LabelParameters): Write the code which actually
3667         applies attributes to the return type. We can't do this on the MS
3668         .NET runtime so we flag a warning in the case an exception is
3669         thrown.
3670
3671 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
3672
3673         * const.cs: Handle implicit null conversions here too.
3674
3675 2002-12-17  Ravi Pratap  <ravi@ximian.com>
3676
3677         * class.cs (MethodCore.LabelParameters): Remove the extra
3678         Type [] parameter since it is completely unnecessary. Instead
3679         pass in the method's attributes so that we can extract
3680         the "return" attribute.
3681
3682 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
3683
3684         * cs-parser.jay (parse): Use Report.Error to flag errors instead
3685         of ignoring it and letting the compile continue.
3686
3687         * typemanager.cs (ChangeType): use an extra argument to return an
3688         error condition instead of throwing an exception.
3689
3690 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
3691
3692         * expression.cs (Unary.TryReduce): mimic the code for the regular
3693         code path.  Perform an implicit cast in the cases where we can
3694         implicitly convert to one of the integral types, and then reduce
3695         based on that constant.   This fixes bug #35483.
3696
3697 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3698
3699         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
3700
3701 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3702
3703         * namespace.cs: fixed bug #35489.
3704
3705 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
3706
3707         * class.cs: Remove some dead code.
3708
3709         * cs-parser.jay: Estimate the number of methods needed
3710         (RootContext.MethodCount);
3711
3712         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
3713         numbers instead of StringBuilders.
3714
3715         * support.cs (PtrHashtable): Add constructor with initial size;
3716         We can now reduce reallocations of the method table.
3717
3718 2002-12-10  Ravi Pratap  <ravi@ximian.com>
3719
3720         * attribute.cs (ApplyAttributes): Keep track of the emitted
3721         attributes on a per-target basis. This fixes bug #35413.
3722
3723 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
3724
3725         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
3726         default to the Windows 1252 encoding.
3727
3728         (UnixParseOption): Support version, thanks to Alp for the missing
3729         pointer. 
3730
3731         * AssemblyInfo.cs: Add nice assembly information.
3732
3733         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
3734         (bug 35169).
3735
3736         * cs-parser.jay: Allow a trailing comma before the close bracked
3737         in the attribute_section production.
3738
3739         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
3740         address of the instance was being taken, I will take this out,
3741         because we take the address of the object immediately here.
3742
3743 2002-12-09  Ravi Pratap  <ravi@ximian.com>
3744
3745         * typemanager.cs (AreMultipleAllowed): Take care of the most
3746         obvious case where attribute type is not in the current assembly -
3747         stupid me ;-)
3748
3749 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
3750
3751         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
3752         definitions, instead of doing that afterwards.  
3753
3754         Also we use a nice little hack, depending on the constructor, we
3755         know if we are a "composed" name or a simple name.  Hence, we
3756         avoid the IndexOf test, and we avoid 
3757
3758         * codegen.cs: Add code to assist in a bug reporter to track down
3759         the source of a compiler crash. 
3760
3761 2002-12-07  Ravi Pratap  <ravi@ximian.com>
3762
3763         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
3764         types have been emitted for a given element and flag an error
3765         if something which does not have AllowMultiple set is used more
3766         than once.
3767
3768         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
3769         attribute types and their corresponding AllowMultiple properties
3770
3771         (AreMultipleAllowed): Check the property for a given type.
3772
3773         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
3774         property in the case we have a TypeContainer.
3775
3776         (Attributes.AddAttribute): Detect duplicates and just skip on
3777         adding them. This trivial fix catches a pretty gross error in our
3778         attribute emission - global attributes were being emitted twice!
3779
3780         Bugzilla bug #33187 is now fixed.
3781
3782 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
3783
3784         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
3785         instead of pp_and).
3786
3787         * expression.cs (Binary.ResolveOperator): I can only use the
3788         Concat (string, string, string) and Concat (string, string,
3789         string, string) if the child is actually a concatenation of
3790         strings. 
3791
3792 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
3793
3794         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
3795         context where we need a 2-character lookahead.
3796
3797         * pending.cs (PendingImplementation): Rework so we can keep track
3798         of interface types all the time, and flag those which were
3799         implemented by parents as optional.
3800
3801 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
3802
3803         * expression.cs (Binary.ResolveOperator): Use
3804         String.Concat(string,string,string) or
3805         String.Concat(string,string,string,string) when possible. 
3806
3807         * typemanager: More helper methods.
3808
3809
3810 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
3811
3812         * pending.cs: remove the bogus return from GetMissingInterfaces()
3813         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
3814
3815 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3816
3817         * namespace.cs: avoid duplicated 'using xxx' being added to
3818         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
3819         when we get more than one 'using' statement for the same namespace.
3820         Report a CS0105 warning for it.
3821
3822 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
3823
3824         * cs-tokenizer.cs (consume_identifier): use read directly, instead
3825         of calling getChar/putback, uses internal knowledge of it.    
3826
3827         (xtoken): Reorder tokenizer so most common patterns are checked
3828         first.  This reduces the compilation time in another 5% (from 8.11s
3829         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
3830
3831         The parsing time is 22% of the compilation in mcs, and from that
3832         64% is spent on the tokenization process.  
3833
3834         I tried using a binary search for keywords, but this is slower
3835         than the hashtable.  Another option would be to do a couple of
3836         things:
3837
3838                 * Not use a StringBuilder, instead use an array of chars,
3839                   with a set value.  Notice that this way we could catch
3840                   the 645 error without having to do it *afterwards*.
3841
3842                 * We could write a hand-parser to avoid the hashtable
3843                   compares altogether.
3844
3845         The identifier consumption process takes 37% of the tokenization
3846         time.  Another 15% is spent on is_number.  56% of the time spent
3847         on is_number is spent on Int64.Parse:
3848
3849                 * We could probably choose based on the string length to
3850                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
3851                   computations. 
3852
3853         Another 3% is spend on wrapping `xtoken' in the `token' function.
3854
3855         Handle 0xa0 as whitespace (#34752)
3856         
3857 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
3858
3859         * typemanager.cs (IsCLRType): New routine to tell whether a type
3860         is one of the builtin types.  
3861
3862         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
3863         typecode in more places instead of doing pointer comparissions.
3864         We could leverage some knowledge about the way the typecodes are
3865         laid out.
3866
3867         New code to cache namespaces in assemblies, it is currently not
3868         invoked, to be used soon.
3869
3870         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
3871
3872         * expression.cs (Binary.ResolveOperator): specially handle
3873         strings, and do not perform user-defined operator overloading for
3874         built-in types.
3875
3876 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
3877
3878         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
3879         internalcall as it is a pretty simple operation;  Avoid whenever
3880         possible to call Char.IsLetter.
3881
3882         (consume_identifier): Cut by half the number of
3883         hashtable calls by merging the is_keyword and GetKeyword behavior.
3884
3885         Do not short-circuit, because if we do, we
3886         report errors (ie, #if false && true would produce an invalid
3887         directive error);
3888         
3889
3890 2002-11-24  Martin Baulig  <martin@ximian.com>
3891
3892         * expression.cs (Cast.TryReduce): If we're in checked syntax,
3893         check constant ranges and report a CS0221.  Fixes #33186.
3894
3895 2002-11-24  Martin Baulig  <martin@ximian.com>
3896
3897         * cs-parser.jay: Make this work for uninitialized variable
3898         declarations in the `for' initializer.  Fixes #32416.
3899
3900 2002-11-24  Martin Baulig  <martin@ximian.com>
3901
3902         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
3903         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
3904
3905 2002-11-24  Martin Baulig  <martin@ximian.com>
3906
3907         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
3908         argument; if true, we also check for user-defined conversions.
3909         This is only needed if both arguments are of a user-defined type.
3910         Fixes #30443, added test-175.cs.
3911         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
3912
3913         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
3914
3915 2002-11-24  Martin Baulig  <martin@ximian.com>
3916
3917         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
3918         function to get the store opcode.
3919         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
3920         only emit the Ldelema if the store opcode is Stobj.  You must run
3921         both test-34 and test-167 to test this.  Fixes #34529.
3922
3923 2002-11-23  Martin Baulig  <martin@ximian.com>
3924
3925         * ecore.cs (Expression.MemberLookup): Added additional
3926         `qualifier_type' argument which is used when we're being called
3927         from MemberAccess.DoResolve() and null if we're called from a
3928         SimpleName lookup.
3929         (Expression.MemberLookupFailed): New method to report errors; this
3930         does the CS1540 check and reports the correct error message.
3931
3932         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
3933         argument for the CS1540 check and redone the way how we're dealing
3934         with private members.  See the comment in the source code for details.
3935         (FilterWithClosure): Reverted this back to revision 1.197; renamed
3936         `closure_start_type' to `closure_qualifier_type' and check whether
3937         it's not null.  It was not this filter being broken, it was just
3938         being called with the wrong arguments.
3939
3940         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
3941         and pass it the correct `qualifier_type'; this also does the error
3942         handling for us.
3943
3944 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
3945
3946         * expression.cs (Invocation.EmitParams): If the we are dealing
3947         with a non-built-in value type, load its address as well.
3948
3949         (ArrayCreation): Use a a pretty constant instead
3950         of the hardcoded value 2.   Use 6 instead of 2 for the number of
3951         static initializers.  
3952
3953         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
3954         because they are not really value types, just glorified integers. 
3955
3956         * driver.cs: Do not append .exe, the CSC compiler does not do it.
3957
3958         * ecore.cs: Remove redundant code for enumerations, make them use
3959         the same code path as everything else, fixes the casting issue
3960         with enumerations in Windows.Forms.
3961
3962         * attribute.cs: Do only cast to string if it is a string, the
3963         validation happens later.
3964
3965         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
3966         people upgrade their corlibs.
3967
3968         * ecore.cs: Oops, enumerations were not following the entire code path
3969
3970 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
3971
3972         * typemanager.cs (FilterWithClosure): Commented out the test for
3973         1540 in typemanager.cs, as it has problems when accessing
3974         protected methods from a parent class (see test-174.cs). 
3975
3976         * attribute.cs (Attribute.ValidateGuid): new method.
3977         (Attribute.Resolve): Use above.
3978
3979 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
3980
3981         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
3982
3983         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
3984         handling for enumerations, as we only needed the TypeContainer
3985         functionality to begin with (this is required for the fix below to
3986         work for enums that reference constants in a container class for
3987         example). 
3988
3989         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
3990
3991         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
3992         a valid TypeBuilder to perform lookups on.o
3993
3994         * class.cs (InheritableMemberSignatureCompare): Use true in the
3995         call to GetGetMethod and GetSetMethod, because we are comparing
3996         the signature, and we need to get the methods *even* if they are
3997         private. 
3998
3999         (PropertyBase.CheckBase): ditto.
4000
4001         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
4002         GotoCase.Resolve): Use Peel on EmpytCasts.
4003
4004         * ecore.cs (EmptyCast): drop child, add Peel method.
4005
4006 2002-11-17  Martin Baulig  <martin@ximian.com>
4007
4008         * ecore.cs (EmptyCast.Child): New public property.
4009
4010         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
4011         label resolved to an EmptyCast.  Fixes #34162.
4012         (GotoCase.Resolve): Likewise.
4013         (Block.EmitMeta): Likewise.
4014
4015 2002-11-17  Martin Baulig  <martin@ximian.com>
4016
4017         * expression.cs (Invocation.BetterConversion): Prefer int over
4018         uint; short over ushort; long over ulong for integer literals.
4019         Use ImplicitConversionExists instead of StandardConversionExists
4020         since we also need to check for user-defined implicit conversions.
4021         Fixes #34165.  Added test-173.cs.
4022
4023 2002-11-16  Martin Baulig  <martin@ximian.com>
4024
4025         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
4026         with the `true' and `false' literals.  Fixes #33151.
4027
4028 2002-11-16  Martin Baulig  <martin@ximian.com>
4029
4030         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
4031         October 22nd; don't do the cs1540 check for static members.
4032
4033         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
4034         now using our own filter here and doing the cs1540 check again.
4035
4036 2002-11-16  Martin Baulig  <martin@ximian.com>
4037
4038         * support.cs (InternalParameters): Don't crash if we don't have
4039         any fixed parameters.  Fixes #33532.
4040
4041 2002-11-16  Martin Baulig  <martin@ximian.com>
4042
4043         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
4044         when looking up static methods to make this work on Windows.
4045         Fixes #33773.
4046
4047 2002-11-16  Martin Baulig  <martin@ximian.com>
4048
4049         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
4050         a setter rather than using PropertyInfo.CanWrite.
4051
4052 2002-11-15  Nick Drochak  <ndrochak@gol.com>
4053
4054         * class.cs: Allow acces to block member by subclasses. Fixes build
4055         breaker.
4056
4057 2002-11-14  Martin Baulig  <martin@ximian.com>
4058
4059         * class.cs (Constructor.Emit): Added the extern/block check.
4060         Fixes bug #33678.
4061
4062 2002-11-14  Martin Baulig  <martin@ximian.com>
4063
4064         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
4065         iteration while looking for indexers, this is needed because the
4066         indexer may have a different name in our base classes.  Fixed the
4067         error reporting (no indexers at all, not get accessor, no
4068         overloaded match).  Fixes bug #33089.
4069         (IndexerAccess.DoResolveLValue): Likewise.
4070
4071 2002-11-14  Martin Baulig  <martin@ximian.com>
4072
4073         * class.cs (PropertyBase.CheckBase): Make this work for multiple
4074         indexers.  Fixes the first part of bug #33089.
4075         (MethodSignature.InheritableMemberSignatureCompare): Added support
4076         for properties.
4077
4078 2002-11-13  Ravi Pratap  <ravi@ximian.com>
4079
4080         * attribute.cs (Attribute.Resolve): Catch the
4081         NullReferenceException and report it since it isn't supposed to
4082         happen. 
4083         
4084 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
4085
4086         * expression.cs (Binary.EmitBranchable): Also handle the cases for
4087         LogicalOr and LogicalAnd that can benefit from recursively
4088         handling EmitBranchable.  The code now should be nice for Paolo.
4089
4090 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
4091
4092         * typemanager.cs (LookupType): Added a negative-hit hashtable for
4093         the Type lookups, as we perform quite a number of lookups on
4094         non-Types.  This can be removed once we can deterministically tell
4095         whether we have a type or a namespace in advance.
4096
4097         But this might require special hacks from our corlib.
4098
4099         * TODO: updated.
4100
4101         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
4102         and double which avoids a conversion from an integer to a double.
4103
4104         * expression.cs: tiny optimization, avoid calling IsConstant,
4105         because it effectively performs the lookup twice.
4106
4107 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
4108
4109         But a bogus return here to keep the semantics of the old code
4110         until the Mono runtime is fixed.
4111         
4112         * pending.cs (GetMissingInterfaces): New method used to remove all
4113         the interfaces that are already implemented by our parent
4114         classes from the list of pending methods. 
4115
4116         * interface.cs: Add checks for calls after ResolveTypeExpr.
4117
4118 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
4119
4120         * class.cs (Class.Emit): Report warning 67: event not used if the
4121         warning level is beyond 3.
4122
4123         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
4124         being a NullLiteral.
4125
4126         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
4127         specifiers. 
4128
4129         * class.cs (TypeContainer.GetClassBases): Cover a missing code
4130         path that might fail if a type can not be resolved.
4131
4132         * expression.cs (Binary.Emit): Emit unsigned versions of the
4133         operators. 
4134
4135         * driver.cs: use error 5.
4136         
4137 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
4138
4139         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
4140
4141 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
4142
4143         * cs-parser.jay (switch_section): A beautiful patch from Martin
4144         Baulig that fixed 33094.
4145
4146 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
4147
4148         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
4149         Check whether the base is abstract and report an error if so.
4150
4151         * expression.cs (IndexerAccess.DoResolveLValue,
4152         IndexerAccess.DoResolve): ditto. 
4153
4154         (Invocation.DoResolve): ditto.
4155         
4156         (Invocation.FullMethodDesc): Improve the report string.
4157
4158         * statement.cs (Block): Eliminate IsVariableDefined as it is
4159         basically just a wrapper for GetVariableInfo.
4160
4161         * ecore.cs (SimpleName): Use new 
4162
4163         * support.cs (ReflectionParamter.ParameterType): We unwrap the
4164         type, as we return the actual parameter ref/unref state on a
4165         different call.
4166
4167 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
4168
4169         * support.cs: Return proper flags REF/OUT fixing the previous
4170         commit.  
4171
4172         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
4173         not used to mean `ref' but `ref or out' in ParameterReference
4174         
4175         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
4176         full type signature instead of calling TypeManger.CSharpName
4177         ourselves. 
4178
4179         * support.cs (InternalParameters.ParameterDesc): Do not compare
4180         directly to the modflags, because REF/OUT will actually be bitsets
4181         if set. 
4182
4183         * delegate.cs (VerifyMethod): Check also the modifiers.
4184
4185         * cs-tokenizer.cs: Fix bug where floating point values with an
4186         exponent where a sign was missing was ignored.
4187
4188         * driver.cs: Allow multiple assemblies to be specified in a single
4189         /r: argument
4190
4191 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
4192
4193         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
4194         because identifiers after a parenthesis would end up in this kind
4195         of production, and we needed to desamiguate it for having casts
4196         like:
4197
4198                 (UserDefinedType *) xxx
4199
4200 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
4201
4202         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
4203         we should set on the Bindingflags.NonPublic, but not turn on
4204         private_ok.  private_ok controls whether a Private member is
4205         returned (this is chekced on the filter routine), while the
4206         BindingFlags.NonPublic just controls whether private/protected
4207         will be allowed.   This fixes the problem part of the problem of
4208         private properties being allowed to be used in derived classes.
4209
4210         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
4211         so we can call the children DoResolveLValue method (this will
4212         properly signal errors on lvalue assignments to base properties)
4213         
4214         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
4215         getter are null, and we have a property info, we know that this
4216         happened because the lookup failed, so we report an error 122 for
4217         protection level violation.
4218
4219         We also silently return if setter and getter are null in the
4220         resolve functions, this condition only happens if we have flagged
4221         the error before.  This is the other half of the problem. 
4222
4223         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
4224         not have accessibility information, that is why we were returning
4225         true in the filter function in typemanager.cs.
4226
4227         To properly report 122 (property is inaccessible because of its
4228         protection level) correctly, we report this error in ResolveAccess
4229         by failing if both the setter and the getter are lacking (ie, the
4230         lookup failed). 
4231
4232         DoResolve and DoLResolve have been modified to check for both
4233         setter/getter being null and returning silently, the reason being
4234         that I did not want to put the knowledge about this error in upper
4235         layers, like:
4236
4237         int old = Report.Errors;
4238         x = new PropertyExpr (...);
4239         if (old != Report.Errors)
4240                 return null;
4241         else
4242                 return x;
4243
4244         So the property expr is returned, but it is invalid, so the error
4245         will be flagged during the resolve process. 
4246
4247         * class.cs: Remove InheritablePropertySignatureCompare from the
4248         class, as we no longer depend on the property signature to compute
4249         whether it is possible to implement a method or not.
4250
4251         The reason is that calling PropertyInfo.GetGetMethod will return
4252         null (in .NET, in Mono it works, and we should change this), in
4253         cases where the Get Method does not exist in that particular
4254         class.
4255
4256         So this code:
4257
4258         class X { public virtual int A { get { return 1; } } }
4259         class Y : X { }
4260         class Z : Y { public override int A { get { return 2; } } }
4261
4262         Would fail in Z because the parent (Y) would not have the property
4263         defined.  So we avoid this completely now (because the alternative
4264         fix was ugly and slow), and we now depend exclusively on the
4265         method names.
4266
4267         (PropertyBase.CheckBase): Use a method-base mechanism to find our
4268         reference method, instead of using the property.
4269
4270         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
4271         routines are gone now.
4272
4273         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
4274         names, they were incorrectly named.
4275
4276         * cs-tokenizer.cs: Return are more gentle token on failure. 
4277
4278         * pending.cs (PendingImplementation.InterfaceMethod): This routine
4279         had an out-of-sync index variable, which caused it to remove from
4280         the list of pending methods the wrong method sometimes.
4281
4282 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
4283
4284         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
4285         CanWrite, because those refer to this particular instance of the
4286         property, and do not take into account the fact that we can
4287         override single members of a property.
4288
4289         Constructor requires an EmitContext.  The resolution process does
4290         not happen here, but we need to compute the accessors before,
4291         because the resolution does not always happen for properties.
4292         
4293         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
4294         subclass, before we did not update this flag, but we did update
4295         bindingflags. 
4296
4297         (GetAccessors): Drop this routine, as it did not work in the
4298         presence of partially overwritten set/get methods. 
4299
4300         Notice that this broke the cs1540 detection, but that will require
4301         more thinking. 
4302         
4303 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4304
4305         * class.cs:
4306         * codegen.cs:
4307         * driver.cs: issue a warning instead of an error if we don't support
4308         debugging for the platform. Also ignore a couple of errors that may
4309         arise when trying to write the symbols. Undo my previous patch.
4310
4311 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4312
4313         * driver.cs: ignore /debug switch except for Unix platforms.
4314
4315 2002-10-23  Nick Drochak  <ndrochak@gol.com>
4316
4317         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
4318
4319 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
4320
4321         * driver.cs: Do not make mcs-debug conditional, so we do not break
4322         builds that use it.
4323
4324         * statement.cs (UsageVector.MergeChildren): I would like Martin to
4325         review this patch.  But basically after all the children variables
4326         have been merged, the value of "Breaks" was not being set to
4327         new_breaks for Switch blocks.  I think that it should be set after
4328         it has executed.  Currently I set this to the value of new_breaks,
4329         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
4330         conservative, but I do not understand this code very well.
4331
4332         I did not break anything in the build, so that is good ;-)
4333
4334         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
4335
4336 2002-10-20  Mark Crichton  <crichton@gimp.org>
4337
4338         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
4339
4340 2002-10-20  Nick Drochak  <ndrochak@gol.com>
4341
4342         * cfold.cs: Fixed compile blocker.
4343
4344 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
4345
4346         * driver.cs: I was chekcing the key, not the file.
4347
4348 2002-10-19  Ravi Pratap  <ravi@ximian.com>
4349
4350         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
4351         message that we were generating - we just need to silently return
4352         a null.
4353
4354 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
4355
4356         * class.cs (Event.Define): Change my previous commit, as this
4357         breaks the debugger.  This is a temporary hack, as it seems like
4358         the compiler is generating events incorrectly to begin with.
4359
4360         * expression.cs (Binary.ResolveOperator): Added support for 
4361         "U operator - (E x, E y)"
4362
4363         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
4364         y)".
4365
4366         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
4367         init-only variables, but this path did not take into account that
4368         there might be also instance readonly variables.  Correct this
4369         problem. 
4370
4371         This fixes bug 32253
4372
4373         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
4374         delegates as well.
4375
4376         * driver.cs: Change the extension for modules to `netmodule'
4377
4378         * cs-parser.jay: Improved slightly the location tracking for
4379         the debugger symbols.
4380
4381         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
4382         modifiers that were specified instead of the hardcoded value
4383         (FamAndAssem).  This was basically ignoring the static modifier,
4384         and others.  Fixes 32429.
4385
4386         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
4387         fixed a bug in the process (32476)
4388
4389         * expression.cs (ArrayAccess.EmitAssign): Patch from
4390         hwang_rob@yahoo.ca that fixes bug 31834.3
4391
4392 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
4393
4394         * driver.cs: Make the module extension .netmodule.
4395
4396 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
4397
4398         * driver.cs: Report an error if the resource file is not found
4399         instead of crashing.
4400
4401         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
4402         false, like Emit does.
4403
4404 2002-10-16  Nick Drochak  <ndrochak@gol.com>
4405
4406         * typemanager.cs: Remove unused private member.  Also reported mcs
4407         bug to report this as a warning like csc.
4408
4409 2002-10-15  Martin Baulig  <martin@gnome.org>
4410
4411         * statement.cs (Statement.Emit): Made this a virtual method; emits
4412         the line number info and calls DoEmit().
4413         (Statement.DoEmit): New protected abstract method, formerly knows
4414         as Statement.Emit().
4415
4416         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
4417
4418 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
4419
4420         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
4421         have fixed a remaining problem: not every AddXXXX was adding a
4422         fully qualified name.  
4423
4424         Now everyone registers a fully qualified name in the DeclSpace as
4425         being defined instead of the partial name.  
4426
4427         Downsides: we are slower than we need to be due to the excess
4428         copies and the names being registered this way.  
4429
4430         The reason for this is that we currently depend (on the corlib
4431         bootstrap for instance) that types are fully qualified, because
4432         we dump all the types in the namespace, and we should really have
4433         types inserted into the proper namespace, so we can only store the
4434         basenames in the defined_names array.
4435
4436 2002-10-10  Martin Baulig  <martin@gnome.org>
4437
4438         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
4439         from bug #31834, see the bug report for a testcase which is
4440         miscompiled.
4441
4442 2002-10-10  Martin Baulig  <martin@gnome.org>
4443
4444         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
4445         flow analysis code for this.
4446
4447         * statement.cs (Do, While, For): Tell the flow analysis code about
4448         infinite loops.
4449         (FlowBranching.UsageVector): Added support for infinite loops.
4450         (Block.Resolve): Moved the dead code elimination here and use flow
4451         analysis to do it.
4452
4453 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
4454
4455         * class.cs (Field.Define): Catch cycles on struct type
4456         definitions. 
4457
4458         * typemanager.cs (IsUnmanagedtype): Do not recursively check
4459         fields if the fields are static.  We only need to check instance
4460         fields. 
4461
4462         * expression.cs (As.DoResolve): Test for reference type.
4463
4464         * statement.cs (Using.ResolveExpression): Use
4465         ConvertImplicitRequired, not ConvertImplicit which reports an
4466         error on failture
4467         (Using.ResolveLocalVariableDecls): ditto.
4468
4469         * expression.cs (Binary.ResolveOperator): Report errors in a few
4470         places where we had to.
4471
4472         * typemanager.cs (IsUnmanagedtype): Finish implementation.
4473
4474 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
4475
4476         * expression.cs: Use StoreFromPtr instead of extracting the type
4477         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
4478
4479         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
4480         an enumeration value to a System.Enum, but System.Enum is not a
4481         value type, but an class type, so we need to box.
4482
4483         (Expression.ConvertExplicit): One codepath could return
4484         errors but not flag them.  Fix this.  Fixes #31853
4485
4486         * parameter.cs (Resolve): Do not allow void as a parameter type.
4487
4488 2002-10-06  Martin Baulig  <martin@gnome.org>
4489
4490         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
4491         if it's a class type and not a struct.  Fixes #31815.
4492
4493 2002-10-06  Martin Baulig  <martin@gnome.org>
4494
4495         * statement.cs: Reworked the flow analysis code a bit to make it
4496         usable for dead code elimination.
4497
4498 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4499
4500         * cs-parser.jay: allow empty source files. Fixes bug #31781.
4501
4502 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
4503
4504         * expression.cs (ComposedCast.DoResolveType): A quick workaround
4505         to fix the test 165, will investigate deeper.
4506
4507 2002-10-04  Martin Baulig  <martin@gnome.org>
4508
4509         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
4510         finally blocks actually work.
4511         (Try.Resolve): We don't need to create a sibling for `finally' if
4512         there is no finally block.
4513
4514 2002-10-04  Martin Baulig  <martin@gnome.org>
4515
4516         * class.cs (Constructor.Define): The default accessibility for a
4517         non-default constructor is private, not public.
4518
4519 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
4520
4521         * class.cs (Constructor): Make AllowedModifiers public, add
4522         EXTERN.
4523
4524         * cs-parser.jay: Perform the modifiers test here, as the
4525         constructor for the Constructor class usually receives a zero
4526         because of the way we create it (first we create, later we
4527         customize, and we were never checking the modifiers).
4528
4529         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
4530         is a version of LookupTypeReflection that includes the type-name
4531         cache.  This can be used as a fast path for functions that know
4532         the fully qualified name and are only calling into *.GetType() to
4533         obtain a composed type.
4534
4535         This is also used by TypeManager.LookupType during its type
4536         composition.
4537
4538         (LookupType): We now also track the real type name, as sometimes
4539         we can get a quey for the real type name from things like
4540         ComposedCast.  This fixes bug 31422.
4541         
4542         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
4543         complete type fullname, it does not have to go through the type
4544         resolution system to obtain the composed version of the type (for
4545         obtaining arrays or pointers).
4546         
4547         (Conditional.Emit): Use the EmitBoolExpression to
4548         generate nicer code, as requested by Paolo.
4549
4550         (ArrayCreation.CheckIndices): Use the patch from
4551         hwang_rob@yahoo.ca to validate the array initializers. 
4552
4553 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
4554
4555         * class.cs (ConstructorInitializer.Emit): simplify code by using
4556         Invocation.EmitCall, and at the same time, fix the bugs in calling
4557         parent constructors that took variable arguments. 
4558
4559         * ecore.cs (Expression.ConvertNumericExplicit,
4560         Expression.ImplicitNumericConversion): Remove the code that
4561         manually wrapped decimal (InternalTypeConstructor call is now gone
4562         as well).
4563
4564         * expression.cs (Cast.TryReduce): Also handle decimal types when
4565         trying to perform a constant fold on the type.
4566
4567         * typemanager.cs (IsUnmanagedtype): Partially implemented.
4568
4569         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
4570         that only turned off an error report, and did nothing else. 
4571
4572 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
4573
4574         * driver.cs: Handle and ignore /fullpaths
4575
4576 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
4577
4578         * expression.cs (Binary.ResolveOperator): Catch the case where
4579         DoNumericPromotions returns true, 
4580
4581         (Binary.DoNumericPromotions): Simplify the code, and the tests.
4582
4583 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
4584
4585         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
4586         report error 70.
4587
4588 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
4589
4590         * ecore.cs (ConvertNumericExplicit): It is not enough that the
4591         conversion exists, but it is also required that the conversion be
4592         performed.  This manifested in "(Type64Enum) 2".  
4593
4594         * class.cs (TypeManager.AddMethod): The fix is not to change
4595         AddEnum, because that one was using a fully qualified name (every
4596         DeclSpace derivative does), but to change the AddMethod routine
4597         that was using an un-namespaced name.  This now correctly reports
4598         the duplicated name.
4599
4600         Revert patch until I can properly fix it.  The issue
4601         is that we have a shared Type space across all namespaces
4602         currently, which is wrong.
4603
4604         Options include making the Namespace a DeclSpace, and merge
4605         current_namespace/current_container in the parser.
4606
4607 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
4608
4609         * cs-parser.jay: Improve error reporting when we get a different
4610         kind of expression in local_variable_type and
4611         local_variable_pointer_type. 
4612
4613         Propagate this to avoid missleading errors being reported.
4614
4615         * ecore.cs (ImplicitReferenceConversion): treat
4616         TypeManager.value_type as a target just like object_type.   As
4617         code like this:
4618
4619         ValueType v = 1;
4620
4621         Is valid, and needs to result in the int 1 being boxed before it
4622         is assigned to the value type v.
4623
4624         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
4625         to validate the enumeration name.
4626
4627         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
4628         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
4629         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
4630
4631         * ecore.cs (TryImplicitIntConversion): When doing an
4632         implicit-enumeration-conversion, check if the type is 64-bits and
4633         perform a conversion before passing to EnumConstant.
4634
4635 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
4636
4637         * decl.cs (Error_AmbiguousTypeReference); New routine used to
4638         report ambiguous type references.  Unlike the MS version, we
4639         report what the ambiguity is.   Innovation at work ;-)
4640
4641         (DeclSpace.FindType): Require a location argument to
4642         display when we display an ambiguous error.
4643
4644         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
4645
4646         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
4647
4648         * expression.cs (EmitDynamicInitializers): Apply patch from
4649         hwang_rob@yahoo.ca that fixes the order in which we emit our
4650         initializers. 
4651
4652 2002-09-21  Martin Baulig  <martin@gnome.org>
4653
4654         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
4655         delegate takes no arguments.
4656
4657 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
4658
4659         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
4660         from integers.
4661
4662         * expression.cs: Extract the underlying type.
4663
4664         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
4665
4666         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
4667
4668 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
4669
4670         * class.cs (TypeContainer.DefineType): We can not use the nice
4671         PackingSize with the size set to 1 DefineType method, because it
4672         will not allow us to define the interfaces that the struct
4673         implements.
4674
4675         This completes the fixing of bug 27287
4676
4677         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
4678         means also structs.  This fixes part of the problem. 
4679         (Expresion.ImplicitReferenceConversionExists): ditto.
4680
4681         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
4682         error if there were no errors reported during the type lookup
4683         process, to avoid duplicates or redundant errors.  Without this
4684         you would get an ambiguous errors plus a type not found.  We have
4685         beaten the user enough with the first error.  
4686
4687         (DeclSparce.FindType): Emit a warning if we have an ambiguous
4688         reference. 
4689
4690         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
4691         during the resolution process, stop the lookup, this avoids
4692         repeated error reports (same error twice).
4693
4694         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
4695
4696         * typemanager.cs (LookupType): Redo the type lookup code to match
4697         the needs of System.Reflection.  
4698
4699         The issue is that System.Reflection requires references to nested
4700         types to begin with a "+" sign instead of a dot.  So toplevel
4701         types look like: "NameSpace.TopLevelClass", and nested ones look
4702         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
4703         levels. 
4704
4705 2002-09-19  Martin Baulig  <martin@gnome.org>
4706
4707         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
4708         says that a method always returns or always throws an exception,
4709         don't report the CS0161.
4710
4711         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
4712         set `Returns = new_returns'.
4713
4714 2002-09-19  Martin Baulig  <martin@gnome.org>
4715
4716         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
4717         to an enum constant, check for a CS0176.
4718
4719 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
4720
4721         * class.cs (TypeContainer.CheckPairedOperators): Now we check
4722         for operators that must be in pairs and report errors.
4723
4724         * ecore.cs (SimpleName.DoResolveType): During the initial type
4725         resolution process, when we define types recursively, we must
4726         check first for types in our current scope before we perform
4727         lookups in the enclosing scopes.
4728
4729         * expression.cs (MakeByteBlob): Handle Decimal blobs.
4730
4731         (Invocation.VerifyArgumentsCompat): Call
4732         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
4733         I thought we were supposed to always call this, but there are a
4734         few places in the code where we dont do it.
4735
4736 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
4737
4738         * driver.cs: Add support in -linkres and -resource to specify the
4739         name of the identifier.
4740
4741 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
4742
4743         * ecore.cs (StandardConversionExists): Sync with the conversion
4744         code: allow anything-* to void* conversions.
4745
4746         (FindMostSpecificSource): Use an Expression argument
4747         instead of a Type, because we might be handed over a Literal which
4748         gets a few more implicit conversions that plain types do not.  So
4749         this information was being lost.
4750
4751         Also, we drop the temporary type-holder expression when not
4752         required.
4753
4754 2002-09-17  Martin Baulig  <martin@gnome.org>
4755
4756         * class.cs (PropertyBase.CheckBase): Don't check the base class if
4757         this is an explicit interface implementation.
4758
4759 2002-09-17  Martin Baulig  <martin@gnome.org>
4760
4761         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
4762         different `IndexerName' attributes.
4763
4764         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
4765         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
4766         virtual CommonResolve().
4767
4768 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
4769
4770         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
4771         and convert that to the UnderlyingType.
4772
4773         * statement.cs (Foreach.Resolve): Indexers are just like variables
4774         or PropertyAccesses.
4775
4776         * cs-tokenizer.cs (consume_string): Track line numbers and columns
4777         inside quoted strings, we were not doing this before.
4778
4779 2002-09-16  Martin Baulig  <martin@gnome.org>
4780
4781         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
4782         resolve it.  This is needed for the definite assignment check of the
4783         instance expression, fixes bug #29846.
4784         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
4785
4786 2002-09-16  Nick Drochak  <ndrochak@gol.com>
4787
4788         * parameter.cs: Fix compile error.  Cannot reference static member
4789         from an instance object.  Is this an mcs bug?
4790
4791 2002-09-14  Martin Baulig  <martin@gnome.org>
4792
4793         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
4794         multiple times.  Fixes bug #30295, added test-166.cs.
4795
4796 2002-09-14  Martin Baulig  <martin@gnome.org>
4797
4798         * statement.cs (Block.Emit): Don't emit unreachable code.
4799         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
4800         `break' statements.
4801         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
4802
4803 2002-09-14  Martin Baulig  <martin@gnome.org>
4804
4805         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
4806         is set.
4807
4808 2002-09-14  Martin Baulig  <martin@gnome.org>
4809
4810         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
4811         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
4812         be false on the ms runtime.
4813
4814 2002-09-13  Martin Baulig  <martin@gnome.org>
4815
4816         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
4817         the CS0038 error message.
4818
4819 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
4820
4821         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
4822         constant inside, return it.
4823
4824 2002-09-12  Martin Baulig  <martin@gnome.org>
4825
4826         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
4827         implicit conversion can be done between enum types.
4828
4829         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
4830         check whether an implicit conversion to the current enum's UnderlyingType
4831         exists and report an error if not.
4832
4833         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
4834         without debugging support.
4835
4836         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
4837         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
4838
4839 2002-09-12  Martin Baulig  <martin@gnome.org>
4840
4841         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
4842
4843         * ecore.cs (IMemberExpr.DeclaringType): New property.
4844         (SimpleName.SimpleNameResolve): Check whether we're accessing a
4845         nonstatic member of an outer type (CS0038).
4846
4847 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
4848
4849         * driver.cs: Activate the using-error detector at warning level
4850         4 (at least for MS-compatible APIs).
4851
4852         * namespace.cs (VerifyUsing): Small buglett fix.
4853
4854         * pending.cs (PendingImplementation): pass the container pointer. 
4855
4856         * interface.cs (GetMethods): Allow for recursive definition.  Long
4857         term, I would like to move every type to support recursive
4858         definitions, not the current ordering mechanism that we have right
4859         now.
4860
4861         The situation is this: Attributes are handled before interfaces,
4862         so we can apply attributes to interfaces.  But some attributes
4863         implement interfaces, we will now handle the simple cases
4864         (recursive definitions will just get an error).  
4865
4866         * parameter.cs: Only invalidate types at the end if we fail to
4867         lookup all types.  
4868
4869 2002-09-09  Martin Baulig  <martin@gnome.org>
4870
4871         * ecore.cs (PropertyExpr.Emit): Also check for
4872         TypeManager.system_int_array_get_length so this'll also work when
4873         compiling corlib.  Fixes #30003.
4874
4875 2002-09-09  Martin Baulig  <martin@gnome.org>
4876
4877         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
4878         and throw an exception if we can't get the type's size.  Fixed #30040,
4879         added test-165.cs.
4880
4881 2002-09-09  Martin Baulig  <martin@gnome.org>
4882
4883         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
4884
4885         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
4886         context.  Fixes bug #30027.
4887
4888         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
4889         virtual functions.  Fixes bug #30043, added test-164.cs.
4890
4891 2002-09-08  Ravi Pratap  <ravi@ximian.com>
4892
4893         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
4894
4895 2002-09-08  Nick Drochak  <ndrochak@gol.com>
4896
4897         * driver.cs: Use an object to get the windows codepage since it's not a
4898         static property.
4899
4900 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
4901
4902         * statement.cs (For.Emit): for infinite loops (test == null)
4903         return whether there is a break inside, not always "true".
4904
4905         * namespace.cs (UsingEntry): New struct to hold the name of the
4906         using definition, the location where it is defined, and whether it
4907         has been used in a successful type lookup.
4908         
4909         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
4910         strings.
4911
4912         * decl.cs: ditto.
4913
4914 2002-09-06  Ravi Pratap  <ravi@ximian.com>
4915
4916         * attribute.cs : Fix incorrect code which relied on catching
4917         a NullReferenceException to detect a null being passed in
4918         where an object was expected.
4919
4920 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
4921
4922         * statement.cs (Try): flag the catch variable as assigned
4923
4924         * expression.cs (Cast): Simplified by using ResolveType instead of
4925         manually resolving.
4926
4927         * statement.cs (Catch): Fix bug by using ResolveType.
4928
4929 2002-09-06  Ravi Pratap  <ravi@ximian.com>
4930
4931         * expression.cs (BetterConversion): Special case for when we have
4932         a NullLiteral as the argument and we have to choose between string
4933         and object types - we choose string the way csc does.
4934
4935         * attribute.cs (Attribute.Resolve): Catch the
4936         NullReferenceException and report error #182 since the Mono
4937         runtime no more has the bug and having this exception raised means
4938         we tried to select a constructor which takes an object and is
4939         passed a null.
4940
4941 2002-09-05  Ravi Pratap  <ravi@ximian.com>
4942
4943         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
4944         message (1502, 1503) when we can't locate a method after overload
4945         resolution. This is much more informative and closes the bug
4946         Miguel reported.
4947
4948         * interface.cs (PopulateMethod): Return if there are no argument
4949         types. Fixes a NullReferenceException bug.
4950
4951         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
4952         expressions too. Previously we were checking only in one place for
4953         positional arguments leaving out named arguments.
4954
4955         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
4956         type to the enum type is not allowed. Remove code corresponding to
4957         that.
4958
4959         (ConvertNumericExplicit): Allow explicit conversions from
4960         the underlying type to enum type. This precisely follows the spec
4961         and closes a bug filed by Gonzalo.
4962         
4963 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4964
4965         * compiler.csproj:
4966         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
4967
4968 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
4969
4970         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
4971         it was important that we stored the right value after the
4972         reduction in `converted'.
4973
4974 2002-09-04  Martin Baulig  <martin@gnome.org>
4975
4976         * location.cs (Location.SymbolDocument): Use full pathnames for the
4977         source files.
4978
4979 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
4980
4981         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
4982         of the expression resolve mechanism, because that will catch the
4983         SimpleName error failures.
4984
4985         (Conditional): If we can not resolve the
4986         expression, return, do not crash.
4987
4988 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4989
4990         * cs-tokenizer.cs:
4991         (location): display token name instead of its number.
4992
4993 2002-08-28  Martin Baulig  <martin@gnome.org>
4994
4995         * expression.cs (Binary.ResolveOperator): Don't silently return
4996         but return an error if an operator cannot be applied between two
4997         enum types.
4998
4999 2002-08-28  Martin Baulig  <martin@gnome.org>
5000
5001         * class.cs (Constructor.Define): Set the permission attributes
5002         correctly instead of making all constructors public.
5003
5004 2002-08-28  Martin Baulig  <martin@gnome.org>
5005
5006         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
5007         for private members before reporting a CS0103; if we find anything,
5008         it's a CS0122.
5009
5010 2002-08-28  Martin Baulig  <martin@gnome.org>
5011
5012         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
5013         to check whether `closure_start_type == closure_invocation_type',
5014         we also need to check whether `m.DeclaringType == closure_invocation_type'
5015         before bypassing the permission checks.  We might be accessing
5016         protected/private members from the base class.
5017         (TypeManager.RealMemberLookup): Only set private_ok if private
5018         members were requested via BindingFlags.NonPublic.
5019
5020         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
5021
5022         * expression.cs (MemberAccess.ResolveMemberAccess): Set
5023         MethodGroupExpr.IsExplicitImpl if appropriate.
5024         (Invocation.DoResolve): Don't report the CS0120 for explicit
5025         interface implementations.
5026
5027 2002-08-27  Martin Baulig  <martin@gnome.org>
5028
5029         * expression.cs (Invocation.DoResolve): If this is a static
5030         method and we don't have an InstanceExpression, we must report
5031         a CS0120.
5032
5033 2002-08-25  Martin Baulig  <martin@gnome.org>
5034
5035         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
5036         `==' between a valuetype and an object.
5037
5038 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
5039
5040         * ecore.cs (TypeExpr): Provide a ToString method.
5041
5042 2002-08-24  Martin Baulig  <martin@gnome.org>
5043
5044         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
5045         now called proggie.dbg and it's a binary file.
5046
5047 2002-08-23  Martin Baulig  <martin@gnome.org>
5048
5049         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
5050
5051 2002-08-23  Martin Baulig  <martin@gnome.org>
5052
5053         * struct.cs (MyStructInfo.ctor): Make this work with empty
5054         structs; it's not allowed to use foreach() on null.
5055
5056 2002-08-23  Martin Baulig  <martin@gnome.org>
5057
5058         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
5059         writer the full pathname of the generated assembly.
5060
5061 2002-08-23  Martin Baulig  <martin@gnome.org>
5062
5063         * statements.cs (FlowBranching.UsageVector.MergeChildren):
5064         A `finally' block never returns or breaks; improved handling of
5065         unreachable code.
5066
5067 2002-08-23  Martin Baulig  <martin@gnome.org>
5068
5069         * statement.cs (Throw.Resolve): Allow `throw null'.
5070
5071 2002-08-23  Martin Baulig  <martin@gnome.org>
5072
5073         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
5074         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
5075         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
5076         MemberLookup would return a wrong event if this is an explicit
5077         interface implementation and the class has an event with the same
5078         name.
5079
5080 2002-08-23  Martin Baulig  <martin@gnome.org>
5081
5082         * statement.cs (Block.AddChildVariableNames): New public method.
5083         (Block.AddChildVariableName): Likewise.
5084         (Block.IsVariableNameUsedInChildBlock): Likewise.
5085         (Block.AddVariable): Check whether a variable name has already
5086         been used in a child block.
5087
5088         * cs-parser.jay (declare_local_variables): Mark all variable names
5089         from the current block as being used in a child block in the
5090         implicit block.
5091
5092 2002-08-23  Martin Baulig  <martin@gnome.org>
5093
5094         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
5095         find the symbol writer.
5096
5097         * driver.cs: csc also allows the arguments to /define being
5098         separated by commas, not only by semicolons.
5099
5100 2002-08-23  Martin Baulig  <martin@gnome.org>
5101
5102         * interface.cs (Interface.GetMembers): Added static check for events.
5103
5104 2002-08-15  Martin Baulig  <martin@gnome.org>
5105
5106         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
5107         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
5108
5109         * ecore.cs (Expression.MemberLookup): Added documentation and explained
5110         why the MethodData.EmitDestructor() change was necessary.
5111
5112 2002-08-20  Martin Baulig  <martin@gnome.org>
5113
5114         * class.cs (TypeContainer.FindMembers): Added static check for events.
5115
5116         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
5117
5118         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
5119         use Type.GetEvents(), not Type.FindMembers().
5120
5121 2002-08-20  Martin Baulig  <martin@gnome.org>
5122
5123         * decl.cs (MemberCache): Added a special method cache which will
5124         be used for method-only searched.  This ensures that a method
5125         search will return a MethodInfo with the correct ReflectedType for
5126         inherited methods.      
5127
5128 2002-08-20  Martin Baulig  <martin@gnome.org>
5129
5130         * decl.cs (DeclSpace.FindMembers): Made this public.
5131
5132 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5133
5134         * delegate.cs: fixed build on windows.
5135         [FIXME:  Filed as bug #29150: MCS must report these errors.]
5136
5137 2002-08-19  Ravi Pratap  <ravi@ximian.com>
5138
5139         * ecore.cs (StandardConversionExists): Return a false
5140         if we are trying to convert the void type to anything else
5141         since that is not allowed.
5142
5143         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
5144         we flag error 70 in the event an event is trying to be accessed
5145         directly from outside the declaring type.
5146
5147 2002-08-20  Martin Baulig  <martin@gnome.org>
5148
5149         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
5150         MemberCache from typemanager.cs to decl.cs.
5151
5152 2002-08-19  Martin Baulig  <martin@gnome.org>
5153
5154         * class.cs (TypeContainer): Implement IMemberContainer.
5155         (TypeContainer.DefineMembers): Create the MemberCache.
5156         (TypeContainer.FindMembers): Do better BindingFlags checking; only
5157         return public members if BindingFlags.Public was given, check
5158         whether members are static.
5159
5160 2002-08-16  Martin Baulig  <martin@gnome.org>
5161
5162         * decl.cs (DeclSpace.Define): Splitted this in Define and
5163         DefineMembers.  DefineMembers is called first and initializes the
5164         MemberCache.
5165
5166         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
5167         DefineMembers() on all our DeclSpaces.
5168
5169         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
5170         but call DefineMembers() on all nested interfaces.  We call their
5171         Define() in our new Define() function.
5172
5173         * interface.cs (Interface): Implement IMemberContainer.
5174         (Interface.Define): Moved all code except the attribute stuf to
5175         DefineMembers().
5176         (Interface.DefineMembers): Initialize the member cache.
5177
5178         * typemanager.cs (IMemberFinder): Removed this interface, we don't
5179         need this anymore since we can use MemberCache.FindMembers directly.
5180
5181 2002-08-19  Martin Baulig  <martin@gnome.org>
5182
5183         * typemanager.cs (MemberCache): When creating the cache for an
5184         interface type, add all inherited members.
5185         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
5186         to `out bool used_cache' and documented it.
5187         (TypeManager.MemberLookup): If we already used the cache in the first
5188         iteration, we don't need to do the interfaces check.
5189
5190 2002-08-19  Martin Baulig  <martin@gnome.org>
5191
5192         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
5193         here from IMemberFinder and don't implement this interface anymore.
5194         (DeclSpace.MemberCache): Moved here from IMemberFinder.
5195
5196         * typemanager.cs (IMemberFinder): This interface is now only used by
5197         classes which actually support the member cache.
5198         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
5199         since we only put DeclSpaces into this Hashtable.
5200         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
5201         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
5202
5203 2002-08-16  Martin Baulig  <martin@gnome.org>
5204
5205         * typemanager.cs (ICachingMemberFinder): Removed.
5206         (IMemberFinder.MemberCache): New property.
5207         (TypeManager.FindMembers): Merged this with RealFindMembers().
5208         This function will never be called from TypeManager.MemberLookup()
5209         so we can't use the cache here, just the IMemberFinder.
5210         (TypeManager.MemberLookup_FindMembers): Check whether the
5211         IMemberFinder has a MemberCache and call the cache's FindMembers
5212         function.
5213         (MemberCache): Rewrote larger parts of this yet another time and
5214         cleaned it up a bit.
5215
5216 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
5217
5218         * driver.cs (LoadArgs): Support quoting.
5219
5220         (Usage): Show the CSC-like command line arguments.
5221
5222         Improved a few error messages.
5223
5224 2002-08-15  Martin Baulig  <martin@gnome.org>
5225
5226         * typemanager.cs (IMemberContainer.Type): New property.
5227         (IMemberContainer.IsInterface): New property.
5228
5229         The following changes are conditional to BROKEN_RUNTIME, which is
5230         defined at the top of the file.
5231
5232         * typemanager.cs (MemberCache.MemberCache): Don't add the base
5233         class'es members, but add all members from TypeHandle.ObjectType
5234         if we're an interface.
5235         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
5236         is the current type.
5237         (MemberCache.CacheEntry.Container): Removed this field.
5238         (TypeHandle.GetMembers): Include inherited members.
5239
5240 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5241
5242         * typemanager.cs: fixed compilation and added a comment on a field that
5243         is never used.
5244
5245 2002-08-15  Martin Baulig  <martin@gnome.org>
5246
5247         * class.cs (ConstructorInitializer.Resolve): In the
5248         Expression.MemberLookup call, use the queried_type as
5249         invocation_type.
5250
5251         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
5252         declared' attribute, it's always true.
5253         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
5254         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
5255         temporary wrapper for FindMembers which tells MemberLookup whether
5256         members from the base classes are included in the return value.
5257         This will go away soon.
5258         (TypeManager.MemberLookup): Use this temporary hack here; once the
5259         new MemberCache is completed, we don't need to do the DeclaredOnly
5260         looping here anymore since the MemberCache will take care of this.
5261         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
5262         (MemberCache): When creating the MemberCache for a class, get
5263         members from the current class and all its base classes.
5264         (MemberCache.CacheEntry.Container): New field.  This is a
5265         temporary hack until the Mono runtime is fixed to distinguish
5266         between ReflectedType and DeclaringType.  It allows us to use MCS
5267         with both the MS runtime and the unfixed Mono runtime without
5268         problems and without accecting performance.
5269         (MemberCache.SearchMembers): The DeclaredOnly looping from
5270         TypeManager.MemberLookup is now done here.      
5271
5272 2002-08-14  Martin Baulig  <martin@gnome.org>
5273
5274         * statement.cs (MyStructInfo.MyStructInfo): Don't call
5275         Type.GetFields on dynamic types but get the fields from the
5276         corresponding TypeContainer.
5277         (MyStructInfo.GetStructInfo): Added check for enum types.
5278
5279         * typemanager.cs (MemberList.IsSynchronized): Implemented.
5280         (MemberList.SyncRoot): Implemented.
5281         (TypeManager.FilterWithClosure): No need to check permissions if
5282         closure_start_type == closure_invocation_type, don't crash if
5283         closure_invocation_type is null.
5284
5285 2002-08-13  Martin Baulig  <martin@gnome.org>
5286
5287         Rewrote TypeContainer.FindMembers to use a member cache.  This
5288         gives us a speed increase of about 35% for the self-hosting MCS
5289         build and of about 15-20% for the class libs (both on GNU/Linux).
5290
5291         * report.cs (Timer): New class to get enhanced profiling.  This
5292         whole class is "TIMER" conditional since it remarkably slows down
5293         compilation speed.
5294
5295         * class.cs (MemberList): New class.  This is an IList wrapper
5296         which we're now using instead of passing MemberInfo[]'s around to
5297         avoid copying this array unnecessarily.
5298         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
5299         (ICachingMemberFinder, IMemberContainer): New interface.
5300         (TypeManager.FilterWithClosure): If `criteria' is null, the name
5301         has already been checked, otherwise use it for the name comparision.
5302         (TypeManager.FindMembers): Renamed to RealMemberFinder and
5303         provided wrapper which tries to use ICachingMemberFinder.FindMembers
5304         if possible.  Returns a MemberList, not a MemberInfo [].
5305         (TypeHandle): New class, implements IMemberContainer.  We create
5306         one instance of this class per type, it contains a MemberCache
5307         which is used to do the member lookups.
5308         (MemberCache): New class.  Each instance of this class contains
5309         all members of a type and a name-based hash table.
5310         (MemberCache.FindMembers): This is our new member lookup
5311         function.  First, it looks up all members of the requested name in
5312         the hash table.  Then, it walks this list and sorts out all
5313         applicable members and returns them.
5314
5315 2002-08-13  Martin Baulig  <martin@gnome.org>
5316
5317         In addition to a nice code cleanup, this gives us a performance
5318         increase of about 1.4% on GNU/Linux - not much, but it's already
5319         half a second for the self-hosting MCS compilation.
5320
5321         * typemanager.cs (IMemberFinder): New interface.  It is used by
5322         TypeManager.FindMembers to call FindMembers on a TypeContainer,
5323         Enum, Delegate or Interface.
5324         (TypeManager.finder_to_member_finder): New PtrHashtable.
5325         (TypeManager.finder_to_container): Removed.
5326         (TypeManager.finder_to_delegate): Removed.
5327         (TypeManager.finder_to_interface): Removed.
5328         (TypeManager.finder_to_enum): Removed.
5329
5330         * interface.cs (Interface): Implement IMemberFinder.
5331
5332         * delegate.cs (Delegate): Implement IMemberFinder.
5333
5334         * enum.cs (Enum): Implement IMemberFinder.
5335
5336         * class.cs (TypeContainer): Implement IMemberFinder.
5337
5338 2002-08-12  Martin Baulig  <martin@gnome.org>
5339
5340         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
5341
5342 2002-08-12  Martin Baulig  <martin@gnome.org>
5343
5344         * ecore.cs (ITypeExpression): New interface for expressions which
5345         resolve to a type.
5346         (TypeExpression): Renamed to TypeLookupExpression.
5347         (Expression.DoResolve): If we're doing a types-only lookup, the
5348         expression must implement the ITypeExpression interface and we
5349         call DoResolveType() on it.
5350         (SimpleName): Implement the new ITypeExpression interface.
5351         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
5352         hack, the situation that we're only looking up types can't happen
5353         anymore when this method is called.  Moved the type lookup code to
5354         DoResolveType() and call it.
5355         (SimpleName.DoResolveType): This ITypeExpression interface method
5356         is now doing the types-only lookup.
5357         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
5358         (ResolveFlags): Added MaskExprClass.
5359
5360         * expression.cs (MemberAccess): Implement the ITypeExpression
5361         interface.
5362         (MemberAccess.DoResolve): Added support for a types-only lookup
5363         when we're called via ITypeExpression.DoResolveType().
5364         (ComposedCast): Implement the ITypeExpression interface.
5365
5366         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
5367         Expression.Resolve() with ResolveFlags.Type instead.
5368
5369 2002-08-12  Martin Baulig  <martin@gnome.org>
5370
5371         * interface.cs (Interface.Define): Apply attributes.
5372
5373         * attribute.cs (Attribute.ApplyAttributes): Added support for
5374         interface attributes.
5375
5376 2002-08-11  Martin Baulig  <martin@gnome.org>
5377
5378         * statement.cs (Block.Emit): Only check the "this" variable if we
5379         do not always throw an exception.
5380
5381         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
5382         whether the property has a set accessor.
5383
5384 2002-08-11  Martin Baulig  <martin@gnome.org>
5385
5386         Added control flow analysis support for structs.
5387
5388         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
5389         with control flow analysis turned off.
5390         (IVariable): New interface.
5391         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
5392         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
5393         (FieldExpr.DoResolve): Resolve the instance expression with flow
5394         analysis turned off and do the definite assignment check after the
5395         resolving when we know what the expression will resolve to.
5396
5397         * expression.cs (LocalVariableReference, ParameterReference):
5398         Implement the new IVariable interface, only call the flow analysis
5399         code if ec.DoFlowAnalysis is true.
5400         (This): Added constructor which takes a Block argument.  Implement
5401         the new IVariable interface.
5402         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
5403         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
5404         This does the definite assignment checks for struct members.
5405
5406         * class.cs (Constructor.Emit): If this is a non-static `struct'
5407         constructor which doesn't have any initializer, call
5408         Block.AddThisVariable() to tell the flow analysis code that all
5409         struct elements must be initialized before control returns from
5410         the constructor.
5411
5412         * statement.cs (MyStructInfo): New public class.
5413         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
5414         argument to this indexer.  If non-zero, check an individual struct
5415         member, not the whole struct.
5416         (FlowBranching.CheckOutParameters): Check struct members.
5417         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
5418         overloaded versions of these methods which take an additional
5419         `int field_idx' argument to check struct members.
5420         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
5421         overloaded versions of these methods which take an additional
5422         `string field_name' argument to check struct member.s
5423         (VariableInfo): Implement the IVariable interface.
5424         (VariableInfo.StructInfo): New public property.  Returns the
5425         MyStructInfo instance of the variable if it's a struct or null.
5426         (Block.AddThisVariable): New public method.  This is called from
5427         Constructor.Emit() for non-static `struct' constructor which do
5428         not have any initializer.  It creates a special variable for the
5429         "this" instance variable which will be checked by the flow
5430         analysis code to ensure that all of the struct's fields are
5431         initialized before control returns from the constructor.
5432         (UsageVector): Added support for struct members.  If a
5433         variable/parameter is a struct with N members, we reserve a slot
5434         in the usage vector for each member.  A struct is considered fully
5435         initialized if either the struct itself (slot 0) or all its
5436         members are initialized.
5437
5438 2002-08-08  Martin Baulig  <martin@gnome.org>
5439
5440         * driver.cs (Driver.MainDriver): Only report an error CS5001
5441         if there were no compilation errors.
5442
5443         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
5444         `UnsafeContext' property to determine whether the parent is in
5445         unsafe context rather than checking the parent's ModFlags:
5446         classes nested in an unsafe class are unsafe as well.
5447
5448 2002-08-08  Martin Baulig  <martin@gnome.org>
5449
5450         * statement.cs (UsageVector.MergeChildren): Distinguish between
5451         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
5452         we return.  Added test17() and test18() to test-154.cs.
5453
5454 2002-08-08  Martin Baulig  <martin@gnome.org>
5455
5456         * typemanager.cs (TypeManager.FilterWithClosure): If we have
5457         Family access, make sure the invoking type isn't a subclass of the
5458         queried type (that'd be a CS1540).
5459
5460         * ecore.cs (Expression.MemberLookup): Added overloaded version of
5461         this method which takes an additional `Type invocation_type'.
5462
5463         * expression.cs (BaseAccess.DoResolve): Use the base type as
5464         invocation and query type.
5465         (MemberAccess.DoResolve): If the lookup failed and we're about to
5466         report a CS0122, try a lookup with the ec.ContainerType - if this
5467         succeeds, we must report a CS1540.
5468
5469 2002-08-08  Martin Baulig  <martin@gnome.org>
5470
5471         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
5472         (MethodGroupExpr): Implement the IMemberExpr interface.
5473
5474         * expression (MemberAccess.ResolveMemberAccess): No need to have
5475         any special code for MethodGroupExprs anymore, they're now
5476         IMemberExprs.   
5477
5478 2002-08-08  Martin Baulig  <martin@gnome.org>
5479
5480         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
5481         Family, FamANDAssem and FamORAssem permissions.
5482         (TypeManager.IsSubclassOrNestedChildOf): New public method.
5483
5484 2002-08-08  Martin Baulig  <martin@gnome.org>
5485
5486         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
5487         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
5488         or loop block.
5489
5490 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
5491
5492         * driver.cs: implemented /resource option to embed managed resources.
5493
5494 2002-08-07  Martin Baulig  <martin@gnome.org>
5495
5496         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
5497         (FieldBase.HasFieldInitializer): New public property.
5498         (FieldBase.GetInitializerExpression): New public method.  Resolves and
5499         returns the field initializer and makes sure it is only resolved once.
5500         (TypeContainer.EmitFieldInitializers): Call
5501         FieldBase.GetInitializerExpression to get the initializer, this ensures
5502         that it isn't resolved multiple times.
5503
5504         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
5505         the resolving process (SimpleName/MemberLookup) that we're currently
5506         emitting a field initializer (which must not access any instance members,
5507         this is an error CS0236).
5508
5509         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
5510         argument, if the `IsFieldInitializer' flag is set, we must report and
5511         error CS0236 and not an error CS0120.   
5512
5513 2002-08-07  Martin Baulig  <martin@gnome.org>
5514
5515         * ecore.cs (IMemberExpr): New public interface.
5516         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
5517         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
5518         if the expression is an IMemberExpr.
5519
5520         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
5521         to be null, implicitly default to `this' if we're non-static in
5522         this case.  Simplified the code a lot by using the new IMemberExpr
5523         interface.  Also fixed bug #28176 here.
5524
5525 2002-08-06  Martin Baulig  <martin@gnome.org>
5526
5527         * cs-parser.jay (SimpleLookup): Removed.  We need to create
5528         ParameterReferences during semantic analysis so that we can do a
5529         type-only search when resolving Cast, TypeOf and SizeOf.
5530         (block): Pass the `current_local_parameters' to the Block's
5531         constructor.
5532
5533         * class.cs (ConstructorInitializer): Added `Parameters parameters'
5534         argument to the constructor.
5535         (ConstructorInitializer.Resolve): Create a temporary implicit
5536         block with the parameters.
5537
5538         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
5539         references here if we aren't doing a type-only search.
5540
5541         * statement.cs (Block): Added constructor which takes a
5542         `Parameters parameters' argument.
5543         (Block.Parameters): New public property.
5544
5545         * support.cs (InternalParameters.Parameters): Renamed `parameters'
5546         to `Parameters' and made it public readonly.
5547
5548 2002-08-06  Martin Baulig  <martin@gnome.org>
5549
5550         * ecore.cs (Expression.Warning): Made this public as well.
5551
5552         * report.cs (Report.Debug): Print the contents of collections.
5553
5554 2002-08-06  Martin Baulig  <martin@gnome.org>
5555
5556         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
5557         used to tell Resolve() which kinds of expressions it may return.
5558         (Expression.Resolve): Added overloaded version of this method which
5559         takes a `ResolveFlags flags' argument.  This can be used to tell
5560         Resolve() which kinds of expressions it may return.  Reports a
5561         CS0118 on error.
5562         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
5563         ResolveFlags.SimpleName.
5564         (Expression.Error118): Added overloaded version of this method which
5565         takes a `ResolveFlags flags' argument.  It uses the flags to determine
5566         which kinds of expressions are allowed.
5567
5568         * expression.cs (Argument.ResolveMethodGroup): New public method.
5569         Resolves an argument, but allows a MethodGroup to be returned.
5570         This is used when invoking a delegate.
5571
5572         * TODO: Updated a bit.
5573
5574 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5575
5576         Fixed compilation with csc.
5577
5578         * ecore.cs: Expression.Error made public. Is this correct? Should
5579         Warning be made public too?
5580
5581         * expression.cs: use ea.Location instead of ea.loc.
5582         [FIXME:  Filed as bug #28607: MCS must report these errors.]
5583
5584 2002-08-06  Martin Baulig  <martin@gnome.org>
5585
5586         * ecore.cs (Expression.loc): Moved the location here instead of
5587         duplicating it in all derived classes.
5588         (Expression.Location): New public property.
5589         (Expression.Error, Expression.Warning): Made them non-static and
5590         removed the location argument.
5591         (Expression.Warning): Added overloaded version which takes an
5592         `int level' argument.
5593         (Expression.Error118): Make this non-static and removed the
5594         expression and location arguments.
5595         (TypeExpr): Added location argument to the constructor.
5596
5597         * expression.cs (StaticCallExpr): Added location argument to
5598         the constructor.
5599         (Indirection, PointerArithmetic): Likewise.
5600         (CheckedExpr, UnCheckedExpr): Likewise.
5601         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
5602         (StringPtr): Likewise.
5603
5604
5605 2002-08-05  Martin Baulig  <martin@gnome.org>
5606
5607         * expression.cs (BaseAccess.DoResolve): Actually report errors.
5608
5609         * assign.cs (Assign.DoResolve): Check whether the source
5610         expression is a value or variable.
5611
5612         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
5613         while resolving the corresponding blocks.
5614
5615         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
5616         an error, don't silently return null.
5617
5618         * statement.cs (Block.AddVariable): Do the error reporting here
5619         and distinguish between CS0128 and CS0136.
5620         (Block.DoResolve): Report all unused labels (warning CS0164).
5621         (LabeledStatement): Pass the location to the constructor.
5622         (LabeledStatement.HasBeenReferenced): New property.
5623         (LabeledStatement.Resolve): Set it to true here.
5624
5625         * statement.cs (Return.Emit): Return success even after reporting
5626         a type mismatch error (CS0126 or CS0127), this is what csc does and
5627         it avoids confusing the users with any consecutive errors.
5628
5629 2002-08-05  Martin Baulig  <martin@gnome.org>
5630
5631         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
5632
5633         * const.cs (Const.LookupConstantValue): Catch circular definitions.
5634
5635         * expression.cs (MemberAccess.DoResolve): Silently return if an
5636         error has already been reported.
5637
5638         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
5639         error has already been reported.
5640
5641 2002-08-05  Martin Baulig  <martin@gnome.org>
5642
5643         * statement.cs (UsageVector): Only initialize the `parameters'
5644         vector if we actually have any "out" parameters.
5645
5646 2002-08-05  Martin Baulig  <martin@gnome.org>
5647
5648         * expression.cs (Binary.ResolveOperator): When combining delegates,
5649         they must have the same type.
5650
5651 2002-08-05  Martin Baulig  <martin@gnome.org>
5652
5653         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
5654         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
5655         work with the ms runtime and we also don't need it: if we're a
5656         PropertyBuilder and not in the `indexer_arguments' hash, then we
5657         are a property and not an indexer.
5658
5659         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
5660         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
5661         since the latter one doesn't work with the ms runtime.
5662
5663 2002-08-03  Martin Baulig  <martin@gnome.org>
5664
5665         Fixed bugs #27998 and #22735.
5666
5667         * class.cs (Method.IsOperator): New public field.
5668         (Method.CheckBase): Report CS0111 if there's already a method
5669         with the same parameters in the current class.  Report CS0508 when
5670         attempting to change the return type of an inherited method.
5671         (MethodData.Emit): Report CS0179 if a method doesn't have a body
5672         and it's not marked abstract or extern.
5673         (PropertyBase): New abstract base class for Property and Indexer.
5674         (PropertyBase.CheckBase): Moved here from Property and made it work
5675         for indexers.
5676         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
5677         the same so we can reuse it there.
5678         (Property, Indexer): Derive from PropertyBase.
5679         (MethodSignature.inheritable_property_signature_filter): New delegate
5680         to find properties and indexers.
5681
5682         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
5683         argument and improved error reporting.
5684
5685         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
5686         EmptyReadOnlyParameters and made it a property.
5687
5688         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
5689         version of this method which takes a `PropertyInfo indexer'.
5690         (TypeManager.RegisterIndexer): New method.
5691
5692         * class.cs: Added myself as author of this file :-)
5693
5694 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5695
5696         * class.cs: fixed compilation on windoze.
5697
5698 2002-08-03  Martin Baulig  <martin@gnome.org>
5699
5700         * interface.cs (Interface.GetInterfaceBases): Check whether all
5701         base interfaces are at least as accessible than the current one.
5702
5703         * class.cs (TypeContainer.GetClassBases): Check whether base types
5704         are at least as accessible than the current type.
5705         (TypeContainer.AsAccessible): Implemented and made non-static.
5706         (MemberBase.CheckParameters): Report errors if the accessibility
5707         checks fail.
5708
5709         * delegate.cs (Delegate.Delegate): The default visibility is
5710         internal for top-level types and private for nested types.
5711         (Delegate.Define): Report errors if the accessibility checks fail.
5712
5713         * enum.cs (Enum.Enum): The default visibility is internal for
5714         top-level types and private for nested types.
5715         (Enum.DefineType): Compute the correct visibility.
5716
5717         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
5718         function which takes a `bool is_toplevel' instead of a TypeContainer.
5719
5720         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
5721         builtin type.
5722
5723 2002-08-02  Martin Baulig  <martin@gnome.org>
5724
5725         * expression.cs (LocalVariableReferenc): Added constructor which
5726         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
5727         (LocalVariableReference.IsReadOnly): New property.
5728         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
5729         variable is readonly, use our own readonly flag to do this; you can
5730         use the new constructor to get a writable reference to a read-only
5731         variable.
5732
5733         * cs-parser.jay (foreach_statement, using_statement): Get a writable
5734         reference to the local variable.
5735
5736 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
5737
5738         * rootcontext.cs (ResolveCore): Also include System.Exception
5739
5740         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
5741         we reach an EmptyStatement.
5742
5743         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
5744         is also fine.
5745
5746         * expression.cs (Binary.ResolveOperator): Check error result in
5747         two places.
5748
5749         use brtrue/brfalse directly and avoid compares to null.
5750
5751 2002-08-02  Martin Baulig  <martin@gnome.org>
5752
5753         * class.cs (TypeContainer.Define): Define all nested interfaces here.
5754         Fixes bug #28407, added test-155.cs.
5755
5756 2002-08-01  Martin Baulig  <martin@gnome.org>
5757
5758         * class.cs (Event.EmitDefaultMethod): Make this work with static
5759         events.  Fixes #28311, added verify-3.cs.
5760
5761 2002-08-01  Martin Baulig  <martin@gnome.org>
5762
5763         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
5764         `is_disposable' fields.
5765         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
5766         `hm.is_disposable' if we're using the collection pattern.
5767         (Foreach.EmitCollectionForeach): Use the correct type for the
5768         enumerator's local variable, only emit the try/finally block if
5769         necessary (fixes #27713).
5770
5771 2002-08-01  Martin Baulig  <martin@gnome.org>
5772
5773         * ecore.cs (Expression.report118): Renamed to Error118 and made
5774         it public static.
5775
5776         * statement.cs (Throw.Resolve): Check whether the expression is of
5777         the correct type (CS0118) and whether the type derives from
5778         System.Exception (CS0155).
5779         (Catch.Resolve): New method.  Do the type lookup here and check
5780         whether it derives from System.Exception (CS0155).
5781         (Catch.CatchType, Catch.IsGeneral): New public properties.
5782
5783         * typemanager.cs (TypeManager.exception_type): Added.
5784
5785 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
5786
5787         * driver.cs: Updated About function.
5788
5789 2002-07-31  Martin Baulig  <martin@gnome.org>
5790
5791         Implemented Control Flow Analysis.
5792
5793         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
5794         (EmitContext.CurrentBranching): Added.
5795         (EmitContext.StartFlowBranching): Added.
5796         (EmitContext.EndFlowBranching): Added.
5797         (EmitContext.KillFlowBranching): Added.
5798         (EmitContext.IsVariableAssigned): Added.
5799         (EmitContext.SetVariableAssigned): Added.
5800         (EmitContext.IsParameterAssigned): Added.
5801         (EmitContext.SetParameterAssigned): Added.
5802         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
5803         Added control flow analysis stuff here.
5804
5805         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
5806         resolve the expression as lvalue.
5807         (LocalVariableReference.DoResolve): Check whether the variable has
5808         already been assigned.
5809         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
5810         the parameter as assigned here.
5811         (ParameterReference.DoResolve): Check whether the parameter has already
5812         been assigned.
5813         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
5814         expression as lvalue.
5815
5816         * statement.cs (FlowBranching): New class for the flow analysis code.
5817         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
5818         (LabeledStatement.IsDefined): New public property.
5819         (LabeledStatement.AddUsageVector): New public method to tell flow
5820         analyis that the label may be reached via a forward jump.
5821         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
5822         flow analysis.
5823         (VariableInfo.Number): New public field.  This is used by flow analysis
5824         to number all locals of a block.
5825         (Block.CountVariables): New public property.  This is the number of
5826         local variables in this block (including the locals from all parent
5827         blocks).
5828         (Block.EmitMeta): Number all the variables.
5829
5830         * statement.cs: Added flow analysis support to all classes.
5831
5832 2002-07-31  Martin Baulig  <martin@gnome.org>
5833
5834         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
5835         To get debugging messages, compile mcs with /define:MCS_DEBUG and
5836         then use this argument.
5837
5838         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
5839
5840         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
5841         use this to specify /define options.
5842
5843 2002-07-29  Martin Baulig  <martin@gnome.org>
5844
5845         * statement.cs (Fixed): Moved all code that does variable lookups
5846         and resolvings from Emit to Resolve.
5847
5848         * statement.cs (For): Moved all code that does variable lookups
5849         and resolvings from Emit to Resolve.
5850
5851         * statement.cs (Using): Moved all code that does variable lookups
5852         and resolvings from Emit to Resolve.
5853
5854 2002-07-29  Martin Baulig  <martin@gnome.org>
5855
5856         * attribute.cs (Attribute.Resolve): Explicitly catch a
5857         System.NullReferenceException when creating the
5858         CustromAttributeBuilder and report a different warning message.
5859
5860 2002-07-29  Martin Baulig  <martin@gnome.org>
5861
5862         * support.cs (ParameterData.ParameterName): Added method to
5863         get the name of a parameter.
5864
5865         * typemanager.cs (TypeManager.IsValueType): New public method.
5866
5867 2002-07-29  Martin Baulig  <martin@gnome.org>
5868
5869         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
5870         is a flag which specifies that it's either ref or out.
5871         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
5872         the out parameter to `out Parameter.Modifier mod', also set the
5873         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
5874
5875         * support.cs (InternalParameters.ParameterModifier): Distinguish
5876         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
5877         Parameter.Modifier.ISBYREF flag if it's either ref or out.
5878
5879         * expression.cs (Argument.GetParameterModifier): Distinguish
5880         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
5881         Parameter.Modifier.ISBYREF flag if it's either ref or out.
5882
5883 2002-07-29  Martin Baulig  <martin@gnome.org>
5884
5885         * expression.cs (ParameterReference.ParameterReference): Added
5886         `Location loc' argument to the constructor.
5887
5888         * cs-parser.jay: Pass location to ParameterReference.
5889
5890 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
5891
5892         * statement.cs (Try): Initialize the location.
5893
5894         * cs-parser.jay: pass location to Try.
5895
5896         * expression.cs (Unary.Reduce): Change the prototype to return
5897         whether a constant fold could be performed or not.  The result is
5898         returned in an out parameters.  In the case of Indirection and
5899         AddressOf, we want to perform the full tests.
5900
5901 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
5902
5903         * statement.cs (Statement.Emit): Flag dead code.
5904
5905 2002-07-27  Andrew Birkett  <andy@nobugs.org>
5906
5907         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
5908
5909 2002-07-27  Martin Baulig  <martin@gnome.org>
5910
5911         * class.cs (MethodData.Define): Put back call to
5912         TypeManager.AddMethod(), accidentally commented this out.
5913
5914         * report.cs (Debug): New public method to print debugging information,
5915         this is `[Conditional ("DEBUG")]'.
5916
5917 2002-07-26  Martin Baulig  <martin@gnome.org>
5918
5919         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
5920         (switch_statement): Push the current_block to the switch_stack and
5921         pop it again when we're done with the switch.
5922         (switch_section): The new block is a child of the current_block.
5923         Fixes bug #24007, added test-152.cs.
5924
5925 2002-07-27  Martin Baulig  <martin@gnome.org>
5926
5927         * expression.cs (Invocation.EmitArguments): When calling a varargs
5928         function with only its fixed arguments, we need to pass an empty
5929         array.
5930
5931 2002-07-27  Martin Baulig  <martin@gnome.org>
5932
5933         Mono 0.13 has been released.
5934
5935 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
5936
5937         * driver.cs: Rename --resource to --linkres, because that is what
5938         we do currently, we dont support --resource yet.
5939
5940         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
5941
5942 2002-07-25  Martin Baulig  <martin@gnome.org>
5943
5944         * class.cs (MethodData): New public class.  This is a `method builder'
5945         class for a method or one accessor of a Property/Indexer/Event.
5946         (MethodData.GetMethodFlags): Moved here from MemberBase.
5947         (MethodData.ApplyAttributes): Likewise.
5948         (MethodData.ApplyObsoleteAttribute): Likewise.
5949         (MethodData.ApplyConditionalAttribute): Likewise.
5950         (MethodData.ApplyDllImportAttribute): Likewise.
5951         (MethodData.CheckAbstractAndExternal): Likewise.
5952         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
5953         (MethodData.Emit): Formerly known as Method.Emit().
5954         (MemberBase): Moved everything which was specific to a single
5955         accessor/method to MethodData.
5956         (Method): Create a new MethodData and call Define() and Emit() on it.
5957         (Property, Indexer, Event): Create a new MethodData objects for each
5958         accessor and call Define() and Emit() on them.
5959
5960 2002-07-25  Martin Baulig  <martin@gnome.org>
5961
5962         Made MethodCore derive from MemberBase to reuse the code from there.
5963         MemberBase now also checks for attributes.
5964
5965         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
5966         (MemberBase.GetMethodFlags): Moved here from class Method and marked
5967         as virtual.
5968         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
5969         `CallingConventions cc' and `Attributes opt_attrs' arguments.
5970         (MemberBase.ApplyAttributes): New virtual method; applies the
5971         attributes to a method or accessor.
5972         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
5973         (MemberBase.ApplyConditionalAttribute): Likewise.
5974         (MemberBase.ApplyDllImportAttribute): Likewise.
5975         (MemberBase.CheckAbstractAndExternal): Likewise.
5976         (MethodCore.ParameterTypes): This is now a property instead of a
5977         method, it's initialized from DoDefineParameters().
5978         (MethodCore.ParameterInfo): Removed the set accessor.
5979         (MethodCore.DoDefineParameters): New protected virtual method to
5980         initialize ParameterTypes and ParameterInfo.
5981         (Method.GetReturnType): We can now simply return the MemberType.
5982         (Method.GetMethodFlags): Override the MemberBase version and add
5983         the conditional flags.
5984         (Method.CheckBase): Moved some code from Define() here, call
5985         DoDefineParameters() here.
5986         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
5987         here to avoid some larger code duplication.
5988         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
5989         ensure that abstract and external accessors don't declare a body.
5990
5991         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
5992         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
5993         lookup in the attribute's parent classes, so we need to abort as soon
5994         as we found the first match.
5995         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
5996         the attribute has no arguments.
5997
5998         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
5999         of a Method.
6000
6001 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6002
6003         * cs-parser.jay: reverted previous patch.
6004
6005 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6006
6007         * cs-parser.jay: fixed bug #22119.
6008
6009 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6010
6011         * attribute.cs: fixed compilation. The error was:
6012         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
6013         be assigned to before control leaves the current method."
6014         [FIXME:  Filed as bug #28186: MCS must report this error.]
6015
6016 2002-07-25  Martin Baulig  <martin@gnome.org>
6017
6018         * attribute.cs (Attribute.Conditional_GetConditionName): New static
6019         method to pull the condition name ouf of a Conditional attribute.
6020         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
6021         the obsolete message and error flag out of an Obsolete attribute.
6022
6023         * class.cs (Method.GetMethodFlags): New public method to get the
6024         TypeManager.MethodFlags for this method.
6025         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
6026         private methods.
6027         (Method.Define): Get and apply the Obsolete and Conditional attributes;
6028         if we're overriding a virtual function, set the new private variable
6029         `parent_method'; call the new TypeManager.AddMethod().
6030
6031         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
6032         the MethodBuilder and the Method in a PtrHashtable.
6033         (TypeManager.builder_to_method): Added for this purpose.
6034         (TypeManager.MethodFlags): Added IsObsoleteError.
6035         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
6036         Obsolete and Conditional arguments in MethodBuilders.  If we discover
6037         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
6038         the message from the attribute.
6039
6040 2002-07-24  Martin Baulig  <martin@gnome.org>
6041
6042         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
6043         preprocessor directives, ensure that the argument to #define/#undef is
6044         exactly one identifier and that it's actually an identifier.
6045
6046         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
6047         did not work ....
6048
6049 2002-07-24  Martin Baulig  <martin@gnome.org>
6050
6051         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
6052         initialize it to TypeManager.object_type in the constructor.
6053         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
6054         of the `hm.get_current' method if we're using the collection pattern.
6055         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
6056         for the explicit conversion to make it work when we're using the collection
6057         pattern and the `Current' property has a different return type than `object'.
6058         Fixes #27713.
6059
6060 2002-07-24  Martin Baulig  <martin@gnome.org>
6061
6062         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
6063         does not match, but don't report any errors.  This method is called in
6064         order for all methods in a MethodGroupExpr until a matching method is
6065         found, so we don't want to bail out if the first method doesn't match.
6066         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
6067         matches, report the 123.  Fixes #28070.
6068
6069 2002-07-24  Martin Baulig  <martin@gnome.org>
6070
6071         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
6072         TypeManager.TypeToCoreType() to the top of the method so the
6073         following equality checks will work.  Fixes #28107.
6074
6075 2002-07-24  Martin Baulig  <martin@gnome.org>
6076
6077         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
6078         operand is of type uint, and the other operand is of type sbyte,
6079         short or int, the operands are converted to type long." -
6080         Actually do what this comment already told us.  Fixes bug #28106,
6081         added test-150.cs.
6082
6083 2002-07-24  Martin Baulig  <martin@gnome.org>
6084
6085         * class.cs (MethodBase): New abstract class.  This is now a base
6086         class for Property, Indexer and Event to avoid some code duplication
6087         in their Define() and DefineMethods() methods.
6088         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
6089         generic methods for Define() and DefineMethods().
6090         (FieldBase): Derive from MemberBase, not MemberCore.
6091         (Property): Derive from MemberBase, not MemberCore.
6092         (Property.DefineMethod): Moved all the code from this method to the
6093         new MethodBase.DefineAccessor(), just call it with appropriate
6094         argumetnts.
6095         (Property.Define): Call the new Property.DoDefine(), this does some
6096         sanity checks and we don't need to duplicate the code everywhere.
6097         (Event): Derive from MemberBase, not MemberCore.
6098         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
6099         accessors, this will also make them work with interface events.
6100         (Indexer): Derive from MemberBase, not MemberCore.
6101         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
6102         (Indexer.Define): Use the new MethodBase functions.
6103
6104         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
6105         argument to the constructor.
6106         (Interface.FindMembers): Added support for interface events.
6107         (Interface.PopluateEvent): Implemented.
6108
6109         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
6110
6111 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
6112
6113         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
6114         but this is required to check for a method name being the same as
6115         the containing class.  
6116
6117         Handle this now.
6118
6119 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6120
6121         * interface.cs: initialize variable.
6122
6123 2002-07-23  Martin Baulig  <martin@gnome.org>
6124
6125         Implemented the IndexerName attribute in interfaces.
6126
6127         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
6128         name if this is an explicit interface implementation.
6129         (Indexer.InterfaceIndexerName): New public variable.  If we're
6130         implementing an interface indexer, this is the IndexerName in that
6131         interface.  Otherwise, it's the IndexerName.
6132         (Indexer.DefineMethod): If we're implementing interface indexer,
6133         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
6134         and Pending.ImplementIndexer methods.
6135         (Indexer.Define): Also define the PropertyBuilder if we're
6136         implementing an interface indexer and this is neither an explicit
6137         interface implementation nor do the IndexerName match the one in
6138         the interface.
6139
6140         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
6141         If a method is defined here, then we always need to create a proxy
6142         for it.  This is used when implementing interface indexers.
6143         (Pending.IsInterfaceIndexer): New public method.
6144         (Pending.ImplementIndexer): New public method.
6145         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
6146         This is used when implementing interface indexers to define a proxy
6147         if necessary.
6148         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
6149         define a proxy if necessary.
6150
6151         * interface.cs (Interface.IndexerName): New public variable.
6152         (Interface.PopulateIndexer): Set the IndexerName.
6153         (Interface.DefineIndexers): New private method.  Populate all the
6154         indexers and make sure their IndexerNames match.
6155
6156         * typemanager.cs (IndexerPropertyName): Added support for interface
6157         indexers.
6158
6159 2002-07-22  Martin Baulig  <martin@gnome.org>
6160
6161         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
6162         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
6163         ret if HasReturnLabel.
6164         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
6165         variables.
6166
6167         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
6168         and set the ec.LoopBeginTryCatchLevel.
6169         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
6170         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
6171         the current ec.TryCatchLevel, the branch goes out of an exception
6172         block.  In this case, we need to use Leave and not Br.
6173
6174 2002-07-22  Martin Baulig  <martin@gnome.org>
6175
6176         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
6177         block unless the block does not always return or it is contained in
6178         another try { ... } catch { ... } block.  Fixes bug #26506.
6179         Added verify-1.cs to the test suite.
6180
6181 2002-07-22  Martin Baulig  <martin@gnome.org>
6182
6183         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
6184         then we do not always return.  Fixes bug #24985.
6185
6186 2002-07-22  Martin Baulig  <martin@gnome.org>
6187
6188         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
6189         lookup on a per-class level; ie. walk up the class hierarchy until we
6190         found at least one applicable method, then choose the best among them.
6191         Fixes bug #24463 and test-29.cs.
6192
6193 2002-07-22  Martin Baulig  <martin@gnome.org>
6194
6195         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
6196         return types of the methods.  The return type is not part of the
6197         signature and we must not check it to make the `new' modifier work.
6198         Fixes bug #27999, also added test-147.cs.
6199         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
6200
6201         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
6202         on the method's return type.
6203
6204 2002-07-21  Martin Baulig  <martin@gnome.org>
6205
6206         * assign.cs: Make this work if the rightmost source is a constant and
6207         we need to do an implicit type conversion.  Also adding a few more tests
6208         to test-38.cs which should have caught this.
6209
6210         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
6211         target in the makefile for this.  The makefile.gnu is primarily intended
6212         for end-users who don't want to debug the compiler.
6213
6214 2002-07-21  Martin Baulig  <martin@gnome.org>
6215
6216         * assign.cs: Improved the Assign class so it can now handle embedded
6217         assignments (X = Y = Z = something).  As a side-effect this'll now also
6218         consume less local variables.  test-38.cs now passes with MCS, added
6219         a few new test cases to that test.
6220
6221 2002-07-20  Martin Baulig  <martin@gnome.org>
6222
6223         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
6224         instructions.  Fixes bug #27977, also added test-146.cs.
6225
6226 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6227
6228         * cs-tokenizer.cs: fixed getHex ().
6229
6230 2002-07-19  Martin Baulig  <martin@gnome.org>
6231
6232         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
6233         not Type.GetType() to lookup the array type.  This is needed when
6234         we're constructing an array of a user-defined type.
6235         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
6236         single-dimensional arrays, but also for single-dimensial arrays of
6237         type decimal.
6238
6239 2002-07-19  Martin Baulig  <martin@gnome.org>
6240
6241         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
6242         this function is called, it's not allowed to share LocalBuilders
6243         among ILGenerators.
6244
6245 2002-07-19  Martin Baulig  <martin@gnome.org>
6246
6247         * expression.cs (Argument.Resolve): Report an error 118 when trying
6248         to pass a type as argument.
6249
6250 2002-07-18  Martin Baulig  <martin@gnome.org>
6251
6252         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
6253         Conv_R_Un for the signed `long' type.
6254
6255 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
6256
6257         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
6258         `expr' for the temporary result, as that will fail if we do
6259         multiple resolves on the same expression.
6260
6261 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
6262
6263         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
6264         ec.TypeContainer for looking up aliases. 
6265
6266         * class.cs (TypeContainer): Remove LookupAlias from here.
6267
6268         * decl.cs (DeclSpace); Move here.
6269
6270 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
6271
6272         * class.cs (FindMembers): Only call filter if the constructor
6273         bulider is not null.
6274
6275         Also handle delegates in `NestedTypes' now.  Now we will perform
6276         type lookups using the standard resolution process.  This also
6277         fixes a bug.
6278
6279         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
6280         This uses Expressions (the limited kind that can be parsed by the
6281         tree) instead of strings.
6282
6283         * expression.cs (ComposedCast.ToString): Implement, used to flag
6284         errors since now we have to render expressions.
6285
6286         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
6287         FormArrayType. 
6288
6289         * ecore.cs (SimpleName.ToString): ditto.
6290
6291         * cs-parser.jay: Instead of using strings to assemble types, use
6292         Expressions to assemble the type (using SimpleName, ComposedCast,
6293         MemberAccess).  This should fix the type lookups in declarations,
6294         because we were using a different code path for this.
6295
6296         * statement.cs (Block.Resolve): Continue processing statements
6297         even when there is an error.
6298
6299 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
6300
6301         * class.cs (Event.Define): Also remove the `remove' method from
6302         the list of pending items.
6303
6304         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
6305         generate more compact code. 
6306
6307 2002-07-17  Martin Baulig  <martin@gnome.org>
6308
6309         * const.cs (Const.LookupConstantValue): Add support for constant
6310         `unchecked' and `checked' expressions.
6311         Also adding test case test-140.cs for this.
6312
6313 2002-07-17  Martin Baulig  <martin@gnome.org>
6314
6315         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
6316         check whether mi.ReturnType implements the IEnumerator interface; the
6317         `==' and the IsAssignableFrom() will fail in this situation.
6318
6319 2002-07-16  Ravi Pratap  <ravi@ximian.com>
6320
6321         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
6322         here too.
6323
6324 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6325
6326         * expression.cs: fixed bug #27811.
6327
6328 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
6329
6330         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
6331         Molaro: when we are a ref, the value already contains a pointer
6332         value, do not take the address of it.
6333
6334 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
6335         * removed mb-parser.jay and mb-tokenizer.cs
6336
6337 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
6338
6339         * expression.cs: check against the building corlib void type.
6340
6341 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
6342
6343         * ecore.cs: fix for valuetype static readonly fields: when 
6344         initializing them, we need their address, not the address of a copy.
6345
6346 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
6347
6348         * typemanager.cs: register also enum_type in corlib.
6349
6350 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
6351
6352         * class.cs: allow calling this (but not base) initializers in structs.
6353
6354 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
6355
6356         * ecore.cs: make sure we compare against the building base types
6357         in GetTypeSize ().
6358
6359 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
6360
6361         * typemanager.cs: fix TypeToCoreType() to handle void and object
6362         (corlib gets no more typerefs after this change).
6363
6364 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
6365
6366         * expression.cs (ArrayCreation.EmitArrayArguments): use
6367         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
6368
6369         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
6370         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
6371         array indexes, the runtime actually forbids them.
6372
6373         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
6374         for array arguments here.
6375
6376         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
6377         instead of the default for ValueTypes.
6378
6379         (New.DoEmit): Use IsValueType instead of
6380         IsSubclassOf (value_type)
6381         (New.DoResolve): ditto.
6382         (Invocation.EmitCall): ditto.
6383
6384         * assign.cs (Assign): ditto.
6385
6386         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
6387         Statements *are* currently doing part of their resolution during
6388         Emit.  
6389
6390         Expressions do always resolve during resolve, but statements are
6391         only required to propagate resolution to their children.
6392
6393 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
6394
6395         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
6396
6397         (LoadAssembly): Do not add the dll if it is already specified
6398         
6399         (MainDriver): Add the System directory to the link path at the end,
6400         after all the other -L arguments. 
6401
6402         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
6403         wrong opcode for loading bytes and bools (ldelem.i1 instead of
6404         ldelem.u1) and using the opposite for sbytes.
6405
6406         This fixes Digger, and we can finally run it.
6407
6408         * driver.cs (UnixParseOption): Move the option parsing here.  
6409         (CSCParseOption): Implement CSC-like parsing of options.
6410
6411         We now support both modes of operation, the old Unix way, and the
6412         new CSC-like way.  This should help those who wanted to make cross
6413         platform makefiles.
6414
6415         The only thing broken is that /r:, /reference: and /lib: are not
6416         implemented, because I want to make those have the same semantics
6417         as the CSC compiler has, and kill once and for all the confussion
6418         around this.   Will be doing this tomorrow.
6419
6420         * statement.cs (Unsafe.Resolve): The state is checked during
6421         resolve, not emit, so we have to set the flags for IsUnsfe here.
6422
6423 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
6424
6425         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
6426         not catch the Error_ObjectRefRequired in SimpleName (as it is
6427         possible to have a class/instance variable name that later gets
6428         deambiguated), we have to check this here.      
6429
6430 2002-07-10  Ravi Pratap  <ravi@ximian.com>
6431
6432         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
6433         make static and put into Expression.
6434
6435         (Event.Define): Register the private field of the event with the 
6436         TypeManager so that GetFieldFromEvent can get at it.
6437
6438         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
6439         keep track of the private field associated with an event which
6440         has no accessors.
6441
6442         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
6443         private field.
6444
6445         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
6446         
6447 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
6448
6449         * expression.cs (Binary.EmitBranchable): this routine emits the
6450         Binary expression in a branchable context.  This basically means:
6451         we need to branch somewhere, not just get the value on the stack.
6452
6453         This works together with Statement.EmitBoolExpression.
6454
6455         * statement.cs (Statement.EmitBoolExpression): Use
6456         EmitBranchable. 
6457
6458 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
6459
6460         * statement.cs (For): Reduce the number of jumps in loops.
6461
6462         (For): Implement loop inversion for the For statement.
6463
6464         (Break): We can be breaking out of a Try/Catch controlled section
6465         (foreach might have an implicit try/catch clause), so we need to
6466         use Leave instead of Br.
6467
6468         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
6469         now).  If the instace expression supports IMemoryLocation, we use
6470         the AddressOf method from the IMemoryLocation to extract the
6471         address instead of emitting the instance.
6472
6473         This showed up with `This', as we were emitting the instance
6474         always (Emit) instead of the Address of This.  Particularly
6475         interesting when This is a value type, as we dont want the Emit
6476         effect (which was to load the object).
6477         
6478 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
6479
6480         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
6481
6482         * statement.cs (Checked): Set the CheckedState during the resolve
6483         process too, as the ConvCast operations track the checked state on
6484         the resolve process, and not emit.
6485
6486         * cs-parser.jay (namespace_member_declaration): Flag that we have
6487         found a declaration when we do.  This is used to flag error 1529
6488
6489         * driver.cs: Report ok when we display the help only.
6490
6491 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
6492
6493         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
6494
6495 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
6496
6497         * cs-tokenizer.cs (define): We also have to track locally the
6498         defines.  AllDefines is just used for the Conditional Attribute,
6499         but we also need the local defines for the current source code. 
6500
6501 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
6502
6503         * statement.cs (While, For, Do): These loops can exit through a
6504         Break statement, use this information to tell whether the
6505         statement is the last piece of code.
6506
6507         (Break): Flag that we break.
6508
6509         * codegen.cs (EmitContexts): New `Breaks' state variable.
6510
6511 2002-07-03  Martin Baulig  <martin@gnome.org>
6512
6513         * class.cs (TypeContainer.MethodModifiersValid): Allow override
6514         modifiers in method declarations in structs.  Otherwise, you won't
6515         be able to override things like Object.Equals().
6516
6517 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
6518
6519         * class.cs (Method, Property, Indexer): Do not allow the public
6520         modifier to be used in explicit interface implementations.
6521
6522         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
6523         override modifiers in method declarations in structs
6524
6525 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
6526
6527         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
6528         integer or real overflow, report an error
6529
6530 2002-07-02  Martin Baulig  <martin@gnome.org>
6531
6532         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
6533         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
6534         to tell the runtime about our newly created System.Object and
6535         System.ValueType types.
6536
6537 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
6538
6539         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
6540         struct instead of Ldarg/Starg.
6541
6542 2002-07-02  Martin Baulig  <martin@gnome.org>
6543
6544         * expression.cs (Indirection.Indirection): Call
6545         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
6546
6547 2002-07-02  Martin Baulig  <martin@gnome.org>
6548
6549         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
6550         ValueType, call TypeManager.TypeToCoreType() on it.
6551         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
6552         the OpCodes.Newarr argument.
6553
6554 2002-07-02  Martin Baulig  <martin@gnome.org>
6555
6556         * expression.cs (Invocation.EmitCall): When compiling corlib,
6557         replace all calls to the system's System.Array type to calls to
6558         the newly created one.
6559
6560         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
6561         System.Array methods.
6562         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
6563         from the system's System.Array type which must be replaced.
6564
6565 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
6566
6567         * typemanager.cs: load unverifiable_code_ctor so we can build
6568         corlib using the correct type. Avoid using GetTypeCode() with
6569         TypeBuilders.
6570         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
6571         TypeManager.object_type to allow building corlib.
6572
6573 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
6574
6575         * ecore.cs: handle System.Enum separately in LoadFromPtr().
6576
6577 2002-07-01  Martin Baulig  <martin@gnome.org>
6578
6579         * class.cs: Make the last change actually work, we need to check
6580         whether `ifaces != null' to avoid a crash.
6581
6582 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
6583
6584         * class.cs: when we build structs without fields that implement
6585         interfaces, we need to add the interfaces separately, since there is
6586         no API to both set the size and add the interfaces at type creation
6587         time.
6588
6589 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
6590
6591         * expression.cs: the dimension arguments to the array constructors
6592         need to be converted if they are a long.
6593
6594 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
6595
6596         * class.cs: don't emit ldarg.0 if there is no parent constructor
6597         (fixes showstopper for corlib).
6598
6599 2002-06-29  Martin Baulig  <martin@gnome.org>
6600
6601         MCS now compiles corlib on GNU/Linux :-)
6602
6603         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
6604         ie. check for MethodImplOptions.InternalCall.
6605
6606         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
6607         and TypeManager.attribute_type are null, so we must explicitly check
6608         whether parent is not null to find out whether it's an attribute type.
6609         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
6610         and SetBuilder, not only if the property is neither abstract nor external.
6611         This is necessary to set the MethodImplOptions on the accessor methods.
6612         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
6613         SetBuilder, see Property.Emit().
6614
6615         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
6616         populate "System.Object", "System.ValueType" and "System.Attribute" since
6617         they've already been populated from BootCorlib_PopulateCoreTypes().
6618
6619 2002-06-29  Martin Baulig  <martin@gnome.org>
6620
6621         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
6622         is the NullLiteral, we also need to make sure that target_type is not
6623         an enum type.   
6624
6625 2002-06-29  Martin Baulig  <martin@gnome.org>
6626
6627         * rootcontext.cs (RootContext.ResolveCore): We must initialize
6628         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
6629         before calling BootstrapCorlib_ResolveDelegate ().
6630
6631 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6632
6633         * statement.cs: fixed build-breaker. All tests passed ok.
6634
6635 2002-06-27  Martin Baulig  <martin@gnome.org>
6636
6637         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
6638         for System.Decimal when compiling corlib.
6639
6640 2002-06-27  Martin Baulig  <martin@gnome.org>
6641
6642         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
6643         switch blocks which contain nothing but a default clause.
6644
6645 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
6646
6647        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
6648
6649 2002-06-27  Martin Baulig  <martin@gnome.org>
6650
6651         * ecore.cs (PropertyExpr.PropertyExpr): Call
6652         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
6653
6654         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
6655         is already a TypeBuilder.
6656
6657 2002-06-27  Martin Baulig  <martin@gnome.org>
6658
6659         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
6660         `target_type == TypeManager.array_type', not IsAssignableFrom() in
6661         the "from an array-type to System.Array" case.  This makes it work
6662         when compiling corlib.
6663
6664 2002-06-27  Martin Baulig  <martin@gnome.org>
6665
6666         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
6667         non-static PropertyExpr, set its InstanceExpression.  This makes
6668         the `ICollection.Count' property work in System/Array.cs.
6669
6670 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
6671
6672         * driver.cs: Made error handling more consistent.  Errors now
6673         tracked by Report class, so many methods which used to return int
6674         now return void.  Main() now prints success/failure and 
6675         errors/warnings message.
6676
6677         Renamed '--probe' compiler argument to '--expect-error'.  Removed
6678         the magic number return values (123 and 124).  Now, if the
6679         expected error occurs, the compiler exits with success (exit value
6680         0).  If the compilation completes without seeing that particular
6681         error, the compiler exits with failure (exit value 1).  The
6682         makefile in mcs/errors has been changed to handle the new behaviour.
6683
6684         * report.cs: Made 'expected error' number a property and renamed
6685         it from 'Probe' to 'ExpectedError'.
6686
6687         * genericparser.cs: Removed error handling support, since it is
6688         now all done by Report class.
6689
6690         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
6691         class, so parse() no longer returns an int.
6692
6693         * namespace.cs: Use Report.Error instead of GenericParser.error
6694
6695 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
6696
6697         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
6698         TypeContainer.AddOperator): At the front of the list put the
6699         explicit implementations, so they get resolved/defined first. 
6700
6701 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
6702
6703         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
6704         interface type is implemented by this TypeContainer.  Used during
6705         explicit interface implementation.
6706
6707         (Property.Define, Indexer.Define, Method.Define): Validate that
6708         the given interface in the explicit implementation is one of the
6709         base classes for the containing type.
6710
6711         Also if we are explicitly implementing an interface, but there is
6712         no match in the pending implementation table, report an error.
6713
6714         (Property.Define): Only define the property if we are
6715         not explicitly implementing a property from an interface.  Use the
6716         correct name also for those properties (the same CSC uses,
6717         although that is really not needed).
6718         
6719         (Property.Emit): Do not emit attributes for explicitly implemented
6720         properties, as there is no TypeBuilder.
6721
6722         (Indexer.Emit): ditto.
6723
6724         Hiding then means that we do not really *implement* a pending
6725         implementation, which makes code fail.
6726
6727 2002-06-22  Martin Baulig  <martin@gnome.org>
6728
6729         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
6730         the return value of Object.GetType().  [FIXME: we need to do this whenever
6731         we get a type back from the reflection library].
6732
6733 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
6734
6735         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
6736
6737 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
6738
6739         * attribute.cs: Return null if we can not look up the type.
6740
6741         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
6742         the interface types found.
6743
6744         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
6745         interface types found.
6746
6747         * typemanager.cs (GetInterfaces): Make this routine returns alll
6748         the interfaces and work around the lame differences between
6749         System.Type and System.Reflection.Emit.TypeBuilder in the results
6750         result for GetInterfaces.
6751         
6752         (ExpandInterfaces): Given an array of interface types, expand and
6753         eliminate repeated ocurrences of an interface.  This expands in
6754         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
6755         be IA, IB, IC.
6756         
6757 2002-06-21  Martin Baulig  <martin@gnome.org>
6758
6759         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
6760         on System.Enum.
6761
6762 2002-06-21  Martin Baulig  <martin@gnome.org>
6763
6764         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
6765         and called with one of the core types, return the corresponding typebuilder for
6766         that type.
6767
6768         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
6769         element type.
6770
6771 2002-06-21  Martin Baulig  <martin@gnome.org>
6772
6773         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
6774         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
6775         (Expression.ConvertReferenceExplicit): Likewise.
6776
6777         * expression.cs (ElementAccess.DoResolve): Likewise.
6778         (ElementAccess.DoResolveLValue): Likewise.
6779
6780 2002-06-10  Martin Baulig  <martin@gnome.org>
6781
6782         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
6783         add the "value" parameter to the parameter list.
6784
6785         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
6786         to our caller.
6787
6788 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
6789
6790         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
6791         the argument to an int, uint, long or ulong, per the spec.  Also
6792         catch negative constants in array creation.
6793
6794 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
6795
6796         * class.cs: do not allow the same interface to appear twice in
6797         the definition list.
6798
6799 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
6800
6801         * ecore.cs: don't use ldlen with System.Array.
6802
6803 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
6804
6805         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
6806
6807 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
6808
6809         * modifiers.cs: produce correct field attributes for protected
6810         internal. Easy fix so miguel can work on ther harder stuff:-)
6811
6812 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
6813
6814         * pending.cs: New file.  Move the code from class.cs here.
6815         Support clearning the pending flag for all methods (when not doing
6816         explicit interface implementation).
6817
6818 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
6819
6820         * rootcontext.cs: added a couple more types needed to bootstrap.
6821
6822 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
6823
6824         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
6825         constructor in the type, instead of any constructor in the type
6826         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
6827         a bug in the Mono runtime when applying the params attribute). 
6828
6829 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
6830         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
6831
6832 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
6833
6834         * expression.cs (Unary.ResolveOperator): Use TypeManager
6835         to resolve the type.
6836         
6837 2002-06-13  Ravi Pratap  <ravi@ximian.com>
6838
6839         * cs-parser.jay (enum_member_declaration): Pass in the attributes
6840         attached.
6841
6842         * enum.cs (AddEnumMember): Add support to store the attributes associated 
6843         with each member too.
6844
6845         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
6846         field builders too - this takes care of the enum member case.
6847
6848 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
6849
6850         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
6851         address-of operator on both value types and pointers.
6852         
6853 2002-06-10  Martin Baulig  <martin@gnome.org>
6854
6855         * interface.cs (Interface.PopulateIndexer): Add the indexer's
6856         PropertyBuilder to the `property_builders' list.
6857
6858         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
6859         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
6860         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
6861         find any indexers which are inherited from an interface.
6862
6863 2002-06-09  Martin Baulig  <martin@gnome.org>
6864
6865         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
6866         the same type as the constant if necessary.  There's also a test-130.cs
6867         for this.
6868
6869         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
6870
6871         * typemanager.cs (TypeManager.ChangeType): Previously known as
6872         Enum.ChangeEnumType().
6873
6874 2002-06-09  Martin Baulig  <martin@gnome.org>
6875
6876         * expression.cs (Cast.TryReduce): Added support for consts.
6877
6878 2002-06-08  Ravi Pratap  <ravi@ximian.com>
6879
6880         * class.cs (Accessor): Hold attributes information so we can pass
6881         it along.
6882
6883         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
6884         Modify to pass in attributes attached to the methods.
6885
6886         (add_accessor_declaration, remove_accessor_declaration): Ditto.
6887
6888         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
6889         to handle the Accessor kind :-)
6890
6891         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
6892         
6893 2002-06-08  Martin Baulig  <martin@gnome.org>
6894
6895         * expression.cs (Unary.TryReduceNegative): Added support for
6896         ULongConstants.
6897
6898 2002-06-08  Martin Baulig  <martin@gnome.org>
6899
6900         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
6901         name can't be found in the `defined_names' - the caller will do a
6902         MemberLookup in this case and thus find methods in System.Enum
6903         such as Enum.IsDefined().
6904
6905 2002-06-08  Martin Baulig  <martin@gnome.org>
6906
6907         * enum.cs (Enum.ChangeEnumType): This is a custom version of
6908         Convert.ChangeType() which works with TypeBuilder created types.
6909         (Enum.LookupEnumValue, Enum.Define): Use it here.
6910
6911         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
6912         `TypeBuilder.BaseType != null' check.
6913         (TypeContainer.FindMembers): Only lookup parent members if we
6914         actually have a parent.
6915         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
6916         (ConstructorInitializer.Resolve): Likewise.
6917
6918         * interface.cs (Interface.FindMembers): Added
6919         `TypeBuilder.BaseType != null' check.
6920
6921         * rootcontext.cs (RootContext.ResolveCore): Added
6922         "System.Runtime.CompilerServices.IndexerNameAttribute" to
6923         classes_second_stage.
6924
6925         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
6926         debug_type and trace_type when compiling with --nostdlib.       
6927
6928 2002-06-07  Martin Baulig  <martin@gnome.org>
6929
6930         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
6931         (AddField): Set it to true when adding a non-static field.
6932         (DefineType): Use `have_nonstatic_fields' to find out whether we
6933         have non-static fields, not `Fields != null'.
6934
6935 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
6936
6937         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
6938         dereferencing a null on the static-field code path)
6939
6940 2002-05-30  Martin Baulig  <martin@gnome.org>
6941
6942         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
6943         to take command line arguments.  Use reflection to call the new
6944         custom `Initialize' function on the symbol writer and pass it the
6945         command line arguments.
6946
6947         * driver.cs (--debug-args): New command line argument to pass command
6948         line arguments to the symbol writer.
6949
6950 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
6951
6952         * assign.cs (DoResolve): Forgot to do the implicit conversion to
6953         the target type for indexers and properties.  Thanks to Joe for
6954         catching this.
6955
6956 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
6957
6958         * typemanager.cs (MethodFlags): returns the method flags
6959         (Obsolete/ShouldIgnore) that control warning emission and whether
6960         the invocation should be made, or ignored. 
6961
6962         * expression.cs (Invocation.Emit): Remove previous hack, we should
6963         not do this on matching a base type, we should do this based on an attribute
6964
6965         Only emit calls to System.Diagnostics.Debug and
6966         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
6967         on the command line.
6968
6969         * rootcontext.cs: Global settings for tracing and debugging.
6970
6971         * cs-tokenizer.cs (define): New utility function to track
6972         defines.   Set the global settings for TRACE and DEBUG if found.
6973
6974 2002-05-25  Ravi Pratap  <ravi@ximian.com>
6975
6976         * interface.cs (Populate*): Pass in the TypeContainer as well as
6977         the DeclSpace as parameters so that we can create EmitContexts and
6978         then use that to apply attributes etc.
6979
6980         (PopulateMethod, PopulateEvent, PopulateProperty)
6981         (PopulateIndexer): Apply attributes everywhere.
6982
6983         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
6984         etc.
6985
6986         (ApplyAttributes): Update accordingly.
6987
6988         We now apply interface attributes for all members too.
6989
6990 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
6991
6992         * class.cs (Indexer.Define); Correctly check if we are explicit
6993         implementation (instead of checking the Name for a ".", we
6994         directly look up if the InterfaceType was specified).
6995
6996         Delay the creation of the PropertyBuilder.
6997
6998         Only create the PropertyBuilder if we are not an explicit
6999         interface implementation.   This means that explicit interface
7000         implementation members do not participate in regular function
7001         lookups, and hence fixes another major ambiguity problem in
7002         overload resolution (that was the visible effect).
7003
7004         (DefineMethod): Return whether we are doing an interface
7005         implementation. 
7006         
7007         * typemanager.cs: Temporary hack until we get attributes in
7008         interfaces (Ravi is working on that) and we get IndexerName
7009         support in interfaces.
7010
7011         * interface.cs: Register the indexers as properties.
7012
7013         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
7014         warning, I have verified that this is a bug in the .NET runtime
7015         (JavaScript suffers of the same problem).
7016
7017         * typemanager.cs (MemberLookup): When looking up members for
7018         interfaces, the parent of an interface is the implicit
7019         System.Object (so we succeed in searches of Object methods in an
7020         interface method invocation.  Example:  IEnumerable x;  x.ToString
7021         ()) 
7022
7023 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
7024
7025         * class.cs (Event): Events should also register if they do
7026         implement the methods that an interface requires.
7027
7028         * typemanager.cs (MemberLookup); use the new GetInterfaces
7029         method. 
7030
7031         (GetInterfaces): The code used to lookup interfaces for a type is
7032         used in more than one place, factor it here. 
7033
7034         * driver.cs: Track the errors at the bottom of the file, we kept
7035         on going.
7036
7037         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
7038         instance if the method we are calling is static!
7039
7040 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
7041
7042         * attribute.cs (ApplyAttributes): Make this function filter out
7043         the IndexerName attribute (as that attribute in reality is never
7044         applied) and return the string constant for the IndexerName
7045         attribute. 
7046
7047         * class.cs (TypeContainer.Emit): Validate that all the indexers
7048         have the same IndexerName attribute, and if so, set the
7049         DefaultName attribute on the class. 
7050
7051         * typemanager.cs: The return value might contain other stuff (not
7052         only methods).  For instance, consider a method with an "Item"
7053         property and an Item method.
7054
7055         * class.cs: If there is a problem with the parameter types,
7056         return. 
7057
7058 2002-05-24  Ravi Pratap  <ravi@ximian.com>
7059
7060         * ecore.cs (ImplicitConversionExists): Wrapper function which also
7061         looks at user defined conversion after making a call to 
7062         StandardConversionExists - we need this for overload resolution.
7063
7064         * expression.cs : Update accordingly the various method calls.
7065
7066         This fixes 2 bugs filed against implicit user defined conversions 
7067
7068 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
7069
7070         * statement.cs: Track the result of the assignment.
7071
7072 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
7073
7074         * expression.cs (MemberAccess): Improved error reporting for
7075         inaccessible members.
7076
7077 2002-05-22  Martin Baulig  <martin@gnome.org>
7078
7079         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
7080         itself with debugging support.
7081
7082 2002-05-22  Martin Baulig  <martin@gnome.org>
7083
7084         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
7085         Removed, this isn't needed anymore.
7086
7087 2002-05-20  Martin Baulig  <martin@gnome.org>
7088
7089         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
7090         be underlying type for an enum.
7091
7092 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
7093
7094         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
7095         that splits out the loading of just the core types.
7096
7097         * rootcontext.cs (ResolveCore): Split the struct resolution in
7098         two, so we can load the enumeration underlying types before any
7099         enums are used.
7100
7101         * expression.cs (Is): Bandaid until we fix properly Switch (see
7102         bug #24985 for details).
7103
7104         * typemanager.cs (ImplementsInterface): The hashtable will contain
7105         a null if there are no interfaces implemented.
7106
7107 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
7108
7109         * cs-parser.jay (indexer_declarator): It is fine to have array
7110         parameters
7111
7112 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
7113
7114         * typemanager.cs: (RegisterBuilder): New function used to register
7115         TypeBuilders that implement interfaces.  Since
7116         TypeBuilder.GetInterfaces (as usual) does not work with lame
7117         Reflection.Emit. 
7118         (AddUserType): register interfaces.
7119
7120         (ImplementsInterface): Use the builder_to_ifaces hash if we are
7121         dealing with TypeBuilder.  Also, arrays are showing up as
7122         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
7123         methods can not be invoked on them!
7124
7125         * ecore.cs (ExplicitReferenceConversionExists): Made public.
7126         (ImplicitReferenceConversionExists): Split out from
7127         StandardConversionExists. 
7128
7129         * expression.cs (As): We were only implementing one of the three
7130         cases for the as operator.  We now implement them all.
7131         (Is): Implement the various other cases for Is as well.
7132
7133         * typemanager.cs (CACHE): New define used to control if we want or
7134         not the FindMembers cache.  Seems to have a negative impact on
7135         performance currently
7136
7137         (MemberLookup): Nested types have full acess to
7138         enclosing type members
7139
7140         Remove code that coped with instance/static returns for events, we
7141         now catch this in RealFindMembers.
7142
7143         (RealFindMembers): only perform static lookup if the instance
7144         lookup did not return a type or an event.  
7145
7146 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
7147
7148         * assign.cs (CompoundAssign): We pass more semantic information
7149         now to Compound Assignments than we did before: now we have all
7150         the information at hand, and now we resolve the target *before* we
7151         do the expression expansion, which allows the "CacheValue" method
7152         to have the effect we intended (before, a [x] += 1 would generate
7153         two differen ArrayAccess expressions from the ElementAccess,
7154         during the resolution process).
7155
7156         (CompoundAssign.DoResolve): Resolve target and original_source here.
7157
7158 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
7159
7160         * expression.cs (ArrayAccess): dropped debugging information. 
7161
7162         * typemanager.cs: Small bug fix: I was always returning i_members,
7163         instead of one of i_members or s_members (depending on which had
7164         the content).
7165
7166         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
7167         method is invoked before any code generation takes place, and it
7168         is a mechanism to inform that the expression will be invoked more
7169         than once, and that the method should use temporary values to
7170         avoid having side effects
7171
7172         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
7173         
7174         * ecore.cs (Expression.CacheTemporaries): Provide empty default
7175         implementation.
7176
7177         * expression.cs (Indirection, ArrayAccess): Add support for
7178         CacheTemporaries in these two bad boys. 
7179
7180         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
7181         ldobj or ldind_ref.  
7182         (StoreFromPtr): Handle stobj as well.
7183
7184         * expression.cs (UnaryMutator): Share more code.
7185         
7186         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
7187         down: I was not tracking the Filter function as well, which
7188         was affecting the results of the cache.
7189
7190 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
7191
7192         * attribute.cs: Remove the hack to handle the CharSet property on
7193         StructLayouts. 
7194
7195 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
7196
7197         * attribute.cs (DoResolve): More uglyness, we now only try to
7198         resolve the attribute partially, to extract the CharSet
7199         information (only if we are a StructLayout attribute).  Otherwise 
7200
7201         (GetExtraTypeInfo): Add some code to conditionally kill in the
7202         future this.   I am more and more convinced that the .NET
7203         framework has special code to handle the attribute setting on
7204         certain elements.
7205
7206         * expression.cs (IsParamsMethodApplicable): Revert my previous
7207         foreach change here, it was wrong.
7208
7209 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
7210
7211         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
7212         (pp_expr): do not abort on unknown input, just return.
7213         (eval): abort if there are pending chars.
7214
7215         * attribute.cs (Attribute.Resolve): Positional parameters are
7216         optional.  Deal with that case.
7217
7218         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
7219         the Ansi/Unicode/Auto information for the type.
7220
7221         (TypeContainer.DefineType): instantiate the EmitContext here, as
7222         we will be using it during the type definition (to resolve
7223         attributes) and during the emit phase.
7224
7225         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
7226         to pull type information out of the attributes
7227
7228         (Attribute.Resolve): track the constructor builder, and allow for
7229         multiple invocations (structs and classes will use this).
7230
7231         * ecore.cs (MemberLookupFinal): new version with all the
7232         parameters customizable.
7233
7234         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
7235         constructors.  Return if the result value is null (as the error
7236         would have been flagged already by MemberLookupFinal)
7237
7238         Do not allow instances of abstract classes or interfaces to be
7239         created.
7240         
7241         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
7242         We have to compare the assembly property here when dealing with
7243         FamANDAssem and Assembly access modifiers, because we might be
7244         creating an assembly from *modules* (that means that we are not
7245         getting TypeBuilders for types defined in other modules that are
7246         part of this assembly).
7247
7248         (Method.Emit): If the method is marked abstract and has a body,
7249         emit an error. 
7250
7251         (TypeContainer.DefineMembers): If both the defined member and the
7252         parent name match are methods, then do not emit any warnings: let
7253         the Method.Define routine take care of flagging warnings.  But if
7254         there is a mismatch (method overrides something else, or method is
7255         overriwritten by something, then emit warning).
7256
7257         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
7258         set to null, this means `do not check for the return type on the
7259         signature'. 
7260
7261         (Method.Define): set the return type for the method signature to
7262         null, so that we get methods with the same name and parameters and
7263         different return types.  This is used to flag warning 114 (you are
7264         hiding a method, and you probably want to use the new/override
7265         keywords instead).
7266
7267         * typemanager.cs (MemberLookup): Implemented proper access
7268         control, closing a long standing set of bug reports.  The problem
7269         was that the Framework only has two bits: Public and NonPublic,
7270         and NonPublic includes private and protected methods, but we need
7271         to enforce the FamANDAssem, FamOrAssem and Family. 
7272
7273 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
7274
7275         * statement.cs (GotoCase): Return true: Ammounts to giving up
7276         knowledge on whether we return or not, and letting the other case
7277         be responsible for it.
7278
7279 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
7280
7281         * driver.cs: Do not load directories for each file processed, only
7282         do it if there is a pattern.
7283
7284         * ecore.cs: Report readonly assigns here as well, as we might have
7285         been resolved only by MemberAccess.
7286
7287         (SimpleName.SimpleNameResolve): Also be useful for LValue
7288         resolution.   We need this to propagate assign to local readonly variables
7289
7290         * typemanager.cs: Use a ptrhashtable for the criteria, because we
7291         do not want to reuse potential criteria memory.
7292
7293         * class.cs (MyEventBuilder): Set reflected_type;
7294
7295         * ecore.cs (Constantify): Added support for constifying bools.
7296
7297         (RootContext.LookupType): Added a cache for values looked up in
7298         the declaration space.
7299
7300         * typemanager.cs (FindMembers): Now is a front-end to
7301         RealFindMembers, and provides a two-level hashtable-based cache to
7302         the request.  
7303
7304         15% performance improvement: from 22.5 to 19.2 seconds.
7305
7306         * expression.cs (IsParamsMethodApplicable): use foreach.
7307         (Invocation.DoResolve): ditto.
7308         (New.DoResolve): ditto.
7309         (ArrayCreation.DoResolve): ditto.
7310
7311         * ecore.cs (FindMostEncompassingType): use foreach.
7312
7313         * delegate.cs (NewDelegate.DoResolve): Use foreach
7314
7315         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
7316         (RemoveMethods): use foreach.
7317
7318         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
7319         nested foreach statements instead of for, and also break out of
7320         the inner loop once a match is found.
7321         
7322         (Invocation.OverloadResolve): Use foreach, simplify the code. 
7323
7324 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
7325
7326         * cfold.cs (BinaryFold): During an enumeration evaluation context,
7327         we actually unwrap the expression to allow for extra information
7328         to be extracted. 
7329
7330         * expression.cs: Use Shr_Un on unsigned operations. 
7331
7332 2002-05-08  Ravi Pratap  <ravi@ximian.com>
7333
7334         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
7335         applicable operators was not being considered correctly. This closes
7336         the bug Miguel reported.
7337
7338 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
7339
7340         * attribute.cs: check that the type derives from System.Attribute
7341         and report the correct error in that case (moved the duplicate code to
7342         its own method, too).
7343
7344 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
7345
7346         * attribute.cs: lookup attribute type name as the spec says: first the
7347         bare attribute name and then name + "Attribute" (nant compiles with
7348         mcs after this fix).
7349
7350 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
7351
7352         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
7353         Because of the way we parse things, we should try to see if a
7354         UIntConstant can fit in an integer.
7355
7356 2002-05-07  Ravi Pratap  <ravi@ximian.com>
7357
7358         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
7359         when we are in an explicit context.
7360
7361         (ConvertReferenceExplicit): When converting from Iface type S to Class
7362         T make sure the rules are implemented as an OR.
7363
7364         * parameter.cs (ParameterType): Make it a property for now although the
7365         purpose really isn't anything immediate.
7366         
7367         * expression.cs (Is*Applicable): Do better checking on the parameter type
7368         of a ref/out parameter. The ones from the system assemblies are already 
7369         marked with the correct type so we don't need to do any correction.
7370
7371         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
7372         the object type is standard too so include that.
7373
7374 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
7375
7376         * ecore.cs (StandardConversionExists): Augment with missing code:
7377         deal with IntConstant, LongConstants and Enumerations.
7378
7379         * assign.cs: Report the error, instead of failing silently
7380
7381         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
7382         typecontainer that they are declared, because the
7383         typecontainer/namespace will have the list of using clauses that
7384         need to be applied.
7385
7386         Assembly Attributes were escaping the normal registration
7387         mechanism. 
7388
7389         (EmitCode): Apply attributes within an EmitContext that represents
7390         the container they were declared on.
7391         
7392         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
7393
7394 2002-05-06  Ravi Pratap  <ravi@ximian.com>
7395
7396         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
7397         Revamp completely - make much cleaner as we now operate only
7398         on a set of Types.
7399
7400         (FindMostSpecificSource, FindMostSpecificTarget): New methods
7401         to implement the logic detailed in the spec more correctly.
7402
7403         (UserDefinedConversion): Update accordingly.
7404
7405 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
7406
7407         * statement.cs: Return flow analysis information up.
7408
7409         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
7410         and the default.
7411
7412         (token): Do not consume an extra character before calling
7413         decimal_digits.
7414
7415 2002-05-06  Piers Haken <piersh@friskit.com>
7416
7417         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
7418
7419 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
7420
7421         * class.cs (Constructor.Emit): Set the IsStatic flag in the
7422         EmitContext during the instance constructor initializer
7423         resolution, to stop access to instance variables.
7424
7425         This is mandated by the spec, last paragraph of the `constructor
7426         initializers' section. 
7427
7428 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
7429
7430         * cs-parser.jay, class.cs (Accessor): new class used to represent
7431         an accessor (get or set).  In the past we used `null' to represent
7432         a missing accessor.  But this is ambiguous because there was no
7433         way to tell in abstract indexers/properties if one of them was
7434         specified.
7435
7436         Now there is a way of addressing that.
7437
7438         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
7439         instead of FindMembers.
7440
7441         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
7442         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
7443
7444         * attribute.cs: Treat indexers and properties as the same in terms
7445         of applying attributes
7446
7447         * ecore.cs (FindMostEncompassedType): Use statically initialized
7448         EmptyExpressions()s like we do elsewhere to avoid creating useless
7449         objects (and we take this out of the tight loop).
7450
7451         (GetConversionOperators): Move the code to extract the actual
7452         operators to a separate routine to clean things up.
7453
7454 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
7455
7456         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
7457         events are always registered FieldBuilders.
7458         
7459         * class.cs (FieldBase): New class shared by Fields 
7460
7461         * delegate.cs: If we are a toplevel delegate, use our full name.
7462         If we are a nested delegate, then only use our tail name.
7463
7464 2002-05-02  Ravi Pratap  <ravi@ximian.com>
7465
7466         * expression.cs (IsApplicable): Ensure that we add the "&" to
7467         ref/out types before comparing it with the type of the argument.
7468
7469         (IsParamsMethodApplicable): Ditto.
7470
7471         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
7472         silly me ;-)
7473
7474         * delegate.cs : Handle the case when we have more than one applicable
7475         method. Flag an error only when we finish checking all.
7476
7477 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
7478
7479         * expression.cs: Add support for boolean static initializers.
7480
7481 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
7482
7483         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
7484
7485         * parameter.cs (ComputeParameterTypes,
7486         ComputeAndDefineParameterTypes): Better error handling: now we
7487         clear the `types' cache if we fail during any of the type lookups.
7488         We also return the status code correctly to our caller
7489
7490         * delegate.cs: If we fail to define a delegate, abort the extra
7491         steps. 
7492
7493         * expression.cs (Binary.ResolveOperator): for
7494         operator==(object,object) and operator !=(object, object) we also
7495         have to verify that there is an implicit conversion from one to
7496         the other.
7497
7498         (ArrayAccess.DoResolve): Array Access can operate on
7499         non-variables. 
7500
7501 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
7502
7503         * assign.cs (CompoundAssign): A new class used as a "flag" that
7504         the assignment actually is happening as part of a compound
7505         assignment operator.
7506
7507         During compound assignment, a few new rules exist to enable things
7508         like:
7509
7510         byte b |= 1 + 2
7511
7512         From the spec:
7513         
7514         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
7515         to the type of x) if y is implicitly convertible to the type of x,
7516         and the operator is a builtin operator and the return type of the
7517         operator is explicitly convertible to the type of x. 
7518
7519         * rootcontext.cs: Reset warning level to 2.  4 catches various
7520         "interesting" features in mcs, we must clean this up at some
7521         point, but currently am trying to kill other bugs ;-)
7522
7523         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
7524         in container classes as well.  
7525
7526         * expression.cs (Binary.ResolveOperator): Handle string case
7527         before anything else (as operator overloading does emit an error
7528         before doing anything else).
7529
7530         This code could go away when we move to a table driven model, but
7531         i could not come up with a good plan last night.
7532         
7533 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
7534
7535         * typemanager.cs (CSharpName): reimplementation using regex.
7536         * class.cs: added null check for fields in Emit
7537         * rootcontext.cs: set warninglevel to 4
7538
7539 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
7540
7541         * typemanager.cs (CSharpName): reimplemented with Lupus
7542         suggestion.
7543
7544 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
7545
7546         * statement.cs (If): correclty implement Resolve, because we were
7547         not catching sem errors in there.  The same process is needed
7548         everywhere else. 
7549         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
7550         
7551
7552         (Statement.Warning_DeadCodeFound): Factorize code.
7553         (While): Report dead code here too.
7554
7555         (Statement): Added Resolve virtual method to allow
7556         for resolution split from the emit code.
7557
7558 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
7559
7560         * statement.cs (EmitBoolExpression): No longer try to resolve the
7561         expression here.    
7562         (MakeBoolean): New utility function that resolve, implicitly
7563         converts to boolean and tags the expression. 
7564         
7565
7566         (If, Do): Implement dead code elimination.
7567         (While): Implement loop inversion
7568
7569         (Do, While, For, If): Resolve the expression prior to calling our
7570         code generation.
7571
7572 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
7573
7574         * class.cs:
7575           - added method Report28 (warning: program has more than one entry point)
7576           - added method IsEntryPoint, implements paragraph 10.1 of the spec
7577           - modified method Method.Define, the part at the end of the method
7578
7579         * rootcontext.cs: added static public Location EntryPointLocation;
7580           
7581         * ../errors/cs0028.cs : Add test case for the above warning.              
7582
7583         * typemanager.cs:
7584           - modified method CSharpName to allow arrays of primitive type to
7585             be printed nicely (e.g. instead of System.Int32[][] it now prints
7586             int[][])
7587           - added method CSharpSignature: returns the signature of a method
7588             in string format to be used in reporting errors, warnings, etc.
7589
7590         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
7591         with String.Empty.
7592         
7593 2002-04-26  Ravi Pratap  <ravi@ximian.com>
7594
7595         * delegate.cs (Define): Fix extremely silly bug where I was
7596         setting the type of the 'object' parameter of the BeginInvoke
7597         method to System.IAsyncResult instead of System.Object ;-)
7598
7599 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
7600
7601         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
7602         here. 
7603
7604         (Constructor.Emit): return if we fail to initialize the
7605         constructor.  Another door closed!  
7606
7607         * expression.cs (New.DoResolve): Improve error message (from -6 to
7608         1501).  Use DeclaredOnly lookup to find the exact constructor.
7609
7610         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
7611         loop.  This is useful.
7612
7613         * cs-parser.jay: Adjust the default parameters so that destructors
7614         have the proper signature.
7615
7616 2002-04-26  Martin Baulig  <martin@gnome.org>
7617
7618         * driver.cs (LoadAssembly): If `assembly' contains any characters
7619         which are only valid in path names and not in assembly names
7620         (currently slash, backslash and point), use Assembly.LoadFrom ()
7621         instead of Assembly.Load () on the `assembly' (before iteration
7622         over the link_paths).
7623
7624 2002-04-26  Martin Baulig  <martin@gnome.org>
7625
7626         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
7627
7628 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
7629
7630         * class.cs (Property): use the new typemanager.MemberLookup
7631
7632         (TypeContainer.MemberLookup): Implement using the
7633         TypeManager.MemberLookup now. 
7634         
7635         * typemanager.cs: Make MemberLookup a function of the TypeManager,
7636         and return MemberInfos, so that these can be used without an
7637         EmitContext (what we had before).
7638
7639 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
7640
7641         * expression.cs: Fix the case where the argument to params if the
7642         type of the params.  I omitted handling this before.   Fixed
7643
7644 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
7645
7646         * driver.cs: Call BootCorlib_PopulateCoreType
7647
7648         * class.cs (Property.CheckBase): Check for properties only, not
7649         for all members. 
7650
7651         * interface.cs: Temporary hack: try/catch around the
7652         CustomAttributeBuilder, because I am getting an exception that I
7653         do not understand.
7654
7655         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
7656         types whose definitions are required to be there (attributes are
7657         defined before standard types).
7658
7659         Compute definitions as we boot the various types, as they are used
7660         immediately (value_type class will need object_type, but if we do
7661         not initialize object_type, we will pass a null, which will let
7662         the runtime pick the System.Object from the existing corlib, which
7663         is not what we want).
7664
7665 2002-04-22  Patrik Torstensson <totte@labs2.com>
7666
7667         * cs-tokenizer.cs: fixed a number of trim() issues.
7668
7669 2002-04-22  Ravi Pratap  <ravi@ximian.com>
7670
7671         * expression.cs (Argument.Type): Ensure that we return the correct
7672         type when we have out or ref parameters [in which case we 
7673         append a "&"].
7674         
7675 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
7676
7677         * class.cs (Property, Indexer): Allow extern modifier in there. 
7678
7679         * typemanager.cs (InitBaseTypes): Initializes object_type and
7680         value_type, since those will be used early on during the bootstrap
7681         process to compile corlib.
7682
7683         (InitCoreTypes): Move code from here to InitBaseTypes.
7684
7685 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
7686
7687         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
7688         single-dimension arrays as using the ldlen opcode.  
7689
7690         Daniel Lewis discovered this optimization.  
7691
7692         * typemanager.cs: Add signature for System.Array::get_Length
7693
7694 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7695
7696         * statement.cs: report the error when the foreach does not apply to an
7697         array nor a collection.
7698
7699 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
7700
7701         * expression.cs: Add implicit conversions to the operator ~.
7702
7703         * constant.cs (DecimalConstant.Emit): Emit decimal value.
7704
7705         * typemanager.cs: Locate the decimal constructor.
7706
7707 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7708
7709         * attribute.cs: use the new property of TypeOf.
7710         * expression.cs: added 'get' property around typearg.
7711
7712         These changes fix a build breaker reported by NickD. Is this the
7713         correct way to fix?  If not, please, revert my changes and make it
7714         work :-).
7715
7716 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
7717
7718         * attribute.cs: Add support for typeof in attribute invocations.
7719         I am not sure that this is right though.
7720
7721 2002-04-14  Duncan Mak  <duncan@ximian.com>
7722
7723         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
7724         Binary.Operator.Division case.
7725
7726 2002-04-13  Ravi Pratap  <ravi@ximian.com>
7727
7728         * class.cs (DefineType): Ensure that we do a proper check on
7729         attribute types and also register it with the TypeManager.
7730
7731         (TypeContainer.Targets): The default for attribute types is
7732         AttributeTargets.All.
7733         
7734         * attribute.cs (ApplyAttributes): Registering the attribute type
7735         is done elsewhere, not when we discover we have a Usage attribute.
7736
7737 2002-04-12  Ravi Pratap  <ravi@ximian.com>
7738
7739         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
7740         and get rid of is_delegate parameter.
7741
7742         * everywhere : update.
7743         
7744 2002-04-12  Ravi Pratap  <ravi@ximian.com>
7745
7746         * cs-parser.jay (compilation_unit): Revamp completely to use
7747         some new ideas that I got from Rhys' grammar to solve the problems
7748         with assembly level attributes.
7749
7750         (outer_declaration): New grammar production.
7751
7752         (attribute_sections): Add.
7753
7754         (opt_attributes): Base on attribute_sections
7755
7756         (namespace_declaration): Allow opt_attributes to tackle the case
7757         when we have assembly level attributes - we are clever in this
7758         regard now ;-)
7759
7760         * attribute.cs (ApplyAttributes): Do not worry about assembly 
7761         attributes in the non-global context.
7762
7763         * rootcontext.cs (AddGlobalAttributes): Go back to using this
7764         instead of SetGlobalAttributes.
7765
7766         * class.cs, rootcontext.cs : Ensure we define and generate 
7767         attribute types before anything else.
7768
7769         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
7770         and flag the new error -20 for the case when the attribute type
7771         does not have valid targets specified. csc does not catch this.
7772
7773         * ../errors/errors.txt : update for error # -20
7774
7775 2002-04-11  Ravi Pratap  <ravi@ximian.com>
7776
7777         * support.cs (InternalParameters.ParameterModifier): Do some null
7778         checking and return sane values.
7779
7780         * class.cs (Method.Define): If we are a PInvoke method, ensure
7781         that we are static and extern. Report error # 601
7782
7783         * ../errors/cs0601.cs : Add test case for the above error.
7784
7785 2002-04-07  Ravi Pratap  <ravi@ximian.com>
7786
7787         * rootcontext.cs (attribute_types): We need to keep type of
7788         all attribute types separately and emit code for them first.
7789
7790         (RegisterAttribute) : Implement.
7791
7792         * class.cs (DefineType): Check if the current Type is a custom
7793         attribute type and register it accordingly.
7794
7795         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
7796         adding the first attribute twice and rename to
7797
7798         (SetGlobalAttributes): this.
7799
7800         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
7801         lookups.
7802
7803         * attribute.cs (ApplyAttributes): Take an additional argument telling us
7804         if we are processing global arguments. Hmm, I am unsure of this.
7805
7806 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7807
7808         * expression.cs: added static array of strings to avoid calling
7809         Enum.ToString () for Operator in Binary. Significant recover of
7810         performance.
7811
7812 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
7813
7814         * class.cs (FindMembers): Allow the Builders of the various
7815         members to be null.  If they are skip them.  This only happens
7816         during the PInvoke declaration.
7817
7818 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
7819
7820         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
7821         failure, so we do not keep going afterwards.
7822
7823         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
7824         wanted to pass `false' as the `is_delegate' argument.  If this is
7825         the case, why not use delegate_type == null to mean `is_delegate =
7826         false' and anything else as is_delegate = true.
7827
7828 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
7829
7830         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
7831         code for the section, not the beginning of the tests.
7832
7833 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
7834
7835         * cfold.cs: Handle operator + (Enum x, Underlying x) 
7836
7837         * expression.cs (Binary): same.  Warn about errors where we have
7838         Enum/Enum in operator + as well.
7839
7840 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
7841
7842         * statement.cs:
7843                 - added support for switch(bool)
7844                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
7845                 - add TableSwitchEmit() to handle table-based switch statements
7846
7847 2002-04-05  Ravi Pratap  <ravi@ximian.com>
7848
7849         * expression.cs (Invocation.OverloadResolve): Factor out code which
7850         does parameter compatibility checking with arguments so that we can 
7851         re-use the code even from Delegate.VerifyApplicability
7852
7853         (VerifyArgumentsCompat): Move above code here.
7854
7855         * delegate.cs (VerifyApplicability): Get rid of duplicate code
7856         and instead make a call to the above method.
7857
7858 2002-03-31  Ravi Pratap  <ravi@ximian.com>
7859
7860         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
7861         We use it to keep track of classes which are attribute types.
7862
7863 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
7864
7865         * delegate.cs (Delegate.Define): Correctly define the types in the
7866         presence of fixed and array parameters.
7867
7868         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
7869         doing FindMembers.
7870
7871         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
7872         include NonPublic after the first iteration.
7873
7874         * class.cs (Indexer.CheckBase): Only check if both parents are
7875         non-null. 
7876         
7877         * cs-parser.jay (accessor_body): If empty, set to null.
7878
7879         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
7880         same code path here to resolve constants names that we did have in
7881         MemberAccess.DoResolve.  There is too much code duplicated here.
7882
7883 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
7884
7885         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
7886
7887         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
7888         to MakeUnionSet.
7889
7890         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
7891         tokens, numbers and strings.
7892
7893         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
7894         parenthesis.
7895
7896         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
7897         asyncronous parameters and the regular parameters.  
7898
7899         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
7900         specify the target directory.
7901
7902         * expression.cs: (This.DoResolve): Simplify
7903         (As.Emit): Optimize, do not generate IsInst if the expression is
7904         always of the given type.
7905
7906         (Is.DoResolve): Bug fix, we were reporting both always/never for
7907         the is expression.
7908
7909         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
7910         creating too many unnecessary arrays.
7911
7912 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
7913
7914         * class.cs (EmitFieldInitializer): Use Assign expression to assign
7915         fields instead of rolling our own initializer.   Takes care of all
7916         implicit conversions, and drops unnecessary static checks/argument.
7917
7918 2002-03-31  Dick Porter  <dick@ximian.com>
7919
7920         * driver.cs: use the GetDirectories() return values properly, and
7921         use "/" as path separator.
7922
7923 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
7924
7925         * expression.cs (Unary): Optimize - - expr into expr.
7926         (Binary): Optimize a + (-b) into a -b.
7927
7928         * codegen.cs (CodeGen): Made all methods static.
7929
7930 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
7931
7932         * rootcontext.cs: 
7933
7934         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
7935         TypeBuilder property.
7936
7937         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
7938         instead. 
7939
7940         * tree.cs: Removed the various RecordXXXX, and replaced with a
7941         single RecordDecl.  Removed all the accessor methods, and just
7942         left a single access point Type 
7943
7944         * enum.cs: Rename DefineEnum to DefineType.
7945
7946         * decl.cs: New abstract method `DefineType' used to unify the
7947         Defines for Enumerations, Interfaces, TypeContainers and
7948         Delegates.
7949
7950         (FindType): Moved LookupInterfaceOrClass here.  Moved the
7951         LookupBaseClasses method that used to live in class.cs and
7952         interface.cs here, and renamed to FindType.
7953         
7954         * delegate.cs: Implement DefineType.  Take advantage of the
7955         refactored pattern for locating the parent builder without taking
7956         the parent_builder argument (which we know does not work if we are
7957         nested, and triggering a toplevel definition).
7958
7959 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
7960
7961         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
7962         accessibility of a member has changed during override and report
7963         an error if so.
7964
7965         * class.cs (Method.Define, Property.Define): Only complain on
7966         overrides if the method is private, any other accessibility is
7967         fine (and since we just checked the permission is the same, we are
7968         good to go).
7969
7970         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
7971         and elif are processed always.  The other pre-processing
7972         directives are only processed if we are "taking" the path
7973
7974 2002-03-29  Martin Baulig  <martin@gnome.org>
7975
7976         * class.cs (Method.Emit): Only emit symbolic debugging info if the
7977         current location is not Null.
7978
7979         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
7980         a separate method so we can profile it.
7981
7982         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
7983         `span.Seconds' are just seconds, but no minutes or hours.
7984         (MainDriver): Profile the CodeGen.SaveSymbols calls.
7985
7986 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
7987
7988         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
7989         Remove the gratuitous set of Final:
7990
7991                                 // If an interface implementation, then we can set Final.
7992                                 if (((flags & MethodAttributes.Abstract) == 0) &&
7993                                     implementing.DeclaringType.IsInterface)
7994                                         flags |= MethodAttributes.Final;
7995
7996         I do not know what I was smoking when I used that.
7997         
7998
7999         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
8000         step into fixing the name resolution issues for delegates and
8001         unifying the toplevel name resolution.
8002
8003 2002-03-28  Martin Baulig  <martin@gnome.org>
8004
8005         * class.cs (Method.Emit): If we have a symbol writer, call its
8006         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
8007         tell it about the current method.
8008
8009         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
8010         writer that we're going to emit the first byte of IL code for a new
8011         statement (a new source line).
8012         (EmitContext.EmitTopBlock): If we have a symbol writer, call
8013         EmitContext.Mark() before emitting any code.
8014
8015         * location.cs (SymbolDocument): Return null when we're Null.
8016
8017         * statement.cs (Statement): Moved the `Location loc' variable here.
8018         (Statement.EmitBoolExpression): If we have a symbol writer, call
8019         ec.Mark() before emitting any code to tell it that we're at the
8020         beginning of a new statement.
8021         (StatementExpression): Added `Location' argument to the constructor.
8022         (Block): Added public readonly variable `StartLocation' and public
8023         variable `EndLocation'.  The latter is to be set using SetEndLocation().
8024         (Block): Added constructor which takes a start and end location.
8025         (Block.SetEndLocation): New method. This sets the end location.
8026         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
8027         local variables we create.
8028         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
8029         each statement and do also mark the begin and end of the block.
8030
8031         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
8032         tell it the current lexer.Location, use Location.Null for the end of the
8033         block.
8034         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
8035         current block, set its end location using SetEndLocation().
8036         (statement_expression): StatementExpression constructor now takes the
8037         lexer.Location as additional argument.
8038         (for_statement, declare_local_variables): Likewise.
8039         (declare_local_variables): When creating a new implicit block, use the
8040         new Block constructor and pass it the lexer.Location.
8041
8042 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
8043
8044         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
8045         members also on the parent interfaces recursively.
8046
8047 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
8048
8049         * report.cs: Use new formats, since Gonzalo finished the missing
8050         bits. 
8051
8052         * expression.cs (Binary.ResolveOperator): added missing operator|
8053         operator& and operator^ for bool/bool.
8054
8055         * cs-parser.jay: CheckDef now takes a Location argument that is
8056         used to report errors more precisly (instead of reporting the end
8057         of a definition, we try to track something which is a lot closer
8058         to the source of the problem).
8059
8060         * cs-tokenizer.cs: Track global token use, so we can properly flag
8061         the use of #define/#undef after the first token has been seen.
8062
8063         Also, rename the reportXXXX to Error_DescriptiveName
8064
8065         * decl.cs (DeclSpace.IsTopLevel): Move property here from
8066         TypeContainer, so that Enum and Interface can use this too.
8067
8068         * class.cs (TypeContainer.LookupInterfaceOrClass,
8069         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
8070         `builder' argument.  Typically this was used to pass the parent
8071         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
8072         the definition).  
8073
8074         The problem is that a nested class could trigger the definition of
8075         a toplevel class, and the builder would be obviously wrong in that
8076         case. 
8077
8078         So we drop this argument, and we compute dynamically the
8079         TypeBuilder/ModuleBuilder (the correct information was available
8080         to us anyways from DeclSpace.Parent)
8081
8082         * interface.cs (Interface.DefineInterface): Drop builder
8083         parameter cleanup like class.cs
8084
8085         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
8086         like class.cs
8087
8088         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
8089         values. 
8090
8091         (Try.Emit): Propagate the returns value from the statement.
8092
8093         (Return.Emit): Even if we are leavning 
8094
8095         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
8096
8097         * modifiers.cs: Fix the computation of MethodAttributes flags.
8098
8099 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
8100
8101         * driver.cs: allow compilation of files that start with '/'.
8102         Add a default case when checking the argument of --target.
8103
8104 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
8105
8106         * interface.cs: Implement the same search algorithm for types in
8107         the interface code.
8108
8109         * delegate.cs: Do not allow multiple definition.
8110
8111         * Recovered ChangeLog that got accidentally amputated
8112
8113         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
8114
8115         * rootcontext.cs: Load manually enum to allow core classes to
8116         contain enumerations.
8117
8118         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
8119         Update to new static methods in TypeManager.
8120
8121         * typemanager.cs (GetMethod, GetConstructor): Use our
8122         implementation of FindMembers to find the members, since during
8123         corlib compilation, the types are TypeBuilders and GetMethod and
8124         GetConstructor do not work.
8125
8126         Make all methods in TypeManager static.
8127
8128         (InitCodeHelpers): Split the functionality from
8129         the InitCodeTypes function.
8130
8131         * driver.cs: Call InitCodeHelpers after we have populated the
8132         types. 
8133
8134         * cs-parser.jay (delegate_declaration): we did not used to compute
8135         the delegate name correctly for void delegates.
8136
8137 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
8138
8139         * rootcontext.cs (RootContext): Init the interface_resolve_order
8140         and type_container_resolve_order always.
8141
8142         (ResolveCore, BootstrapCorlib_ResolveClass,
8143         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
8144         compiler when compiling with --nostdlib
8145
8146         * class.cs (TypeContainer.DefineType): Check that our parent is
8147         not null.  This test is most important when we are bootstraping
8148         the core types.
8149
8150         * codegen.cs: Split out the symbol writing code.
8151
8152 2002-03-25  Martin Baulig  <martin@gnome.org>
8153
8154         * driver.cs (-g): Made -g an alias for --debug.
8155
8156 2002-03-24  Martin Baulig  <martin@gnome.org>
8157
8158         * codegen.cs (SymbolWriter): New public variable. Returns the
8159         current symbol writer.
8160         (CodeGen): Added `bool want_debugging_support' argument to the
8161          constructor. If true, tell the ModuleBuild that we want debugging
8162         support and ask it for the ISymbolWriter.
8163         (Save): If we have a symbol writer, call it's Close() method after
8164         saving the assembly.
8165
8166         * driver.c (--debug): New command line argument to create a
8167         debugger information file.
8168
8169         * location.cs (SymbolDocument): New public property. Returns an
8170         ISymbolDocumentWriter object for the current source file or null
8171         if we don't have a symbol writer.
8172
8173 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
8174
8175         * driver.cs (LoadAssembly): Correctly return when all the paths
8176         have been tried and not before.
8177
8178         * statement.cs (Switch.Emit): return the actual coverage for this
8179         statement (returns/not-returns)
8180
8181         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
8182         switch of the statement if we are the last switch section.  That
8183         kills two problems: try/catch problems (we used to emit an empty
8184         nop at the end) and switch statements where all branches would
8185         return. 
8186
8187 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
8188
8189         * driver.cs: Add default assemblies (the equivalent to the
8190         Microsoft CSC.RSP file)
8191
8192         * cs-tokenizer.cs: When updating `cols and setting it to zero,
8193         also update tokens_seen and set it to false.
8194
8195         * driver.cs: Implement --recurse for Mike.
8196
8197         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
8198         correctly splitting out the paths.
8199
8200 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
8201
8202         * interface.cs (Interface.PopulateProperty): Instead of using
8203         `parent' as the declaration space for the set parameters, use
8204         `this' 
8205
8206         * support.cs (InternalParameters): InternalParameters constructor
8207         takes a DeclSpace instead of a TypeContainer.
8208
8209         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
8210         types are being initialized, load the address of it before calling
8211         the function.  
8212
8213         (New): Provide a mechanism to disable the generation of local
8214         value type temporaries when the caller will be providing us with
8215         an address to store it.
8216
8217         (ArrayCreation.EmitDynamicInitializers): Use it.
8218
8219 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
8220
8221         * expression.cs (Invocation.EmitArguments): Only probe for array
8222         property if there is more than one argument.  Sorry about that.
8223
8224         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
8225         empty param arrays.
8226         
8227         * class.cs (Method.LabelParameters): Fix incorrect code path that
8228         prevented the `ParamArrayAttribute' from being applied to the
8229         params attribute.
8230
8231 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
8232
8233         * support.cs (ReflectionParameters): Correctly compute whether the
8234         last argument is a params array.  Fixes the problem with
8235         string.Split ('a')
8236
8237         * typemanager.cs: Make the assemblies array always be non-null
8238         (empty, but non-null)
8239
8240         * tree.cs (RecordDecl): New function that abstracts the recording
8241         of names.  This reports error 101, and provides a pointer to the
8242         previous declaration.  Fixes a crash in the compiler.
8243
8244         * cs-parser.jay (constructor_declaration): Update to new grammar,
8245         and provide a constructor_body that can be empty.
8246
8247 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
8248
8249         * driver.cs: Add support for --resources.
8250
8251         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
8252         Make all types for the various array helper methods be integer.
8253
8254         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
8255         CheckState to ConvCast.
8256
8257         (ConvCast): Now it takes a `checked' state argument, to avoid
8258         depending on the emit context for the conversion, and just using
8259         the resolve time setting.
8260
8261         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
8262         instead of Invocation.EmitArguments.  We do not emit the original
8263         arguments, instead we emit those which have been converted to
8264         unsigned int expressions.
8265
8266         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
8267
8268         * codegen.cs: ditto.
8269
8270         * expression.cs (LocalVariableReference): Drop the use of the
8271         Store function that depended on the variable index.
8272
8273         * statement.cs (VariableInfo): Drop the `Idx' property from this
8274         class, as this is not taking into account the indexes for
8275         temporaries tat we generate during the execution, getting the
8276         indexes wrong.
8277
8278         * class.cs: First emit class initializers, then call the parent
8279         constructor. 
8280
8281         * expression.cs (Binary): Fix opcode emision.
8282         (UnaryMutator.EmitCode): Support checked code generation
8283
8284         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
8285         matches for events for both the Static and Instance scans,
8286         pointing to the same element.   Fix that.
8287
8288 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
8289
8290         * rootcontext.cs (ResolveTree): Always set the
8291         interface_resolve_order, because nested interfaces will be calling
8292         into us.
8293
8294         * class.cs (GetInterfaceOrClass): Track the same resolution
8295         process used by TypeManager.LookupType.  This fixes the nested
8296         type lookups in class declarations (separate path from
8297         LookupType). 
8298
8299         (TypeContainer.DefineType): Also define nested interfaces.
8300         (TypeContainer.RegisterOrder): New public function used to
8301         register the order in which child interfaces need to be closed.
8302
8303         Nested interfaces need to be closed after their parents have been
8304         created. 
8305         
8306         * interface.cs (InterfaceAttr): Put all the logic for computing
8307         the interface attribute here. 
8308
8309         (DefineInterface): Register our interface order with the
8310         RootContext or with the TypeContainer depending on the case.
8311
8312 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
8313
8314         * cs-parser.jay: rework foreach statement to work with the new
8315         changes to the policy on SimpleNames.
8316         
8317         * report.cs: support Stacktrace on warnings as well.
8318
8319         * makefile: drop --unsafe and /unsafe from the compile.
8320
8321 2002-03-13  Ravi Pratap  <ravi@ximian.com>
8322
8323         * ecore.cs (StandardConversionExists): Modify to take an Expression
8324         as the first parameter. Ensure we do null -> reference type conversion
8325         checking.
8326
8327         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
8328         temporary Expression objects.
8329
8330 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
8331
8332         * interface.cs: workaround bug in method overloading resolution
8333         (there is already a bugzilla bug for it).
8334
8335 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
8336
8337         We could also solve this problem by having a separate path for
8338         performing type lookups, instead of DoResolve, we could have a
8339         ResolveType entry point, and only participating pieces of the
8340         production (simplename, deref, array) would implement this. 
8341         
8342         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
8343         signal SimpleName to only resolve type names and not attempt to
8344         resolve anything else.
8345
8346         * expression.cs (Cast): Set the flag.
8347
8348         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
8349
8350         * class.cs: Only report 108 if there is no `new' modifier.
8351
8352         * cs-parser.jay: rework foreach statement to work with the new
8353         changes to the policy on SimpleNames.
8354         
8355         * report.cs: support Stacktrace on warnings as well.
8356
8357         * makefile: drop --unsafe and /unsafe from the compile.
8358
8359 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
8360
8361         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
8362         lookups here, instead of doing that at parse time.  This means
8363         that our grammar will not introduce `LocalVariableReferences' as
8364         expressions at this point.  That solves the problem of code like
8365         this:
8366
8367         class X {
8368            static void Main ()
8369            { int X = 1;
8370             { X x = null }}}
8371
8372         This is only half the fix.  The full fix requires parameters to
8373         also be handled in this way.
8374
8375         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
8376         makes the use more obvious of the DeclSpace.  The
8377         ec.TypeContainer.TypeBuilder is now only used to pull the
8378         TypeBuilder for it.
8379
8380         My theory is that I can get rid of the TypeBuilder completely from
8381         the EmitContext, and have typecasts where it is used (from
8382         DeclSpace to where it matters).  
8383
8384         The only pending problem is that the code that implements Aliases
8385         is on TypeContainer, and probably should go in DeclSpace.
8386
8387         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
8388         lookups here, instead of doing that at parse time.  This means
8389         that our grammar will not introduce `LocalVariableReferences' as
8390         expressions at this point.  That solves the problem of code like
8391         this:
8392
8393         class X {
8394            static void Main ()
8395            { int X = 1;
8396             { X x = null }}}
8397
8398         This is only half the fix.  The full fix requires parameters to
8399         also be handled in this way.
8400
8401         * class.cs (Property.DefineMethod): When implementing an interface
8402         method, set newslot, when implementing an abstract method, do not
8403         set the flag (before we tried never setting it, or always setting
8404         it, which is the difference).
8405         (Indexer.DefineMethod): same.
8406         (Method.DefineMethod): same.
8407
8408         * ecore.cs: Only set the status used flag if we get back a Field.
8409
8410         * attribute.cs: Temporary hack, so Paolo can keep working.
8411
8412 2002-03-08  Ravi Pratap  <ravi@ximian.com>
8413
8414         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
8415         the unmanaged type in the case we have a MarshalAs attribute.
8416
8417         (Resolve): Handle the case when we are parsing the special MarshalAs
8418         attribute [we need to store the unmanaged type to use later]
8419         
8420         * typemanager.cs (marshal_as_attr_type): Built in type for the 
8421         MarshalAs Attribute.
8422
8423         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
8424         on parameters and accordingly set the marshalling info.
8425         
8426 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
8427
8428         * class.cs: Optimizing slightly by removing redundant code after
8429         we switched to the `NoTypes' return value.
8430         (Property.DefineMethod): use NoTypes here too.
8431
8432         This fixes the bug I introduced in my last batch of changes.
8433
8434 2002-03-05  Ravi Pratap  <ravi@ximian.com>
8435
8436         * tree.cs (RecordEnum): Add. We now keep track of enums too.
8437
8438         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
8439         Enums since those are types too. 
8440
8441         * cs-parser.jay (enum_declaration): Record enums as we parse them.
8442         
8443         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
8444         thanks to a call during the lookup process.
8445
8446 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
8447
8448         * statement.cs (Foreach): Lots of work to accomodate a particular
8449         kind of foreach statement that I had not kept in mind.  It is
8450         possible to have foreachs on classes that provide a GetEnumerator
8451         method that return objects that implement the "pattern" for using
8452         a foreach, there is no need to support GetEnumerator
8453         specifically. 
8454
8455         This is needed to compile nant.
8456
8457         * decl.cs: Only report 114 if the member is not `Finalize' and if
8458         the warning level is at least 2.
8459
8460         * class.cs: Moved the compare function from Method to
8461         MethodSignature. 
8462
8463         (MethodSignature.InheritableMemberSignatureCompare): Add new
8464         filter function that is used to extract inheritable methods from a
8465         class. 
8466
8467         (Method.Define): Use the new `inheritable_method_signature_filter'
8468         delegate
8469
8470         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
8471         command. 
8472
8473 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
8474
8475         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
8476
8477         * cs-parser.jay: Add opt_semicolon to the interface declaration.
8478
8479         * expression.cs: Pass location information to
8480         ConvertImplicitStandard. 
8481
8482         * class.cs: Added debugging code to track return values from
8483         interfaces. 
8484
8485 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
8486
8487         * expression.cs (Is.DoResolve): If either side of the `is' is an
8488         interface, do not flag the warning.
8489
8490         * ecore.cs (ImplicitReferenceConversion): We need a separate test
8491         for interfaces
8492
8493         * report.cs: Allow for --fatal to be used with --probe.
8494         
8495         * typemanager.cs (NoTypes): Move the definition for the empty Type
8496         array here. 
8497
8498         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
8499         properties. 
8500         (TypeContainer.DefineProxy): New function used to proxy to parent
8501         implementations when implementing interfaces.
8502         (TypeContainer.ParentImplements): used to lookup if our parent
8503         implements a public function that is required by an interface.
8504         (TypeContainer.VerifyPendingMethods): Hook this up.
8505
8506         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
8507         `modules' and `assemblies' arraylists into arrays.  We only grow
8508         these are the very early start up of the program, so this improves
8509         the speedof LookupType (nicely measured).
8510
8511         * expression.cs (MakeByteBlob): Replaced unsafe code with
8512         BitConverter, as suggested by Paolo.
8513
8514         * cfold.cs (ConstantFold.Binary): Special case: perform constant
8515         folding of string concatenation, but if either side is a string,
8516         and the other is not, then return null, and let the runtime use
8517         the concatenation on the string plus the object (using
8518         `Object.ToString'). 
8519
8520 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
8521
8522         Constant Folding has been implemented now.
8523         
8524         * expression.cs (Unary.Reduce): Do not throw an exception, catch
8525         the error instead on types that are not supported in one's
8526         complement. 
8527
8528         * constant.cs (Constant and all children): New set of functions to
8529         perform implict and explicit conversions.
8530         
8531         * ecore.cs (EnumConstant): Implement the new functions to perform
8532         conversion by proxying to the child expression.
8533
8534         * codegen.cs: (ConstantCheckState): Constant evaluation has its
8535         own separate setting that can not be turned off from the command
8536         line using --unchecked or --checked and is only controlled using
8537         the checked/unchecked statements and expressions.  This setting is
8538         used by the constant folder to flag errors.
8539
8540         * expression.cs (CheckedExpr, UncheckedExpr): Set the
8541         ConstantCheckState as well.   
8542
8543         During Resolve, they also have to flag the state, because the
8544         constant folder runs completely in the Resolve phase.
8545
8546         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
8547         well.
8548
8549 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
8550
8551         * cfold.cs: New file, this file contains the constant folder.
8552         
8553         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
8554         argument to track whether we are using the resulting address to
8555         load or store a value and provide better error messages. 
8556
8557         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
8558         new AddressOf arguments.
8559
8560         * statement.cs (Foreach.EmitCollectionForeach): Update
8561
8562         * expression.cs (Argument.Emit): Call AddressOf with proper
8563         arguments to track usage.
8564
8565         (New.DoEmit): Call AddressOf with new arguments.
8566
8567         (Unary.Emit): Adjust AddressOf call.
8568
8569 2002-03-01  Ravi Pratap  <ravi@ximian.com>
8570
8571         * cs-parser.jay (member_access): Change the case for pre-defined types
8572         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
8573         this suggestion.
8574
8575         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
8576         a method body.
8577
8578         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
8579         essentially like methods and apply attributes like MethodImplOptions to them too.
8580
8581         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
8582         not being null.
8583
8584         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
8585         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
8586         is the DeclSpace.
8587
8588         * Update code everywhere accordingly.
8589
8590         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
8591
8592         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
8593
8594 2002-02-28  Ravi Pratap  <ravi@ximian.com>
8595
8596         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
8597         try performing lookups against those instead of jumping straight into using
8598         the 'using' clauses.
8599
8600         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
8601
8602         (LookupType): Perform lookups in implicit parents too.
8603
8604         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
8605         sequence as RootContext.LookupType. 
8606
8607         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
8608         the various cases of namespace lookups into this method.
8609
8610 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
8611
8612         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
8613         in positional arguments)
8614
8615         * class.cs (Operator): Update the AllowedModifiers to contain
8616         extern. 
8617
8618         * cs-parser.jay: Update operator declaration to allow for the
8619         operator body to be empty.
8620
8621         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
8622         values. 
8623
8624 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
8625
8626         * class.cs (Method.Emit): Label parameters.
8627
8628         * driver.cs: Return 1 or 0 as the program exit code.
8629
8630 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
8631
8632         * expression.cs: Special case the `null' object when trying to
8633         auto-compute the type, as anything can be explicitly converted to
8634         that. 
8635
8636         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
8637         spotting this Paolo.
8638
8639         (Expression.ImplicitNumericConversion): Perform comparissions of
8640         the type using the underlying type in the case of an enumeration
8641         rather than using the enumeration type for the compare.
8642
8643         Cope with the underlying == type case, which is not possible to
8644         catch before. 
8645
8646         (Expression.ConvertNumericExplicit): Perform comparissions of
8647         the type using the underlying type in the case of an enumeration
8648         rather than using the enumeration type for the compare.
8649
8650         * driver.cs: If the user does not supply an extension, assume .exe
8651
8652         * cs-parser.jay (if_statement): Rewrote so that we can track the
8653         location for the if statement.
8654
8655         * expression.cs (Binary.ConstantFold): Only concat strings when
8656         the operation is "+", not everything ;-)
8657
8658         * statement.cs (Statement.EmitBoolExpression): Take a location
8659         argument. 
8660         (If, While, Do): Track location.
8661
8662         * expression.cs (Binary.ResolveOperator): In the object + string
8663         case, I was missing a call to ConvertImplicit
8664
8665 2002-02-25  Ravi Pratap  <ravi@ximian.com>
8666
8667         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
8668         Location arguments. Ensure we use RootContext.LookupType to do our work
8669         and not try to do a direct Type.GetType and ModuleBuilder.GetType
8670
8671         * interface.cs (PopulateMethod): Handle the type of the parameter being
8672         null gracefully.
8673
8674         * expression.cs (Invocation.BetterFunction): Handle the case when we 
8675         have a params method with no fixed arguments and a call is made with no
8676         arguments.
8677
8678 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
8679
8680         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
8681         the verbatim-string-literal
8682
8683         * support.cs (InternalParameters.ParameterModifier): handle null
8684         fixed parameters.
8685         (InternalParameters.ParameterType): ditto.
8686
8687         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
8688         duplicating the name of the variable parameter.
8689         (GetParameterByName): Fix bug where we were not looking up array
8690         paramters if they were the only present (thanks Paolo!).
8691         (GetParameterInfo): We only have an empty set of types if both
8692         fixed and array are set to null.
8693         (GetParameterInfo-idx): Handle FixedParameter == null
8694
8695         * cs-parser.jay: Handle the case where there is no catch
8696         statements (missing null test).
8697
8698 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
8699
8700         * driver.cs (MainDriver): Be conservative on our command line
8701         handling.
8702
8703         Catch DirectoryNotFoundException when calling GetFiles.
8704         
8705         (SplitPathAndPattern): Used to split the input specification into
8706         a path and a pattern that we can feed to Directory.GetFiles.
8707
8708 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
8709
8710         * statement.cs (Fixed): Implement the last case of the Fixed
8711         statement (string handling).
8712
8713         * expression.cs (StringPtr): New class used to return a char * to
8714         a string;  Used by the Fixed statement.
8715
8716         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
8717
8718         * expression.cs (Binary.ResolveOperator): Remove redundant
8719         MemberLookup pn parent type.
8720         Optimize union call, we do not need a union if the types are the same.
8721         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
8722         type.
8723
8724         Specialize the use of MemberLookup everywhere, instead of using
8725         the default settings. 
8726
8727         (StackAlloc): Implement stackalloc keyword.
8728
8729         * cs-parser.jay: Add rule to parse stackalloc.
8730         
8731         * driver.cs: Handle /h, /help, /?
8732
8733         * expression.cs (MakeByteBlob): Removed the hacks we had in place
8734         before we supported unsafe code.
8735         
8736         * makefile: add --unsafe to the self compilation of mcs.
8737
8738 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
8739
8740         * expression.cs (PointerArithmetic): New class that is used to
8741         perform pointer arithmetic.
8742         (Binary.Resolve): Handle pointer arithmetic
8743         Handle pointer comparission.
8744         (ArrayPtr): Utility expression class that is used to take the
8745         address of an array.
8746
8747         (ElementAccess): Implement array access for pointers
8748         
8749         * statement.cs (Fixed): Implement fixed statement for arrays, we
8750         are missing one more case before we are done.
8751
8752         * expression.cs (Indirection): Implement EmitAssign and set the
8753         ExprClass to Variable.  This allows pointer dereferences to be
8754         treated as variables, and to have values assigned to them.
8755         
8756         * ecore.cs (Expression.StoreFromPtr): New utility function to
8757         store values dereferencing.
8758
8759 2002-02-20  Ravi Pratap  <ravi@ximian.com>
8760
8761         * expression.cs (Binary.ResolveOperator): Ensure that we are
8762         not trying to operate on a void type - this fixes the reported
8763         bug.
8764
8765         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
8766         the parent implementation is sealed.
8767
8768         * ../errors/cs0239.cs : Add.
8769
8770         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
8771
8772         * typemanager.cs (unverifiable_code_type): Corresponds to 
8773         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
8774         which have unsafe code in them.
8775
8776         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
8777         unsafe context.
8778
8779 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
8780
8781         * cs-tokenizer.cs: Add support for @"litreal strings"
8782
8783         Make tokenizer accept pre-processor directives
8784         on any column (remove the old C-like limitation). 
8785
8786         * rootcontext.cs (EmitCode): Emit any global attributes.
8787         (AddGlobalAttributes): Used to keep track of assembly attributes. 
8788
8789         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
8790
8791         * cs-parser.jay: Add support for global attributes.  
8792
8793 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
8794
8795         * expression.cs (Indirection): New helper class.  Unary will
8796         create Indirection classes to be able to implement the
8797         IMemoryLocation interface on it.
8798
8799 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
8800
8801         * cs-parser.jay (fixed_statement): reference the right statement.
8802
8803         * statement.cs (Fixed.Emit): Finish implementing the fixed
8804         statement for the &x case.
8805
8806 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
8807
8808         * class.cs (Property.Define, Method.Define): Remove newslot when
8809         `implementing'.  
8810
8811         * modifiers.cs: My use of NewSlot when `Abstract' was set was
8812         wrong.  NewSlot should only be used if the `new' keyword is present.
8813
8814         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
8815         locating our system dir.  Sorry about this.
8816
8817 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
8818
8819         * driver.cs (GetSystemDir): Compute correctly the location of our
8820         system assemblies.  I was using the compiler directory instead of
8821         the library directory.
8822
8823 2002-02-13  Ravi Pratap  <ravi@ximian.com>
8824
8825         * expression.cs (BetterFunction): Put back in what Miguel commented out
8826         since it is the correct fix. The problem is elsewhere ;-)
8827
8828         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
8829         parameters of the parms method are themselves compatible or not !
8830
8831         (StandardConversionExists): Fix very dangerous bug where we were forgetting
8832         to check that a class implements an interface before saying that an implicit
8833         conversion was allowed. Use ImplementsInterface to do the checking.
8834
8835 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
8836
8837         * class.cs (Method.Define): Track whether we are an explicit
8838         implementation or not.  And only call DefineMethodOverride if we
8839         are an explicit implementation.
8840
8841         (Property.DefineMethod): Ditto.
8842
8843 2002-02-11  Ravi Pratap  <ravi@ximian.com>
8844
8845         * expression.cs (BetterFunction): Catch hideous bug which was
8846          preventing us from detecting ambiguous calls due to implicit casts i.e
8847         cs0121.
8848
8849 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
8850
8851         * support.cs (Pair): Remove un-needed method.  I figured why I was
8852         getting the error in cs-parser.jay, the variable in a foreach loop
8853         is readonly, and the compiler does not really treat this as a variable.
8854
8855         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
8856         instead of EQUALS in grammar.  
8857
8858         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
8859
8860         * expression.cs (Unary.DoResolve): Check whether the argument is
8861         managed or not.
8862
8863 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
8864
8865         * support.cs: Api for Pair to set a value.  Despite the fact that
8866         the variables are public the MS C# compiler refuses to compile
8867         code that accesses the field if the variable is part of a foreach
8868         statement. 
8869
8870         * statement.cs (Fixed): Begin implementation of the fixed
8871         statement.
8872
8873         (Block.AddVariable): Return the VariableInfo on success and null
8874         on failure instead of true/false. 
8875
8876         * cs-parser.jay (foreach): Catch errors on variables already
8877         defined (we were ignoring this value before) and properly unwind
8878         the block hierarchy
8879
8880         (fixed_statement): grammar for the fixed statement.
8881
8882 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
8883
8884         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
8885         pointer types to be incretemented.
8886
8887         (SizeOf): Implement.
8888
8889         * cs-parser.jay (pointer_member_access): Implement
8890         expr->IDENTIFIER production.
8891
8892         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
8893         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
8894         on safe contexts.
8895
8896         (Unary): Implement indirection.
8897
8898         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
8899         use in non-unsafe context).
8900
8901         (SimpleName.DoResolve): Check for pointers in field access on safe
8902         contexts. 
8903
8904         (Expression.LoadFromPtr): Factor the load-indirect code in this
8905         function.  This was duplicated in UnboxCast and ParameterReference
8906
8907 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
8908
8909         * expression.cs (ComposedCast): report an error if a pointer cast
8910         is used in a safe region.
8911
8912         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
8913         pointer type casts in unsafe context.
8914
8915         * codegen.cs (EmitContext): Set up IsUnsafe.
8916
8917         * cs-parser.jay (non_expression_type): Add productions for pointer
8918         casts. 
8919
8920         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
8921         code.  We should not use force into static mode if the method is
8922         not virtual.  Fixes bug in MIS
8923
8924         * statement.cs (Do.Emit, While.Emit, For.Emit,
8925         Statement.EmitBoolExpression): Add support to Do and While to
8926         propagate infinite loop as `I do return' semantics.
8927
8928         Improve the For case to also test for boolean constants.
8929
8930         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
8931         to the list of attributes we can add.
8932
8933         Remove `EmitContext' argument.
8934
8935         * class.cs (Method.Define): Apply parameter attributes.
8936         (Constructor.Define): Apply parameter attributes.
8937         (MethodCore.LabelParameters): Move here the core of labeling
8938         parameters. 
8939
8940         * support.cs (ReflectionParameters.ParameterModifier,
8941         InternalParameters.ParameterModifier): Use IsByRef on the type and
8942         only return the OUT bit for these parameters instead of in/out/ref
8943         flags.
8944
8945         This is because I miss-understood things.  The ParameterInfo.IsIn
8946         and IsOut represent whether the parameter has the [In] and [Out]
8947         attributes set.  
8948
8949 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
8950
8951         * ecore.cs (FieldExpr.Emit): Release temporaries.
8952
8953         * assign.cs (LocalTemporary.Release): new function.
8954
8955         * codegen.cs (EmitContext.GetTemporaryStorage,
8956         EmitContext.FreeTemporaryStorage): Rework the way we deal with
8957         temporary storage.  Now we can "put back" localbuilders when we
8958         are done with them
8959
8960 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
8961
8962         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
8963         need to make a copy of the variable to generate verifiable code.
8964
8965 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
8966
8967         * driver.cs: Compute dynamically the system directory.
8968
8969         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
8970         Slower, but more generally useful.  Used by the abstract
8971         registering implementation. 
8972
8973         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
8974         the rules for the special rule on Type/instances.  First check if
8975         we have the same name, and if so, try that special static path
8976         rather than the instance path.
8977         
8978 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
8979
8980         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
8981         for, while and if.
8982
8983         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
8984         Enum, ValueType, Delegate or Array for non-corlib compiles.
8985
8986         * cs-tokenizer.cs: Catch long identifiers (645)
8987
8988         * typemanager.cs (IndexerPropetyName): Ravi never tested this
8989         piece of code.
8990
8991         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
8992         fix, we were returning too early, so we were not registering
8993         pending methods from abstract classes.
8994
8995         Do not register pending methods if the class is abstract.
8996
8997         * expression.cs (Conditional.DoResolve): Report circular implicit
8998         conversions when we neecd to compute it for conditional
8999         expressions. 
9000
9001         (Is.DoResolve): If the expression is always of the provided type,
9002         flag warning 183.  If the expression can not ever be of the
9003         provided type flag warning 184.
9004
9005         * class.cs: Catch 169 as well.
9006
9007         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
9008         read. 
9009
9010 2002-01-18  Nick Drochak  <ndrochak@gol.com>
9011
9012         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
9013
9014 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
9015
9016         * interface.cs: (PopulateMethod): Check for pointers being defined
9017         only if the unsafe context is active.
9018         (PopulateProperty): ditto.
9019         (PopulateIndexer): ditto.
9020
9021         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
9022         specified.  If pointers are present, make sure that they are
9023         present in an unsafe context.
9024         (Constructor, Constructor.Define): ditto.
9025         (Field, Field.Define): ditto.
9026         (Property, Property.Define): ditto.
9027         (Event, Event.Define): ditto.
9028
9029         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
9030         hashtable if there are classes or structs defined.
9031
9032         * expression.cs (LocalVariableReference.DoResolve): Simplify this
9033         code, as the constant resolution moved.
9034
9035         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
9036         the metadata, so we can flag error 133. 
9037
9038         * decl.cs (MemberCore.UnsafeOK): New function to test that a
9039         pointer is being declared in an unsafe context.
9040
9041 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
9042
9043         * modifiers.cs (Modifiers.Check): Require a Location argument.
9044         Report error 227 for Unsafe use.
9045
9046         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
9047
9048         * statement.cs (For.Emit): If the test is null, then report that
9049         we do `return', as we wont reach anything afterwards.
9050
9051         (Switch.SwitchGoverningType): Track the expression that matched
9052         the conversion.
9053
9054         * driver.cs: Allow negative numbers as an error code to flag.
9055
9056         * cs-parser.jay: Handle 1551.
9057
9058         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
9059
9060 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
9061
9062         * cs-parser.jay: Report 1518 (type declaration can only contain
9063         class, struct, interface, enum or delegate)
9064
9065         (switch_label): Report 1523 (keywords `case' or `default' must
9066         preced code)
9067
9068         (opt_switch_sections): Report 1522 (empty switch)
9069
9070         * driver.cs: Report 1515 (response file specified multiple times)
9071         Report 1516 (Source file specified multiple times).
9072
9073         * expression.cs (Argument.Resolve): Signal 1510
9074
9075         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
9076         access not allowed in static code)
9077
9078 2002-01-11  Ravi Pratap  <ravi@ximian.com>
9079
9080         * typemanager.cs (IsPointerType): Utility method which we are going
9081         to need a lot.
9082
9083         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
9084         the object type, so we take care of that.
9085
9086         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
9087         
9088         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
9089         added to non-params parameters :-)
9090
9091         * typemanager.cs (CSharpName): Include 'void' type too. 
9092
9093         (void_ptr_type): Include in the set of core types.
9094
9095         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
9096         duplicating code.
9097
9098         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
9099         an unsafe context.
9100
9101         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
9102         completely forgotten about it.
9103
9104 2002-01-10  Ravi Pratap  <ravi@ximian.com>
9105
9106         * cs-parser.jay (pointer_type): Add. This begins our implementation
9107         of parsing rules for unsafe code.
9108
9109         (unsafe_statement): Implement.
9110
9111         (embedded_statement): Modify to include the above.
9112
9113         * statement.cs (Unsafe): Implement new class for unsafe blocks.
9114
9115         * codegen.cs (EmitContext.InUnsafe): Add. This determines
9116         if the current context is an unsafe one.
9117
9118         * cs-parser.jay (local_variable_pointer_type): Since local variable types
9119         are handled differently, we need separate rules for them.
9120
9121         (local_variable_declaration): Update to use local_variable_pointer_type
9122         to allow variable declarations of unmanaged pointer types.
9123
9124         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
9125         in unsafe contexts.
9126
9127         * ../errors/cs0214.cs : Add.
9128
9129 2002-01-16  Nick Drochak  <ndrochak@gol.com>
9130
9131         * makefile: remove 'response' file when cleaning.
9132
9133 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
9134
9135         * cs-parser.jay: Report 1524.
9136
9137 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
9138
9139         * typemanager.cs (RegisterMethod): drop checking if we have
9140         registered this from here
9141
9142 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
9143
9144         * class.cs (Method.EmitDestructor): Implement calling our base
9145         destructor. 
9146
9147         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
9148         value of InFinally.
9149
9150         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
9151         this routine and will wrap the call in a try/catch block.  Deal
9152         with the case.
9153
9154 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
9155
9156         * ecore.cs (Expression.MemberLookup): instead of taking a
9157         parameter `same_type' that was used to tell whether we could
9158         access private members we compute our containing type from the
9159         EmitContext.
9160
9161         (FieldExpr): Added partial support for volatile fields.  This does
9162         not work for volatile fields exposed from assemblies, as I can not
9163         figure out how to extract the modreq from it.
9164
9165         Updated all the source files to use this.
9166
9167         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
9168         because it is referenced by MemberLookup very often. 
9169
9170 2002-01-09  Ravi Pratap  <ravi@ximian.com>
9171
9172         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
9173         TypeBuilder.GetCustomAttributes to retrieve what we need.
9174
9175         Get rid of redundant default_member_attr_type as this is the same as
9176         default_member_type which already exists.
9177
9178         * interface.cs, attribute.cs : Update accordingly.
9179         
9180 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
9181
9182         * typemanager.cs: Enable IndexerPropertyName again.  It does not
9183         work for TYpeBuilders though.  Ravi, can you please fix this?
9184
9185         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
9186
9187         * expression.cs (Argument.Emit): Handle the case of ref objects
9188         being passed to ref functions;  
9189
9190         (ParameterReference.EmitLoad): Loads the content of the pointer
9191         without dereferencing.
9192
9193 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
9194
9195         * cs-tokenizer.cs: Implemented the pre-processing expressions.
9196
9197 2002-01-08  Ravi Pratap  <ravi@ximian.com>
9198
9199         * class.cs (Indexer.DefineMethod): Incorporate the interface
9200         type in the name of the method if we are doing explicit interface
9201         implementation.
9202
9203         * expression.cs (ConversionExists): Remove as it is completely obsolete.
9204
9205         (BetterConversion): Fix extremely trivial bug where we were referring to
9206         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
9207         again !
9208
9209         * ../errors/bug16.cs : Add although we have fixed it.
9210
9211 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
9212
9213         * expression.cs (BaseIndexer): Begin implementation.
9214
9215         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
9216
9217         * cs-parser.jay (indexer_declarator): Use qualified_identifier
9218         production directly to remove a shift/reduce, and implement
9219         explicit interface implementation.
9220
9221         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
9222         after a floating point suffix.
9223
9224         * expression.cs (DoNumericPromotions): Improved the conversion for
9225         uint/uint.  If we have a constant, we avoid doing a typecast to a
9226         larger type.
9227
9228         * class.cs (Indexer): Implement explicit interface implementation
9229         for indexers.
9230         
9231 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
9232
9233         * class.cs: make the default instance constructor public and hidebysig.
9234
9235 2001-01-03  Ravi Pratap  <ravi@ximian.com>
9236
9237         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
9238         so we can call it from elsewhere.
9239
9240         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
9241         we emit it internally if the class has a defined indexer; otherwise the user
9242         emits it by decorating the class definition with the DefaultMemberAttribute.
9243
9244         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
9245         attribute is not used on a type which defines an indexer.
9246
9247         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
9248         character when we skip whitespace.
9249
9250         * ../errors/cs0646.cs : Add.
9251
9252 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
9253
9254         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
9255         again. 
9256
9257         * makefile: Add practical target `mcs3.exe' which builds the third
9258         generation compiler. 
9259
9260         * expression.cs (New): Fix structures constructor calling.
9261
9262         * class.cs (Property, Method, Indexer): Emit Final flag on the
9263         method if we are an interface implementation and we are not
9264         abstract. 
9265
9266         * ecore.cs (PropertyExpr): New public field `IsBase', tells
9267         whether this property is referencing a `base' method.
9268
9269         * expression.cs (Invocation.EmitCall): take an extra argument:
9270         is_base, this is used to determine whether the `call' or
9271         `callvirt' opcode should be used.
9272
9273         
9274         * delegate.cs: update EmitCall.
9275
9276         * class.cs (Method.Define): Set NewSlot for the cases where we are
9277         not implementing an interface method.
9278
9279         (Property.Define): ditto.
9280
9281 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
9282
9283         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
9284         'r'.  Allows mcs to parse itself fully.
9285
9286 2002-01-02  Ravi Pratap  <ravi@ximian.com>
9287
9288         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
9289         of the number of initializers that require the InitializeArray method.
9290
9291         (CheckIndices): Store the Expression in all cases - not the plain value. Also
9292         update the above field where necessary.
9293
9294         (MakeByteBlob): Update accordingly.
9295
9296         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
9297         greater than 2.
9298
9299         (EmitDynamicInitializers): Update in accordance with the new optimization.
9300
9301         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
9302         same OpCode applies.
9303
9304         * cs-parser.jay : Fix some glaring errors I introduced.
9305
9306 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
9307
9308         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
9309         so that we can check for name clashes there too.
9310
9311         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
9312         for interface indexers.
9313
9314         * interfaces.cs (Define): Emit the default member attribute.
9315
9316         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
9317         variable was being referred to while setting the value ;-)
9318
9319 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
9320
9321         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
9322         byte-by-byte information when we know the data is zero.
9323
9324         Make the block always a multiple of 4, because
9325         DefineInitializedData has a bug.
9326
9327         * assign.cs: Fix, we should assign from the temporary, not from
9328         the source. 
9329
9330         * expression.cs (MakeByteBlob): Fix my incorrect code.
9331
9332 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
9333
9334         * typemanager.cs (EnumToUnderlying): This function is used to get
9335         the underlying type from an enumeration, because it does not
9336         always work. 
9337
9338         * constant.cs: Use the I4_S form for values between -128 and 127.
9339
9340         * statement.cs (Block.LookupLabel): Looks up a label.
9341         (Block): Drop support for labeled blocks.
9342
9343         (LabeledStatement): New kind of statement that represents a label
9344         only.
9345
9346         (Goto): Finally implement this bad boy.
9347         
9348         * cs-parser.jay: Update to reflect new mechanism to implement
9349         labels.
9350
9351 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
9352
9353         * codegen.cs (EmitContext.This): a codegen property that keeps the
9354         a single instance of this instead of creating many different this
9355         instances. 
9356
9357         * delegate.cs (Delegate.DoResolve): Update to use the property;
9358
9359         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
9360
9361         * expression.cs (BaseAccess.DoResolve): Ditto.
9362
9363 2001-12-29  Ravi Pratap  <ravi@ximian.com>
9364
9365         * typemanager.cs (methodimpl_attr_type): Add to hold the type
9366         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
9367
9368         (InitCoreTypes): Update accordingly.
9369
9370         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
9371         so we can quickly store the state.
9372
9373         (ApplyAttributes): Set the correct implementation flags
9374         for InternalCall methods.
9375
9376 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
9377
9378         * expression.cs (EmitCall): if a method is not virtual, then do
9379         not use callvirt on it.
9380
9381         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
9382         user defined stuff) requires the use of stobj, which takes an
9383         address on the stack instead of an array and an index.  So emit
9384         the Ldelema operation for it.
9385
9386         (EmitStoreOpcode): Use stobj for valuetypes.
9387
9388         (UnaryMutator.EmitCode): Use the right 1 value depending on
9389         whether we are dealing with int64/uint64, float or doubles.
9390
9391         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
9392         constructors that I implemented last night.
9393
9394         (Constructor.IsDefault): Fix to work properly for static
9395         constructors.
9396
9397         * cs-parser.jay (CheckDef): report method signature errors.
9398         Update error number 103 to be 132.
9399
9400         * decl.cs: New AdditionResult enumeration value: MethodExists.
9401         Although we do this check for methods later on in the semantic
9402         analysis, catching repeated default constructors is so easy that
9403         we catch these here. 
9404         
9405         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
9406         promotions code.
9407
9408         (ParameterReference.EmitAssign, Emit): handle
9409         bools as bytes.
9410
9411         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
9412         (ArrayAccess.EmitStoreOpcode): ditto.
9413
9414         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
9415
9416         * expression.cs (MakeByteBlob): Complete all the missing types
9417         (uint, short, ushort, byte, sbyte)
9418
9419         * class.cs: Only init instance field initializers on instance
9420         constructors. 
9421
9422         Rename `constructors' to instance_constructors. 
9423
9424         (TypeContainer.AddConstructor): Only add constructors to the list
9425         if it is not static.
9426
9427         Make sure that we handle default_static_constructor independently
9428         everywhere where we handle instance_constructors
9429
9430 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
9431
9432         * class.cs: Do not lookup or create a base initializer for a
9433         static constructor.
9434
9435         (ConstructorInitializer.Resolve): use the proper type to lookup
9436         for constructors.
9437
9438         * cs-parser.jay: Report error 1585 (modifiers between type and name).
9439
9440         * enum.cs, interface.cs: Remove CloseType, this is taken care by
9441         in DeclSpace. 
9442
9443         * decl.cs: CloseType is now an virtual method, the default
9444         implementation just closes this type.
9445         
9446 2001-12-28  Ravi Pratap  <ravi@ximian.com>
9447
9448         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
9449         to PreserveSig by default. Also emit HideBySig on such methods.
9450
9451         Basically, set the defaults to standard values.
9452
9453         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
9454         argument, if candidate is better, it can't be worse than the best !
9455
9456         (Invocation): Re-write bits to differentiate between methods being
9457         applicable in their expanded form and their normal form - for params
9458         methods of course.
9459
9460         Get rid of use_standard everywhere as only standard conversions are allowed
9461         in overload resolution. 
9462
9463         More spec conformance.
9464         
9465 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
9466
9467         * driver.cs: Add --timestamp, to see where the compiler spends
9468         most of its time.
9469
9470         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
9471         `this' in static code.
9472
9473         (SimpleName.DoResolve): Implement in terms of a helper function
9474         that allows static-references to be passed upstream to
9475         MemberAccess.
9476
9477         (Expression.ResolveWithSimpleName): Resolve specially simple
9478         names when called by MemberAccess to implement the special
9479         semantics. 
9480
9481         (Expression.ImplicitReferenceConversion): Handle conversions from
9482         Null to reference types before others, as Null's type is
9483         System.Object. 
9484
9485         * expression.cs (Invocation.EmitCall): Handle the special case of
9486         calling methods declared on a reference type from a ValueType
9487         (Base classes System.Object and System.Enum)
9488
9489         (MemberAccess.Resolve): Only perform lookups on Enumerations if
9490         the left hand side is a TypeExpr, not on every enumeration. 
9491
9492         (Binary.Resolve): If types are reference types, then do a cast to
9493         object on operators != and == of both arguments.
9494         
9495         * typemanager.cs (FindMembers): Extract instance and static
9496         members if requested.
9497
9498         * interface.cs (PopulateProperty): Use void_type instead of null
9499         as the return type for the setter method.
9500
9501         (PopulateIndexer): ditto.
9502
9503 2001-12-27  Ravi Pratap  <ravi@ximian.com>
9504
9505         * support.cs (ReflectionParameters): Fix minor bug where we
9506         were examining the wrong parameter for the ParamArray attribute.
9507
9508         Cope with requests for the type of the parameter at position
9509         greater than the params parameter's. We now return the element
9510         type of the params array as that makes more sense.
9511
9512         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
9513         accordingly as we no longer have to extract the element type
9514         ourselves.
9515
9516         (Invocation.OverloadResolve): Update.
9517
9518 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
9519
9520         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
9521         against IEnumerator, test whether the return value is a descendant
9522         of the IEnumerator interface.
9523
9524         * class.cs (Indexer.Define): Use an auxiliary method to implement
9525         the other bits of the method definition.  Begin support for
9526         explicit interface implementation.
9527
9528         (Property.DefineMethod): Use TypeManager.void_type instead of null
9529         for an empty return value.
9530
9531 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
9532
9533         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
9534         dealing with a FieldExpr which is composed of a FieldBuilder, in
9535         the code path we did extract the constant, but we should have
9536         obtained the underlying value to be able to cast it (otherwise we
9537         end up in an infinite loop, this is what Ravi was running into).
9538
9539         (ArrayCreation.UpdateIndices): Arrays might be empty.
9540
9541         (MemberAccess.ResolveMemberAccess): Add support for section
9542         14.5.4.1 that deals with the special case of E.I when E is a type
9543         and something else, that I can be a reference to a static member.
9544
9545         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
9546         handle a particular array type to create byte blobs, it is just
9547         something we dont generate byteblobs for.
9548
9549         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
9550         arguments. 
9551
9552         * location.cs (Push): remove the key from the hashtable that we
9553         are about to add.   This happens for empty files.
9554
9555         * driver.cs: Dispose files after we have parsed them.
9556
9557         (tokenize): new function that only runs the tokenizer on its
9558         input, for speed testing.
9559
9560 2001-12-26  Ravi Pratap  <ravi@ximian.com>
9561
9562         * class.cs (Event.Define): Define the private field only if there
9563         are no accessors defined.
9564
9565         * expression.cs (ResolveMemberAccess): If there is no associated
9566         field with the event, that means we have an event defined with its
9567         own accessors and we should flag error cs0070 since transforming
9568         ourselves into a field is not valid in that case.
9569
9570         * ecore.cs (SimpleName.DoResolve): Same as above.
9571
9572         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
9573         and charset to sane values.
9574
9575 2001-12-25  Ravi Pratap  <ravi@ximian.com>
9576
9577         * assign.cs (DoResolve): Perform check on events only if they 
9578         are being accessed outside the declaring type.
9579
9580         * cs-parser.jay (event_declarations): Update rules to correctly
9581         set the type of the implicit parameter etc.
9582
9583         (add_accessor, remove_accessor): Set current local parameters.
9584
9585         * expression.cs (Binary): For delegate addition and subtraction,
9586         cast the return value from the method into the appropriate delegate
9587         type.
9588
9589 2001-12-24  Ravi Pratap  <ravi@ximian.com>
9590
9591         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
9592         of these as the workaround is unnecessary.
9593
9594         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
9595         delegate data - none of that is needed at all.
9596
9597         Re-write bits to extract the instance expression and the delegate method
9598         correctly.
9599
9600         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
9601         on delegates too.
9602
9603         * attribute.cs (ApplyAttributes): New method to take care of common tasks
9604         of attaching attributes instead of duplicating code everywhere.
9605
9606         * everywhere : Update code to do attribute emission using the above method.
9607
9608 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
9609
9610         * expression.cs (IsParamsMethodApplicable): if there are not
9611         parameters, return immediately.
9612
9613         * ecore.cs: The 0 literal can be implicity converted to an enum
9614         type. 
9615
9616         (SimpleName.DoResolve): First lookup the type, then lookup the
9617         members. 
9618
9619         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
9620         want to get its address.  If the InstanceExpression is not
9621         addressable, store the result in a temporary variable, then get
9622         the address of it.
9623
9624         * codegen.cs: Only display 219 errors on warning level or above. 
9625
9626         * expression.cs (ArrayAccess): Make it implement the
9627         IMemoryLocation interface.
9628
9629         (Binary.DoResolve): handle the operator == (object a, object b)
9630         and operator != (object a, object b) without incurring into a
9631         BoxedCast (because 5 != o should never be performed).
9632
9633         Handle binary enumerator operators.
9634
9635         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
9636         value type, otherwise use Ldelem_ref.
9637
9638         Use precomputed names;
9639
9640         (AddressOf): Implement address of
9641
9642         * cs-parser.jay (labeled_statement): Fix recursive block
9643         addition by reworking the production.
9644
9645         * expression.cs (New.DoEmit): New has a special case:
9646                 
9647                  If we are dealing with a ValueType, we have a few
9648                  situations to deal with:
9649                 
9650                     * The target of New is a ValueType variable, that is
9651                       easy, we just pass this as the variable reference
9652                 
9653                     * The target of New is being passed as an argument,
9654                       to a boxing operation or a function that takes a
9655                       ValueType.
9656                 
9657                       In this case, we need to create a temporary variable
9658                       that is the argument of New.
9659
9660
9661 2001-12-23  Ravi Pratap  <ravi@ximian.com>
9662
9663         * rootcontext.cs (LookupType): Check that current_type is not null before
9664         going about looking at nested types.
9665
9666         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
9667         not implement the IAssignMethod interface any more.
9668
9669         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
9670         where we tranform them into FieldExprs if they are being resolved from within
9671         the declaring type.
9672
9673         * ecore.cs (SimpleName.DoResolve): Do the same here.
9674
9675         * assign.cs (DoResolve, Emit): Clean up code considerably. 
9676
9677         * ../errors/bug10.cs : Add.
9678
9679         * ../errors/cs0070.cs : Add.
9680
9681         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
9682
9683         * assign.cs : Get rid of EventIsLocal everywhere.
9684         
9685 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
9686
9687         * ecore.cs (ConvertIntLiteral): finished the implementation.
9688
9689         * statement.cs (SwitchLabel): Convert the value we are using as a
9690         key before looking up the table.
9691
9692 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
9693
9694         * codegen.cs (EmitTopBlock): Require a Location argument now.
9695
9696         * cs-parser.jay (constructor_declarator): We need to setup
9697         current_local_parameters before we parse the
9698         opt_constructor_initializer, to allow the variables to be bound
9699         to the constructor arguments.
9700
9701         * rootcontext.cs (LookupType): First lookup nested classes in our
9702         class and our parents before we go looking outside our class.
9703
9704         * expression.cs (ConstantFold): Extract/debox the values at the
9705         beginnning. 
9706
9707         * rootcontext.cs (EmitCode): Resolve the constants first before we
9708         resolve the types.  This is not really needed, but it helps debugging.
9709
9710         * statement.cs: report location.
9711         
9712         * cs-parser.jay: pass location to throw statement.
9713
9714         * driver.cs: Small bug fix.
9715
9716         * report.cs: Updated format to be 4-zero filled digits.
9717
9718 2001-12-22  Ravi Pratap  <ravi@ximian.com>
9719
9720         * expression.cs (CheckIndices): Fix minor bug where the wrong
9721         variable was being referred to ;-)
9722
9723         (DoEmit): Do not call EmitStaticInitializers when the 
9724         underlying type is System.Object.
9725
9726 2001-12-21  Ravi Pratap  <ravi@ximian.com>
9727
9728         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
9729         and do the usual workaround for SRE.
9730
9731         * class.cs (MyEventBuilder.EventType): New member to get at the type
9732         of the event, quickly.
9733
9734         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
9735
9736         * assign.cs (Assign.DoResolve): Handle the case when the target
9737         is an EventExpr and perform the necessary checks.
9738
9739         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
9740         interface.
9741
9742         (SimpleName.MemberStaticCheck): Include check for EventExpr.
9743
9744         (EventExpr): Set the type in the constructor itself since we 
9745         are meant to be born fully resolved.
9746
9747         (EventExpr.Define): Revert code I wrote earlier.
9748                 
9749         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
9750         instance expression is null. The instance expression is a This in that case
9751         or a null, depending on whether it is a static method or not.
9752
9753         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
9754         refers to more than one method.
9755
9756         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
9757         and accordingly flag errors.
9758
9759 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
9760
9761         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
9762
9763 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
9764
9765         * location.cs (ToString): Provide useful rutine.
9766
9767 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
9768
9769         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
9770         objects, return the actual integral boxed.
9771
9772         * statement.cs (SwitchLabel): define an ILLabel for each
9773         SwitchLabel. 
9774         
9775         (Switch.CheckSwitch): If the value is a Literal, extract
9776         the underlying literal.
9777         
9778         Also in the unused hashtable we had, add the SwitchLabel so we can
9779         quickly look this value up.
9780
9781         * constant.cs: Implement a bunch of new constants.  Rewrite
9782         Literal based on this.  Made changes everywhere to adapt to this.
9783         
9784         * expression.cs (Expression.MakeByteBlob): Optimize routine by
9785         dereferencing array only once, and also copes with enumrations.
9786
9787         bytes are two bytes wide, not one.
9788
9789         (Cast): Perform constant conversions.
9790         
9791         * ecore.cs (TryImplicitIntConversion): Return literals instead of
9792         wrappers to the literals here.
9793
9794         * expression.cs (DoNumericPromotions): long literals can converted
9795         to ulong implicity (this is taken care of elsewhere, but I was
9796         missing this spot).
9797
9798         * ecore.cs (Expression.Literalize): Make the return type Literal,
9799         to improve type checking.
9800
9801         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
9802
9803 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
9804
9805         * literal.cs: Revert code from ravi that checked the bounds.  The
9806         bounds are sane by the definition of the type itself. 
9807
9808         * typemanager.cs: Fix implementation of ImplementsInterface.  We
9809         need to actually look up in our parent hierarchy for interfaces
9810         implemented. 
9811
9812         * const.cs: Use the underlying type for enumerations
9813
9814         * delegate.cs: Compute the basename for the delegate creation,
9815         that should fix the delegate test case, and restore the correct
9816         Type Lookup semantics in rootcontext
9817
9818         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
9819         referencing a nested type with the Reflection API is using the "+"
9820         sign. 
9821
9822         * cs-parser.jay: Do not require EOF token at the end.
9823
9824 2001-12-20  Ravi Pratap  <ravi@ximian.com>
9825
9826         * rootcontext.cs (LookupType): Concatenate type names with
9827         a '.' instead of a '+' The test suite passes again.
9828
9829         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
9830         field of the enumeration.
9831
9832         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
9833         the case when the member is an EventExpr.
9834
9835         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
9836         static has an associated instance expression.
9837
9838         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
9839
9840         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
9841
9842         * class.cs (Event.Define): Register event and perform appropriate checks
9843         for error #111.
9844
9845         We define the Add and Remove methods even if the use provides none because
9846         in that case, we provide default implementations ourselves.
9847
9848         Define a private field of the type of the event. This is done by the CSC compiler
9849         and we should be doing it too ;-)
9850
9851         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
9852         More methods we use in code we generate.
9853
9854         (multicast_delegate_type, delegate_type): Two separate types since the distinction
9855         is important.
9856
9857         (InitCoreTypes): Update accordingly for the above.
9858
9859         * class.cs (Event.Emit): Generate code for default accessors that we provide
9860
9861         (EmitDefaultMethod): Do the job in the above.
9862
9863         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
9864         appropriate place.
9865
9866 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
9867
9868         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
9869         builders even if we were missing one.
9870
9871         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
9872         pass the Basename as our class name instead of the Name.  The
9873         basename will be correctly composed for us.
9874
9875         * parameter.cs (Paramters): Now takes a Location argument.
9876
9877         * decl.cs (DeclSpace.LookupType): Removed convenience function and
9878         make all the code call directly LookupType in RootContext and take
9879         this chance to pass the Location information everywhere.
9880
9881         * Everywhere: pass Location information.
9882
9883 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
9884
9885         * class.cs (Constructor.Define): Updated way of detecting the
9886         length of the parameters.
9887
9888         (TypeContainer.DefineType): Use basename as the type name for
9889         nested types.
9890
9891         (TypeContainer.Define): Do not recursively define types here, as
9892         definition is taken care in order by the RootContext.
9893
9894         * tree.cs: Keep track of namespaces in a per-file basis.
9895
9896         * parameter.cs (Parameter.ComputeSignature): Update to use
9897         DeclSpace. 
9898
9899         (Parameters.GetSignature): ditto.
9900
9901         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
9902         instead of a TypeContainer.
9903
9904         (Interface.SemanticAnalysis): Use `this' instead of our parent to
9905         resolve names.  Because we need to be resolve in our context, not
9906         our parents.
9907         
9908         * driver.cs: Implement response files.
9909
9910         * class.cs (TypeContainer.DefineType): If we are defined, do not
9911         redefine ourselves.
9912         
9913         (Event.Emit): Emit the code for add/remove handlers.
9914         (Event.Define): Save the MethodBuilders for add/remove.
9915
9916         * typemanager.cs: Use pair here too.
9917
9918         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
9919         DictionaryEntry requires the first argument to be non-null.  
9920         
9921         (enum_declaration): Compute full name for registering the
9922         enumeration.
9923         
9924         (delegate_declaration): Instead of using
9925         formal_parameter_list, use opt_formal_parameter_list as the list
9926         can be empty.
9927
9928         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
9929         (EventParsing): New property that controls whether `add' and
9930         `remove' are returned as tokens or identifiers (for events);
9931
9932 2001-12-19  Ravi Pratap  <ravi@ximian.com>
9933
9934         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
9935         use MyEventBuilder only and let it wrap the real builder for us.
9936
9937         (MyEventBuilder): Revamp constructor etc.
9938
9939         Implement all operations that we perform on EventBuilder in precisely the same
9940         way here too.
9941
9942         (FindMembers): Update to use the EventBuilder member.
9943
9944         (Event.Emit): Update accordingly.
9945
9946 2001-12-18  Ravi Pratap  <ravi@ximian.com>
9947
9948         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
9949         by calling the appropriate methods.
9950
9951         (GetCustomAttributes): Make stubs as they cannot possibly do anything
9952         useful.
9953
9954         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
9955
9956 2001-12-17  Ravi Pratap  <ravi@ximian.com>
9957
9958         * delegate.cs (Delegate.Populate): Check that the return type
9959         and various parameters types are indeed accessible.
9960
9961         * class.cs (Constructor.Define): Same here.
9962
9963         (Field.Define): Ditto.
9964
9965         (Event.Define): Ditto.
9966
9967         (Operator.Define): Check that the underlying Method defined itself
9968         correctly - so it's MethodBuilder should not be null.
9969
9970         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
9971         expression happens to be null.
9972
9973         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
9974         members but as of now we don't seem to be able to do anything really useful with it.
9975
9976         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
9977         not the EventBuilder.
9978
9979 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
9980
9981         * cs-tokenizer.cs: Add support for defines.
9982         Add support for #if, #elif, #else, #endif
9983         
9984         (eval_var): evaluates a variable.
9985         (eval): stubbed for evaluating functions.
9986
9987         * cs-parser.jay: Pass the defines information
9988
9989         * driver.cs: Add --define command line option.
9990
9991         * decl.cs: Move MemberCore here.
9992
9993         Make it the base class for DeclSpace.  This allows us to catch and
9994         report 108 and 109 for everything now.
9995
9996         * class.cs (TypeContainer.Define): Extract all the members
9997         before populating and emit the warning 108 (new keyword required
9998         to override) instead of having each member implement this.
9999
10000         (MemberCore.Define): New abstract method, we will be using this in
10001         the warning reporting engine in Populate.
10002         
10003         (Operator.Define): Adjust to new MemberCore protocol. 
10004
10005         * const.cs (Const): This does not derive from Expression, it is a
10006         temporary object we use to create fields, it is a MemberCore. 
10007
10008         * class.cs (Method.Define): Allow the entry point to be in a
10009         specific class.
10010
10011         * driver.cs: Rewrite the argument handler to clean it up a bit.
10012
10013         * rootcontext.cs: Made it just an auxiliary namespace feature by
10014         making everything static.
10015
10016         * driver.cs: Adapt code to use RootContext type name instead of
10017         instance variable.
10018
10019         * delegate.cs: Remove RootContext argument.
10020
10021         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
10022         argument. 
10023
10024         * class.cs (Event.Define): The lookup can fail.
10025         
10026         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
10027
10028         * expression.cs: Resolve the this instance before invoking the code.
10029
10030 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
10031
10032         * cs-parser.jay: Add a production in element_access that allows
10033         the thing to become a "type" reference.  This way we can parse
10034         things like "(string [])" as a type.
10035
10036         Note that this still does not handle the more complex rules of
10037         casts. 
10038         
10039
10040         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
10041
10042         * ecore.cs: (CopyNewMethods): new utility function used to
10043         assemble the list of methods from running FindMembers.
10044
10045         (MemberLookup): Rework FindMembers so that 
10046
10047 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
10048
10049         * class.cs (TypeContainer): Remove Delegates who fail to be
10050         defined.
10051
10052         * delegate.cs (Populate): Verify that we dont get null return
10053         values.   TODO: Check for AsAccessible.
10054
10055         * cs-parser.jay: Use basename to emit error 574 (destructor should
10056         have the same name as container class), not the full name.
10057
10058         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
10059         possible representation.  
10060
10061         Also implements integer type suffixes U and L.
10062
10063 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
10064
10065         * expression.cs (ArrayCreation.DoResolve): We need to do the
10066         argument resolution *always*.
10067
10068         * decl.cs: Make this hold the namespace.  Hold the root context as
10069         well.
10070         (LookupType): Move here.
10071
10072         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
10073
10074         * location.cs (Row, Name): Fixed the code, it was always returning
10075         references to the first file.
10076
10077         * interface.cs: Register properties defined through interfaces.
10078
10079         * driver.cs: Add support for globbing on the command line
10080
10081         * class.cs (Field): Make it derive from MemberCore as well.
10082         (Event): ditto.
10083
10084 2001-12-15  Ravi Pratap  <ravi@ximian.com>
10085
10086         * class.cs (Event::Define): Check that the type of the event is a delegate
10087         type else flag error #66.
10088
10089         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
10090         same.
10091
10092         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
10093         values of EntryPoint, CharSet etc etc.
10094
10095         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
10096
10097         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
10098         be null and we should ignore this. I am not sure if this is really clean. Apparently,
10099         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
10100         which needs this to do its work.
10101
10102         * ../errors/cs0066.cs : Add.
10103
10104 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
10105
10106         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
10107         helper functions.
10108
10109         * class.cs: (MethodSignature.MethodSignature): Removed hack that
10110         clears out the parameters field.
10111         (MemberSignatureCompare): Cleanup
10112
10113         (MemberCore): New base class used to share code between MethodCore
10114         and Property.
10115
10116         (RegisterRequiredImplementations) BindingFlags.Public requires
10117         either BindingFlags.Instace or Static.  Use instance here.
10118
10119         (Property): Refactored code to cope better with the full spec.
10120
10121         * parameter.cs (GetParameterInfo): Return an empty array instead
10122         of null on error.
10123
10124         * class.cs (Property): Abstract or extern properties have no bodies.
10125
10126         * parameter.cs (GetParameterInfo): return a zero-sized array.
10127
10128         * class.cs (TypeContainer.MethodModifiersValid): Move all the
10129         method modifier validation to the typecontainer so we can reuse
10130         this on properties.
10131
10132         (MethodCore.ParameterTypes): return an empty sized array of types.
10133
10134         (Property.Define): Test property modifier validity.
10135
10136         Add tests for sealed/override too.
10137
10138         (Method.Emit): abstract or extern methods have no bodies.
10139
10140 2001-12-14  Ravi Pratap  <ravi@ximian.com>
10141
10142         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
10143         thing.
10144
10145         (Method::Define, ::Emit): Modify accordingly.
10146
10147         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
10148
10149         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
10150
10151         * makefile: Pass in /unsafe.
10152
10153 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
10154
10155         * class.cs (MakeKey): Kill routine.
10156         
10157         * class.cs (TypeContainer.Define): Correctly define explicit
10158         method implementations (they require the full interface name plus
10159         the method name).
10160
10161         * typemanager.cs: Deply the PtrHashtable here and stop using the
10162         lame keys.  Things work so much better.
10163
10164         This of course broke everyone who depended on `RegisterMethod' to
10165         do the `test for existance' test.  This has to be done elsewhere.
10166
10167         * support.cs (PtrHashtable): A hashtable that avoid comparing with
10168         the object stupid Equals method (because, that like fails all over
10169         the place).  We still do not use it.
10170
10171         * class.cs (TypeContainer.SetRequiredInterface,
10172         TypeContainer.RequireMethods): Killed these two routines and moved
10173         all the functionality to RegisterRequiredImplementations.
10174
10175         (TypeContainer.RegisterRequiredImplementations): This routine now
10176         registers all the implementations required in an array for the
10177         interfaces and abstract methods.  We use an array of structures
10178         which can be computed ahead of time to reduce memory usage and we
10179         also assume that lookups are cheap as most classes will not
10180         implement too many interfaces.
10181
10182         We also avoid creating too many MethodSignatures.
10183
10184         (TypeContainer.IsInterfaceMethod): Update and optionally does not
10185         clear the "pending" bit if we find that there are problems with
10186         the declaration.
10187
10188         (TypeContainer.VerifyPendingMethods): Update to report errors of
10189         methods that look like implementations but are not.
10190
10191         (TypeContainer.Define): Add support for explicit interface method
10192         implementation. 
10193         
10194 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
10195
10196         * typemanager.cs: Keep track of the parameters here instead of
10197         being a feature of the TypeContainer.
10198
10199         * class.cs: Drop the registration of parameters here, as
10200         InterfaceMethods are also interface declarations.
10201
10202         * delegate.cs: Register methods with the TypeManager not only with
10203         the TypeContainer.  This code was buggy.
10204
10205         * interface.cs: Full registation here.
10206
10207 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
10208
10209         * expression.cs: Remove reducer for binary expressions, it can not
10210         be done this way.
10211
10212         * const.cs: Put here the code that used to go into constant.cs
10213
10214         * constant.cs: Put here the code for constants, this is a new base
10215         class for Literals.
10216
10217         * literal.cs: Make Literal derive from Constant.
10218
10219 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
10220
10221         * statement.cs (Return.Emit): Report error 157 if the user
10222         attempts to return from a finally block.
10223
10224         (Return.Emit): Instead of emitting a return, jump to the end of
10225         the function.
10226
10227         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
10228         LocalBuilder to store the result of the function.  ReturnLabel is
10229         the target where we jump.
10230         
10231
10232 2001-12-09  Radek Doulik  <rodo@ximian.com>
10233
10234         * cs-parser.jay: remember alias in current namespace
10235
10236         * ecore.cs (SimpleName::DoResolve): use aliases for types or
10237         namespaces
10238
10239         * class.cs (LookupAlias): lookup alias in my_namespace
10240
10241         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
10242         aliases hashtable
10243         (LookupAlias): lookup alias in this and if needed in parent
10244         namespaces
10245
10246 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
10247
10248         * support.cs: 
10249
10250         * rootcontext.cs: (ModuleBuilder) Made static, first step into
10251         making things static.  I need this to avoid passing the
10252         TypeContainer when calling ParameterType.
10253
10254         * support.cs (InternalParameters.ParameterType): Remove ugly hack
10255         that did string manipulation to compute the type and then call
10256         GetType.  Use Parameter.ParameterType instead.
10257
10258         * cs-tokenizer.cs: Consume the suffix for floating values.
10259
10260         * expression.cs (ParameterReference): figure out whether this is a
10261         reference parameter or not.  Kill an extra variable by computing
10262         the arg_idx during emission.
10263
10264         * parameter.cs (Parameters.GetParameterInfo): New overloaded
10265         function that returns whether a parameter is an out/ref value or not.
10266
10267         (Parameter.ParameterType): The type of the parameter (base,
10268         without ref/out applied).
10269         
10270         (Parameter.Resolve): Perform resolution here.
10271         (Parameter.ExternalType): The full type (with ref/out applied).
10272
10273         * statement.cs (Using.Emit, Using.EmitExpression): Implement
10274         support for expressions on the using statement.
10275
10276 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
10277
10278         * statement.cs (Using.EmitLocalVariableDecls): Split the
10279         localvariable handling of the using statement.
10280
10281         (Block.EmitMeta): Keep track of variable count across blocks.  We
10282         were reusing slots on separate branches of blocks.
10283
10284         (Try.Emit): Emit the general code block, we were not emitting it. 
10285
10286         Check the type of the declaration to be an IDisposable or
10287         something that can be implicity converted to it. 
10288
10289         Emit conversions if required.
10290
10291         * ecore.cs (EmptyExpression): New utility class.
10292         (Expression.ImplicitConversionExists): New utility function.
10293
10294 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
10295
10296         * statement.cs (Using): Implement.
10297
10298         * expression.cs (LocalVariableReference): Support read only variables.
10299
10300         * statement.cs: Remove the explicit emit for the Leave opcode.
10301         (VariableInfo): Add a readonly field.
10302
10303 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
10304
10305         * ecore.cs (ConvCast): new class used to encapsulate the various
10306         explicit integer conversions that works in both checked and
10307         unchecked contexts.
10308
10309         (Expression.ConvertNumericExplicit): Use new ConvCast class to
10310         properly generate the overflow opcodes.
10311
10312 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
10313
10314         * statement.cs: The correct type for the EmptyExpression is the
10315         element_type, not the variable type.  Ravi pointed this out.
10316
10317 2001-12-04  Ravi Pratap  <ravi@ximian.com>
10318
10319         * class.cs (Method::Define): Handle PInvoke methods specially
10320         by using DefinePInvokeMethod instead of the usual one.
10321
10322         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
10323         above to do the task of extracting information and defining the method.
10324         
10325 2001-12-04  Ravi Pratap  <ravi@ximian.com>
10326
10327         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
10328         of the condition for string type.
10329
10330         (Emit): Move that here. 
10331
10332         (ArrayCreation::CheckIndices): Keep string literals in their expression
10333         form.
10334
10335         (EmitDynamicInitializers): Handle strings appropriately.
10336
10337 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
10338
10339         * codegen.cs (EmitContext): Replace multiple variables with a
10340         single pointer to the current Switch statement.
10341
10342         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
10343         EmitContext.
10344
10345 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
10346
10347         * statement.cs 
10348
10349         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
10350         default'.
10351         
10352         (Foreach.Emit): Foreach on arrays was not setting
10353         up the loop variables (for break/continue).
10354
10355         (GotoCase): Semi-implented.
10356         
10357 2001-12-03  Ravi Pratap  <ravi@ximian.com>
10358
10359         * attribute.cs (CheckAttribute): Handle system attributes by using
10360         Attribute.GetAttributes to examine information we need.
10361
10362         (GetValidPlaces): Same here.
10363
10364         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
10365
10366         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
10367
10368         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
10369
10370         (Method::Define): Set appropriate flags if we have a DllImport attribute.
10371
10372         (Method::Emit): Handle the case when we are a PInvoke method.
10373
10374 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
10375
10376         * expression.cs: Use ResolveWithSimpleName on compound names.
10377
10378 2001-12-02  Ravi Pratap  <ravi@ximian.com>
10379
10380         * constant.cs (EmitConstant): Make sure we resolve the associated expression
10381         before trying to reduce it.
10382
10383         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
10384
10385         * constant.cs (LookupConstantValue): Implement.
10386
10387         (EmitConstant): Use the above in emitting the constant.
10388
10389         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
10390         that are user-defined by doing a LookupConstantValue on them.
10391
10392         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
10393         too, like above.
10394
10395 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
10396
10397         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
10398
10399         (BaseAccess.DoResolve): Implement.
10400
10401         (MemberAccess.DoResolve): Split this routine into a
10402         ResolveMemberAccess routine that can be used independently
10403
10404 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
10405
10406         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
10407         As that share bits of the implementation.  Is returns a boolean,
10408         while As returns the Type that is being probed.
10409
10410 2001-12-01  Ravi Pratap  <ravi@ximian.com>
10411
10412         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
10413         instead of a Literal - much easier.
10414
10415         (EnumInTransit): Remove - utterly useless :-)
10416
10417         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
10418
10419         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
10420
10421         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
10422         chain when we have no associated expression.
10423
10424 2001-11-30  Ravi Pratap  <ravi@ximian.com>
10425
10426         * constant.cs (Define): Use Location while reporting the errror.
10427
10428         Also emit a warning when 'new' is used and there is no inherited
10429         member to hide.
10430
10431         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
10432         populated.
10433
10434         (LookupEnumValue): Implement to lookup an enum member's value and define it
10435         if necessary.
10436
10437         (Populate): Re-write accordingly to use the above routine.
10438
10439 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
10440
10441         * expression.cs (This): Fix prototype for DoResolveLValue to
10442         override the base class DoResolveLValue.
10443
10444         * cs-parser.cs: Report errors cs574 and cs575 (destructor
10445         declarations) 
10446
10447         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
10448         (we need to load the address of the field here).  This fixes
10449         test-22. 
10450         
10451         (FieldExpr.DoResolveLValue): Call the DoResolve
10452         function to initialize the Instance expression.
10453         
10454         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
10455         correctly the GetEnumerator operation on a value type.
10456
10457         * cs-parser.jay: Add more simple parsing error catches.
10458
10459         * statement.cs (Switch): Add support for string switches.
10460         Handle null specially.
10461
10462         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
10463
10464 2001-11-28  Ravi Pratap  <ravi@ximian.com>
10465
10466         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
10467
10468         (declare_local_constant): New helper function.
10469
10470         * statement.cs (AddConstant): Keep a separate record of constants
10471
10472         (IsConstant): Implement to determine if a variable is a constant.
10473
10474         (GetConstantExpression): Implement.
10475
10476         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
10477
10478         * statement.cs (IsVariableDefined): Re-write.
10479
10480 2001-11-27  Ravi Pratap  <ravi@ximian.com>
10481
10482         * class.cs (TypeContainer::FindMembers): Look for constants
10483         in the case when we are looking for MemberTypes.Field
10484
10485         * expression.cs (MemberAccess::DoResolve): Check that in the
10486         case we are a FieldExpr and a Literal, we are not being accessed
10487         by an instance reference.
10488
10489         * cs-parser.jay (local_constant_declaration): Implement.
10490
10491         (declaration_statement): Implement for constant declarations.
10492
10493 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
10494
10495         * statement.cs (Switch): Catch double defaults.
10496
10497         (Switch): More work on the switch() statement
10498         implementation.  It works for integral values now, need to finish
10499         string support.
10500
10501
10502 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
10503
10504         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
10505         integer literals into other integer literals.  To be used by
10506         switch. 
10507
10508 2001-11-24  Ravi Pratap  <ravi@ximian.com>
10509
10510         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
10511         some memory.
10512
10513         (EmitDynamicInitializers): Cope with the above since we extract data
10514         directly from ArrayData now.
10515
10516         (ExpectInitializers): Keep track of whether initializers are mandatory
10517         or not.
10518
10519         (Bounds): Make it a hashtable to prevent the same dimension being 
10520         recorded for every element in that dimension.
10521
10522         (EmitDynamicInitializers): Fix bug which prevented the Set array method
10523         from being found.
10524
10525         Also fix bug which was causing the indices to be emitted in the reverse
10526         order.
10527
10528 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
10529
10530         * expression.cs (ArrayCreation): Implement the bits that Ravi left
10531         unfinished.  They do not work, because the underlying code is
10532         sloppy.
10533
10534 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
10535
10536         * cs-parser.jay: Remove bogus fixme.
10537
10538         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
10539         on Switch statement.
10540         
10541 2001-11-23  Ravi Pratap  <ravi@ximian.com>
10542
10543         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
10544         the same. 
10545         
10546         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
10547         parameter. Apparently, any expression is allowed. 
10548
10549         (ValidateInitializers): Update accordingly.
10550
10551         (CheckIndices): Fix some tricky bugs thanks to recursion.
10552
10553         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
10554         I was being completely brain-dead.
10555
10556         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
10557         and re-write acordingly.
10558
10559         (DelegateInvocation): Re-write accordingly.
10560
10561         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
10562
10563         (MakeByteBlob): Handle types more correctly.
10564
10565         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
10566         initialization from expressions but it is incomplete because I am a complete
10567         Dodo :-|
10568
10569 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
10570
10571         * statement.cs (If.Emit): Fix a bug that generated incorrect code
10572         on If.  Basically, we have to return `true' (ie, we do return to
10573         our caller) only if both branches of the if return.
10574
10575         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
10576         short-circuit operators, handle them as short circuit operators. 
10577
10578         (Cast.DoResolve): Resolve type.
10579         (Cast.Cast): Take an expression as the target type.
10580
10581         * cs-parser.jay (cast_expression): Remove old hack that only
10582         allowed a limited set of types to be handled.  Now we take a
10583         unary_expression and we resolve to a type during semantic
10584         analysis.
10585
10586         Use the grammar productions from Rhys to handle casts (this is
10587         not complete like Rhys syntax yet, we fail to handle that corner
10588         case that C# has regarding (-x), but we will get there.
10589         
10590 2001-11-22  Ravi Pratap  <ravi@ximian.com>
10591
10592         * class.cs (EmitFieldInitializer): Take care of the case when we have a
10593         field which is an array type.
10594
10595         * cs-parser.jay (declare_local_variables): Support array initialization too.
10596
10597         * typemanager.cs (MakeKey): Implement.
10598
10599         (everywhere): Use the above appropriately.
10600
10601         * cs-parser.jay (for_statement): Update for array initialization while
10602         declaring variables.
10603
10604         * ecore.cs : The error message was correct, it's the variable's names that
10605         were misleading ;-) Make the code more readable.
10606
10607         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
10608         the correct type etc.
10609
10610         (ConvertExplicit): Handle Enum types by examining the underlying type.
10611
10612 2001-11-21  Ravi Pratap  <ravi@ximian.com>
10613
10614         * parameter.cs (GetCallingConvention): Always return
10615         CallingConventions.Standard for now.
10616
10617 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
10618
10619         * expression.cs (Binary.ResolveOperator): Update the values of `l'
10620         and `r' after calling DoNumericPromotions.
10621
10622         * ecore.cs: Fix error message (the types were in the wrong order).
10623
10624         * statement.cs (Foreach.ProbeCollectionType): Need to pass
10625         BindingFlags.Instance as well 
10626
10627         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
10628         implicit int literal conversion in an empty cast so that we
10629         propagate the right type upstream.
10630
10631         (UnboxCast): new class used to unbox value types.
10632         (Expression.ConvertExplicit): Add explicit type conversions done
10633         by unboxing.
10634
10635         (Expression.ImplicitNumericConversion): Oops, forgot to test for
10636         the target type before applying the implicit LongLiterals to ULong
10637         literal cast.
10638
10639 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
10640
10641         * cs-parser.jay (for_statement): Reworked the way For works: now
10642         we declare manually any variables that are introduced in
10643         for_initializer to solve the problem of having out-of-band code
10644         emition (that is what got for broken).
10645
10646         (declaration_statement): Perform the actual variable declaration
10647         that used to be done in local_variable_declaration here.
10648
10649         (local_variable_declaration): Do not declare anything, just pass
10650         the information on a DictionaryEntry
10651
10652 2001-11-20  Ravi Pratap  <ravi@ximian.com>
10653
10654         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
10655         re-write of the logic to now make it recursive.
10656
10657         (UpdateIndices): Re-write accordingly.
10658
10659         Store element data in a separate ArrayData list in the above methods.
10660
10661         (MakeByteBlob): Implement to dump the array data into a byte array.
10662
10663 2001-11-19  Ravi Pratap  <ravi@ximian.com>
10664
10665         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
10666         into CheckIndices.
10667
10668         * constant.cs (Define): Implement.
10669
10670         (EmitConstant): Re-write fully.
10671
10672         Pass in location info.
10673
10674         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
10675         respectively.
10676
10677         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
10678         DictionaryEntry since we need location info too.
10679
10680         (constant_declaration): Update accordingly.
10681
10682         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
10683         code into another method : UpdateIndices.
10684
10685 2001-11-18  Ravi Pratap  <ravi@ximian.com>
10686
10687         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
10688         some type checking etc.
10689
10690 2001-11-17  Ravi Pratap  <ravi@ximian.com>
10691
10692         * expression.cs (ArrayCreation::ValidateInitializers): Implement
10693         bits to provide dimension info if the user skips doing that.
10694
10695         Update second constructor to store the rank correctly.
10696
10697 2001-11-16  Ravi Pratap  <ravi@ximian.com>
10698
10699         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
10700         and try to implement.
10701
10702         * ../errors/cs0150.cs : Add.
10703
10704         * ../errors/cs0178.cs : Add.
10705
10706 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
10707
10708         * statement.cs: Implement foreach on multi-dimensional arrays. 
10709
10710         * parameter.cs (Parameters.GetParameterByName): Also lookup the
10711         name of the params argument.
10712
10713         * expression.cs: Use EmitStoreOpcode to get the right opcode while
10714         initializing the array.
10715
10716         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
10717         we can use this elsewhere.
10718
10719         * statement.cs: Finish implementation of foreach for single
10720         dimension arrays.
10721
10722         * cs-parser.jay: Use an out-of-band stack to pass information
10723         around, I wonder why I need this.
10724
10725         foreach_block: Make the new foreach_block the current_block.
10726
10727         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
10728         function used to return a static Parameters structure.  Used for
10729         empty parameters, as those are created very frequently.
10730
10731         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
10732
10733 2001-11-15  Ravi Pratap  <ravi@ximian.com>
10734
10735         * interface.cs : Default modifier is private, not public. The
10736         make verify test passes again.
10737
10738 2001-11-15  Ravi Pratap  <ravi@ximian.com>
10739
10740         * support.cs (ReflectionParameters): Fix logic to determine
10741         whether the last parameter is a params one. Test 9 passes again.
10742
10743         * delegate.cs (Populate): Register the builders we define with
10744         RegisterParameterForBuilder. Test 19 passes again.
10745
10746         * cs-parser.jay (property_declaration): Reference $6 instead
10747         of $$ to get at the location.
10748
10749         (indexer_declaration): Similar stuff.
10750
10751         (attribute): Ditto.
10752
10753         * class.cs (Property): Register parameters for the Get and Set methods
10754         if they exist. Test 23 passes again.
10755
10756         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
10757         call to EmitArguments as we are sure there aren't any params arguments. 
10758         Test 32 passes again.
10759
10760         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
10761         IndexOutOfRangeException. 
10762
10763         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
10764         Test 33 now passes again.
10765         
10766 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
10767
10768         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
10769         broke a bunch of things.  Will have to come up with a better way
10770         of tracking locations.
10771
10772         * statement.cs: Implemented foreach for single dimension arrays.
10773
10774 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
10775
10776         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
10777         an error.  This removes the lookup from the critical path.
10778
10779         * cs-parser.jay: Removed use of temporary_loc, which is completely
10780         broken. 
10781
10782 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
10783
10784         * support.cs (ReflectionParameters.ParameterModifier): Report
10785         whether the argument is a PARAMS argument or not.
10786
10787         * class.cs: Set the attribute `ParamArrayAttribute' on the
10788         parameter argument.
10789
10790         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
10791         and cons_param_array_attribute (ConstructorInfo for
10792         ParamArrayAttribute)., 
10793
10794         * codegen.cs: Emit the return using the `Return' statement, that
10795         way we can report the error correctly for missing return values. 
10796
10797         * class.cs (Method.Emit): Clean up.
10798
10799         * expression.cs (Argument.Resolve): Take another argument: the
10800         location where this argument is used.  Notice that this is not
10801         part of the "Argument" class as to reduce the size of the
10802         structure (we know the approximate location anyways).
10803
10804         Test if the argument is a variable-reference, if not, then
10805         complain with a 206.
10806
10807         (Argument.Emit): Emit addresses of variables.
10808
10809         (Argument.FullDesc): Simplify.
10810
10811         (Invocation.DoResolve): Update for Argument.Resolve.
10812
10813         (ElementAccess.DoResolve): ditto.
10814
10815         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
10816         method should be virtual, as this method is always virtual.
10817
10818         (NewDelegate.DoResolve): Update for Argument.Resolve.
10819
10820         * class.cs (ConstructorInitializer.DoResolve): ditto.
10821         
10822         * attribute.cs (Attribute.Resolve): ditto.
10823
10824 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
10825
10826         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
10827
10828         * expression.cs (ParameterReference): Drop IStackStorage and implement
10829         IAssignMethod instead. 
10830
10831         (LocalVariableReference): ditto.
10832         
10833         * ecore.cs (FieldExpr): Drop IStackStorage and implement
10834         IAssignMethod instead. 
10835
10836 2001-11-13  Miguel de Icaza <miguel@ximian.com>
10837
10838         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
10839         enumerations that are used in heavily used structures derive from
10840         byte in a laughable and pathetic attempt to reduce memory usage.
10841         This is the kind of pre-optimzations that you should not do at
10842         home without adult supervision.
10843
10844         * expression.cs (UnaryMutator): New class, used to handle ++ and
10845         -- separatedly from the other unary operators.  Cleans up the
10846         code, and kills the ExpressionStatement dependency in Unary.
10847
10848         (Unary): Removed `method' and `Arguments' from this class, making
10849         it smaller, and moving it all to SimpleCall, so I can reuse this
10850         code in other locations and avoid creating a lot of transient data
10851         strucutres when not required.
10852
10853         * cs-parser.jay: Adjust for new changes.
10854
10855 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
10856
10857         * enum.cs (Enum.Populate): If there is a failure during
10858         definition, return
10859
10860         * cs-parser.jay (opt_enum_base): we used to catch type errors
10861         here, but this is really incorrect.  The type error should be
10862         catched during semantic analysis.
10863
10864 2001-12-11  Ravi Pratap  <ravi@ximian.com>
10865
10866         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
10867         current_local_parameters as expected since I, in my stupidity, had forgotten
10868         to do this :-)
10869
10870         * attribute.cs (GetValidPlaces): Fix stupid bug.
10871
10872         * class.cs (Method::Emit): Perform check on applicability of attributes.
10873
10874         (Constructor::Emit): Ditto.
10875
10876         (Field::Emit): Ditto.
10877
10878         (Field.Location): Store location information.
10879
10880         (Property, Event, Indexer, Operator): Ditto.
10881
10882         * cs-parser.jay (field_declaration): Pass in location for each field.
10883
10884         * ../errors/cs0592.cs : Add.
10885
10886 2001-11-12  Ravi Pratap  <ravi@ximian.com>
10887
10888         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
10889
10890         (InitCoreTypes): Update accordingly.
10891
10892         (RegisterAttrType, LookupAttr): Implement.
10893
10894         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
10895         info about the same.
10896
10897         (Resolve): Update to populate the above as necessary.
10898
10899         (Error592): Helper.
10900
10901         (GetValidPlaces): Helper to the above.
10902
10903         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
10904
10905         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
10906
10907 2001-11-12  Ravi Pratap  <ravi@ximian.com>
10908
10909         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
10910
10911         * ../errors/cs0617.cs : Add.
10912
10913 2001-11-11  Ravi Pratap  <ravi@ximian.com>
10914
10915         * enum.cs (Emit): Rename to Populate to be more consistent with what
10916         we expect it to do and when exactly it is called.
10917
10918         * class.cs, rootcontext.cs : Update accordingly.
10919
10920         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
10921         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
10922
10923         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
10924
10925         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
10926         of a fieldinfo using the above, when dealing with a FieldBuilder.
10927
10928 2001-11-10  Ravi Pratap  <ravi@ximian.com>
10929
10930         * ../errors/cs0031.cs : Add.
10931
10932         * ../errors/cs1008.cs : Add.
10933
10934         * ../errrors/cs0543.cs : Add.
10935
10936         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
10937         enum type.
10938
10939         (FindMembers): Implement.
10940
10941         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
10942         enums and delegates too.
10943
10944         (enum_types): Rename to builder_to_enum.
10945
10946         (delegate_types): Rename to builder_to_delegate.
10947
10948         * delegate.cs (FindMembers): Implement.
10949
10950 2001-11-09  Ravi Pratap  <ravi@ximian.com>
10951
10952         * typemanager.cs (IsEnumType): Implement.
10953
10954         * enum.cs (Emit): Re-write parts to account for the underlying type
10955         better and perform checking etc.
10956
10957         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
10958         of the underlying type.
10959
10960         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
10961         value
10962
10963         * enum.cs (error31): Helper to report error #31.
10964
10965         * cs-parser.jay (enum_declaration): Store location of each member too.
10966
10967         * enum.cs (member_to_location): New hashtable. 
10968
10969         (AddEnumMember): Update location hashtable.
10970
10971         (Emit): Use the location of each member while reporting errors.
10972
10973 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
10974
10975         * cs-parser.jay: A for_initializer if is a
10976         local_variable_declaration really ammount to have an implicit
10977         block with the variable declaration and no initializer for for.
10978
10979         * statement.cs (For.Emit): Cope with null initializers.
10980
10981         This fixes the infinite loop on for initializers.
10982
10983 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
10984
10985         * enum.cs: More cleanup.
10986
10987         * ecore.cs: Remove dead code.
10988
10989         * class.cs (Property.Emit): More simplification.
10990         (Event.Emit): ditto.
10991
10992         Reworked to have less levels of indentation.
10993         
10994 2001-11-08  Ravi Pratap  <ravi@ximian.com>
10995
10996         * class.cs (Property): Emit attributes.
10997
10998         (Field): Ditto.
10999         
11000         (Event): Ditto.
11001
11002         (Indexer): Ditto.
11003
11004         (Operator): Ditto.
11005
11006         * enum.cs (Emit): Ditto.
11007
11008         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
11009         Enums too.
11010
11011         * class.cs (Field, Event, etc.): Move attribute generation into the
11012         Emit method everywhere.
11013
11014         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
11015         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
11016         as we had no way of defining nested enums !
11017
11018         * rootcontext.cs : Adjust code accordingly.
11019
11020         * typemanager.cs (AddEnumType): To keep track of enum types separately.
11021
11022 2001-11-07  Ravi Pratap  <ravi@ximian.com>
11023
11024         * expression.cs (EvalConstantExpression): Move into ecore.cs
11025         
11026         * enum.cs (Enum): Rename some members and make them public and readonly
11027         according to our convention.
11028
11029         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
11030         nothing else.
11031
11032         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
11033
11034         (Enum::Emit): Write a simple version for now which doesn't try to compute
11035         expressions. I shall modify this to be more robust in just a while.
11036
11037         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
11038
11039         (TypeContainer::CloseType): Create the Enum types too.
11040
11041         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
11042
11043         * expression.cs (EvalConstantExpression): Get rid of completely.
11044
11045         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
11046         user-defined values and other cases.
11047
11048         (IsValidEnumLiteral): Helper function.
11049
11050         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
11051         out there in the case we had a literal FieldExpr.
11052
11053         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
11054
11055         (Literalize): Revamp a bit to take two arguments.
11056         
11057         (EnumLiteral): New class which derives from Literal to wrap enum literals.
11058         
11059 2001-11-06  Ravi Pratap  <ravi@ximian.com>
11060
11061         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
11062
11063         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
11064
11065         (Resolve): Use the above to ensure we have proper initializers.
11066
11067 2001-11-05  Ravi Pratap  <ravi@ximian.com>
11068
11069         * expression.cs (Expression::EvalConstantExpression): New method to 
11070         evaluate constant expressions.
11071
11072         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
11073
11074 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
11075
11076         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
11077         in an array.
11078
11079         (Binary.ResolveOperator): Handle operator != (object a, object b)
11080         and operator == (object a, object b);
11081
11082         (Binary.DoNumericPromotions): Indicate whether the numeric
11083         promotion was possible.
11084
11085         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
11086         Implement.  
11087
11088         Made the ArrayAccess implement interface IAssignMethod instead of
11089         IStackStore as the order in which arguments are passed reflects
11090         this.
11091
11092         * assign.cs: Instead of using expr.ExprClass to select the way of
11093         assinging, probe for the IStackStore/IAssignMethod interfaces.
11094
11095         * typemanager.cs: Load InitializeArray definition.
11096
11097         * rootcontext.cs (RootContext.MakeStaticData): Used to define
11098         static data that can be used to initialize arrays. 
11099
11100 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
11101
11102         * expression.cs: Handle operator== and operator!= for booleans.
11103
11104         (Conditioal.Reduce): Implement reducer for the ?: operator.
11105
11106         (Conditional.Resolve): Implement dead code elimination.
11107
11108         (Binary.Resolve): Catch string literals and return a new
11109         concatenated string.
11110
11111         (Unary.Reduce): Implement reduction of unary expressions.
11112
11113         * ecore.cs: Split out the expression core handling here.
11114
11115         (Expression.Reduce): New method used to perform constant folding
11116         and CSE.  This is needed to support constant-expressions. 
11117         
11118         * statement.cs (Statement.EmitBoolExpression): Pass true and false
11119         targets, and optimize for !x.
11120
11121 2001-11-04  Ravi Pratap  <ravi@ximian.com>
11122
11123         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
11124         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
11125         set custom atttributes.
11126
11127         * literal.cs (Literal::GetValue): New abstract method to return the actual
11128         value of the literal, cast as an object.
11129
11130         (*Literal): Implement GetValue method.
11131
11132         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
11133         expressions to the arraylist but objects of type Argument.
11134
11135         * class.cs (TypeContainer::Emit): Emit our attributes too.
11136
11137         (Method::Emit, Constructor::Emit): Ditto.
11138
11139         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
11140         to be ignoring earlier.
11141
11142 2001-11-03  Ravi Pratap  <ravi@ximian.com>
11143
11144         * attribute.cs (AttributeSection::Define): Implement to do the business
11145         of constructing a CustomAttributeBuilder.
11146
11147         (Attribute): New trivial class. Increases readability of code.  
11148
11149         * cs-parser.jay : Update accordingly.
11150
11151         (positional_argument_list, named_argument_list, named_argument): New rules
11152
11153         (attribute_arguments): Use the above so that we are more correct.
11154         
11155 2001-11-02  Ravi Pratap  <ravi@ximian.com>
11156         
11157         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
11158         to perform all checks for a method with a params parameter.
11159
11160         (Invocation::OverloadResolve): Update to use the above method and therefore
11161         cope correctly with params method invocations.
11162
11163         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
11164         params too.
11165
11166         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
11167         constructors in our parent too because we can't afford to miss out on 
11168         protected ones ;-)
11169
11170         * attribute.cs (AttributeSection): New name for the class Attribute
11171
11172         Other trivial changes to improve readability.
11173
11174         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
11175         use the new class names.
11176         
11177 2001-11-01  Ravi Pratap  <ravi@ximian.com>
11178
11179         * class.cs (Method::Define): Complete definition for params types too
11180
11181         (Indexer::Define): Ditto.
11182
11183         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
11184         Cope everywhere with a request for info about the array parameter.
11185
11186 2001-11-01  Ravi Pratap  <ravi@ximian.com>
11187
11188         * tree.cs (RecordNamespace): Fix up to check for the correct key.
11189
11190         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
11191         local_variable_type to extract the string corresponding to the type.
11192
11193         (local_variable_type): Fixup the action to use the new helper method.
11194
11195         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
11196         go.
11197
11198         * expression.cs : Clean out code which uses the above.
11199
11200 2001-10-31  Ravi Pratap  <ravi@ximian.com>
11201         
11202         * typemanager.cs (RegisterMethod): Check if we already have an existing key
11203         and bale out if necessary by returning a false.
11204
11205         (RegisterProperty): Ditto.
11206
11207         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
11208         and print out appropriate error messages.
11209
11210         * interface.cs (everywhere): Ditto.
11211
11212         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
11213         location to constructor.
11214
11215         * class.cs (Property, Event, Indexer): Update accordingly.
11216
11217         * ../errors/cs111.cs : Added.
11218
11219         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
11220         of a method, as laid down by the spec.
11221
11222         (Invocation::OverloadResolve): Use the above method.
11223
11224 2001-10-31  Ravi Pratap  <ravi@ximian.com>
11225
11226         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
11227         now take a TypeContainer and a Parameters object.
11228
11229         (ParameterData): Modify return type of ParameterModifier method to be 
11230         Parameter.Modifier and not a string.
11231
11232         (ReflectionParameters, InternalParameters): Update accordingly.
11233
11234         * expression.cs (Argument::GetParameterModifier): Same here.
11235
11236         * support.cs (InternalParameters::ParameterType): Find a better way of determining
11237         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
11238         symbol in it at all so maybe this is only for now.
11239
11240 2001-10-30  Ravi Pratap  <ravi@ximian.com>
11241
11242         * support.cs (InternalParameters): Constructor now takes an extra argument 
11243         which is the actual Parameters class.
11244
11245         (ParameterDesc): Update to provide info on ref/out modifiers.
11246
11247         * class.cs (everywhere): Update call to InternalParameters to pass in
11248         the second argument too.
11249
11250         * support.cs (ParameterData): Add ParameterModifier, which is a method 
11251         to return the modifier info [ref/out etc]
11252
11253         (InternalParameters, ReflectionParameters): Implement the above.
11254
11255         * expression.cs (Argument::ParameterModifier): Similar function to return
11256         info about the argument's modifiers.
11257
11258         (Invocation::OverloadResolve): Update to take into account matching modifiers 
11259         too.
11260
11261         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
11262         a new SetFormalParameters object which we pass to InternalParameters.
11263
11264 2001-10-30  Ravi Pratap  <ravi@ximian.com>
11265
11266         * expression.cs (NewArray): Merge into the ArrayCreation class.
11267
11268 2001-10-29  Ravi Pratap  <ravi@ximian.com>
11269
11270         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
11271         NewUserdefinedArray into one as there wasn't much of a use in having
11272         two separate ones.
11273
11274         * expression.cs (Argument): Change field's name to ArgType from Type.
11275
11276         (Type): New readonly property which returns the proper type, taking into 
11277         account ref/out modifiers.
11278
11279         (everywhere): Adjust code accordingly for the above.
11280
11281         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
11282         whether we are emitting for a ref or out parameter.
11283
11284         * expression.cs (Argument::Emit): Use the above field to set the state.
11285
11286         (LocalVariableReference::Emit): Update to honour the flag and emit the
11287         right stuff.
11288
11289         * parameter.cs (Attributes): Set the correct flags for ref parameters.
11290
11291         * expression.cs (Argument::FullDesc): New function to provide a full desc.
11292
11293         * support.cs (ParameterData): Add method ParameterDesc to the interface.
11294
11295         (ReflectionParameters, InternalParameters): Implement the above method.
11296
11297         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
11298         reporting errors.
11299
11300         (Invocation::FullMethodDesc): Ditto. 
11301
11302 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
11303
11304         * cs-parser.jay: Add extra production for the second form of array
11305         creation. 
11306
11307         * expression.cs (ArrayCreation): Update to reflect the above
11308         change. 
11309
11310         * Small changes to prepare for Array initialization.
11311
11312 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
11313
11314         * typemanager.cs (ImplementsInterface): interface might be null;
11315         Deal with this problem;
11316
11317         Also, we do store negative hits on the cache (null values), so use
11318         this instead of calling t.GetInterfaces on the type everytime.
11319
11320 2001-10-28  Ravi Pratap  <ravi@ximian.com>
11321
11322         * typemanager.cs (IsBuiltinType): New method to help determine the same.
11323
11324         * expression.cs (New::DoResolve): Get rid of array creation code and instead
11325         split functionality out into different classes.
11326
11327         (New::FormArrayType): Move into NewBuiltinArray.
11328
11329         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
11330         quite useless.
11331
11332         (NewBuiltinArray): New class to handle creation of built-in arrays.
11333
11334         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
11335         account creation of one-dimensional arrays.
11336
11337         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
11338
11339         (NewUserdefinedArray::DoResolve): Implement.
11340
11341         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
11342
11343         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
11344         we maintain inside the TypeManager. This is necessary to perform lookups on the
11345         module builder.
11346
11347         (LookupType): Update to perform GetType on the module builders too.     
11348
11349         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
11350
11351         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
11352
11353 2001-10-23  Ravi Pratap  <ravi@ximian.com>
11354
11355         * expression.cs (New::DoResolve): Implement guts of array creation.
11356
11357         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
11358         
11359 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
11360
11361         * expression.cs: Fix bug I introduced lsat night that broke
11362         Delegates. 
11363
11364         (Expression.Resolve): Report a 246 error (can not resolve name)
11365         if we find a SimpleName in the stream.
11366         
11367         (Expression.ResolveLValue): Ditto.
11368         
11369         (Expression.ResolveWithSimpleName): This function is a variant of
11370         ResolveName, this one allows SimpleNames to be returned without a
11371         warning.  The only consumer of SimpleNames is MemberAccess
11372
11373 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
11374
11375         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
11376         might arrive here.  I have my doubts that this is correct.
11377
11378         * statement.cs (Lock): Implement lock statement.
11379
11380         * cs-parser.jay: Small fixes to support `lock' and `using'
11381
11382         * cs-tokenizer.cs: Remove extra space
11383
11384         * driver.cs: New flag --checked, allows to turn on integer math
11385         checking. 
11386
11387         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
11388         Threading.Monitor.Exit 
11389         
11390 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
11391
11392         * expression.cs (IndexerAccess::DoResolveLValue): Set the
11393         Expression Class to be IndexerAccess.
11394
11395         Notice that Indexer::DoResolve sets the eclass to Value.
11396
11397 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
11398
11399         * class.cs (TypeContainer::Emit): Emit code for indexers.
11400
11401         * assign.cs (IAssignMethod): New interface implemented by Indexers
11402         and Properties for handling assignment.
11403
11404         (Assign::Emit): Simplify and reuse code. 
11405         
11406         * expression.cs (IndexerAccess, PropertyExpr): Implement
11407         IAssignMethod, clean up old code. 
11408
11409 2001-10-22  Ravi Pratap  <ravi@ximian.com>
11410
11411         * typemanager.cs (ImplementsInterface): New method to determine if a type
11412         implements a given interface. Provides a nice cache too.
11413
11414         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
11415         method.
11416
11417         (ConvertReferenceExplicit): Ditto.
11418
11419         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
11420         various methods, with correct names etc.
11421
11422         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
11423         Operator.UnaryNegation.
11424
11425         * cs-parser.jay (operator_declarator): Be a little clever in the case where
11426         we have a unary plus or minus operator.
11427
11428         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
11429         UnaryMinus.
11430
11431         * everywhere : update accordingly.
11432
11433         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
11434         respectively.
11435
11436         * class.cs (Method::Define): For the case where we are implementing a method
11437         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
11438         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
11439         
11440 2001-10-21  Ravi Pratap  <ravi@ximian.com>
11441
11442         * interface.cs (FindMembers): Implement to work around S.R.E
11443         lameness.
11444
11445         * typemanager.cs (IsInterfaceType): Implement.
11446
11447         (FindMembers): Update to handle interface types too.
11448
11449         * expression.cs (ImplicitReferenceConversion): Re-write bits which
11450         use IsAssignableFrom as that is not correct - it doesn't work.
11451
11452         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
11453         and accordingly override EmitStatement.
11454
11455         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
11456         using the correct logic :-)
11457
11458 2001-10-19  Ravi Pratap  <ravi@ximian.com>
11459
11460         * ../errors/cs-11.cs : Add to demonstrate error -11 
11461
11462 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
11463
11464         * assign.cs (Assign::Resolve): Resolve right hand side first, and
11465         then pass this as a hint to ResolveLValue.
11466         
11467         * expression.cs (FieldExpr): Add Location information
11468
11469         (FieldExpr::LValueResolve): Report assignment to readonly
11470         variable. 
11471         
11472         (Expression::ExprClassFromMemberInfo): Pass location information.
11473
11474         (Expression::ResolveLValue): Add new method that resolves an
11475         LValue. 
11476
11477         (Expression::DoResolveLValue): Default invocation calls
11478         DoResolve. 
11479
11480         (Indexers): New class used to keep track of indexers in a given
11481         Type. 
11482
11483         (IStackStore): Renamed from LValue, as it did not really describe
11484         what this did.  Also ResolveLValue is gone from this interface and
11485         now is part of Expression.
11486
11487         (ElementAccess): Depending on the element access type
11488         
11489         * typemanager.cs: Add `indexer_name_type' as a Core type
11490         (System.Runtime.CompilerServices.IndexerNameAttribute)
11491
11492         * statement.cs (Goto): Take a location.
11493         
11494 2001-10-18  Ravi Pratap  <ravi@ximian.com>
11495
11496         * delegate.cs (Delegate::VerifyDelegate): New method to verify
11497         if two delegates are compatible.
11498
11499         (NewDelegate::DoResolve): Update to take care of the case when
11500         we instantiate a delegate from another delegate.
11501
11502         * typemanager.cs (FindMembers): Don't even try to look up members
11503         of Delegate types for now.
11504
11505 2001-10-18  Ravi Pratap  <ravi@ximian.com>
11506
11507         * delegate.cs (NewDelegate): New class to take care of delegate
11508         instantiation.
11509
11510         * expression.cs (New): Split the delegate related code out into 
11511         the NewDelegate class.
11512
11513         * delegate.cs (DelegateInvocation): New class to handle delegate 
11514         invocation.
11515
11516         * expression.cs (Invocation): Split out delegate related code into
11517         the DelegateInvocation class.
11518
11519 2001-10-17  Ravi Pratap  <ravi@ximian.com>
11520
11521         * expression.cs (New::DoResolve): Implement delegate creation fully
11522         and according to the spec.
11523
11524         (New::DoEmit): Update to handle delegates differently.
11525
11526         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
11527         because of which we were printing out arguments in reverse order !
11528
11529         * delegate.cs (VerifyMethod): Implement to check if the given method
11530         matches the delegate.
11531
11532         (FullDelegateDesc): Implement.
11533
11534         (VerifyApplicability): Implement.
11535
11536         * expression.cs (Invocation::DoResolve): Update to accordingly handle
11537         delegate invocations too.
11538
11539         (Invocation::Emit): Ditto.
11540
11541         * ../errors/cs1593.cs : Added.
11542
11543         * ../errors/cs1594.cs : Added.
11544
11545         * delegate.cs (InstanceExpression, TargetMethod): New properties.
11546
11547 2001-10-16  Ravi Pratap  <ravi@ximian.com>
11548
11549         * typemanager.cs (intptr_type): Core type for System.IntPtr
11550
11551         (InitCoreTypes): Update for the same.
11552
11553         (iasyncresult_type, asynccallback_type): Ditto.
11554
11555         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
11556         correct.
11557
11558         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
11559         too.
11560
11561         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
11562         the builders for the 4 members of a delegate type :-)
11563
11564         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
11565         type.
11566
11567         * expression.cs (New::DoResolve): Implement guts for delegate creation.
11568
11569         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
11570
11571 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
11572
11573         * statement.cs (Break::Emit): Implement.   
11574         (Continue::Emit): Implement.
11575
11576         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
11577         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
11578         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
11579         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
11580         end loop
11581         
11582         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
11583         properties that track the label for the current loop (begin of the
11584         loop and end of the loop).
11585
11586 2001-10-15  Ravi Pratap  <ravi@ximian.com>
11587
11588         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
11589         use of emitting anything at all.
11590
11591         * class.cs, rootcontext.cs : Get rid of calls to the same.
11592
11593         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
11594
11595         (Populate): Define the constructor correctly and set the implementation
11596         attributes.
11597
11598         * typemanager.cs (delegate_types): New hashtable to hold delegates that
11599         have been defined.
11600
11601         (AddDelegateType): Implement.
11602
11603         (IsDelegateType): Implement helper method.
11604
11605         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
11606
11607         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
11608         and accordingly handle it.
11609
11610         * delegate.cs (Populate): Take TypeContainer argument.
11611         Implement bits to define the Invoke method. However, I still haven't figured out
11612         how to take care of the native int bit :-(
11613
11614         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
11615         Qualify the name of the delegate, not its return type !
11616
11617         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
11618         conversion.
11619
11620         (StandardConversionExists): Checking for array types turns out to be recursive.
11621
11622         (ConvertReferenceExplicit): Implement array conversion.
11623
11624         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
11625         
11626 2001-10-12  Ravi Pratap  <ravi@ximian.com>
11627
11628         * cs-parser.jay (delegate_declaration): Store the fully qualified
11629         name as it is a type declaration.
11630
11631         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
11632         readonly.
11633
11634         (DefineDelegate): Renamed from Define. Does the same thing essentially,
11635         as TypeContainer::DefineType.
11636
11637         (Populate): Method in which all the definition of the various methods (Invoke)
11638         etc is done.
11639
11640         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
11641         see.
11642         
11643         (CloseDelegate): Finally creates the delegate.
11644
11645         * class.cs (TypeContainer::DefineType): Update to define delegates.
11646         (Populate, Emit and CloseType): Do the same thing here too.
11647
11648         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
11649         delegates in all these operations.
11650
11651 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
11652
11653         * expression.cs: LocalTemporary: a new expression used to
11654         reference a temporary that has been created.
11655
11656         * assign.cs: Handle PropertyAccess back here, so that we can
11657         provide the proper semantic access to properties.
11658
11659         * expression.cs (Expression::ConvertReferenceExplicit): Implement
11660         a few more explicit conversions. 
11661
11662         * modifiers.cs: `NEW' modifier maps to HideBySig.
11663
11664         * expression.cs (PropertyExpr): Make this into an
11665         ExpressionStatement, and support the EmitStatement code path. 
11666
11667         Perform get/set error checking, clean up the interface.
11668
11669         * assign.cs: recognize PropertyExprs as targets, and if so, turn
11670         them into toplevel access objects.
11671
11672 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
11673
11674         * expression.cs: PropertyExpr::PropertyExpr: use work around the
11675         SRE.
11676
11677         * typemanager.cs: Keep track here of our PropertyBuilders again to
11678         work around lameness in SRE.
11679
11680 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
11681
11682         * expression.cs (LValue::LValueResolve): New method in the
11683         interface, used to perform a second resolution pass for LValues. 
11684         
11685         (This::DoResolve): Catch the use of this in static methods.
11686
11687         (This::LValueResolve): Implement.
11688
11689         (This::Store): Remove warning, assigning to `this' in structures
11690         is 
11691
11692         (Invocation::Emit): Deal with invocation of
11693         methods on value types.  We need to pass the address to structure
11694         methods rather than the object itself.  (The equivalent code to
11695         emit "this" for structures leaves the entire structure on the
11696         stack instead of a pointer to it). 
11697
11698         (ParameterReference::DoResolve): Compute the real index for the
11699         argument based on whether the method takes or not a `this' pointer
11700         (ie, the method is static).
11701
11702         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
11703         value types returned from functions when we need to invoke a
11704         method on the sturcture.
11705         
11706
11707 2001-10-11  Ravi Pratap  <ravi@ximian.com>
11708
11709         * class.cs (TypeContainer::DefineType): Method to actually do the business of
11710         defining the type in the Modulebuilder or Typebuilder. This is to take
11711         care of nested types which need to be defined on the TypeBuilder using
11712         DefineNestedMethod.
11713
11714         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
11715         methods in RootContext, only ported to be part of TypeContainer.
11716
11717         (TypeContainer::GetInterfaceOrClass): Ditto.
11718
11719         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
11720
11721         * interface.cs (Interface::DefineInterface): New method. Does exactly
11722         what RootContext.CreateInterface did earlier, only it takes care of nested types 
11723         too.
11724
11725         (Interface::GetInterfaces): Move from RootContext here and port.
11726
11727         (Interface::GetInterfaceByName): Same here.
11728
11729         * rootcontext.cs (ResolveTree): Re-write.
11730
11731         (PopulateTypes): Re-write.
11732
11733         * class.cs (TypeContainer::Populate): Populate nested types too.
11734         (TypeContainer::Emit): Emit nested members too.
11735
11736         * typemanager.cs (AddUserType): Do not make use of the FullName property,
11737         instead just use the name argument passed in as it is already fully
11738         qualified.
11739
11740         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
11741         to TypeContainer mapping to see if a type is user-defined.
11742
11743         * class.cs (TypeContainer::CloseType): Implement. 
11744
11745         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
11746         the default constructor.
11747         
11748         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
11749         twice.
11750
11751         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
11752
11753         * interface.cs (CloseType): Create the type here.
11754         
11755         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
11756         the hierarchy.
11757
11758         Remove all the methods which are now in TypeContainer.
11759
11760 2001-10-10  Ravi Pratap  <ravi@ximian.com>
11761
11762         * delegate.cs (Define): Re-write bits to define the delegate
11763         correctly.
11764
11765 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
11766
11767         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
11768
11769         * expression.cs (ImplicitReferenceConversion): handle null as well
11770         as a source to convert to any reference type.
11771
11772         * statement.cs (Return): Perform any implicit conversions to
11773         expected return type.  
11774
11775         Validate use of return statement.  
11776
11777         * codegen.cs (EmitContext): Pass the expected return type here.
11778
11779         * class.cs (Method, Constructor, Property): Pass expected return
11780         type to EmitContext.
11781
11782 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
11783
11784         * expression.cs: Make DoResolve take an EmitContext instead of a
11785         TypeContainer.
11786
11787         Replaced `l' and `location' for `loc', for consistency.
11788         
11789         (Error, Warning): Remove unneeded Tc argument.
11790
11791         * assign.cs, literal.cs, constant.cs: Update to new calling
11792         convention. 
11793         
11794         * codegen.cs: EmitContext now contains a flag indicating whether
11795         code is being generated in a static method or not.
11796
11797         * cs-parser.jay: DecomposeQI, new function that replaces the old
11798         QualifiedIdentifier.  Now we always decompose the assembled
11799         strings from qualified_identifier productions into a group of
11800         memberaccesses.
11801
11802 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
11803
11804         * rootcontext.cs: Deal with field-less struct types correctly now
11805         by passing the size option to Define Type.
11806
11807         * class.cs: Removed hack that created one static field. 
11808
11809 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
11810
11811         * statement.cs: Moved most of the code generation here. 
11812
11813 2001-10-09  Ravi Pratap  <ravi@ximian.com>
11814
11815         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
11816         seem very right.
11817
11818         (ElementAccess): Remove useless bits for now - keep checks as the spec
11819         says.
11820
11821 2001-10-08  Ravi Pratap  <ravi@ximian.com>
11822
11823         * expression.cs (ElementAccess::DoResolve): Remove my crap code
11824         and start performing checks according to the spec.
11825
11826 2001-10-07  Ravi Pratap  <ravi@ximian.com>
11827
11828         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
11829         rank_specifiers instead.
11830
11831         (rank_specifiers): Change the order in which the rank specifiers are stored
11832
11833         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
11834
11835         * expression.cs (ElementAccess): Implement the LValue interface too.
11836         
11837 2001-10-06  Ravi Pratap  <ravi@ximian.com>
11838         
11839         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
11840         except that user defined conversions are not included.
11841
11842         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
11843         perform the conversion of the return type, if necessary.
11844
11845         (New::DoResolve): Check whether we are creating an array or an object
11846         and accordingly do the needful.
11847
11848         (New::Emit): Same here.
11849
11850         (New::DoResolve): Implement guts of array creation.
11851
11852         (New::FormLookupType): Helper function.
11853
11854 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
11855
11856         * codegen.cs: Removed most of the code generation here, and move the
11857         corresponding code generation bits to the statement classes. 
11858
11859         Added support for try/catch/finalize and throw.
11860         
11861         * cs-parser.jay: Added support for try/catch/finalize.
11862
11863         * class.cs: Catch static methods having the flags override,
11864         virtual or abstract.
11865
11866         * expression.cs (UserCast): This user cast was not really doing
11867         what it was supposed to do.  Which is to be born in fully resolved
11868         state.  Parts of the resolution were being performed at Emit time! 
11869
11870         Fixed this code.
11871
11872 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
11873
11874         * expression.cs: Implicity convert the result from UserCast.
11875
11876 2001-10-05  Ravi Pratap  <ravi@ximian.com>
11877
11878         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
11879         prevented it from working correctly. 
11880
11881         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
11882         merely ConvertImplicit.
11883
11884 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
11885
11886         * typemanager.cs: Make the LookupTypeContainer function static,
11887         and not per-instance.  
11888
11889         * class.cs: Make static FindMembers (the one that takes a Type
11890         argument). 
11891
11892         * codegen.cs: Add EmitForeach here.
11893
11894         * cs-parser.jay: Make foreach a toplevel object instead of the
11895         inline expansion, as we need to perform semantic analysis on it. 
11896
11897 2001-10-05  Ravi Pratap  <ravi@ximian.com>
11898
11899         * expression.cs (Expression::ImplicitUserConversion): Rename to
11900         UserDefinedConversion.
11901
11902         (Expression::UserDefinedConversion): Take an extra argument specifying 
11903         whether we look for explicit user conversions too.
11904
11905         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
11906
11907         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
11908
11909         (ExplicitUserConversion): Make it a call to UserDefinedConversion
11910         with the appropriate arguments.
11911
11912         * cs-parser.jay (cast_expression): Record location too.
11913
11914         * expression.cs (Cast): Record location info.
11915
11916         (Expression::ConvertExplicit): Take location argument.
11917
11918         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
11919         to determine if we are doing explicit conversions.
11920
11921         (UserCast::Emit): Update accordingly.
11922
11923         (Expression::ConvertExplicit): Report an error if everything fails.
11924
11925         * ../errors/cs0030.cs : Add.
11926
11927 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
11928
11929         * modifiers.cs: If the ABSTRACT keyword is present, also set the
11930         virtual and newslot bits. 
11931
11932         * class.cs (TypeContainer::RegisterRequiredImplementations):
11933         Record methods we need.
11934
11935         (TypeContainer::MakeKey): Helper function to make keys for
11936         MethodBases, since the Methodbase key is useless.
11937
11938         (TypeContainer::Populate): Call RegisterRequiredImplementations
11939         before defining the methods.   
11940
11941         Create a mapping for method_builders_to_methods ahead of time
11942         instead of inside a tight loop.
11943
11944         (::RequireMethods):  Accept an object as the data to set into the
11945         hashtable so we can report interface vs abstract method mismatch.
11946
11947 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
11948
11949         * report.cs: Make all of it static.
11950
11951         * rootcontext.cs: Drop object_type and value_type computations, as
11952         we have those in the TypeManager anyways.
11953
11954         Drop report instance variable too, now it is a global.
11955
11956         * driver.cs: Use try/catch on command line handling.
11957
11958         Add --probe option to debug the error reporting system with a test
11959         suite. 
11960
11961         * report.cs: Add support for exiting program when a probe
11962         condition is reached.
11963
11964 2001-10-03  Ravi Pratap  <ravi@ximian.com>
11965
11966         * expression.cs (Binary::DoNumericPromotions): Fix the case when
11967         we do a forcible conversion regardless of type, to check if 
11968         ForceConversion returns a null.
11969
11970         (Binary::error19): Use location to report error.
11971
11972         (Unary::error23): Use location here too.
11973
11974         * ../errors/cs0019.cs : Check in.
11975
11976         * ../errors/cs0023.cs : Check in.
11977
11978         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
11979         case of a non-null MethodInfo object with a length of 0 !
11980
11981         (Binary::ResolveOperator): Flag error if overload resolution fails to find
11982         an applicable member - according to the spec :-)
11983         Also fix logic to find members in base types.
11984
11985         (Unary::ResolveOperator): Same here.
11986
11987         (Unary::report23): Change name to error23 and make first argument a TypeContainer
11988         as I was getting thoroughly confused between this and error19 :-)
11989         
11990         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
11991         (::FindMostEncompassedType): Implement.
11992         (::FindMostEncompassingType): Implement.
11993         (::StandardConversionExists): Implement.
11994
11995         (UserImplicitCast): Re-vamp. We now need info about most specific
11996         source and target types so that we can do the necessary conversions.
11997
11998         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
11999         mathematical union with no duplicates.
12000
12001 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
12002
12003         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
12004         in order from base classes to child classes, so that we can in
12005         child classes look up in our parent for method names and
12006         attributes (required for handling abstract, virtual, new, override
12007         constructs: we need to instrospect our base class, and if we dont
12008         populate the classes in order, the introspection might be
12009         incorrect.  For example, a method could query its parent before
12010         the parent has any methods and would determine that the parent has
12011         no abstract methods (while it could have had them)).
12012
12013         (RootContext::CreateType): Record the order in which we define the
12014         classes.
12015
12016 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
12017
12018         * class.cs (TypeContainer::Populate): Also method definitions can
12019         fail now, keep track of this.
12020
12021         (TypeContainer::FindMembers): Implement support for
12022         DeclaredOnly/noDeclaredOnly flag.
12023
12024         (Constructor::Emit) Return the ConstructorBuilder.
12025
12026         (Method::Emit) Return the MethodBuilder. 
12027         Check for abstract or virtual methods to be public.
12028
12029         * rootcontext.cs (RootContext::CreateType): Register all the
12030         abstract methods required for the class to be complete and the
12031         interface methods that must be implemented. 
12032
12033         * cs-parser.jay: Report error 501 (method requires body if it is
12034         not marked abstract or extern).
12035
12036         * expression.cs (TypeOf::Emit): Implement.
12037
12038         * typemanager.cs: runtime_handle_type, new global type.
12039
12040         * class.cs (Property::Emit): Generate code for properties.
12041
12042 2001-10-02  Ravi Pratap  <ravi@ximian.com>
12043
12044         * expression.cs (Unary::ResolveOperator): Find operators on base type
12045         too - we now conform exactly to the spec.
12046
12047         (Binary::ResolveOperator): Same here.
12048
12049         * class.cs (Operator::Define): Fix minor quirk in the tests.
12050
12051         * ../errors/cs0215.cs : Added.
12052
12053         * ../errors/cs0556.cs : Added.
12054
12055         * ../errors/cs0555.cs : Added.
12056
12057 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
12058
12059         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
12060         single integer which is really efficient
12061
12062 2001-10-01  Ravi Pratap  <ravi@ximian.com>
12063
12064         *  expression.cs (Expression::ImplicitUserConversion): Use location
12065         even in the case when we are examining True operators.
12066  
12067         * class.cs (Operator::Define): Perform extensive checks to conform
12068         with the rules for operator overloading in the spec.
12069
12070         * expression.cs (Expression::ImplicitReferenceConversion): Implement
12071         some of the other conversions mentioned in the spec.
12072
12073         * typemanager.cs (array_type): New static member for the System.Array built-in
12074         type.
12075
12076         (cloneable_interface): For System.ICloneable interface.
12077
12078         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
12079         we start resolving the tree and populating types.
12080
12081         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
12082  
12083 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
12084
12085         * expression.cs (Expression::ExprClassFromMemberInfo,
12086         Expression::Literalize): Create literal expressions from
12087         FieldInfos which are literals.
12088
12089         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
12090         type casts, because they were wrong.  The test suite in tests
12091         caught these ones.
12092
12093         (ImplicitNumericConversion): ushort to ulong requires a widening
12094         cast. 
12095
12096         Int32 constant to long requires widening cast as well.
12097
12098         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
12099         for integers because the type on the stack is not i4.
12100
12101 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
12102
12103         * expression.cs (report118): require location argument. 
12104
12105         * parameter.cs: Do not dereference potential null value.
12106
12107         * class.cs: Catch methods that lack the `new' keyword when
12108         overriding a name.  Report warnings when `new' is used without
12109         anything being there to override.
12110
12111         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
12112
12113         * class.cs: Only add constructor to hashtable if it is non-null
12114         (as now constructors can fail on define).
12115
12116         (TypeManager, Class, Struct): Take location arguments.
12117
12118         Catch field instance initialization in structs as errors.
12119
12120         accepting_filter: a new filter for FindMembers that is static so
12121         that we dont create an instance per invocation.
12122
12123         (Constructor::Define): Catch errors where a struct constructor is
12124         parameterless 
12125
12126         * cs-parser.jay: Pass location information for various new
12127         constructs. 
12128         
12129         * delegate.cs (Delegate): take a location argument.
12130
12131         * driver.cs: Do not call EmitCode if there were problesm in the
12132         Definition of the types, as many Builders wont be there. 
12133
12134         * decl.cs (Decl::Decl): Require a location argument.
12135
12136         * cs-tokenizer.cs: Handle properly hex constants that can not fit
12137         into integers, and find the most appropiate integer for it.
12138
12139         * literal.cs: Implement ULongLiteral.
12140
12141         * rootcontext.cs: Provide better information about the location of
12142         failure when CreateType fails.
12143         
12144 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
12145
12146         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
12147         as well.
12148
12149         * expression.cs (Binary::CheckShiftArguments): Add missing type
12150         computation.
12151         (Binary::ResolveOperator): Add type to the logical and and logical
12152         or, Bitwise And/Or and Exclusive Or code paths, it was missing
12153         before.
12154
12155         (Binary::DoNumericPromotions): In the case where either argument
12156         is ulong (and most signed types combined with ulong cause an
12157         error) perform implicit integer constant conversions as well.
12158
12159 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
12160
12161         * expression.cs (UserImplicitCast): Method should always be
12162         non-null. 
12163         (Invocation::BetterConversion): Simplified test for IntLiteral.
12164
12165         (Expression::ImplicitNumericConversion): Split this routine out.
12166         Put the code that performs implicit constant integer conversions
12167         here. 
12168
12169         (Expression::Resolve): Become a wrapper around DoResolve so we can
12170         check eclass and type being set after resolve.
12171
12172         (Invocation::Badness): Remove this dead function
12173
12174         (Binary::ResolveOperator): Do not compute the expensive argumnets
12175         unless we have a union for it.
12176
12177         (Probe::Emit): Is needs to do an isinst and then
12178         compare against null.
12179
12180         (::CanConvert): Added Location argument.  If the Location argument
12181         is null (Location.Null), then we do not report errors.  This is
12182         used by the `probe' mechanism of the Explicit conversion.  We do
12183         not want to generate an error for something that the user
12184         explicitly requested to be casted.  But the pipeline for an
12185         explicit cast first tests for potential implicit casts.
12186
12187         So for now, if the Location is null, it means `Probe only' to
12188         avoid adding another argument.   Might have to revise this
12189         strategy later.
12190
12191         (ClassCast): New class used to type cast objects into arbitrary
12192         classes (used in Explicit Reference Conversions).
12193
12194         Implement `as' as well.
12195
12196         Reverted all the patches from Ravi below: they were broken:
12197
12198                 * The use of `level' as a mechanism to stop recursive
12199                   invocations is wrong.  That was there just to catch the
12200                   bug with a strack trace but not as a way of addressing
12201                   the problem.
12202
12203                   To fix the problem we have to *understand* what is going
12204                   on and the interactions and come up with a plan, not
12205                   just get things going.
12206
12207                 * The use of the type conversion cache that I proposed
12208                   last night had an open topic: How does this work across
12209                   protection domains.  A user defined conversion might not
12210                   be public in the location where we are applying the
12211                   conversion, a different conversion might be selected
12212                   (ie, private A->B (better) but public B->A (worse),
12213                   inside A, A->B applies, but outside it, B->A will
12214                   apply).
12215
12216                 * On top of that (ie, even if the above is solved),
12217                   conversions in a cache need to be abstract.  Ie, `To
12218                   convert from an Int to a Short use an OpcodeCast', not
12219                   `To convert from an Int to a Short use the OpcodeCast on
12220                   the variable 5' (which is what this patch was doing).
12221         
12222 2001-09-28  Ravi Pratap  <ravi@ximian.com>
12223
12224         * expression.cs (Invocation::ConversionExists): Re-write to use
12225         the conversion cache
12226         
12227         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
12228         cache all conversions done, not just user-defined ones.
12229
12230         (Invocation::BetterConversion): The real culprit. Use ConversionExists
12231         to determine if a conversion exists instead of acutually trying to 
12232         perform the conversion. It's faster too.
12233
12234         (Expression::ConvertExplicit): Modify to use ConversionExists to check
12235         and only then attempt the implicit conversion.
12236
12237 2001-09-28  Ravi Pratap  <ravi@ximian.com>
12238
12239         * expression.cs (ConvertImplicit): Use a cache for conversions
12240         already found. Check level of recursion and bail out if necessary.
12241         
12242 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
12243
12244         * typemanager.cs (string_concat_string_string, string_concat_object_object):
12245         Export standard methods that we expect for string operations.
12246         
12247         * statement.cs (Block::UsageWarning): Track usage of variables and
12248         report the errors for not used variables.
12249
12250         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
12251         operator. 
12252
12253 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
12254
12255         * codegen.cs: remove unnneded code 
12256
12257         * expression.cs: Removed BuiltinTypeAccess class
12258
12259         Fix the order in which implicit conversions are
12260         done.  
12261
12262         The previous fixed dropped support for boxed conversions (adding a
12263         test to the test suite now)
12264
12265         (UserImplicitCast::CanConvert): Remove test for source being null,
12266         that code is broken.  We should not feed a null to begin with, if
12267         we do, then we should track the bug where the problem originates
12268         and not try to cover it up here.
12269
12270         Return a resolved expression of type UserImplicitCast on success
12271         rather than true/false.  Ravi: this is what I was talking about,
12272         the pattern is to use a static method as a "constructor" for
12273         objects. 
12274
12275         Also, do not create arguments until the very last minute,
12276         otherwise we always create the arguments even for lookups that
12277         will never be performed. 
12278
12279         (UserImplicitCast::Resolve): Eliminate, objects of type
12280         UserImplicitCast are born in a fully resolved state. 
12281         
12282         * typemanager.cs (InitCoreTypes): Init also value_type
12283         (System.ValueType). 
12284
12285         * expression.cs (Cast::Resolve): First resolve the child expression.
12286
12287         (LValue): Add new method AddressOf to be used by
12288         the `&' operator.  
12289
12290         Change the argument of Store to take an EmitContext instead of an
12291         ILGenerator, because things like FieldExpr need to be able to call
12292         their children expression to generate the instance code. 
12293
12294         (Expression::Error, Expression::Warning): Sugar functions for
12295         reporting errors.
12296
12297         (Expression::MemberLookup): Accept a TypeContainer instead of a
12298         Report as the first argument.
12299
12300         (Expression::ResolvePrimary): Killed.  I still want to improve
12301         this as currently the code is just not right.
12302
12303         (Expression::ResolveMemberAccess): Simplify, but it is still
12304         wrong. 
12305
12306         (Unary::Resolve): Catch errors in AddressOf operators.
12307
12308         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
12309         index to a byte for the short-version, or the compiler will choose
12310         the wrong Emit call, which generates the wrong data.
12311
12312         (ParameterReference::Emit, ::Store): same.
12313
12314         (FieldExpr::AddressOf): Implement.
12315         
12316         * typemanager.cs: TypeManager: made public variable instead of
12317         property.
12318         
12319         * driver.cs: document --fatal.
12320
12321         * report.cs (ErrorMessage, WarningMessage): new names for the old
12322         Error and Warning classes.
12323
12324         * cs-parser.jay (member_access): Turn built-in access to types
12325         into a normal simplename
12326
12327 2001-09-27  Ravi Pratap  <ravi@ximian.com>
12328
12329         * expression.cs (Invocation::BetterConversion): Fix to cope
12330         with q being null, since this was introducing a bug.
12331
12332         * expression.cs (ConvertImplicit): Do built-in conversions first.
12333
12334 2001-09-27  Ravi Pratap  <ravi@ximian.com>
12335
12336         * expression.cs (UserImplicitCast::Resolve): Fix bug.
12337
12338 2001-09-27  Ravi Pratap  <ravi@ximian.com>
12339
12340         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
12341         I had introduced long ago (what's new ?).
12342
12343         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
12344         the work of all the checking. 
12345         (ConvertImplicit): Call CanConvert and only then create object if necessary.
12346         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
12347
12348         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
12349         that is the right way. 
12350
12351         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
12352         overloading resolution. Use everywhere instead of cutting and pasting code.
12353
12354         (Binary::ResolveOperator): Use MakeUnionSet.
12355
12356         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
12357         we have to convert to bool types. Not complete yet.
12358         
12359 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
12360
12361         * typemanager.cs (TypeManager::CSharpName): support ushort.
12362
12363         * expression.cs (Expression::TryImplicitIntConversion): Attempts
12364         to provide an expression that performsn an implicit constant int
12365         conversion (section 6.1.6).
12366         (Expression::ConvertImplicitRequired): Reworked to include
12367         implicit constant expression conversions.
12368
12369         (Expression::ConvertNumericExplicit): Finished.
12370
12371         (Invocation::Emit): If InstanceExpression is null, then it means
12372         that we perform a call on this.
12373         
12374 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
12375
12376         * expression.cs (Unary::Emit): Remove some dead code.
12377         (Probe): Implement Resolve and Emit for `is'.
12378         (Expression::ConvertImplicitRequired): Attempt to do constant
12379         expression conversions here.  Maybe should be moved to
12380         ConvertImplicit, but I am not sure.
12381         (Expression::ImplicitLongConstantConversionPossible,
12382         Expression::ImplicitIntConstantConversionPossible): New functions
12383         that tell whether is it possible to apply an implicit constant
12384         expression conversion.
12385
12386         (ConvertNumericExplicit): Started work on explicit numeric
12387         conversions.
12388
12389         * cs-parser.jay: Update operator constants.
12390
12391         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
12392         (Parameters::GetSignature): Hook up VerifyArgs here.
12393         (Parameters::VerifyArgs): Verifies that no two arguments have the
12394         same name. 
12395
12396         * class.cs (Operator): Update the operator names to reflect the
12397         ones that the spec expects (as we are just stringizing the
12398         operator names).
12399         
12400         * expression.cs (Unary::ResolveOperator): Fix bug: Use
12401         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
12402         previous usage did only work for our methods.
12403         (Expression::ConvertImplicit): Handle decimal implicit numeric
12404         conversions as well.
12405         (Expression::InternalTypeConstructor): Used to invoke constructors
12406         on internal types for default promotions.
12407
12408         (Unary::Emit): Implement special handling for the pre/post
12409         increment/decrement for overloaded operators, as they need to have
12410         the same semantics as the other operators.
12411
12412         (Binary::ResolveOperator): ditto.
12413         (Invocation::ConversionExists): ditto.
12414         (UserImplicitCast::Resolve): ditto.
12415         
12416 2001-09-26  Ravi Pratap  <ravi@ximian.com>
12417
12418         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
12419         operator, return after emitting body. Regression tests pass again !
12420
12421         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
12422         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
12423         (Invocation::OverloadResolve): Ditto.
12424         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
12425
12426         * everywhere : update calls to the above methods accordingly.
12427
12428 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
12429
12430         * assign.cs (Assign): Make it inherit from ExpressionStatement.
12431
12432         * expression.cs (ExpressionStatement): New base class used for
12433         expressions that can appear in statements, so that we can provide
12434         an alternate path to generate expression that do not leave a value
12435         on the stack.
12436
12437         (Expression::Emit, and all the derivatives): We no longer return
12438         whether a value is left on the stack or not.  Every expression
12439         after being emitted leaves a single value on the stack.
12440
12441         * codegen.cs (EmitContext::EmitStatementExpression): Use the
12442         facilties of ExpressionStatement if possible.
12443
12444         * cs-parser.jay: Update statement_expression.
12445
12446 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
12447
12448         * driver.cs: Change the wording of message
12449
12450 2001-09-25  Ravi Pratap  <ravi@ximian.com>
12451
12452         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
12453         the type of the expression to the return type of the method if
12454         we have an overloaded operator match ! The regression tests pass again !
12455         (Unary::ResolveOperator): Ditto.
12456
12457         * expression.cs (Invocation::ConversionExists): Correct the member lookup
12458         to find "op_Implicit", not "implicit" ;-)
12459         (UserImplicitCast): New class to take care of user-defined implicit conversions.
12460         (ConvertImplicit, ForceConversion): Take TypeContainer argument
12461
12462         * everywhere : Correct calls to the above accordingly.
12463
12464         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
12465         (ConvertImplicit): Do user-defined conversion if it exists.
12466
12467 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
12468
12469         * assign.cs: track location.
12470         (Resolve): Use implicit conversions on assignment.
12471
12472         * literal.cs: Oops.  Not good, Emit of short access values should
12473         pass (Bytes) or the wrong argument will be selected.
12474
12475         * expression.cs (Unary::Emit): Emit code for -expr.
12476         
12477         (Unary::ResolveOperator): Handle `Substract' for non-constants
12478         (substract from zero from the non-constants).
12479         Deal with Doubles as well. 
12480         
12481         (Expression::ConvertImplicitRequired): New routine that reports an
12482         error if no implicit conversion exists. 
12483
12484         (Invocation::OverloadResolve): Store the converted implicit
12485         expressions if we make them
12486         
12487 2001-09-24  Ravi Pratap  <ravi@ximian.com>
12488
12489         * class.cs (ConstructorInitializer): Take a Location argument.
12490         (ConstructorBaseInitializer): Same here.
12491         (ConstructorThisInitializer): Same here.
12492
12493         * cs-parser.jay : Update all calls accordingly.
12494
12495         * expression.cs (Unary, Binary, New): Take location argument.
12496         Update accordingly everywhere.
12497
12498         * cs-parser.jay : Update all calls to the above to take a location
12499         argument.
12500
12501         * class.cs : Ditto.
12502
12503 2001-09-24  Ravi Pratap  <ravi@ximian.com>
12504
12505         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
12506         (Invocation::BetterConversion): Same here
12507         (Invocation::ConversionExists): Ditto.
12508
12509         (Invocation::ConversionExists): Implement.
12510
12511 2001-09-22  Ravi Pratap  <ravi@ximian.com>
12512
12513         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
12514         Also take an additional TypeContainer argument.
12515
12516         * All over : Pass in TypeContainer as argument to OverloadResolve.
12517
12518         * typemanager.cs (CSharpName): Update to check for the string type and return
12519         that too.
12520
12521         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
12522         a given method.
12523         
12524 2001-09-21  Ravi Pratap  <ravi@ximian.com>
12525
12526         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
12527         (Invocation::BetterFunction): Implement.
12528         (Invocation::BetterConversion): Implement.
12529         (Invocation::ConversionExists): Skeleton, no implementation yet.
12530
12531         Okay, things work fine !
12532
12533 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
12534
12535         * typemanager.cs: declare and load enum_type, delegate_type and
12536         void_type. 
12537
12538         * expression.cs (Expression::Emit): Now emit returns a value that
12539         tells whether a value is left on the stack or not.  This strategy
12540         might be reveted tomorrow with a mechanism that would address
12541         multiple assignments.
12542         (Expression::report118): Utility routine to report mismatches on
12543         the ExprClass.
12544
12545         (Unary::Report23): Report impossible type/operator combination
12546         utility function.
12547
12548         (Unary::IsIncrementableNumber): Whether the type can be
12549         incremented or decremented with add.
12550         (Unary::ResolveOperator): Also allow enumerations to be bitwise
12551         complemented. 
12552         (Unary::ResolveOperator): Implement ++, !, ~,
12553
12554         (Invocation::Emit): Deal with new Emit convetion.
12555         
12556         * All Expression derivatives: Updated their Emit method to return
12557         whether they leave values on the stack or not.
12558         
12559         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
12560         stack for expressions that are statements. 
12561
12562 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
12563
12564         * expression.cs (LValue): New interface.  Must be implemented by
12565         LValue objects.
12566         (LocalVariableReference, ParameterReference, FieldExpr): Implement
12567         LValue interface.
12568         
12569         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
12570         interface for generating code, simplifies the code.
12571
12572 2001-09-20  Ravi Pratap  <ravi@ximian.com>
12573
12574         * expression.cs (everywhere): Comment out return statements in ::Resolve
12575         methods to avoid the warnings.
12576
12577 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
12578
12579         * driver.cs (parse): Report error 2001 if we can not open the
12580         source file.
12581
12582         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
12583         not resolve it.
12584
12585         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
12586         object. 
12587
12588         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
12589         otherwise nested blocks end up with the same index.
12590
12591         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
12592
12593         * expression.cs:  Instead of having FIXMEs in the Resolve
12594         functions, throw exceptions so it is obvious that we are facing a
12595         bug. 
12596
12597         * cs-parser.jay (invocation_expression): Pass Location information.
12598
12599         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
12600         Use a basename for those routines because .NET does not like paths
12601         on them. 
12602
12603         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
12604         already defined.
12605
12606 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
12607
12608         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
12609         are loading the correct data types (throws an exception if not).
12610         (TypeManager::InitCoreTypes): Use CoreLookupType
12611
12612         * expression.cs (Unary::ResolveOperator): return the child
12613         expression for expressions which are just +expr.
12614         (Unary::ResolveOperator): Return negative literals for -LITERAL
12615         expressions (otherwise they are Unary {Literal}).
12616         (Invocation::Badness): Take into account `Implicit constant
12617         expression conversions'.
12618
12619         * literal.cs (LongLiteral): Implement long literal class.
12620         (IntLiteral): export the `Value' of the intliteral. 
12621
12622 2001-09-19  Ravi Pratap  <ravi@ximian.com>
12623
12624         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
12625
12626         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
12627         instead of 'Operator'
12628
12629         * expression.cs (Binary::ResolveOperator): Update accordingly.
12630         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
12631         and 'Minus'
12632
12633         * cs-parser.jay (unary_expression): Update to use the new names.
12634
12635         * gen-treedump.cs (GetUnary): Same here.
12636
12637         * expression.cs (Unary::Resolve): Implement.
12638         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
12639         operators are found instead of making noise ;-)
12640         (Unary::ResolveOperator): New method to do precisely the same thing which
12641         Binary::ResolveOperator does for Binary expressions.
12642         (Unary.method, .Arguments): Add.
12643         (Unary::OperName): Implement.   
12644         (Unary::ForceConversion): Copy and Paste !
12645
12646         * class.cs (Operator::Define): Fix a small bug for the case when we have 
12647         a unary operator.
12648
12649         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
12650         for the inbuilt operators. Only overloading works for now ;-)
12651
12652 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
12653
12654         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
12655         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
12656
12657         * expression.cs (This::Emit): Implement. 
12658         (This::Resolve): Implement.
12659         (TypeOf:Resolve): Implement.
12660         (Expression::ResolveSimpleName): Add an implicit this to instance
12661         field references. 
12662         (MemberAccess::Resolve): Deal with Parameters and Fields. 
12663         Bind instance variable to Field expressions.
12664         (FieldExpr::Instance): New field used to track the expression that
12665         represents the object instance.
12666         (FieldExpr::Resolve): Track potential errors from MemberLookup not
12667         binding 
12668         (FieldExpr::Emit): Implement.
12669
12670         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
12671         the last instruction contains a return opcode to avoid generating
12672         the last `ret' instruction (this generates correct code, and it is
12673         nice to pass the peverify output).
12674
12675         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
12676         initializer for static and instance variables.
12677         (Constructor::Emit): Allow initializer to be null in the case of
12678         static constructors.  Only emit initializer for instance
12679         constructors. 
12680
12681         (TypeContainer::FindMembers): Return a null array if there are no
12682         matches.
12683
12684         Also fix the code for the MemberTypes.Method branch, as it was not
12685         scanning that for operators (or tried to access null variables before).
12686
12687         * assign.cs (Assign::Emit): Handle instance and static fields. 
12688
12689         * TODO: Updated.
12690
12691         * driver.cs: Stop compilation if there are parse errors.
12692
12693         * cs-parser.jay (constructor_declaration): Provide default base
12694         initializer for non-static constructors.
12695         (constructor_declarator): Do not provide a default base
12696         initializers if none was specified.
12697         Catch the fact that constructors should not have parameters.
12698
12699         * class.cs: Do not emit parent class initializers for static
12700         constructors, that should be flagged as an error.
12701
12702 2001-09-18  Ravi Pratap  <ravi@ximian.com>
12703
12704         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
12705         Move back code into TypeContainer::Populate.
12706
12707 2001-09-18  Ravi Pratap  <ravi@ximian.com>
12708
12709         * class.cs (TypeContainer::AddConstructor): Fix the check to
12710         compare against Name, not Basename. 
12711         (Operator::OpType): Change Plus and Minus to Add and Subtract.
12712
12713         * cs-parser.jay : Update accordingly.
12714
12715         * class.cs (TypeContainer::FindMembers): For the case where we are searching
12716         for methods, don't forget to look into the operators too.
12717         (RegisterMethodBuilder): Helper method to take care of this for
12718         methods, constructors and operators.
12719         (Operator::Define): Completely revamp.
12720         (Operator.OperatorMethod, MethodName): New fields.
12721         (TypeContainer::Populate): Move the registering of builders into
12722         RegisterMethodBuilder.
12723         (Operator::Emit): Re-write.
12724
12725         * expression.cs (Binary::Emit): Comment out code path to emit method
12726         invocation stuff for the case when we have a user defined operator. I am
12727         just not able to get it right !
12728         
12729 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
12730
12731         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
12732         argument. 
12733
12734         (Expression::MemberLookup): Provide a version that allows to
12735         specify the MemberTypes and BindingFlags. 
12736
12737         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
12738         so it was not fetching variable information from outer blocks.
12739
12740         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
12741         Beforefieldinit as it was buggy.
12742
12743         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
12744         that Ravi put here.  
12745
12746         * class.cs (Constructor::Emit): Only emit if block is not null.
12747         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
12748         deal with this by semantically definining it as if the user had
12749         done it.
12750
12751         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
12752         constructors as we now "emit" them at a higher level.
12753
12754         (TypeContainer::DefineDefaultConstructor): Used to define the
12755         default constructors if none was provided.
12756
12757         (ConstructorInitializer): Add methods Resolve and Emit. 
12758         
12759         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
12760
12761 2001-09-17  Ravi Pratap  <ravi@ximian.com>
12762
12763         * class.cs (TypeContainer::EmitDefaultConstructor): Register
12764         the default constructor builder with our hashtable for methodbuilders
12765         to methodcores.
12766
12767         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
12768         and argument_count is 0 in which case we have a match.
12769         (Binary::ResolveOperator): More null checking and miscellaneous coding
12770         style cleanup.
12771
12772 2001-09-17  Ravi Pratap  <ravi@ximian.com>
12773
12774         * rootcontext.cs (IsNameSpace): Compare against null.
12775
12776         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
12777
12778         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
12779         and Unary::Operator.
12780
12781         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
12782         accordingly.
12783
12784         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
12785         we have overloaded operators.
12786         (Binary::ResolveOperator): Implement the part which does the operator overload
12787         resolution.
12788
12789         * class.cs (Operator::Emit): Implement.
12790         (TypeContainer::Emit): Emit the operators we have too.
12791
12792         * expression.cs (Binary::Emit): Update to emit the appropriate code for
12793         the case when we have a user-defined operator.
12794         
12795 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
12796
12797         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
12798
12799 2001-09-16  Ravi Pratap  <ravi@ximian.com>
12800
12801         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
12802         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
12803         (Constructor::Emit): Implement.
12804         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
12805         if we have no work to do. 
12806         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
12807         Emit method.
12808
12809         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
12810         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
12811
12812         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
12813         of parent.parent.
12814
12815 2001-09-15  Ravi Pratap  <ravi@ximian.com>
12816
12817         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
12818         in the source.
12819         (Tree::RecordNamespace): Method to do what the name says ;-)
12820         (Tree::Namespaces): Property to get at the namespaces hashtable.
12821
12822         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
12823         keep track.
12824
12825         * rootcontext.cs (IsNamespace): Fixed it :-)
12826
12827 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
12828
12829         * class.cs (TypeContainer::FindMembers): Add support for
12830         constructors. 
12831         (MethodCore): New class that encapsulates both the shared aspects
12832         of a Constructor and a Method.  
12833         (Method, Constructor): Factored pieces into MethodCore.
12834
12835         * driver.cs: Added --fatal which makes errors throw exceptions.
12836         Load System assembly as well as part of the standard library.
12837
12838         * report.cs: Allow throwing exceptions on errors for debugging.
12839
12840         * modifiers.cs: Do not use `parent', instead use the real type
12841         container to evaluate permission settings.
12842
12843         * class.cs: Put Ravi's patch back in.  He is right, and we will
12844         have to cope with the
12845
12846 2001-09-14  Ravi Pratap  <ravi@ximian.com>
12847
12848         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
12849         FamORAssem, not FamANDAssem.
12850         
12851 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
12852
12853         * driver.cs: Added --parse option that only parses its input files
12854         and terminates.
12855
12856         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
12857         incorrect.  IsTopLevel is not used to tell whether an object is
12858         root_types or not (that can be achieved by testing this ==
12859         root_types).  But to see if this is a top-level *class* (not
12860         necessarly our "toplevel" container). 
12861
12862 2001-09-14  Ravi Pratap  <ravi@ximian.com>
12863
12864         * enum.cs (Enum::Define): Modify to call the Lookup method on the
12865         parent instead of a direct call to GetType.
12866
12867 2001-09-14  Ravi Pratap  <ravi@ximian.com>
12868
12869         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
12870         Modifiers.TypeAttr. This should just be a call to that method.
12871
12872         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
12873         object so that we can determine if we are top-level or not.
12874
12875         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
12876         TypeContainer too.
12877
12878         * enum.cs (Enum::Define): Ditto.
12879
12880         * modifiers.cs (FieldAttr): Re-write.
12881
12882         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
12883         (TypeContainer::HaveStaticConstructor): New property to provide access
12884         to precisely that info.
12885
12886         * modifiers.cs (MethodAttr): Re-write.
12887         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
12888
12889         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
12890         of top-level types as claimed.
12891         
12892 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
12893
12894         * expression.cs (MemberLookup): Fruitless attempt to lookup
12895         constructors.  Maybe I need to emit default constructors?  That
12896         might be it (currently .NET emits this for me automatically).
12897         (Invocation::OverloadResolve): Cope with Arguments == null.
12898         (Invocation::EmitArguments): new function, shared by the new
12899         constructor and us.
12900         (Invocation::Emit): Handle static and instance methods.  Emit
12901         proper call instruction for virtual or non-virtual invocations.
12902         (New::Emit): Implement.
12903         (New::Resolve): Implement.
12904         (MemberAccess:Resolve): Implement.
12905         (MethodGroupExpr::InstanceExpression): used conforming to the spec
12906         to track instances.
12907         (FieldExpr::Resolve): Set type.
12908
12909         * support.cs: Handle empty arguments.
12910                 
12911         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
12912         SimpleLookup): Auxiliary routines to help parse a qualifier
12913         identifier.  
12914
12915         Update qualifier_identifier rule.
12916
12917         * codegen.cs: Removed debugging messages.
12918
12919         * class.cs: Make this a global thing, this acts just as a "key" to
12920         objects that we might have around.
12921
12922         (Populate): Only initialize method_builders_to_methods once.
12923
12924         * expression.cs (PropertyExpr): Initialize type from the
12925         PropertyType. 
12926
12927         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
12928         Resolve pattern.  Attempt to implicitly convert value to boolean.
12929         Emit code.
12930
12931         * expression.cs: Set the type for the int32/int32 argument case.
12932         (Binary::ResolveOperator): Set the return type to boolean for
12933         comparission operators
12934
12935         * typemanager.cs: Remove debugging print code.
12936
12937         (Invocation::Resolve): resolve type.
12938
12939         * class.cs: Allocate a MemberInfo of the correct size, as the code
12940         elsewhere depends on the test to reflect the correct contents.
12941
12942         (Method::) Keep track of parameters, due to System.Reflection holes
12943
12944         (TypeContainer::Populate): Keep track of MethodBuilders to Method
12945         mapping here.
12946
12947         (TypeContainer::FindMembers): Use ArrayList and then copy an array
12948         of the exact size and return that.
12949
12950         (Class::LookupMethodByBuilder): New function that maps
12951         MethodBuilders to its methods.  Required to locate the information
12952         on methods because System.Reflection bit us again.
12953
12954         * support.cs: New file, contains an interface ParameterData and
12955         two implementations: ReflectionParameters and InternalParameters
12956         used to access Parameter information.  We will need to grow this
12957         as required.
12958
12959         * expression.cs (Invocation::GetParameterData): implement a cache
12960         and a wrapper around the ParameterData creation for methods. 
12961         (Invocation::OverloadResolve): Use new code.
12962
12963 2001-09-13  Ravi Pratap  <ravi@ximian.com>
12964
12965         * class.cs (TypeContainer::EmitField): Remove and move into 
12966         (Field::Define): here and modify accordingly.
12967         (Field.FieldBuilder): New member.
12968         (TypeContainer::Populate): Update accordingly.
12969         (TypeContainer::FindMembers): Implement.
12970
12971 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
12972
12973         * statement.cs: (VariableInfo::VariableType): New field to be
12974         initialized with the full type once it is resolved. 
12975
12976 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
12977
12978         * parameter.cs (GetParameterInfo): Use a type cache to compute
12979         things only once, and to reuse this information
12980
12981         * expression.cs (LocalVariableReference::Emit): Implement.
12982         (OpcodeCast::Emit): fix.
12983
12984         (ParameterReference::Resolve): Implement.
12985         (ParameterReference::Emit): Implement.
12986
12987         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
12988         that are expressions need to stay as Expressions.
12989
12990         * typemanager.cs (CSharpName): Returns the C# name of a type if
12991         possible. 
12992
12993         * expression.cs (Expression::ConvertImplicit): New function that
12994         implements implicit type conversions.
12995
12996         (Expression::ImplicitReferenceConversion): Implements implicit
12997         reference conversions.
12998
12999         (EmptyCast): New type for transparent casts.
13000
13001         (OpcodeCast): New type for casts of types that are performed with
13002         a sequence of bytecodes.
13003         
13004         (BoxedCast): New type used for casting value types into reference
13005         types.  Emits a box opcode.
13006
13007         (Binary::DoNumericPromotions): Implements numeric promotions of
13008         and computation of the Binary::Type.
13009
13010         (Binary::EmitBranchable): Optimization.
13011
13012         (Binary::Emit): Implement code emission for expressions.
13013         
13014         * typemanager.cs (TypeManager): Added two new core types: sbyte
13015         and byte.
13016
13017 2001-09-12  Ravi Pratap  <ravi@ximian.com>
13018
13019         * class.cs (TypeContainer::FindMembers): Method which does exactly
13020         what Type.FindMembers does, only we don't have to use reflection. No
13021         implementation yet.
13022
13023         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
13024         typecontainer objects as we need to get at them.
13025         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
13026
13027         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
13028         typecontainer object.
13029
13030         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
13031         of just a Report object.
13032
13033 2001-09-11  Ravi Pratap  <ravi@ximian.com>
13034
13035         * class.cs (Event::Define): Go back to using the prefixes "add_" and
13036         "remove_"
13037         (TypeContainer::Populate): Now define the delegates of the type too.
13038         (TypeContainer.Delegates): Property to access the list of delegates defined
13039         in the type.
13040
13041         * delegates.cs (Delegate::Define): Implement partially.
13042
13043         * modifiers.cs (TypeAttr): Handle more flags.
13044
13045 2001-09-11  Ravi Pratap  <ravi@ximian.com>
13046
13047         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
13048         and not <=
13049         (Operator::Define): Re-write logic to get types by using the LookupType method
13050         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
13051         (Indexer::Define): Ditto.
13052         (Event::Define): Ditto.
13053         (Property::Define): Ditto.
13054         
13055 2001-09-10  Ravi Pratap  <ravi@ximian.com>
13056
13057         * class.cs (TypeContainer::Populate): Now define operators too. 
13058         (TypeContainer.Operators): New property to access the list of operators
13059         in a type.
13060         (Operator.OperatorMethodBuilder): New member to hold the method builder
13061         for the operator we are defining.
13062         (Operator::Define): Implement.
13063
13064 2001-09-10  Ravi Pratap  <ravi@ximian.com>
13065
13066         * class.cs (Event::Define): Make the prefixes of the accessor methods
13067         addOn_ and removeOn_ 
13068
13069         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
13070         of the location being passed in too. Ideally, this should go later since all
13071         error reporting should be done through the Report object.
13072
13073         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
13074         (Populate): Iterate thru the indexers we have and define them too.
13075         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
13076         for the get and set accessors.
13077         (Indexer::Define): Implement.
13078         
13079 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
13080
13081         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
13082         my previous implementation, did not work.
13083
13084         * typemanager.cs: Add a couple of missing types (the longs).
13085
13086         * literal.cs: Use TypeManager.bool_type instead of getting it.
13087
13088         * expression.cs (EventExpr): New kind of expressions.
13089         (Expressio::ExprClassFromMemberInfo): finish
13090
13091 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
13092
13093         * assign.cs: Emit stores to static fields differently.
13094
13095 2001-09-08  Ravi Pratap  <ravi@ximian.com>
13096
13097         * Merge in changes and adjust code to tackle conflicts. Backed out my
13098         code in Assign::Resolve ;-) 
13099
13100 2001-09-08  Ravi Pratap  <ravi@ximian.com>
13101
13102         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
13103         instead Report.Error and also pass in the location.
13104         (CSharpParser::Lexer): New readonly property to return the reference
13105         to the Tokenizer object.
13106         (declare_local_variables): Use Report.Error with location instead of plain 
13107         old error.
13108         (CheckDef): Ditto.
13109
13110         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
13111         (Operator.CheckBinaryOperator): Ditto.
13112
13113         * cs-parser.jay (operator_declarator): Update accordingly.
13114
13115         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
13116         (CheckBinaryOperator): Same here.
13117
13118         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
13119         on the name without any prefixes of namespace names etc. This is because we
13120         already might have something already fully qualified like 
13121         'System.Console.WriteLine'
13122
13123         * assign.cs (Resolve): Begin implementation. Stuck ;-)
13124
13125 2001-09-07  Ravi Pratap  <ravi@ximian.com>
13126
13127         * cs-tokenizer.cs (location): Return a string which also contains
13128         the file name.
13129
13130         * expression.cs (ElementAccess): New class for expressions of the
13131         type 'element access.'
13132         (BaseAccess): New class for expressions of the type 'base access.'
13133         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
13134         respectively.
13135         
13136         * cs-parser.jay (element_access): Implement action.
13137         (base_access): Implement actions.
13138         (checked_expression, unchecked_expression): Implement.
13139
13140         * cs-parser.jay (local_variable_type): Correct and implement.
13141         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
13142
13143         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
13144
13145         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
13146         name and the specifiers.
13147
13148         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
13149         
13150         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
13151         making them all public ;-)
13152
13153         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
13154         class anyways.
13155         
13156 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
13157
13158         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
13159         PropertyExprs.
13160         (FieldExpr, PropertyExprs): New resolved expressions.
13161         (SimpleName::MemberStaticCheck): Perform static checks for access
13162         to non-static fields on static methods. Maybe this should be
13163         generalized for MemberAccesses. 
13164         (SimpleName::ResolveSimpleName): More work on simple name
13165         resolution. 
13166
13167         * cs-parser.jay (primary_expression/qualified_identifier): track
13168         the parameter index.
13169
13170         * codegen.cs (CodeGen::Save): Catch save exception, report error.
13171         (EmitContext::EmitBoolExpression): Chain to expression generation
13172         instead of temporary hack.
13173         (::EmitStatementExpression): Put generic expression code generation.
13174
13175         * assign.cs (Assign::Emit): Implement variable assignments to
13176         local variables, parameters and fields.
13177
13178 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
13179
13180         * statement.cs (Block::GetVariableInfo): New method, returns the
13181         VariableInfo for a variable name in a block.
13182         (Block::GetVariableType): Implement in terms of GetVariableInfo
13183
13184         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
13185         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
13186
13187 2001-09-06  Ravi Pratap  <ravi@ximian.com>
13188
13189         * cs-parser.jay (operator_declaration): Continue on my quest : update
13190         to take attributes argument.
13191         (event_declaration): Ditto.
13192         (enum_declaration): Ditto.
13193         (indexer_declaration): Ditto.
13194         
13195         * class.cs (Operator::Operator): Update constructor accordingly.
13196         (Event::Event): Ditto.
13197
13198         * delegate.cs (Delegate::Delegate): Same here.
13199
13200         * enum.cs (Enum::Enum): Same here.
13201         
13202 2001-09-05  Ravi Pratap  <ravi@ximian.com>
13203
13204         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
13205
13206         * ../tests/cs0658.cs : New file to demonstrate error 0658.
13207
13208         * attribute.cs (Attributes): New class to encapsulate all attributes which were
13209         being passed around as an arraylist.
13210         (Attributes::AddAttribute): Method to add attribute sections.
13211
13212         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
13213         (struct_declaration): Update accordingly.
13214         (constant_declaration): Update.
13215         (field_declaration): Update.
13216         (method_header): Update.
13217         (fixed_parameter): Update.
13218         (parameter_array): Ditto.
13219         (property_declaration): Ditto.
13220         (destructor_declaration): Ditto.
13221         
13222         * class.cs (Struct::Struct): Update constructors accordingly.
13223         (Class::Class): Ditto.
13224         (Field::Field): Ditto.
13225         (Method::Method): Ditto.
13226         (Property::Property): Ditto.
13227         (TypeContainer::OptAttribute): update property's return type.
13228         
13229         * interface.cs (Interface.opt_attributes): New member.
13230         (Interface::Interface): Update to take the extra Attributes argument.
13231
13232         * parameter.cs (Parameter::Parameter): Ditto.
13233
13234         * constant.cs (Constant::Constant): Ditto.
13235
13236         * interface.cs (InterfaceMemberBase): New OptAttributes field.
13237         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
13238         the attributes as a parameter.
13239         (InterfaceProperty): Update constructor call.
13240         (InterfaceEvent): Ditto.
13241         (InterfaceMethod): Ditto.
13242         (InterfaceIndexer): Ditto.
13243
13244         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
13245         pass the attributes too.
13246         (interface_event_declaration): Ditto.
13247         (interface_property_declaration): Ditto.
13248         (interface_method_declaration): Ditto.
13249         (interface_declaration): Ditto.
13250
13251 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
13252
13253         * class.cs (Method::Define): Track the "static Main" definition to
13254         create an entry point. 
13255
13256         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
13257         EntryPoint if we find it. 
13258
13259         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
13260         (EmitContext::ig): Make this variable public.
13261
13262         * driver.cs: Make the default output file be the first file name
13263         with the .exe extension.  
13264
13265         Detect empty compilations
13266
13267         Handle various kinds of output targets.  Handle --target and
13268         rename -t to --dumper.
13269
13270         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
13271         methods inherited from Expression return now an Expression.  This
13272         will is used during the tree rewriting as we resolve them during
13273         semantic analysis.
13274
13275         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
13276         the spec.  Missing entirely is the information about
13277         accessability of elements of it.
13278
13279         (Expression::ExprClassFromMemberInfo): New constructor for
13280         Expressions that creates a fully initialized Expression based on
13281         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
13282         a Type.
13283
13284         (Invocation::Resolve): Begin implementing resolution of invocations.
13285         
13286         * literal.cs (StringLiteral):  Implement Emit.
13287
13288 2001-09-05  Ravi Pratap  <ravi@ximian.com>
13289
13290         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
13291         member.
13292         
13293 2001-09-04  Ravi Pratap  <ravi@ximian.com>
13294
13295         * cs-parser.jay (attribute_arguments): Implement actions.
13296         (attribute): Fix bug in production. Implement action.
13297         (attribute_list): Implement.
13298         (attribute_target): Implement.
13299         (attribute_target_specifier, opt_target_specifier): Implement
13300         (CheckAttributeTarget): New method to check if the attribute target
13301         is valid.
13302         (attribute_section): Implement.
13303         (opt_attributes): Implement.
13304
13305         * attribute.cs : New file to handle attributes.
13306         (Attribute): Class to hold attribute info.
13307
13308         * cs-parser.jay (opt_attribute_target_specifier): Remove production
13309         (attribute_section): Modify production to use 2 different rules to 
13310         achieve the same thing. 1 s/r conflict down !
13311         Clean out commented, useless, non-reducing dimension_separator rules.
13312         
13313         * class.cs (TypeContainer.attributes): New member to hold list
13314         of attributes for a type.
13315         (Struct::Struct): Modify to take one more argument, the attribute list.
13316         (Class::Class): Ditto.
13317         (Field::Field): Ditto.
13318         (Method::Method): Ditto.
13319         (Property::Property): Ditto.
13320         
13321         * cs-parser.jay (struct_declaration): Update constructor call to
13322         pass in the attributes too.
13323         (class_declaration): Ditto.
13324         (constant_declaration): Ditto.
13325         (field_declaration): Ditto.
13326         (method_header): Ditto.
13327         (fixed_parameter): Ditto.
13328         (parameter_array): Ditto.
13329         (property_declaration): Ditto.
13330
13331         * constant.cs (Constant::Constant): Update constructor similarly.
13332         Use System.Collections.
13333
13334         * parameter.cs (Parameter::Parameter): Update as above.
13335
13336 2001-09-02  Ravi Pratap  <ravi@ximian.com>
13337
13338         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
13339         (TypeContainer.delegates): New member to hold list of delegates.
13340
13341         * cs-parser.jay (delegate_declaration): Implement the action correctly 
13342         this time as I seem to be on crack ;-)
13343
13344 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
13345
13346         * rootcontext.cs (RootContext::IsNamespace): new function, used to
13347         tell whether an identifier represents a namespace.
13348
13349         * expression.cs (NamespaceExpr): A namespace expression, used only
13350         temporarly during expression resolution.
13351         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
13352         utility functions to resolve names on expressions.
13353
13354 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
13355
13356         * codegen.cs: Add hook for StatementExpressions. 
13357
13358         * class.cs: Fix inverted test for static flag in methods.
13359
13360 2001-09-02  Ravi Pratap  <ravi@ximian.com>
13361
13362         * class.cs (Operator::CheckUnaryOperator): Correct error number used
13363         to make it coincide with MS' number.
13364         (Operator::CheckBinaryOperator): Ditto.
13365
13366         * ../errors/errors.txt : Remove error numbers added earlier.
13367
13368         * ../errors/cs1019.cs : Test case for error # 1019
13369
13370         * ../errros/cs1020.cs : Test case for error # 1020
13371
13372         * cs-parser.jay : Clean out commented cruft.
13373         (dimension_separators, dimension_separator): Comment out. Ostensibly not
13374         used anywhere - non-reducing rule.
13375         (namespace_declarations): Non-reducing rule - comment out.
13376
13377         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
13378         with TypeContainer::AddEnum.
13379
13380         * delegate.cs : New file for delegate handling classes.
13381         (Delegate): Class for declaring delegates.
13382
13383         * makefile : Update.
13384
13385         * cs-parser.jay (delegate_declaration): Implement.
13386
13387 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
13388
13389         * class.cs (Event::Define): Implement.
13390         (Event.EventBuilder): New member.
13391
13392         * class.cs (TypeContainer::Populate): Update to define all enums and events
13393         we have.
13394         (Events): New property for the events arraylist we hold. Shouldn't we move to using
13395         readonly fields for all these cases ?
13396
13397 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
13398
13399         * class.cs (Property): Revamp to use the convention of making fields readonly.
13400         Accordingly modify code elsewhere.
13401
13402         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
13403         the Define method of the Property class.
13404
13405         * class.cs : Clean up applied patch and update references to variables etc. Fix 
13406         trivial bug.
13407         (TypeContainer::Populate): Update to define all the properties we have. Also
13408         define all enumerations.
13409
13410         * enum.cs (Define): Implement.
13411         
13412 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
13413
13414         * cs-parser.jay (overloadable_operator): The semantic value is an
13415         enum of the Operator class.
13416         (operator_declarator): Implement actions.
13417         (operator_declaration): Implement.
13418
13419         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
13420         validity of definitions.
13421         (Operator::CheckBinaryOperator): Static method to check for binary operators
13422         (TypeContainer::AddOperator): New method to add an operator to a type.
13423
13424         * cs-parser.jay (indexer_declaration): Added line to actually call the
13425         AddIndexer method so it gets added ;-)
13426
13427         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
13428         already taken care of by the MS compiler ?  
13429
13430 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
13431
13432         * class.cs (Operator): New class for operator declarations.
13433         (Operator::OpType): Enum for the various operators.
13434
13435 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
13436
13437         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
13438         ostensibly handle this in semantic analysis.
13439
13440         * cs-parser.jay (general_catch_clause): Comment out
13441         (specific_catch_clauses, specific_catch_clause): Ditto.
13442         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
13443         (catch_args, opt_catch_args): New productions.
13444         (catch_clause): Rewrite to use the new productions above
13445         (catch_clauses): Modify accordingly.
13446         (opt_catch_clauses): New production to use in try_statement
13447         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
13448         and re-write the code in the actions to extract the specific and
13449         general catch clauses by being a little smart ;-)
13450
13451         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
13452         Hooray, try and catch statements parse fine !
13453         
13454 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
13455
13456         * statement.cs (Block::GetVariableType): Fix logic to extract the type
13457         string from the hashtable of variables.
13458
13459         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
13460         I end up making that mistake ;-)
13461         (catch_clauses): Fixed gross error which made Key and Value of the 
13462         DictionaryEntry the same : $1 !!
13463
13464 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
13465
13466         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
13467
13468         * cs-parser.jay (event_declaration): Correct to remove the semicolon
13469         when the add and remove accessors are specified. 
13470
13471 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
13472
13473         * cs-parser.jay (IndexerDeclaration): New helper class to hold
13474         information about indexer_declarator.
13475         (indexer_declarator): Implement actions.
13476         (parsing_indexer): New local boolean used to keep track of whether
13477         we are parsing indexers or properties. This is necessary because 
13478         implicit_parameters come into picture even for the get accessor in the 
13479         case of an indexer.
13480         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
13481
13482         * class.cs (Indexer): New class for indexer declarations.
13483         (TypeContainer::AddIndexer): New method to add an indexer to a type.
13484         (TypeContainer::indexers): New member to hold list of indexers for the
13485         type.
13486
13487 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
13488
13489         * cs-parser.jay (add_accessor_declaration): Implement action.
13490         (remove_accessor_declaration): Implement action.
13491         (event_accessors_declaration): Implement
13492         (variable_declarators): swap statements for first rule - trivial.
13493
13494         * class.cs (Event): New class to hold information about event
13495         declarations.
13496         (TypeContainer::AddEvent): New method to add an event to a type
13497         (TypeContainer::events): New member to hold list of events.
13498
13499         * cs-parser.jay (event_declaration): Implement actions.
13500
13501 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
13502
13503         * cs-parser.jay (dim_separators): Implement. Make it a string
13504         concatenating all the commas together, just as they appear.
13505         (opt_dim_separators): Modify accordingly
13506         (rank_specifiers): Update accordingly. Basically do the same
13507         thing - instead, collect the brackets here.
13508         (opt_rank_sepcifiers): Modify accordingly.
13509         (array_type): Modify to actually return the complete type string
13510         instead of ignoring the rank_specifiers.
13511         (expression_list): Implement to collect the expressions
13512         (variable_initializer): Implement. We make it a list of expressions
13513         essentially so that we can handle the array_initializer case neatly too.
13514         (variable_initializer_list): Implement.
13515         (array_initializer): Make it a list of variable_initializers
13516         (opt_array_initializer): Modify accordingly.
13517
13518         * expression.cs (New::NType): Add enumeration to help us
13519         keep track of whether we have an object/delegate creation
13520         or an array creation.
13521         (New:NewType, New::Rank, New::Indices, New::Initializers): New
13522         members to hold data about array creation.
13523         (New:New): Modify to update NewType
13524         (New:New): New Overloaded contructor for the array creation
13525         case.
13526
13527         * cs-parser.jay (array_creation_expression): Implement to call
13528         the overloaded New constructor.
13529         
13530 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
13531
13532         * class.cs (TypeContainer::Constructors): Return member
13533         constructors instead of returning null.
13534
13535 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
13536
13537         * typemanager.cs (InitCoreTypes): Initialize the various core
13538         types after we have populated the type manager with the user
13539         defined types (this distinction will be important later while
13540         compiling corlib.dll)
13541
13542         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
13543         on Expression Classification.  Now all expressions have a method
13544         `Resolve' and a method `Emit'.
13545
13546         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
13547         generation from working.     Also add some temporary debugging
13548         code. 
13549         
13550 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
13551
13552         * codegen.cs: Lots of code generation pieces.  This is only the
13553         beginning, will continue tomorrow with more touches of polish.  We
13554         handle the fundamentals of if, while, do, for, return.  Others are
13555         trickier and I need to start working on invocations soon.
13556         
13557         * gen-treedump.cs: Bug fix, use s.Increment here instead of
13558         s.InitStatement. 
13559
13560         * codegen.cs (EmitContext): New struct, used during code
13561         emission to keep a context.   Most of the code generation will be
13562         here. 
13563
13564         * cs-parser.jay: Add embedded blocks to the list of statements of
13565         this block.  So code generation proceeds in a top down fashion.
13566
13567 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
13568
13569         * statement.cs: Add support for multiple child blocks.
13570
13571 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
13572
13573         * codegen.cs (EmitCode): New function, will emit the code for a
13574         Block of code given a TypeContainer and its ILGenerator. 
13575
13576         * statement.cs (Block): Standard public readonly optimization.
13577         (Block::Block constructors): Link children. 
13578         (Block::Child): Child Linker.
13579         (Block::EmitVariables): Emits IL variable declarations.
13580
13581         * class.cs: Drop support for MethodGroups here, delay until
13582         Semantic Analysis.
13583         (Method::): Applied the same simplification that I did before, and
13584         move from Properties to public readonly fields.
13585         (Method::ParameterTypes): Returns the parameter types for the
13586         function, and implements a cache that will be useful later when I
13587         do error checking and the semantic analysis on the methods is
13588         performed.
13589         (Constructor::GetCallingConvention): Renamed from CallingConvetion
13590         and made a method, optional argument tells whether this is a class
13591         or a structure to apply the `has-this' bit.
13592         (Method::GetCallingConvention): Implement, returns the calling
13593         convention. 
13594         (Method::Define): Defines the type, a second pass is performed
13595         later to populate the methods.
13596
13597         (Constructor::ParameterTypes): implement a cache similar to the
13598         one on Method::ParameterTypes, useful later when we do semantic
13599         analysis. 
13600
13601         (TypeContainer::EmitMethod):  New method.  Emits methods.
13602
13603         * expression.cs: Removed MethodGroup class from here.
13604         
13605         * parameter.cs (Parameters::GetCallingConvention): new method.
13606
13607 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
13608
13609         * class.cs (TypeContainer::Populate): Drop RootContext from the
13610         argument. 
13611
13612         (Constructor::CallingConvention): Returns the calling convention.
13613         (Constructor::ParameterTypes): Returns the constructor parameter
13614         types. 
13615         
13616         (TypeContainer::AddConstructor): Keep track of default constructor
13617         and the default static constructor.
13618
13619         (Constructor::) Another class that starts using `public readonly'
13620         instead of properties. 
13621
13622         (Constructor::IsDefault): Whether this is a default constructor. 
13623
13624         (Field::) use readonly public fields instead of properties also.
13625
13626         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
13627         track of static constructors;  If none is used, turn on
13628         BeforeFieldInit in the TypeAttributes. 
13629
13630         * cs-parser.jay (opt_argument_list): now the return can be null
13631         for the cases where there are no arguments. 
13632
13633         (constructor_declarator): If there is no implicit `base' or
13634         `this', then invoke the default parent constructor. 
13635         
13636         * modifiers.cs (MethodAttr): New static function maps a set of
13637         modifiers flags into a MethodAttributes enum
13638         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
13639         MethodAttr, TypeAttr to represent the various mappings where the
13640         modifiers are used.
13641         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
13642
13643 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
13644
13645         * parameter.cs (GetParameterInfo): Fix bug where there would be no
13646         method arguments.
13647
13648         * interface.cs (PopulateIndexer): Implemented the code generator
13649         for interface indexers.
13650
13651 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
13652
13653         * interface.cs (InterfaceMemberBase): Now we track the new status
13654         here.  
13655
13656         (PopulateProperty): Implement property population.  Woohoo!  Got
13657         Methods and Properties going today. 
13658
13659         Removed all the properties for interfaces, and replaced them with
13660         `public readonly' fields. 
13661
13662 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
13663
13664         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
13665         initialize their hashtables/arraylists only when they are needed
13666         instead of doing this always.
13667
13668         * parameter.cs: Handle refs and out parameters.
13669
13670         * cs-parser.jay: Use an ArrayList to construct the arguments
13671         instead of the ParameterCollection, and then cast that to a
13672         Parameter[] array.
13673
13674         * parameter.cs: Drop the use of ParameterCollection and use
13675         instead arrays of Parameters.
13676
13677         (GetParameterInfo): Use the Type, not the Name when resolving
13678         types. 
13679
13680 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
13681
13682         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
13683         and instead use public readonly fields.
13684
13685         * class.cs: Put back walking code for type containers.
13686
13687 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
13688
13689         * class.cs (MakeConstant): Code to define constants.
13690
13691         * rootcontext.cs (LookupType): New function.  Used to locate types 
13692
13693         
13694 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
13695
13696         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
13697         this System.Reflection code is.  Kudos to Microsoft
13698         
13699         * typemanager.cs: Implement a type cache and avoid loading all
13700         types at boot time.  Wrap in LookupType the internals.  This made
13701         the compiler so much faster.  Wow.  I rule!
13702         
13703         * driver.cs: Make sure we always load mscorlib first (for
13704         debugging purposes, nothing really important).
13705
13706         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
13707         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
13708
13709         * rootcontext.cs: Lookup types on their namespace;  Lookup types
13710         on namespaces that have been imported using the `using' keyword.
13711
13712         * class.cs (TypeContainer::TypeAttr): Virtualize.
13713         (Class::TypeAttr): Return attributes suitable for this bad boy.
13714         (Struct::TypeAttr): ditto.
13715         Handle nested classes.
13716         (TypeContainer::) Remove all the type visiting code, it is now
13717         replaced with the rootcontext.cs code
13718
13719         * rootcontext.cs (GetClassBases): Added support for structs. 
13720
13721 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
13722
13723         * interface.cs, statement.cs, class.cs, parameter.cs,
13724         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
13725         Drop use of TypeRefs, and use strings instead.
13726
13727 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
13728
13729         * rootcontext.cs: 
13730
13731         * class.cs (Struct::Struct): set the SEALED flags after
13732         checking the modifiers.
13733         (TypeContainer::TypeAttr): new property, returns the
13734         TypeAttributes for a class.  
13735
13736         * cs-parser.jay (type_list): Oops, list production was creating a
13737         new list of base types.
13738
13739         * rootcontext.cs (StdLib): New property.
13740         (GetInterfaceTypeByName): returns an interface by type name, and
13741         encapsulates error handling here.
13742         (GetInterfaces): simplified.
13743         (ResolveTree): Encapsulated all the tree resolution here.
13744         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
13745         types. 
13746         
13747         * driver.cs: Add support for --nostdlib, to avoid loading the
13748         default assemblies.
13749         (Main): Do not put tree resolution here. 
13750
13751         * rootcontext.cs: Beginning of the class resolution.
13752
13753 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
13754
13755         * rootcontext.cs: Provide better error reporting. 
13756
13757         * cs-parser.jay (interface_base): set our $$ to be interfaces.
13758
13759         * rootcontext.cs (CreateInterface): Handle the case where there
13760         are no parent interfaces.
13761         
13762         (CloseTypes): Routine to flush types at the end.
13763         (CreateInterface): Track types.
13764         (GetInterfaces): Returns an array of Types from the list of
13765         defined interfaces.
13766
13767         * typemanager.c (AddUserType): Mechanism to track user types (puts
13768         the type on the global type hash, and allows us to close it at the
13769         end). 
13770         
13771 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
13772
13773         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
13774         RecordInterface instead.
13775
13776         * cs-parser.jay: Updated to reflect changes above.
13777
13778         * decl.cs (Definition): Keep track of the TypeBuilder type that
13779         represents this type here.  Not sure we will use it in the long
13780         run, but wont hurt for now.
13781
13782         * driver.cs: Smaller changes to accomodate the new code.
13783
13784         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
13785         when done. 
13786
13787         * rootcontext.cs (CreateInterface):  New method, used to create
13788         the System.TypeBuilder type for interfaces.
13789         (ResolveInterfaces): new entry point to resolve the interface
13790         hierarchy. 
13791         (CodeGen): Property, used to keep track of the code generator.
13792
13793 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
13794
13795         * cs-parser.jay: Add a second production for delegate_declaration
13796         with `VOID'.
13797
13798         (enum_body): Put an opt_comma here instead of putting it on
13799         enum_body or enum_member_declarations so we can handle trailing
13800         commas on enumeration members.  Gets rid of a shift/reduce.
13801         
13802         (type_list): Need a COMMA in the middle.
13803
13804         (indexer_declaration): Tell tokenizer to recognize get/set
13805
13806         * Remove old targets.
13807
13808         * Re-add the parser target.
13809
13810 2001-07-13  Simon Cozens <simon@simon-cozens.org>
13811
13812         * cs-parser.jay: Add precendence rules for a number of operators
13813         ot reduce the number of shift/reduce conflicts in the grammar.
13814         
13815 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
13816
13817         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
13818         and put it here.
13819
13820         Get rid of old crufty code.
13821
13822         * rootcontext.cs: Use this to keep track of the parsed
13823         representation and the defined types available to the program. 
13824
13825         * gen-treedump.cs: adjust for new convention.
13826
13827         * type.cs: Split out the type manager, and the assembly builder
13828         from here. 
13829
13830         * typemanager.cs: the type manager will live here now.
13831
13832         * cil-codegen.cs: And the code generator here. 
13833
13834 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
13835
13836         * makefile: Fixed up for easy making.
13837
13838 2001-07-13  Simon Cozens <simon@simon-cozens.org>
13839
13840         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
13841         the 
13842
13843         (unary_expression): Expand pre_increment_expression and
13844         post_decrement_expression to reduce a shift/reduce.
13845
13846 2001-07-11  Simon Cozens
13847
13848         * cs-tokenizer.cs: Hex numbers should begin with a 0.
13849
13850         Improve allow_keyword_as_indent name.
13851
13852 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
13853
13854         * Adjustments for Beta2. 
13855
13856 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
13857
13858         * decl.cs: Added `Define' abstract method.
13859         (InTransit): new property, used to catch recursive definitions. 
13860
13861         * interface.cs: Implement `Define'. 
13862
13863         * modifiers.cs: Map Modifiers.constants to
13864         System.Reflection.TypeAttribute flags.
13865
13866         * class.cs: Keep track of types and user-defined types.
13867         (BuilderInit): New method for creating an assembly
13868         (ResolveType): New function to launch the resolution process, only
13869         used by interfaces for now.
13870
13871         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
13872         that are inserted into the name space. 
13873
13874 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
13875
13876         * ARGH.  I have screwed up my tree so many times due to the use of
13877         rsync rather than using CVS.  Going to fix this at once. 
13878
13879         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
13880         load types.
13881
13882 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
13883
13884         * Experiment successful: Use System.Type rather that our own
13885         version of Type.  
13886
13887 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
13888
13889         * cs-parser.jay: Removed nsAliases from here.
13890
13891         Use new namespaces, handle `using XXX;' 
13892
13893         * namespace.cs: Reimplemented namespace handling, use a recursive
13894         definition of the class.  Now we can keep track of using clauses
13895         and catch invalid using clauses.
13896
13897 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
13898
13899         * gen-treedump.cs: Adapted for all the renaming.
13900
13901         * expression.cs (Expression): this class now has a Type property
13902         which returns an expression Type.
13903
13904         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
13905         `Type', as this has a different meaning now in the base
13906
13907 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
13908
13909         * interface.cs, class.cs: Removed from all the sources the
13910         references to signature computation, as we can not do method
13911         signature computation during the parsing time, as we are not
13912         trying to solve at that point distinguishing:
13913
13914         class X {
13915                 void a (Blah x) {}
13916                 void a (NS.Blah x) {}
13917         }
13918
13919         Which depending on the context might be valid or not, as we do not
13920         know if Blah is the same thing as NS.Blah at that point.
13921
13922         * Redid everything so the code uses TypeRefs now instead of
13923         Types.  TypeRefs are just temporary type placeholders, that need
13924         to be resolved.  They initially have a pointer to a string and the
13925         current scope in which they are used.  This is used later by the
13926         compiler to resolve the reference to an actual Type. 
13927
13928         * DeclSpace is no longer a CIR.Type, and neither are
13929         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
13930         are all DeclSpaces, but no Types. 
13931
13932         * type.cs (TypeRefManager): This implements the TypeRef manager,
13933         which keeps track of all the types that need to be resolved after
13934         the parsing has finished. 
13935
13936 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
13937
13938         * ARGH.  We are going to have to store `foreach' as a class rather
13939         than resolving it, as we need to verify error 1579 after name
13940         resolution.   *OR* we could keep a flag that says `This request to
13941         IEnumerator comes from a foreach statement' which we can then use
13942         to generate the error.
13943
13944 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
13945
13946         * class.cs (TypeContainer.AddMethod): we now add methods to the
13947         MethodGroup instead of the method hashtable.  
13948
13949         * expression.cs: Add MethodGroup abstraction, which gets us one
13950         step closer to the specification in the way we handle method
13951         declarations.  
13952
13953         * cs-parser.jay (primary_expression): qualified_identifier now
13954         tried to match up an identifier to a local variable reference or
13955         to a parameter reference.
13956
13957         current_local_parameters is now a parser global variable that
13958         points to the current parameters for the block, used during name
13959         lookup.
13960
13961         (property_declaration): Now creates an implicit `value' argument to
13962         the set accessor.
13963
13964 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
13965
13966         * parameter.cs: Do not use `param' arguments as part of the
13967         signature, per the spec.
13968
13969 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
13970
13971         * decl.cs: Base class for classes, structs and interfaces.  This
13972         is the "Declaration Space" 
13973
13974         * cs-parser.jay: Use CheckDef for checking declaration errors
13975         instead of having one on each function.
13976
13977         * class.cs: Factor out some code for handling error handling in
13978         accordance to the "Declarations" section in the "Basic Concepts"
13979         chapter in the ECMA C# spec.
13980
13981         * interface.cs: Make all interface member classes derive from
13982         InterfaceMemberBase.
13983
13984 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
13985
13986         * Many things: all interfaces are parsed and generated in
13987         gen-treedump.  Support for member variables, constructors,
13988         destructors, properties, constants is there.
13989
13990         Beginning of the IL backend, but very little done, just there for
13991         testing purposes. 
13992
13993 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
13994
13995         * cs-parser.jay: Fix labeled statement.
13996
13997         * cs-tokenizer.cs (escape): Escape " and ' always.
13998         ref_line, ref_name: keep track of the line/filename as instructed
13999         by #line by the compiler.
14000         Parse #line.
14001
14002 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
14003
14004         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
14005         to match the values in System.CodeDOM.
14006
14007         Divid renamed to Divide.
14008
14009         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
14010         statements. 
14011         (Statements.set): remove.
14012
14013         * System.CodeDOM/CodeCatchClause.cs: always have a valid
14014         statements. 
14015
14016         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
14017         falseStatements always have valid values. 
14018
14019         * cs-parser.jay: Use System.CodeDOM now.
14020