2004-02-17 Carlos Guzm��n ��lvarez <carlosga@telefonica.net>
[mono.git] / mcs / mcs / ChangeLog
1 2004-02-16  Marek Safar  <marek.safar@seznam.cz>
2
3         * interface.cs (FindMembers): The operation is performed on all base
4         interfaces and not only on the first. It is required for future CLS Compliance patch.
5
6 2004-02-12 Ben Maurer  <bmaurer@users.sourceforge.net>
7
8         * statement.cs, codegen.cs:
9         This patch deals with patterns such as:
10
11         public class List : IEnumerable {
12
13                 public MyEnumerator GetEnumerator () {
14                         return new MyEnumerator(this);
15                 }
16         
17                 IEnumerator IEnumerable.GetEnumerator () {
18                         ...
19                 }
20                 
21                 public struct MyEnumerator : IEnumerator {
22                         ...
23                 }
24         }
25
26         Before, there were a few things we did wrong:
27         1) we would emit callvirt on a struct, which is illegal
28         2) we emited ldarg when we needed to emit ldarga
29         3) we would mistakenly call the interface methods on an enumerator
30         type that derived from IEnumerator and was in another assembly. For example:
31
32         public class MyEnumerator : IEnumerator
33
34         Would have the interface methods called, even if there were public impls of the
35         method. In a struct, this lead to invalid IL code.
36         
37 2004-02-11  Marek Safar  <marek.safar@seznam.cz>
38
39         * const.cs: Const is now derived from FieldBase. Method EmitConstant name
40           renamed to Emit.
41
42         * delegate.cs (Define): Fixed crash when delegate type is undefined.
43         
44 2004-02-11  Miguel de Icaza  <miguel@ximian.com>
45
46         * cs-parser.jay: Fix small regression: we were not testing V2
47         compiler features correctly.
48
49         * interface.cs: If the emit context is null, then create one
50
51 2004-02-09  Marek Safar  <marek.safar@seznam.cz>
52
53         * decl.cs (GetSignatureForError): New virtual method to get full name
54           for error messages.
55         
56         * attribute.cs (IAttributeSupport): New interface for attribute setting.
57           Now it is possible to rewrite ApplyAttributes method to be less if/else.
58
59         * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
60           Duplicated members and code in these classes has been removed.
61           Better encapsulation in these classes.
62
63 2004-02-07  Miguel de Icaza  <miguel@ximian.com>
64
65         * assign.cs (Assign.DoResolve): When dealing with compound
66         assignments, there is a new rule in ECMA C# 2.4 (might have been
67         there before, but it is documented here) that states that in:
68
69         a op= b;
70
71         If b is of type int, and the `op' is a shift-operator, then the
72         above is evaluated as:
73
74         a = (int) a op b 
75
76         * expression.cs (Binary.ResolveOperator): Instead of testing for
77         int/uint/long/ulong, try to implicitly convert to any of those
78         types and use that in pointer arithmetic.
79
80         * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
81         method to print information for from the type, not from the
82         null-method we were given.
83
84 2004-02-01  Duncan Mak  <duncan@ximian.com>
85
86         * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
87         parsing for cmd, fixes bug #53694.
88
89 2004-02-04  Marek Safar  <marek.safar@seznam.cz>
90
91         * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
92         in the member name duplication tests. Property and operator name duplication
93         was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
94
95 2004-02-03  Marek Safar  <marek.safar@seznam.cz>
96
97         * interface.cs (PopulateMethod): Fixed crash when interface method
98         returns not existing type (error test cs0246-3.cs).
99
100 2004-02-02  Ravi Pratap M <ravi@ximian.com>
101
102         * cs-parser.jay (interface_accessors): Re-write actions to also
103         store attributes attached to get and set methods. Fix spelling
104         while at it.
105
106         (inteface_property_declaration): Modify accordingly.
107
108         (InterfaceAccessorInfo): New helper class to store information to pass
109         around between rules that use interface_accessors.
110
111         * interface.cs (Emit): Apply attributes on the get and set
112         accessors of properties and indexers too.
113         
114         * attribute.cs (ApplyAttributes): Modify accordingly to use the
115         right MethodBuilder when applying attributes to the get and set accessors.
116
117 2004-01-31  Miguel de Icaza  <miguel@ximian.com>
118
119         * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
120
121 2004-01-26  Miguel de Icaza  <miguel@ximian.com>
122
123         * cs-tokenizer.cs: Handle #line hidden from PDC bits.
124
125 2004-01-25  Miguel de Icaza  <miguel@ximian.com>
126
127         * cs-parser.jay: Remove YIELD token, instead use the new grammar
128         changes that treat `yield' specially when present before `break'
129         or `return' tokens.
130
131         * cs-tokenizer.cs: yield is no longer a keyword.
132
133 2004-01-23  Marek Safar  <marek.safar@seznam.cz>
134
135         * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
136         setting for default constructors.
137         For default constructors are almost every time set wrong Modifier. The
138         generated IL code has been alright. But inside mcs this values was
139         wrong and this was reason why several of my CLS Compliance tests
140         failed.
141
142 2004-01-22  Martin Baulig  <martin@ximian.com>
143
144         * cs-parser.jay (namespace_or_type_name): Return an Expression,
145         not a QualifiedIdentifier.  This is what `type_name_expression'
146         was previously doing.
147         (type_name_expression): Removed; the code is now in
148         `namespace_or_type_name'.
149         (qualified_identifier): Removed, use `namespace_or_type_name'
150         instead.
151         (QualifiedIdentifier): Removed this class.      
152
153 2004-01-22  Martin Baulig  <martin@ximian.com>
154
155         * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
156         not a string as alias name.
157
158 2004-01-21  Miguel de Icaza  <miguel@ximian.com>
159
160         * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
161         #52730 bug, and instead compute correctly the need to use a
162         temporary variable when requesting an address based on the
163         static/instace modified of the field and the constructor.
164  
165 2004-01-21  Martin Baulig  <martin@ximian.com>
166
167         * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
168         class and namespace before looking up aliases.  Fixes #52517.
169
170 2004-01-21  Martin Baulig  <martin@ximian.com>
171
172         * flowanalysis.cs (UsageVector.Merge): Allow variables being
173         assinged in a 'try'; fixes exception4.cs.
174
175 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
176         * class.cs : Implemented parameter-less constructor for TypeContainer
177         
178         * decl.cs: Attributes are now stored here. New property OptAttributes
179         
180         * delegate.cs, enum.cs, interface.cs: Removed attribute member.
181         
182         * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
183
184 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
185
186         * typemanager.cs (CSharpSignature): Now reports also inner class name.
187           (CSharpSignature): New method for indexer and property signature.
188
189 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
190
191         * pending.cs (IsVirtualFilter): Faster implementation.
192
193 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
194
195         * typemanager.cs: Avoid inclusion of same assembly more than once.
196
197 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
198
199         * cs-parser.jay: Fixed problem where the last assembly attribute
200           has been applied also to following declaration (class, struct, etc.)
201           
202 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
203
204         * class.cs: Added error CS0538, CS0539 reporting.
205         Fixed crash on Microsoft runtime when field type is void.
206
207         * cs-parser.jay: Added error CS0537 reporting.
208
209         * pending.cs: Added error CS0535 reporting.
210         Improved error report for errors CS0536, CS0534.
211
212 2004-01-20  Miguel de Icaza  <miguel@ximian.com>
213
214         Merge a few bits from the Anonymous Method MCS tree.
215         
216         * statement.cs (ToplevelBlock): New class for toplevel methods,
217         will hold anonymous methods, lifted variables.
218
219         * cs-parser.jay: Create toplevel blocks for delegates and for
220         regular blocks of code. 
221
222 2004-01-20  Martin Baulig  <martin@ximian.com>
223
224         * codegen.cs (EmitContext): Removed `InTry', `InCatch',
225         `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
226         and `NeedExplicitReturn'; added `IsLastStatement'.
227         (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
228         have a `ReturnLabel' or we're not unreachable.
229
230         * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
231         child's reachability; don't just override ours with it.  Fixes
232         #58058 (lluis's example).
233         (FlowBranching): Added public InTryOrCatch(), InCatch(),
234         InFinally(), InLoop(), InSwitch() and
235         BreakCrossesTryCatchBoundary() methods.
236
237         * statement.cs (Return): Do all error checking in Resolve().
238         Unless we are the last statement in a top-level block, always
239         create a return label and jump to it.
240         (Break, Continue): Do all error checking in Resolve(); also make
241         sure we aren't leaving a `finally'.
242         (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
243         statement in a top-level block.
244         (Block.Flags): Added `IsDestructor'.
245         (Block.IsDestructor): New public property.
246
247 2004-01-20  Martin Baulig  <martin@ximian.com>
248
249         * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
250
251 2004-01-20  Martin Baulig  <martin@ximian.com>
252
253         * statement.cs (Statement.ResolveUnreachable): New public method.
254         (If, While): Do the dead-code elimination in Resolve(), not in Emit().
255         (Block.Resolve): Resolve unreachable statements.
256
257 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
258
259         * expression.cs: We need to fix the case where we do
260         not have a temp variable here.
261
262         * assign.cs: Only expression compound assignments need
263         temporary variables.
264
265 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
266
267         * flowanalysis.cs: Reduce memory allocation in a few ways:
268           - A block with no variables should not allocate a bit
269             vector for itself.
270           - A method with no out parameters does not need any tracking
271             for assignment of the parameters, so we need not allocate
272             any data for it.
273           - The arrays:
274                 public readonly Type[] VariableTypes;
275                 public readonly string[] VariableNames;
276             Are redundant. The data is already stored in the variable
277             map, so we need not allocate another array for it.
278           - We need to add alot of checks for if (params | locals) == null
279             due to the first two changes.
280
281 2004-01-18  Miguel de Icaza  <miguel@ximian.com>
282
283         * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
284         implement IMemoryLocation, we store a copy on a local variable and
285         take the address of it.  Patch from Benjamin Jemlich
286
287         * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
288         to use a special "type_name_expression" rule which reduces the
289         number of "QualifiedIdentifier" classes created, and instead
290         directly creates MemberAccess expressions.
291
292 2004-01-17  Miguel de Icaza  <miguel@ximian.com>
293
294         * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
295         that fixes #52853.  Null literal assignment to ValueType
296
297         * class.cs (MethodData.Emit): Instead of checking the name of the
298         method to determine if its a destructor, create a new derived
299         class from Method called Destructor, and test for that.  
300
301         * cs-parser.jay: Create a Destructor object instead of a Method.  
302
303         Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
304
305         Fixes: 52933
306         
307 2004-01-16  Miguel de Icaza  <miguel@ximian.com>
308
309         * expression.cs (Binary.ResolveOperator): Perform an implicit
310         conversion from MethodGroups to their delegate types on the
311         Addition operation.
312
313         * delegate.cs: Introduce a new class DelegateCreation that is the
314         base class for `NewDelegate' and `ImplicitDelegateCreation',
315         factor some code in here.
316
317         * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
318         conversion from MethodGroups to compatible delegate types. 
319
320         * ecore.cs (Expression.Resolve): Do not flag error 654
321         (Methodgroupd needs parenthesis) if running on the V2 compiler, as
322         we allow conversions from MethodGroups to delegate types now.
323         
324         * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
325         assignments in v2 either.
326
327 2004-01-10  Miguel de Icaza  <miguel@ximian.com>
328
329         * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
330         static read-only fields in ctors.
331
332         Applied patch from Benjamin Jemlich 
333
334         * expression.cs (UnaryMutator): Avoid leaking local variables. 
335         
336 2004-01-09  Miguel de Icaza  <miguel@ximian.com>
337
338         * cs-tokenizer.cs (IsCastToken): Allow the various native types
339         here to return true, as they can be used like this:
340
341                 (XXX) int.MEMBER ()
342
343         Fixed 49836 and all the other dups
344         
345 2004-01-09  Zoltan Varga  <vargaz@freemail.hu>
346
347         * driver.cs: Implement /win32res and /win32icon.
348
349 2004-01-08  Miguel de Icaza  <miguel@ximian.com>
350
351         * cs-parser.jay: Add a rule to improve error handling for the
352         common mistake of placing modifiers after the type.
353
354 2004-01-07  Miguel de Icaza  <miguel@ximian.com>
355
356         * cs-parser.jay (interface_event_declaration): Catch
357         initialization of events on interfaces, and report cs0068
358
359         * cs-parser.jay (interface_event_declaration): Catch
360         initialization of events. 
361
362         * ecore.cs: Better report missing constructors.
363         
364         * expression.cs (Binary.ResolveOperator): My previous bug fix had
365         the error reporting done in the wrong place.  Fix.
366
367         * expression.cs (Binary.ResolveOperator): Catch the 
368         operator + (E x, E y) error earlier, and later allow for implicit
369         conversions in operator +/- (E e, U x) from U to the underlying
370         type of E.
371
372         * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
373         52596, if the container class is abstract, the default constructor
374         is protected otherwise its public (before, we were always public).
375
376         * statement.cs (Fixed.Resolve): Catch a couple more errors in the
377         fixed statement.
378
379         (Using.EmitLocalVariableDecls): Applied patch from Benjamin
380         Jemlich that fixes bug #52597, MCS was generating invalid code for
381         idisposable structs.   Thanks to Ben for following up with this
382         bug as well.
383         
384 2004-01-06  Miguel de Icaza  <miguel@ximian.com>
385
386         * driver.cs: Allow assemblies without code to be generated, fixes
387         52230.
388
389 2004-01-07  Nick Drochak <ndrochak@gol.com>
390
391         * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
392
393 2004-01-05  Miguel de Icaza  <miguel@ximian.com>
394
395         * cs-parser.jay: Add rules to improve error reporting if fields or
396         methods are declared at the namespace level (error 116)
397
398         * Add rules to catch event add/remove
399
400 2004-01-04  David Sheldon <dave-mono@earth.li>
401
402   * expression.cs: Added matching ")" to error message for 
403   CS0077
404
405 2004-01-03 Todd Berman <tberman@gentoo.org>
406         
407         * ecore.cs, attribute.cs:
408         Applying fix from #52429.
409
410 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
411
412         * ecore.cs, expression.cs, statement.cs:
413         Total rewrite of how we handle branching. We
414         now handle complex boolean expressions with fewer
415         jumps. As well if (x == 0) no longer emits a ceq.
416
417         if (x is Foo) is much faster now, because we generate
418         better code.
419
420         Overall, we get a pretty big improvement on our benchmark
421         tests. The code we generate is smaller and more readable.
422
423         I did a full two-stage bootstrap. The patch was reviewed
424         by Martin and Miguel.
425
426 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
427
428         * cs-parser.jay: Make primary_expression not take a QI.
429         we dont need this because the member_access rule covers
430         us here. So we replace the rule with just IDENTIFIER.
431
432         This has two good effects. First, we remove a s/r conflict.
433         Second, we allocate many fewer QualifiedIdentifier objects.
434
435 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
436
437         * attribute.cs: Handle MarshalAs attributes as pseudo, and
438         set the correct information via SRE. This prevents
439         hanging on the MS runtime. Fixes #29374.
440
441 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
442
443         * convert.cs: correctly handle conversions to value types
444         from Enum and ValueType as unboxing conversions.
445
446         Fixes bug #52569. Patch by Benjamin Jemlich.
447
448 2004-01-02  Ravi Pratap  <ravi@ximian.com>
449
450         * expression.cs (BetterConversion): Prefer int -> uint
451         over int -> ulong (csc's behaviour). This fixed bug #52046.
452
453 2004-01-02 Ben Maurer  <bmaurer@users.sourceforge.net>
454
455         * decl.cs (MemberCache.FindMembers): now returns a
456         MemberInfo [].
457
458         * typemanager.cs: In general, go with with ^^.
459         (CopyNewMethods): take an IList.
460         (RealMemberLookup): Only allocate an arraylist
461         if we copy from two sets of methods.
462
463         This change basically does two things:
464         1) Fewer array lists allocated due to CopyNewMethods.
465         2) the explicit cast in MemberList costed ALOT.
466
467 2004-01-02  Zoltan Varga  <vargaz@freemail.hu>
468
469         * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
470         a hashtable to avoid needless string allocations when an identifier is
471         used more than once (the common case).
472
473 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
474
475         * pending.cs: MS's TypeBuilder.GetInterfaces ()
476         is broken, it will not return anything. So, we
477         have to use the information we have in mcs to
478         do the task.
479
480         * typemanager.cs: Add a cache for GetInterfaces,
481         since this will now be used more often (due to ^^)
482
483         (GetExplicitInterfaces) New method that gets the
484         declared, not effective, interfaces on a type
485         builder (eg, if you have interface IFoo, interface
486         IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
487         { IBar }.
488
489         This patch makes MCS able to bootstrap itself on
490         Windows again.
491
492 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
493
494         * expression.cs: Remove the Nop's that Miguel put
495         in by mistake.
496
497 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
498
499         * report.cs, codegen.cs: Give the real stack trace to
500         the error when an exception is thrown.
501
502 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
503
504         * decl.cs: only allocate hashtables for ifaces if 
505         it is an iface!
506
507 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
508
509         * expression.cs: fix the error from cs0121-2.cs
510         (a parent interface has two child interfaces that
511         have a function with the same name and 0 params
512         and the function is called through the parent).
513
514 2003-12-30 Ben Maurer  <bmaurer@users.sourceforge.net>
515
516         * class.cs, rootcontext.cs, typmanager.cs: do not
517         leak pointers.
518
519 2003-12-28 Ben Maurer  <bmaurer@users.sourceforge.net>
520
521         * codegen.cs: remove stack for the ec flow branching.
522         It is already a linked list, so no need.
523
524 2003-12-27 Ben Maurer  <bmaurer@users.sourceforge.net>
525
526         * Makefile: Allow custom profiler here.
527
528 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
529
530         * typemanager.cs (LookupType):
531           - Use a static char [], because split takes
532             a param array for args, so it was allocating
533             every time.
534           - Do not store true in a hashtable, it boxes.
535
536 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
537
538         * flowanalysis.cs: bytify common enums.
539
540 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
541
542         * modifiers.cs: Add a new set of flags for the
543         flags allowed on explicit interface impls.
544         * cs-parser.jay: catch the use of modifiers in
545         interfaces correctly.
546         * class.cs: catch private void IFoo.Blah ().
547
548         All related to bug #50572.
549
550 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
551
552         * decl.cs: Rewrite the consistant accessability checking.
553         Accessability is not linear, it must be implemented in
554         a tableish way. Fixes #49704.
555
556 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
557
558         * expression.cs: Handle negation in a checked context.
559         We must use subtraction from zero. Fixes #38674.
560
561 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
562
563         * class.cs: Ignore static void main in DLLs.
564         * rootcontext.cs: Handle the target type here,
565         since we are have to access it from class.cs
566         * driver.cs: account for the above.
567
568 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
569
570         * report.cs: Give line numbers and files if available.
571
572 2003-12-20  Zoltan Varga  <vargaz@freemail.hu>
573
574         * driver.cs: Implement /addmodule.
575
576         * typemanager.cs:  Change 'modules' field so it now contains Modules not
577         ModuleBuilders.
578
579 2003-12-20  Martin Baulig  <martin@ximian.com>
580
581         * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
582         (FieldBase.IsAssigned): Removed this field.
583         (FieldBase.SetAssigned): New public method.
584         (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
585
586 2003-12-20  Martin Baulig  <martin@ximian.com>
587
588         * expression.cs (LocalVariableReference.DoResolve): Don't set
589         `vi.Used' if we're called from DoResolveLValue().
590
591         * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
592         returns the usage vector it just merged into the current one -
593         pass this one to UsageWarning().
594         (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
595         of the `EmitContext', don't call this recursively on our children.
596
597 2003-12-19  Zoltan Varga  <vargaz@freemail.hu>
598
599         * driver.cs: Implement /target:module.
600
601 2003-12-18  Zoltan Varga  <vargaz@freemail.hu>
602
603         * support.cs (CharArrayHashtable): New helper class.
604
605         * cs-tokenizer.cs: Store keywords in a hashtable indexed by 
606         char arrays, not strings, so we can avoid creating a string in
607         consume_identifier if the identifier is a keyword.
608
609 2003-12-16  Martin Baulig  <martin@ximian.com>
610
611         * statement.cs (LocalInfo.Assigned): Removed this property.
612         (LocalInfo.Flags): Removed `Assigned'.
613         (LocalInfo.IsAssigned): New public method; takes the EmitContext
614         and uses flow analysis.
615         (Block.UsageWarning): Made this method private.
616         (Block.Resolve): Call UsageWarning() if appropriate.
617
618         * expression.cs (LocalVariableReference.DoResolve): Always set
619         LocalInfo.Used here.
620
621 2003-12-13  Martin Baulig  <martin@ximian.com>
622
623         * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
624         any value here; we're now using flow analysis to figure out
625         whether a statement/block returns a value.
626
627 2003-12-13  Martin Baulig  <martin@ximian.com>
628
629         * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
630         working again.
631         (FlowBranching.MergeFinally): Don't call
632         `branching.CheckOutParameters()' here, this is called in
633         MergeTopBlock().
634         (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
635         when adding the `finally' vector.       
636
637 2003-12-13  Martin Baulig  <martin@ximian.com>
638
639         * flowanalysis.cs
640         (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
641         actually work and also fix #48962.
642
643 2003-12-12 Ben Maurer  <bmaurer@users.sourceforge.net>
644
645         * decl.cs: Do not check System.Object for nested types,
646         since we know it does not have any. Big bang for buck:
647
648         BEFORE:
649            Run 1:   8.35 seconds
650            Run 2:   8.32 seconds
651            corlib:  17.99 seconds
652         AFTER:
653            Run 1:   8.17 seconds
654            Run 2:   8.17 seconds
655            corlib:  17.39 seconds
656
657 2003-12-11 Ben Maurer  <bmaurer@users.sourceforge.net>
658
659         * class.cs (FindMembers): Allocate arraylists on demand. Most of the
660         time we are returning 0 members, so we save alot here.
661
662 2003-12-11  Martin Baulig  <martin@ximian.com>
663
664         * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
665         `MergeChild()', also just take the `FlowBranching' as argument;
666         call Merge() on it and return the result.
667         (FlowBranching.Merge): We don't need to do anything if we just
668         have one sibling.
669
670 2003-12-11  Martin Baulig  <martin@ximian.com>
671
672         * flowanalysis.cs: Use a list of `UsageVector's instead of storing
673         them in an `ArrayList' to reduce memory usage.  Thanks to Ben
674         Maurer for this idea.
675
676 2003-12-11  Martin Baulig  <martin@ximian.com>
677
678         * flowanalysis.cs (MergeResult): This class is now gone; we now
679         use the `UsageVector' for this.  The reason for this is that if a
680         branching just has one sibling, we don't need to "merge" them at
681         all - that's the next step to do.
682         (FlowBranching.Merge): We now return a `UsageVector' instead of a
683         `MergeResult'.
684
685 2003-12-11  Martin Baulig  <martin@ximian.com>
686
687         Reworked flow analyis and made it more precise and bug-free.  The
688         most important change is that we're now using a special `Reachability'
689         class instead of having "magic" meanings of `FlowReturns'.  I'll
690         do some more cleanups and optimizations and also add some more
691         documentation this week.
692
693         * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
694         largely reworked this class.
695         (FlowReturns): Removed `Unreachable' and `Exception'; we now use
696         the new `Reachability' class instead of having "magic" values here.
697         (FlowBranching): We're now using an instance of `Reachability'
698         instead of having separate `Returns', `Breaks' etc. fields.
699
700         * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
701         based on flow analysis; ignore the return value of block.Emit ().
702
703 2003-12-10  Zoltan Varga  <vargaz@freemail.hu>
704
705         * driver.cs typemanager.cs: Find the mono extensions to corlib even
706         if they are private.
707
708 2003-12-09  Martin Baulig  <martin@ximian.com>
709
710         * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
711         call them directly on the UsageVector.
712
713 2003-12-09  Martin Baulig  <martin@ximian.com>
714
715         * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
716         Changed return type from `FlowReturns' to `Reachability'.
717
718 2003-12-09  Martin Baulig  <martin@ximian.com>
719
720         * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
721         (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
722         `Reachable' fields with a single `Reachability' one.
723
724 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
725
726         * class.cs (FindMembers): Remove foreach's.
727
728         Bootstrap times:
729         
730         BEFORE
731                 Run 1:   8.74 seconds
732                 Run 2:   8.71 seconds
733         
734         AFTER
735                 Run 1:   8.64 seconds
736                 Run 2:   8.58 seconds
737         
738
739 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
740
741         * cs-parser.jay:
742         * gen-treedump.cs:
743         * statement.cs:
744         This patch does a few things:
745                 1. EmptyStatement is now a singleton, so it is never reallocated.
746                 2. All blah is EmptyStatement constructs have been changed to
747                    blah == EmptyStatement.Value, which is much faster and valid
748                    now that EmptyStatement is a singleton.
749                 3. When resolving a block, rather than allocating a new array for
750                    the non-empty statements, empty statements are replaced with
751                    EmptyStatement.Value
752                 4. Some recursive functions have been made non-recursive.
753         Mainly the performance impact is from (3), however (1) and (2) are needed for
754         this to work. (4) does not make a big difference in normal situations, however
755         it makes the profile look saner.
756
757         Bootstrap times:
758
759         BEFORE
760         9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
761         9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
762         Total memory allocated: 56397 KB
763         
764         AFTER
765         9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
766         8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
767         Total memory allocated: 55666 KB
768
769 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
770
771         * support.cs: Rewrite DoubleHash to use its own impl. Is faster
772         than the hashtable in a hashtable version
773
774         * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
775         we always end up concating a string. This results in a huge perf
776         loss, because many strings have to be tracked by the GC. In this
777         patch, we first use a hashtable that works with two keys, so that
778         the strings do not need to be concat'ed.
779
780         Bootstrap times:
781         BEFORE
782                 Run 1:   8.74 seconds
783                 Run 2:   8.71 seconds
784         
785         AFTER
786                 Run 1:   8.65 seconds
787                 Run 2:   8.56 seconds
788         
789 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
790
791         * Makefile: Add a new target `do-time' that does a quick and simple
792         profile, leaving easy to parse output.
793
794 2003-12-08  Zoltan Varga  <vargaz@freemail.hu>
795
796         * codegen.cs (Init): Create the dynamic assembly with 
797         AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
798
799 2003-12-02 Ben Maurer  <bmaurer@users.sourceforge.net>
800
801         * support.cs: Make the PtrHashtable use only one
802         instance of its comparer.
803
804 2003-11-30  Zoltan Varga  <vargaz@freemail.hu>
805
806         * typemanager.cs: Fix lookup of GetNamespaces.
807
808 2003-11-29  Miguel de Icaza  <miguel@ximian.com>
809
810         * expression.cs: Removed redundant line.
811
812         * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
813         ArrayLists, use for loops with bounds.  
814
815         * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
816         arraylist.
817
818         * expression.cs (Invocation.OverloadResolve): Avoid foreach on
819         arraylists, use for loop with bounds.
820
821         The above three changes give us a 0.071 second performance
822         improvement out of 3.294 seconds down to 3.223.  On my machine
823         the above changes reduced the memory usage by 1,387 KB during
824         compiler bootstrap.
825
826         * cs-parser.jay (QualifiedIdentifier): New class used to represent
827         QualifiedIdentifiers.  Before we created a new string through
828         concatenation, and mostly later on, the result would be
829         manipulated by DecomposeQI through string manipulation.
830
831         This reduced the compiler memory usage for bootstrapping from
832         59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
833         compile times in 0.05 seconds.
834
835 2003-11-28  Dick Porter  <dick@ximian.com>
836
837         * support.cs: Do string compares with the Invariant culture.
838
839         * rootcontext.cs: 
840         * gen-treedump.cs: 
841         * expression.cs: 
842         * driver.cs: 
843         * decl.cs: 
844         * codegen.cs: 
845         * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
846         the comparison is done with the Invariant culture.
847
848 2003-11-27  Miguel de Icaza  <miguel@ximian.com>
849
850         * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
851         GetEnumerator method.
852
853         (ProbeCollectionType): Iterate starting at the most specific type
854         upwards looking for a GetEnumerator
855
856         * expression.cs: Shift count can be up to 31 for int/uint and 63
857         for long/ulong.
858
859 2003-11-26  Miguel de Icaza  <miguel@ximian.com>
860
861         * statement.cs (Block.LookupLabel): Also look for the label on the
862         children blocks.  Use a hash table to keep track of visited
863         nodes. 
864
865         * cfold.cs (IntConstant to UIntConstant mapping): Only return if
866         we actually did transform the other operand, otherwise fall back
867         to the common codepath that casts to long.
868
869         * cs-tokenizer.cs: Use the same code pattern as the int case.
870         Maybe I should do the parsing myself, and avoid depending on the
871         Parse routines to get this done.
872
873 2003-11-25  Miguel de Icaza  <miguel@ximian.com>
874
875         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
876         which fixes bug 51347.  This time test it.
877         
878         * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
879         attributes for example can not tell the difference between these.
880         The difference was only a syntax feature of the language. 
881
882         * attribute.cs: Apply attributes to delegates.
883
884         * delegate.cs: Call the apply attributes method.
885
886 2003-11-24  Miguel de Icaza  <miguel@ximian.com>
887
888         * convert.cs (TryImplicitIntConversion): One line bug fix: we were
889         comparing 0 vs Byte.MinValue, not the value
890
891         (ImplicitConversionRequired): When reporting a conversion error,
892         use error 31 to print out the constant error instead of the
893         simpler 29.
894
895         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
896         which fixes bug 51347.
897         
898 2003-11-22  Miguel de Icaza  <miguel@ximian.com>
899
900         * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen) 
901         which fixes the -warnaserror command line option.
902         
903 2003-11-21  Miguel de Icaza  <miguel@ximian.com>
904
905         * cfold.cs (DoNumericPromotions): During constant folding of
906         additions on UIntConstant, special case intconstants with
907         IntConstants like we do on the expression binary operator. 
908
909 2003-11-12  Miguel de Icaza  <miguel@ximian.com>
910
911         * convert.cs (ImplicitReferenceConversion): We were missing a case
912         (System.Enum are not value types or class types, so we need to
913         classify them separatedly).
914
915         * driver.cs: We do not support error 2007.
916
917 2003-11-12 Jackson Harper <jackson@ximian.com>
918
919         * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
920         system directory. Also use the full file name so users can
921         libraries names mscorlib-o-tron.dll in a non system dir.
922         
923 2003-11-10  Martin Baulig  <martin@ximian.com>
924
925         * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
926         (TypeManager.InitCoreTypes): Initialize them here, but instead of
927         calling `ResolveType()' on them, directly assign their `Type'.
928
929 2003-11-08  Martin Baulig  <martin@ximian.com>
930
931         * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
932         return value and the `out parent' parameter.
933         (TypeContainer.DefineType): Moved the CS0644 check into
934         GetClassBases().  Don't pass the interface types to the
935         `builder.DefineType()'/`builder.DefineNestedType()', but resolve
936         them later and then call `TypeBuilder.AddInterfaceImplementation()'.
937
938         * ecore.cs (TypeExpr.IsAttribute): New property.
939         (TypeExpr.GetInterfaces): New method.
940
941         * interface.cs (Interface.GetInterfaceTypeByName): Return a
942         TypeExpr instead of a Type.
943         (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
944         (Interface.DefineType): Don't pass the interface types to the
945         `builder.Definetype()'/`builder.DefineNestedType()', but resolve
946         them later and then call `TypeBulider.AddInterfaceImplementation()'.
947
948         * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
949         instead of a `Type[]'.
950         (TypeManager.RegisterBuilder): Likewise.
951         (TypeManager.AddUserInterface): Likewise.
952         (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
953         `Type[]' and also return a `TypeExpr[]'.
954         (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
955
956 2003-11-08  Martin Baulig  <martin@ximian.com>
957
958         * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
959         Expression.     
960
961 2003-11-08  Martin Baulig  <martin@ximian.com>
962
963         * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
964         TypeManager.ResolveExpressionTypes().
965
966         * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
967         instead of an Expression.
968         (TypeExpr): This is now an abstract base class for `TypeExpression'.
969         (TypeExpression): New public class; formerly known as `TypeExpr'.
970
971         * expression.cs (ComposedCast): Derive from TypeExpr.
972
973         * typemanager.cs (TypeManager.system_*_expr): These are now
974         TypExpr's instead of Expression's.
975         (TypeManager.ResolveExpressionTypes): New public static function;
976         called from DeclSpace.GetTypeResolveEmitContext() to resolve all
977         of them.        
978
979 2003-11-06  Miguel de Icaza  <miguel@ximian.com>
980
981         * expression.cs (New.DoResolve): Do not dereference value that
982         might be a null return.
983
984         * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
985         sure that the constant value has the right type.  Fixes an
986         unreported bug, similar to 50425.
987
988         * const.cs (Const.LookupConstantValue): Call
989         ImplicitStandardConversionExists before doing a conversion to
990         avoid havng the TypeManager.ChangeType do conversions.
991
992         Reduced the number of casts used
993
994         (Const.ChangeType): New routine to enable reuse of the constant
995         type changing code from statement.
996
997         * typemanager.cs (ChangeType): Move common initialization to
998         static global variables.
999
1000         Fixes #50425.
1001
1002         * convert.cs (ImplicitReferenceConversion): Somehow we allowed
1003         every value type to go through, even if it was void.  Fix that. 
1004
1005         * cs-tokenizer.cs: Use is_identifier_start_character on the start
1006         character of the define, and the is_identifier_part_character for
1007         the rest of the string.
1008
1009 2003-11-05  Miguel de Icaza  <miguel@ximian.com>
1010
1011         * expression.cs (UnaryMutator.EmitCode): When I updated
1012         LocalVariableReference.DoResolve, I overdid it, and dropped an
1013         optimization done on local variable references.
1014
1015 2003-11-04  Miguel de Icaza  <miguel@ximian.com>
1016
1017         * ecore.cs: Convert the return from Ldlen into an int.
1018
1019 2003-10-20  Miguel de Icaza  <miguel@ximian.com>
1020
1021         * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
1022         the accessibility, this is a special case for toplevel non-public
1023         classes (internal for instance).
1024
1025 2003-10-20  Nick Drochak <ndrochak@gol.com>
1026
1027         * ecore.cs: Fix typo and build.  Needed another right paren.
1028
1029 2003-10-19  Miguel de Icaza  <miguel@ximian.com>
1030
1031         * ecore.cs: Applied fix from Ben Maurer.   We were handling in the
1032         `internal' case regular and protected, but not allowing protected
1033         to be evaluated later.  Bug 49840
1034
1035 2003-10-15  Miguel de Icaza  <miguel@ximian.com>
1036
1037         * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
1038         to kb.Nlast, and not the kb.nFirst to isolate the switch
1039         statement.
1040
1041         Extract the underlying type, so enumerations of long/ulong are
1042         treated like long/ulong.
1043
1044 2003-10-14  Miguel de Icaza  <miguel@ximian.com>
1045
1046         * expression.cs (New): Overload the meaning of RequestedType to
1047         track the possible creation of the NewDelegate type, since
1048         DoResolve is invoked more than once for new constructors on field
1049         initialization.
1050
1051         See bugs: #48800 and #37014
1052
1053         * cs-parser.jay (declare_local_constants): Take an arraylist
1054         instead of a single constant.
1055
1056         (local_constant_declaration): It should take a
1057         constant_declarators, not a constant_declarator.  Fixes 49487
1058
1059         * convert.cs: Fix error report.
1060
1061 2003-10-13 Jackson Harper <jackson@ximian.com>
1062
1063         * typemanager.cs (TypeToCoreType): Add float and double this fixes
1064         bug #49611
1065         
1066 2003-10-09  Martin Baulig  <martin@ximian.com>
1067
1068         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
1069         to the .ctor.
1070         (MethodCore.DoDefineParameters): Removed the TypeContainer
1071         argument; use the DeclSpace which was passed to the .ctor instead.
1072         (MethodCore.CheckParameter): Take a DeclSpace instead of a
1073         TypeContainer; we only need a DeclSpace here.
1074
1075 2003-10-09  Martin Baulig  <martin@ximian.com>
1076
1077         * class.cs (MethodData): Added additional `DeclSpace ds' argument
1078         to the .ctor.
1079         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
1080         EmitContext's .ctor.    
1081
1082 2003-10-09  Martin Baulig  <martin@ximian.com>
1083
1084         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
1085         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
1086         AsAccessible(), moved them as well.
1087
1088         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
1089
1090 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
1091
1092         * cs-parser.jay : Renamed yyName to yyNames related to jay.
1093
1094 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
1095
1096         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
1097         generation for >=, as spotted by Paolo, bug 48679.  
1098         Patch from David Waite.
1099
1100         * cs-tokenizer.cs: Add handling for #pragma.
1101
1102         * cs-parser.jay: Allow for both yield and yield return in the
1103         syntax.  The anti-cobolization of C# fight will go on!
1104
1105         * class.cs (TypeBuilder.DefineType): Catch error condition here
1106         (Parent.DefineType erroring out and returning null).
1107
1108         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1109         coping with enumerations variables, we were mistakenly processing
1110         them as a regular value type instead of built-in types.  Fixes the
1111         bug #48063
1112
1113         * typemanager.cs (IsBuiltinOrEnum): New method.
1114
1115 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
1116
1117         * cs-parser.jay: Upgrade: yield now needs the return clause.
1118
1119 2003-09-19  Martin Baulig  <martin@ximian.com>
1120
1121         * decl.cs (MemberCache.SetupCacheForInterface): Take a
1122         `MemberCache parent' argument.  Normally, an interface doesn't
1123         have a parent type except System.Object, but we use this in gmcs
1124         for generic type parameters.
1125
1126 2003-09-18  Martin Baulig  <martin@ximian.com>
1127
1128         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
1129         on `type.IsInterface'; don't check whether the type has a parent
1130         to determine whether it's an interface.
1131
1132 2003-09-15  Martin Baulig  <martin@ximian.com>
1133
1134         * class.cs (TypeContainer.DefineType): Added an error flag to
1135         avoid reporting duplicate CS0146's ("class definition is
1136         circular.").
1137
1138         * driver.cs (Driver.MainDriver): Abort if
1139         RootContext.ResolveTree() reported any errors.
1140
1141 2003-09-07  Martin Baulig  <martin@ximian.com>
1142
1143         * report.cs (Error, Warning): Added overloaded versions which take
1144         a `params object[] args' and call String.Format().
1145
1146 2003-09-07  Martin Baulig  <martin@ximian.com>
1147
1148         * decl.cs (DeclSpace..ctor): Don't call
1149         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
1150         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
1151         (DeclSpace.RecordDecl): New method.
1152
1153         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
1154
1155 2003-09-02  Ravi Pratap  <ravi@ximian.com>
1156
1157         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
1158         value attributes to be applied to ParameterBuilders.
1159
1160         * class.cs (MethodCore.LabelParameters): Make static and more
1161         generic so that it can be used from other places - like interface
1162         methods, for instance.
1163
1164         * interface.cs (Interface.Emit): Call LabelParameters before
1165         emitting attributes on the InterfaceMethod.
1166
1167 2003-08-26  Martin Baulig  <martin@ximian.com>
1168
1169         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
1170         resolving aliases; fixes #47927.
1171
1172 2003-08-26  Martin Baulig  <martin@ximian.com>
1173
1174         * statement.cs (Using.DoResolve): This is internally emitting a
1175         try/finally clause, so we need to set ec.NeedExplicitReturn if we
1176         do not always return.  Fixes #47681.
1177
1178 2003-08-26  Martin Baulig  <martin@ximian.com>
1179
1180         * decl.cs (MemberCore): Moved WarningNotHiding(),
1181         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
1182         into MemberBase.
1183         (AdditionResult): Make this nested in DeclSpace.
1184         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
1185         argument; call NamespaceEntry.Define() unless we're nested in a
1186         class or struct.
1187
1188         * namespace.cs (Namespace.DefineName): New public function.  This
1189         is called from DeclSpace's .ctor to add 
1190         (Namespace.Lookup): Include DeclSpaces in the lookup.
1191
1192         * class.cs (Operator): Derive from MemberBase, not MemberCore.
1193
1194         * const.cs (Const): Derive from MemberBase, not MemberCore.     
1195
1196 2003-08-25  Martin Baulig  <martin@ximian.com>
1197
1198         * convert.cs (Convert.ExplicitReferenceConversion): When
1199         converting from an interface type to a class, unbox if the target
1200         type is a struct type.  Fixes #47822.
1201
1202 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1203
1204         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
1205         #47854.
1206
1207 2003-08-22  Martin Baulig  <martin@ximian.com>
1208
1209         * class.cs (TypeManager.DefineType): When defining a nested type,
1210         call DefineType() on our parent; fixes #47801.
1211
1212 2003-08-22  Martin Baulig  <martin@ximian.com>
1213
1214         * class.cs (MethodData.Define): While checking if a method is an
1215         interface implementation, improve the test a bit more to fix #47654.
1216
1217 2003-08-22  Martin Baulig  <martin@ximian.com>
1218
1219         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
1220         correctly; fixes #47722.
1221
1222 2003-08-22  Martin Baulig  <martin@ximian.com>
1223
1224         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
1225         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
1226
1227         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
1228
1229 2003-08-22  Martin Baulig  <martin@ximian.com>
1230
1231         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
1232         can only be assigned in static constructors.  Fixes #47161.
1233
1234 2003-08-22  Martin Baulig  <martin@ximian.com>
1235
1236         Rewrote and improved the flow analysis code.
1237
1238         * flowbranching.cs (FlowBranching): Make this class abstract.
1239         (FlowBranching.CreateBranching): New static function to create a
1240         new flow branching.
1241         (FlowBranchingBlock, FlowBranchingException): New classes.
1242         (FlowBranching.UsageVector.Type): New public readonly field.
1243         (FlowBranching.UsageVector.Breaks): Removed the setter.
1244         (FlowBranching.UsageVector.Returns): Removed the setter.
1245         (FlowBranching.UsageVector): Added Break(), Return(),
1246         NeverReachable() and Throw() methods to modify the reachability.
1247         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
1248         done by FlowBranching.Merge().
1249         (FlowBranching.UsageVector.MergeChild): New method; merges the
1250         merge result into the current vector.
1251         (FlowBranching.Merge): New abstract method to merge a branching.
1252
1253 2003-08-12  Martin Baulig  <martin@ximian.com>
1254
1255         * expression.cs (Indirection.CacheTemporaries): Create the
1256         LocalTemporary with the pointer type, not its element type.
1257
1258 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
1259
1260         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
1261         token was a keyword or not.
1262
1263         Add `error' options where an IDENTIFIER was expected;  Provide
1264         CheckToken and CheckIdentifierToken convenience error reporting
1265         functions. 
1266
1267         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
1268
1269         * decl.cs: Rename `NamespaceEntry Namespace' public field into
1270         NameSpaceEntry NameSpaceEntry.
1271
1272         (LookupInterfaceOrClass): Avoid creating a full qualified name
1273         from namespace and name: avoid doing lookups when we know the
1274         namespace is non-existant.   Use new Tree.LookupByNamespace which
1275         looks up DeclSpaces based on their namespace, name pair.
1276
1277         * driver.cs: Provide a new `parser verbose' to display the
1278         exception thrown during parsing.  This is turned off by default
1279         now, so the output of a failure from mcs is more graceful.
1280
1281         * namespace.cs: Track all the namespaces defined in a hashtable
1282         for quick lookup.
1283         
1284         (IsNamespace): New method
1285
1286 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
1287
1288         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
1289         we know that we need to concatenate (full typename can never be
1290         null). 
1291
1292         * class.cs: ditto.
1293
1294         * statement.cs: Use a bitfield;  Do not initialize to null things
1295         which are done by the constructor by default.
1296
1297         * cs-parser.jay: bug fix, parameter was 4, not 3.
1298
1299         * expression.cs: Just use the property;
1300
1301         * statement.cs: No need for GetVariableInfo method.
1302
1303 2003-08-08  Martin Baulig  <martin@ximian.com>
1304
1305         * flowanalysis.cs (FlowReturns): This is now nested in the
1306         `FlowBranching' class.
1307         (MyBitVector): Moved this here from statement.cs.
1308         (FlowBranching.SiblingType): New enum type.
1309         (FlowBranching.CreateSibling): Added `SiblingType' argument.
1310
1311 2003-08-07  Martin Baulig  <martin@ximian.com>
1312
1313         * flowanalysis.cs (FlowBranchingType): This is now nested in the
1314         `FlowBranching' class and called `BranchingType'.
1315
1316 2003-08-07  Martin Baulig  <martin@ximian.com>
1317
1318         * flowanalysis.cs: Moved all the control flow analysis code into
1319         its own file.
1320
1321 2003-08-07  Martin Baulig  <martin@ximian.com>
1322
1323         * assign.cs (Assign.DoResolve): `target' must either be an
1324         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
1325         #37319.
1326
1327 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
1328
1329         * expression.cs (BinaryMethod): This kind of expression is created by the
1330         Binary class if it determines that the operator has to be handled
1331         by a method.
1332
1333         (BinaryDelegate): This kind of expression is created if we are
1334         dealing with a + or - operator on delegates.
1335
1336         (Binary): remove method, argumetns, and DelegateOperator: when
1337         dealing with methods, 
1338         
1339         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
1340
1341         * statement.cs (Block): use bitfields for the three extra booleans
1342         we had in use.   Remove unused topblock parameter.
1343
1344         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
1345
1346         * assign.cs: Drop extra unneeded tests.
1347
1348 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
1349
1350         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
1351
1352         * statement.cs (Foreach): Use VariableStorage instead of
1353         LocalBuilders.   
1354
1355         * codegen.cs (VariableStorage): New class used by clients that
1356         require a variable stored: locals or fields for variables that
1357         need to live across yield.
1358
1359         Maybe provide a convenience api for EmitThis+EmitLoad?
1360
1361         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
1362         these bad boys.
1363
1364 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
1365
1366         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
1367         RemapParameterLValue): New methods that are used to turn a
1368         precomputed FieldInfo into an expression like this:
1369
1370                 instance.FieldInfo
1371
1372         The idea is to use this instead of making LocalVariableReference
1373         have more than one meaning.
1374
1375         * cs-parser.jay: Add error production to BASE.
1376
1377         * ecore.cs: Deal with TypeManager.GetField returning null, which
1378         is now a valid return value.
1379
1380         (FieldExprNoAddress): New expression for Fields whose address can
1381         not be taken.
1382
1383         * expression.cs (LocalVariableReference): During the resolve
1384         phases, create new expressions if we are in a remapping context.
1385         Remove code that dealt with remapping here.
1386
1387         (ParameterReference): same.
1388
1389         (ProxyInstance): New expression, like the `This' expression, but
1390         it is born fully resolved.  We know what we are doing, so remove
1391         the errors that are targeted to user-provided uses of `this'.
1392
1393         * statement.cs (Foreach): our variable is now stored as an
1394         Expression;  During resolution, follow the protocol, dont just
1395         assume it will return this.
1396         
1397 2003-08-06  Martin Baulig  <martin@ximian.com>
1398
1399         * support.cs (SeekableStreamReader.cs): New public class.
1400
1401         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
1402         SeekableStreamReader instead of the normal StreamReader.
1403
1404 2003-08-04  Martin Baulig  <martin@ximian.com>
1405
1406         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
1407         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
1408         deambiguate casts and delegate invocations.
1409         (parenthesized_expression): Use the new tokens to ensure this is
1410         not a cast of method invocation.
1411
1412         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
1413         when reading a `)' and Deambiguate_CloseParens () was previously
1414         called.
1415
1416         * expression.cs (ParenthesizedExpression): New class.  This is
1417         just used for the CS0075 test.
1418         (Binary.DoResolve): Check for CS0075.   
1419
1420 2003-07-29  Ravi Pratap  <ravi@ximian.com>
1421
1422         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
1423         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
1424         reference comparison.
1425
1426         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
1427         examine the ReturnType for equality - this is necessary in the
1428         cases of implicit and explicit operators whose signature also
1429         includes the return type.
1430
1431 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
1432
1433         * namespace.cs: Cache the result of the namespace computation,
1434         instead of computing it every time.
1435
1436 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
1437
1438         * decl.cs: Use a global arraylist that we reuse over invocations
1439         to avoid excesive memory consumption.  Reduces memory usage on an
1440         mcs compile by one meg (45 average).
1441
1442         * typemanager.cs (LookupTypeReflection): In .NET pointers are
1443         private, work around that.
1444
1445 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
1446
1447         * literal.cs (IntLiteral): Define Zero and One static literals. 
1448
1449         * cs-parser.jay (integer_literal): use static literals to reduce
1450         memory usage for the most used literals (0, 1 and -1).  211kb
1451         reduced in memory usage.
1452
1453         Replace all calls to `new ArrayList' with `new
1454         ArrayList(4)' which is a good average number for most allocations,
1455         and also requires only 16 bytes of memory for its buffer by
1456         default. 
1457
1458         This reduced MCS memory usage in seven megabytes for the RSS after
1459         bootstrapping.
1460
1461 2003-07-28  Ravi Pratap  <ravi@ximian.com>
1462
1463         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
1464         handle params methods the correct way by forming only one
1465         applicable set with params and normal methods in them. Earlier we
1466         were looking at params methods only if we found no normal methods
1467         which was not the correct thing to do.
1468
1469         (Invocation.BetterFunction): Take separate arguments indicating
1470         when candidate and the best method are params methods in their
1471         expanded form.
1472
1473         This fixes bugs #43367 and #46199.
1474
1475         * attribute.cs: Documentation updates.
1476
1477         (CheckAttribute): Rename to CheckAttributeTarget.
1478         (GetValidPlaces): Rename to GetValidTargets.
1479
1480         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
1481         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
1482
1483         Fixes bug #44468.
1484
1485 2003-07-28  Martin Baulig  <martin@ximian.com>
1486
1487         * class.cs (TypeContainer.DefineMembers): Use the base type's full
1488         name when looking up the base class of a nested class.  Fixes #46977.
1489
1490 2003-07-26  Martin Baulig  <martin@ximian.com>
1491
1492         * expression.cs (Indexers.Indexer): New nested struct; contains
1493         getter, setter and the indexer's type.
1494         (Indexers.Properties): This is now an ArrayList of
1495         Indexers.Indexer's.
1496         (IndexerAccess.DoResolveLValue): Correctly set the type if the
1497         indexer doesn't have any getters.
1498
1499         * assign.cs (Assign.DoResolve): Also do the implicit conversions
1500         for embedded property and indexer assignments.
1501
1502 2003-07-26  Martin Baulig  <martin@ximian.com>
1503
1504         * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
1505         preprocessor directive is not the first non-whitespace character
1506         on a line.
1507
1508 2003-07-26  Martin Baulig  <martin@ximian.com>
1509
1510         * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
1511         namespace parsing, follow the spec more closely.
1512
1513         * rootcontext.cs (RootContext.NamespaceLookup): Use the new
1514         NamespaceEntry.Lookup().
1515
1516 2003-07-25  Martin Baulig  <martin@ximian.com>
1517
1518         * MethodCore.cs (OverridesSomething): New public field; it's set
1519         from TypeContainer.DefineMembers if this method overrides
1520         something (which doesn't need to be a method).  Fix #39462.
1521
1522 2003-07-25  Ravi Pratap  <ravi@ximian.com>
1523
1524         * typemanager.cs (GetMembers): Ensure that the list of members is
1525         reversed. This keeps things in sync.
1526
1527         * attribute.cs (Attribute.CheckAttribute): Break as soon as we
1528         find an AttributeUsage attribute.
1529
1530         * expression.cs (Invocation.OverloadResolve): Perform the check
1531         which disallows Invoke to be directly called on a Delegate.
1532
1533         (Error_InvokeOnDelegate): Report error cs1533.
1534         
1535 2003-07-25  Martin Baulig  <martin@ximian.com>
1536
1537         * expression.cs (Indexers.GetIndexersForType): Only look in the
1538         interface hierarchy if the requested type is already an
1539         interface.  Fixes #46788 while keeping #46502 fixed.
1540
1541 2003-07-25  Martin Baulig  <martin@ximian.com>
1542
1543         * class.cs (TypeContainer.DefineMembers): Check whether all
1544         readonly fields have been assigned and report warning CS0649 if
1545         not.
1546
1547         * statement.cs (LocalInfo.IsFixed): Always return true if this is
1548         a valuetype.
1549
1550 2003-07-24  Ravi Pratap  <ravi@ximian.com>
1551
1552         * decl.cs (MemberCache.AddMethods): Reverse the order of the array
1553         returned from GetMethods to make things consistent with the
1554         assumptions MCS makes about ordering of methods.
1555
1556         This should comprehensively fix bug #45127 and it does :-)
1557
1558         * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
1559         ordering is actually reverse.
1560
1561         * Clean up some debug messages I left lying around.
1562
1563         * interface.cs (Populate*): Get rid of code which emits attributes
1564         since the stage in which we emit attributes is the 'Emit' stage,
1565         not the define stage.
1566
1567         (Emit): Move attribute emission for interface members here.
1568         
1569 2003-07-22  Ravi Pratap  <ravi@ximian.com>
1570
1571         * expression.cs (Invocation.OverloadResolve): Follow the spec more
1572         closely: we eliminate methods in base types when we have an
1573         applicable method in a top-level type.
1574
1575         Please see section 14.5.5.1 for an exact description of what goes
1576         on. 
1577
1578         This fixes bug #45127 and a host of other related to corlib compilation.
1579
1580         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
1581         array is the method corresponding to the top-level type (this is
1582         because of the changes made to icall.c) so we change this
1583         accordingly.
1584
1585         (MethodGroupExpr.Name): This too.
1586
1587         * typemanager.cs (GetElementType): New method which does the right
1588         thing when compiling corlib. 
1589
1590         * everywhere: Make use of the above in the relevant places.
1591
1592 2003-07-22  Martin Baulig  <martin@ximian.com>
1593
1594         * cs-parser.jay (invocation_expression): Moved
1595         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
1596         `cast_expression', but create a InvocationOrCast which later
1597         resolves to either an Invocation or a Cast.
1598
1599         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
1600         method; call this before EmitStatement() to make sure that this
1601         expression can be used as a statement.
1602
1603         * expression.cs (InvocationOrCast): New class; resolves to either
1604         an Invocation or a Cast.
1605
1606         * statement.cs (StatementExpression): Call ResolveStatement() on
1607         the ExpressionStatement before emitting it.
1608
1609 2003-07-21  Martin Baulig  <martin@ximian.com>
1610
1611         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
1612         `ref' and `out' attributes match; fixes #46220.
1613         (MemberAccess.ResolveMemberAccess): You can't reference a type
1614         through an expression; fixes #33180.
1615         (Indexers.GetIndexersForType): Don't return the indexers from
1616         interfaces the class implements; fixes #46502.
1617
1618 2003-07-21  Martin Baulig  <martin@ximian.com>
1619
1620         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
1621         CS0661 checks; fixes bug #30442.
1622
1623 2003-07-21  Martin Baulig  <martin@ximian.com>
1624
1625         * decl.cs (AdditionResult): Added `Error'.
1626
1627         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
1628
1629         * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
1630         makes cs0031.cs actually work.
1631
1632 2003-07-20  Martin Baulig  <martin@ximian.com>
1633
1634         * namespace.cs: Fixed that bug which caused a crash when compiling
1635         the debugger's GUI.
1636
1637 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
1638
1639         * typemanager.cs (LookupTypeReflection): Never expose types which
1640         are NotPublic, NestedPrivate, NestedAssembly, or
1641         NestedFamANDAssem.  We used to return these, and later do a check
1642         that would report a meaningful error, but the problem is that we
1643         would not get the real match, if there was a name override.
1644
1645 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
1646
1647         * namespace.cs (Namespace, Name): Do not compute the namespace
1648         name dynamically, compute it in the constructor.  This reduced
1649         memory usage by 1697 KB.
1650
1651         * driver.cs: Use --pause to pause at the end.
1652
1653 2003-07-17  Peter Williams  <peter@newton.cx>
1654
1655         * Makefile: Change the name of the test target so that it doesn't
1656         conflict with the recursive test target.
1657
1658 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
1659
1660         * expression.cs (LocalVariableReference.Emit, EmitAssign,
1661         AddressOf): Do not use EmitThis, that was wrong, use the actual
1662         this pointer.
1663
1664 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
1665
1666         * class.cs (MethodData.Define): While checking if a method is an
1667         interface implementation, improve the test: If we are not public
1668         (use new test here: use the computed MethodAttributes directly,
1669         instead of the parsed modifier flags) check if the `implementing'
1670         method comes from an interface or not.
1671
1672         * pending.cs (VerifyPendingMethods): Slightly better error
1673         message.
1674
1675         * makefile: add test target that does the mcs bootstrap.
1676
1677 2003-07-16  Ravi Pratap  <ravi@ximian.com>
1678
1679         * interface.cs (Define): Do nothing here since there are no
1680         members to populate etc. Move the attribute emission out of here
1681         since this was just totally the wrong place to put it. Attribute
1682         application happens during the 'Emit' phase, not in the 'Define'
1683         phase.
1684
1685         (Emit): Add this method and move the attribute emission here
1686
1687         * rootcontext.cs (EmitCode): Call the Emit method on interface
1688         types too.
1689
1690 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
1691
1692         * expression.cs (OverloadResolve): Report error only if Location
1693         is not 'Null' which means that there was a probe going on.
1694
1695 2003-07-14  Martin Baulig  <martin@ximian.com>
1696
1697         * expression.cs (ConditionalLogicalOperator): New public class to
1698         implement user defined conditional logical operators.
1699         This is section 14.11.2 in the spec and bug #40505.
1700
1701 2003-07-14  Martin Baulig  <martin@ximian.com>
1702
1703         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
1704
1705 2003-07-14  Martin Baulig  <martin@ximian.com>
1706
1707         * codegen.cs (EmitContext.InFixedInitializer): New public field.
1708
1709         * ecore.cs (IVariable.VerifyFixed): New interface method.
1710
1711         * expression.cs (Unary.ResolveOperator): When resolving the `&'
1712         operator, check whether the variable is actually fixed.  Fixes bug
1713         #36055.  Set a variable definitely assigned when taking its
1714         address as required by the spec.
1715
1716         * statement.cs (LocalInfo.IsFixed): New field.
1717         (LocalInfo.MakePinned): Set `IsFixed' to true.
1718
1719 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
1720
1721         * attribute.cs (Attribute.Resolve): While doing a Member lookup
1722         for .ctors, ensure that we only ask for members declared in the
1723         attribute type (BindingFlags.DeclaredOnly).
1724
1725         Fixes bug #43632.
1726
1727         * expression.cs (Error_WrongNumArguments): Report error 1501
1728         correctly the way CSC does.
1729
1730 2003-07-13  Martin Baulig  <martin@ximian.com>
1731
1732         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
1733         lookup on the fully qualified name, to make things like "X.X" work
1734         where "X.X" is a fully qualified type name, but we also have a
1735         namespace "X" in the using list.  Fixes #41975.
1736
1737 2003-07-13  Martin Baulig  <martin@ximian.com>
1738
1739         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
1740         function. If we're a CompoundAssign, we need to create an embedded
1741         CompoundAssign, not an embedded Assign.
1742         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
1743         Fixes #45854.
1744
1745 2003-07-13  Martin Baulig  <martin@ximian.com>
1746
1747         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
1748         work to fix bug #46088.
1749
1750 2003-07-13  Ravi Pratap <ravi@ximian.com>
1751
1752         * class.cs (Operator.Emit): Do not emit attributes here - it is
1753         taken care of by the Method class that we delegate too. This takes
1754         care of bug #45876.
1755         
1756 2003-07-10  Martin Baulig  <martin@ximian.com>
1757
1758         * expression.cs (TypeOfVoid): New class.
1759         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
1760
1761 2003-07-10  Martin Baulig  <martin@ximian.com>
1762
1763         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
1764         bug #35957.
1765
1766 2003-07-10  Martin Baulig  <martin@ximian.com>
1767
1768         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
1769         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
1770
1771         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
1772
1773         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
1774
1775 2003-07-10  Martin Baulig  <martin@ximian.com>
1776
1777         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
1778         of decimal.  Fixes #42850.
1779
1780         NOTE: I also fixed the created byte blob, but this doesn't work on
1781         the MS runtime and csc never produces any byte blobs for decimal
1782         arrays.
1783
1784 2003-07-10  Martin Baulig  <martin@ximian.com>
1785
1786         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
1787         structs; fixes #32068.
1788         (Block.AddChildVariableNames): Fixed #44302.
1789
1790 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1791
1792         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
1793         
1794 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1795
1796         * attribute.cs: And this test is onger needed.
1797
1798 2003-07-08  Martin Baulig  <martin@ximian.com>
1799
1800         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
1801         inaccessible types.  Fixes #36313.
1802
1803         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
1804
1805         * namespace.cs (NamespaceEntry): Create implicit entries for all
1806         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
1807         implicit entries for N1.N2 and N1.
1808
1809 2003-07-08  Martin Baulig  <martin@ximian.com>
1810
1811         Rewrote the handling of namespaces to fix a lot of the issues
1812         wrt. `using' aliases etc.
1813
1814         * namespace.cs (Namespace): Splitted this class into a
1815         per-assembly `Namespace' and a per-file `NamespaceEntry'.
1816
1817         * typemanager.cs (TypeManager.IsNamespace): Removed.
1818         (TypeManager.ComputeNamespaces): Only compute namespaces from
1819         loaded assemblies here, not the namespaces from the assembly we're
1820         currently compiling.
1821
1822 2003-07-08  Martin Baulig  <martin@ximian.com>
1823
1824         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
1825
1826 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1827
1828         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
1829         already fixed it.  
1830
1831         I thought about the memory savings here, but LookupTypeReflection
1832         is used under already very constrained scenarios.  Compiling
1833         corlib or mcs only exposes one hit, so it would not really reduce
1834         any memory consumption.
1835
1836 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1837
1838         * typemanager.cs: fixes bug #45889 by only adding public types from
1839         other assemblies to the list of known types.
1840
1841 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1842
1843         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
1844         on the type we resolved.
1845
1846 2003-07-05  Martin Baulig  <martin@ximian.com>
1847
1848         * pending.cs (PendingImplementation.ParentImplements): Don't
1849         create the proxy if the parent is abstract.
1850
1851         * class.cs (TypeContainer.DefineIndexers): Process explicit
1852         interface implementations first.  Fixes #37714.
1853
1854 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
1855
1856         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
1857         defined recursively;  but since we modify the input parameters
1858         (left is set to `this' temporarily), we reset this value if the
1859         left_is_explicit is false, which gives the original semantics to
1860         the code.  
1861
1862         * literal.cs (NullPointer): new class used to represent a null
1863         literal in a pointer context.
1864
1865         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
1866         type is a pointer, use a NullPointer object instead of a
1867         NullLiteral.   Closes 43687
1868
1869         (ExplicitConversion): Convert pointer values using
1870         the conv opcode to the proper type.
1871
1872         * ecore.cs (New): change ValueTypeVariable property into a method,
1873         that returns whether the valuetype is suitable for being used.
1874
1875         * expression.cs (Binary.DoNumericPromotions): Only return if we
1876         the int constant was a valid uint, and we can return both left and
1877         right as uints.  If not, we continue processing, to trigger the
1878         type conversion.  This fixes 39018.
1879
1880         * statement.cs (Block.EmitMeta): During constant resolution, set
1881         the CurrentBlock property on the emitcontext, so that we resolve
1882         constants propertly.
1883
1884 2003-07-02  Martin Baulig  <martin@ximian.com>
1885
1886         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
1887         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
1888
1889         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
1890         than emitting it here.
1891
1892         * statement.cs: Fixed some more flow analysis bugs.
1893
1894 2003-07-02  Martin Baulig  <martin@ximian.com>
1895
1896         * class.cs (MethodData.Define): When implementing interface
1897         methods, set Final unless we're Virtual.
1898
1899         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
1900         check work for interface methods.
1901
1902 2003-07-01  Martin Baulig  <martin@ximian.com>
1903
1904         * ecore.cs (EmitContext.This): Replaced this property with a
1905         GetThis() method which takes a Location argument.  This ensures
1906         that we get the correct error location for a CS0188.
1907
1908 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
1909
1910         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
1911         ImplicitStandardConversion.
1912
1913         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
1914
1915 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
1916
1917         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
1918         optimization.
1919
1920 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
1921
1922         * class.cs (Constructor.Define): Turn off initlocals for unsafe
1923         constructors.
1924
1925         (MethodData.Define): Turn off initlocals for unsafe methods.
1926
1927 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
1928
1929         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
1930         complete;  Fixes #37521.
1931
1932         * delegate.cs: Use Modifiers.TypeAttr to compute the
1933         TypeAttributes, instead of rolling our own.  This makes the flags
1934         correct for the delegates.
1935
1936 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
1937
1938         * class.cs (Constructor.Define): Set the private flag for static
1939         constructors as well.
1940
1941         * cs-parser.jay (statement_expression): Set the return value to
1942         null, to avoid a crash when we catch an error.
1943
1944 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
1945
1946         * cs-parser.jay: Applied patch from Jackson that adds support for
1947         extern and unsafe modifiers to destructor declarations.
1948
1949         * expression.cs: Report error 21 if the user is trying to index a
1950         System.Array.
1951
1952         * driver.cs: Add an error message, suggested by the bug report.
1953
1954         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
1955         if we do not have a ": this ()" constructor initializer.  Fixes 45149
1956
1957 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
1958
1959         * namespace.cs: Add some information to reduce FAQs.
1960
1961 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
1962
1963         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
1964         underlying enumeration types.  Fixes #43915.
1965
1966         * expression.cs: Treat ushort/short as legal values to be used in
1967         bitwise operations.
1968
1969 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
1970
1971         * delegate.cs: transfer custom attributes for paramenters from
1972         the delegate declaration to Invoke and BeginInvoke.
1973
1974 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
1975
1976         * attribute.cs: handle custom marshalers and emit marshal info
1977         for fields, too.
1978
1979 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
1980
1981         * makefile.gnu: Added anonymous.cs to the compiler sources.
1982
1983 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
1984
1985         * iterators.cs: Change the name of the proxy class to include two
1986         underscores.
1987
1988         * cs-parser.jay: Update grammar to include anonymous methods.
1989         
1990         * anonymous.cs: new file.
1991
1992 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
1993
1994         * class.cs (Field.Define): Add missing test for pointers and
1995         safety. 
1996
1997 2003-05-27  Ravi Pratap  <ravi@ximian.com>
1998
1999         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
2000         we use the stobj opcode.
2001
2002         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
2003         since it wasn't the correct fix. 
2004
2005         It still is puzzling that we are required to use stobj for IntPtr
2006         which seems to be a ValueType.
2007
2008 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
2009
2010         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
2011         during regular simple name resolution.   Now, the trick is that
2012         instead of returning for processing the simplename, we do a
2013         TypeManager.LookupType (ie, a rooted lookup as opposed to a
2014         contextual lookup type).   If a match is found, return that, if
2015         not, return for further composition.
2016
2017         This fixes long-standing 30485.
2018
2019         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
2020         using the address to initialize an object, do an Stobj instead of
2021         using the regular Stelem.
2022
2023         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
2024         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
2025         Because if we are a BaseIndexerAccess that value will be true.
2026         Fixes 43643.
2027
2028         * statement.cs (GotoCase.Resolve): Return after reporting an
2029         error, do not attempt to continue. 
2030
2031         * expression.cs (PointerArithmetic.Emit): If our operand is a
2032         long, convert our constants to match the operand before
2033         multiplying.  Convert to I type before adding.   Fixes 43670.
2034         
2035 2003-05-14  Ravi Pratap  <ravi@ximian.com>
2036
2037         * enum.cs (ImplicitConversionExists) : Rename to
2038         ImplicitEnumConversionExists to remove ambiguity. 
2039
2040         * ecore.cs (NullCast): New type of cast expression class which
2041         basically is very similar to EmptyCast with the difference being
2042         it still is a constant since it is used only to cast a null to
2043         something else
2044         (eg. (string) null)
2045
2046         * convert.cs (ImplicitReferenceConversion): When casting a null
2047         literal, we return a NullCast.
2048
2049         * literal.cs (NullLiteralTyped): Remove - I don't see why this
2050         should be around anymore.
2051
2052         The renaming (reported was slightly wrong). Corrections:
2053
2054         ConvertImplicitStandard -> ImplicitConversionStandard
2055         ConvertExplicitStandard -> ExplicitConversionStandard
2056
2057         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
2058         before passing them in !
2059
2060         * convert.cs (ImplicitConversionStandard): When comparing for
2061         equal expr and target types, ensure that expr is not a
2062         NullLiteral.
2063
2064         In general, we must not be checking (expr_type ==
2065         target_type) in the top level conversion methods
2066         (ImplicitConversion, ExplicitConversion etc). This checking is
2067         done in the methods that they delegate to.
2068
2069 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
2070
2071         * convert.cs: Move Error_CannotConvertType,
2072         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
2073         ImplicitNumericConversion, ImplicitConversionExists,
2074         ImplicitUserConversionExists, StandardConversionExists,
2075         FindMostEncompassedType, FindMostSpecificSource,
2076         FindMostSpecificTarget, ImplicitUserConversion,
2077         ExplicitUserConversion, GetConversionOperators,
2078         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
2079         TryImplicitIntConversion, Error_CannotConvertImplicit,
2080         ConvertImplicitRequired, ConvertNumericExplicit,
2081         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
2082         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
2083         its own file.
2084
2085         Perform the following renames:
2086         
2087         StandardConversionExists -> ImplicitStandardConversionExists
2088         ConvertImplicit -> ImplicitConversion
2089         ConvertImplicitStandard -> ImplicitStandardConversion
2090         TryImplicitIntConversion -> ImplicitIntConversion
2091         ConvertImplicitRequired -> ImplicitConversionRequired
2092         ConvertNumericExplicit -> ExplicitNumericConversion
2093         ConvertReferenceExplicit -> ExplicitReferenceConversion
2094         ConvertExplicit -> ExplicitConversion
2095         ConvertExplicitStandard -> ExplicitStandardConversion
2096
2097 2003-05-19  Martin Baulig  <martin@ximian.com>
2098
2099         * statement.cs (TypeInfo.StructInfo): Made this type protected.
2100         (TypeInfo): Added support for structs having structs as fields.
2101
2102         * ecore.cs (FieldExpr): Implement IVariable.
2103         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
2104         VariableInfo for the field.
2105
2106 2003-05-18  Martin Baulig  <martin@ximian.com>
2107
2108         * expression.cs (This.DoResolve): Report a CS0027 if we're
2109         emitting a field initializer.
2110
2111 2003-05-18  Martin Baulig  <martin@ximian.com>
2112
2113         * expression.cs (This.ResolveBase): New public function.
2114         (This.DoResolve): Check for CS0188.
2115
2116         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
2117         This.Resolve().
2118
2119         * ecore.cs (MethodGroupExpr.DoResolve): Set the
2120         `instance_expression' to null if we don't have any non-static
2121         methods.
2122
2123 2003-05-18  Martin Baulig  <martin@ximian.com>
2124
2125         Reworked the way how local variables and parameters are handled by
2126         the flow analysis code.
2127
2128         * statement.cs (TypeInfo, VariableMap): New public classes.
2129         (VariableInfo): New public class.  This is now responsible for
2130         checking whether a variable has been assigned.  It is used for
2131         parameters and local variables.
2132         (Block.EmitMeta): Take the InternalParameters as argument; compute
2133         the layout of the flow vectors here.
2134         (Block.LocalMap, Block.ParameterMap): New public properties.
2135         (FlowBranching): The .ctor doesn't get the InternalParameters
2136         anymore since Block.EmitMeta() now computes the layout of the flow
2137         vector.
2138         (MyStructInfo): This class is now known as `StructInfo' and nested
2139         in `TypeInfo'; we don't access this directly anymore.
2140
2141         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
2142         property and removed IsAssigned(), IsFieldAssigned(),
2143         SetAssigned() and SetFieldAssigned(); we now call them on the
2144         VariableInfo so we don't need to duplicate this code everywhere.
2145
2146         * expression.cs (ParameterReference): Added `Block block' argument
2147         to the .ctor.
2148         (LocalVariableReference, ParameterReference, This): The new
2149         VariableInfo class is now responsible for all the definite
2150         assignment stuff.
2151
2152         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
2153         IsParameterAssigned, SetParameterAssigned): Removed.
2154
2155 2003-05-18  Martin Baulig  <martin@ximian.com>
2156
2157         * typemanager.cs (InitCoreTypes): Try calling
2158         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
2159         the 3-args-version.  Corlib now also needs our `void_type'.
2160         (GetMethod): Added overloaded version which takes an optional
2161         `bool report_errors' to allow lookups of optional methods.
2162
2163 2003-05-12  Martin Baulig  <martin@ximian.com>
2164
2165         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
2166         only used for locals and not for parameters.
2167
2168 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
2169
2170         * support.cs (InternalParameters.ParameterType): Return the
2171         ExternalType of the parameter.
2172
2173         * parameter.cs (Parameter.ExternalType): drop the two arguments,
2174         they were unused.
2175
2176 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
2177
2178         * class.cs (MethodData.Define): Do not set the `newslot' on
2179         interface members, if they are also flagged as "override".
2180
2181         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
2182         better code for ++i and i++.  This only works for static fields
2183         and local variables.
2184
2185         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
2186         want to pull the DeclSpace out of the builder_to_declspace instead
2187         of the TypeBuilder (like in TypeContainer.FindMembers).
2188
2189         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
2190         instead of LookupTypeContainer.  Fixes the crash on .NET for
2191         looking up interface members.
2192
2193         * const.cs: Create our own emit context during the Definition
2194         stage, so that constants are evaluated in the proper context, when
2195         a recursive definition happens.
2196
2197 2003-05-11  Martin Baulig  <martin@ximian.com>
2198
2199         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
2200         new block for a switch section.
2201         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
2202         the adding/lookup in the switch block.  Fixes #39828.
2203
2204 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
2205
2206         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
2207         functionality: I needed to convert the data after I had performed
2208         the add/sub operation into the operands type size.
2209
2210         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
2211         pass the type for the box operation, otherwise the resulting
2212         object would have been of type object.
2213
2214         (BoxedCast): Add constructor to specify the type to box as.
2215
2216 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
2217
2218         * iterators.cs: I was reusing the `count' variable inadvertently,
2219         take steps to not allow this to happen.
2220
2221 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
2222
2223         * attribute.cs (Attribute.Resolve): Params attributes are encoded
2224         by creating an array at the point where the params starts and
2225         putting all those arguments there, then adjusting the size of the
2226         array.
2227
2228 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
2229
2230         * expression.cs (New.AddressOf): Implement interface
2231         IMemoryLocation.  This is used when the `new' operator is used in
2232         the context of an invocation to a method on a value type.
2233
2234         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
2235         example. 
2236
2237         * namespace.cs: Also check the using aliases here.
2238
2239         * driver.cs: Move the test for using validity after the types have
2240         been entered, so we do a single pass that also includes the using
2241         aliases. 
2242
2243         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
2244         in the regular case.   CreateSiblingForFinally is doing extra
2245         error checking.
2246
2247         * attribute.cs (GetAttributeArgumentExpression): Store the result
2248         on an out value, and use the return value to indicate failure
2249         instead of using null (which is a valid return for Constant.GetValue).
2250
2251         * statement.cs: Perform the analysis flow for the increment
2252         portion after the statement, because this will be the real flow of
2253         execution.  Fixes #42385
2254
2255         * codegen.cs (EmitContext.EmitArgument,
2256         EmitContext.EmitStoreArgument): New helper functions when the
2257         RemapToProxy flag is set.
2258
2259         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
2260         function.
2261
2262         Add support for remapping parameters. 
2263
2264         * iterators.cs: Propagate parameter values;  Store parameter
2265         values in the proxy classes.
2266         
2267 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
2268
2269         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
2270         need a proxy reference;  I do not know what I was thinking
2271
2272         * cs-parser.jay (constructor_initializer): catch another error,
2273         and display nice message.
2274         
2275         (field_declaration): catch void field declaration
2276         to flag a better error. 
2277
2278         * class.cs (MemberBase.CheckBase): Report an error instead of a
2279         warning if a new protected member is declared in a struct. 
2280         (Field.Define): catch the error of readonly/volatile.
2281
2282         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
2283
2284         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
2285         volatile variable is taken
2286
2287 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
2288
2289         * statement.cs (Fixed.Resolve): Report an error if we are not in
2290         an unsafe context.
2291
2292 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
2293
2294         * typemanager.cs: reuse the code that handles type clashes for
2295         delegates and enumerations.
2296
2297         * class.cs (Report28): Always report.
2298
2299         * expression.cs (EncodeAsAttribute): Allow nulls here.
2300
2301 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
2302
2303         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
2304         the functionality for testing whether an expression is valid for
2305         an attribute here.  Also handle the case of arrays of elements
2306         being stored. 
2307
2308         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
2309         encoding a linear array into an array of objects that are suitable
2310         to be passed to an CustomAttributeBuilder.
2311
2312         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
2313
2314         * ecore.cs: (FieldExpr): Handle field remapping here.
2315
2316         * iteratators.cs: Pass the instance variable (if the method is an
2317         instance method) to the constructors, so we can access the field
2318         variables on the class.
2319
2320         TODO: Test this with structs.  I think the THIS variable on
2321         structs might have to be a pointer, and not a refenrece
2322
2323 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
2324
2325         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
2326         local variables to fields in a proxy class.
2327
2328         * iterators.cs (PopulateProxy): Rename our internal fields to
2329         <XXX>.  
2330         Create a <THIS> field if we are an instance method, so we can
2331         reference our parent container variables.
2332         (MapVariable): Called back from the EmitContext code to enter a
2333         new variable to field mapping into the proxy class (we just create
2334         a FieldBuilder).
2335
2336         * expression.cs
2337         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
2338         for using the remapped locals to fields.
2339
2340         I placed the code here, because that gives the same semantics to
2341         local variables, and only changes the Emit code.
2342
2343         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
2344         statements inside iterators.
2345         (VariableInfo): Add a FieldBuilder for the cases when we are
2346         remapping local variables to fields in a proxy class
2347
2348         * ecore.cs (SimpleNameResolve): Avoid testing two times for
2349         current_block != null.
2350
2351         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
2352         not cope with strings, as it has been moved to the
2353         TableSwitchEmit.  Fixed bug in switch generation.
2354
2355         * expression.cs (New.DoResolve): Provide more context for the user
2356         when reporting an error.
2357
2358         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
2359         pointers. 
2360
2361         * expression.cs (MemberAccess.DoResolve): When we get a type back,
2362         check the permissions for it.  Note than in a type-resolution
2363         context the check was already present in DeclSpace.ResolveType,
2364         but was missing from the MemberAccess.
2365
2366         (ArrayCreation.CheckIndices): warn if the user has
2367         more nested levels of expressions, but there are no more
2368         dimensions specified.  Avoids crash on bug 41906.
2369
2370 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
2371
2372         * statement.cs (Block): replace Implicit bool, for a generic
2373         flags.   
2374         New flag: `Unchecked'.  This is used during the EmitMeta phase
2375         (which is out-of-line with the regular Resolve/Emit process for a
2376         statement, as this is done ahead of time, but still gets a chance
2377         to call constant resolve).
2378         
2379         (Block.Flags): new enum for adding a new flag.
2380
2381         (Block.EmitMeta): track the state of unchecked.
2382         
2383         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
2384         to enable constant resolution to work there as well.
2385
2386 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
2387
2388         * typemanager.cs (ienumerable_type): Also look up
2389         System.Collections.IEnumerable. 
2390
2391 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
2392
2393         TODO: Test more than one conditional per method.
2394         
2395         * class.cs (Indexer.Define): Report the location where the user is
2396         referencing the unsupported feature.
2397
2398         (MethodData): Overload the use of `conditionals' to
2399         minimize the creation of needless ArrayLists.   This saves roughly
2400         212kb on my machine.
2401
2402         (Method): Implement the new IIteratorContainer interface.
2403         (Method.SetYields): Implement the method by setting the ModFlags
2404         to contain METHOD_YIELDS.
2405         
2406         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
2407         which just got set to null.
2408
2409         * iterators.cs: New file.
2410
2411         (Yield, YieldBreak): New statements.
2412
2413         * statement.cs (Return.Resolve): Flag an error if we are used in
2414         an iterator method.
2415
2416         * codegen.cs (InIterator): New flag set if the code is being
2417         compiled in an iterator method.
2418
2419         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
2420         internal modifier, and we just use it to avoid adding extra
2421         fields, as this is seldom used.  
2422
2423         * cs-parser.jay: Add yield_statement (yield and yield break).
2424
2425         * driver.cs: New flag -v2 to turn on version 2 features. 
2426
2427         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
2428         hashtable when v2 is enabled.
2429
2430 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
2431
2432         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
2433         there is already a namespace defined with this name.
2434
2435         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
2436         people upgraded their corlibs.
2437
2438         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
2439         always use fully qualified types, no need to use the compiler
2440         front end.
2441
2442         (TypeManager.IsNamespace): Use binarysearch.
2443         
2444         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
2445         AddDelegate): I did not quite use the new IsValid API properly: I
2446         have to pass the short-name and the fullname.  I was passing only
2447         the basename instead of the fullname sometimes. 
2448
2449         (TypeContainer.DefineType): call NamespaceClash.
2450
2451         * interface.cs (Interface.DefineType): use NamespaceClash before
2452         defining the type.
2453
2454         * delegate.cs (Delegate.DefineType): use NamespaceClash before
2455         defining the type.
2456
2457         * enum.cs: (Enum.DefineType): use NamespaceClash before
2458         defining the type.
2459
2460         * typemanager.cs (: 3-line patch that gives us some tasty 11%
2461         speed increase.  First, use the negative_hits cache when we get a
2462         negative.  Second, add the type with its full original name
2463         instead of the new . and + encoded name (reflection uses + to
2464         separate type from a nested type).  Use LookupTypeReflection
2465         directly which bypasses the type->name hashtable (that we already
2466         know does not contain the type.
2467         
2468         * decl.cs (DeclSpace.ResolveTypeExpr): track the
2469         location/container type. 
2470
2471         * driver.cs: When passing utf8, use directly the UTF8Encoding.
2472
2473 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
2474
2475         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
2476
2477         * delegate.cs (NewDelegate.Resolve): Test whether an instance
2478         method is being referenced in the method group from a static
2479         context, and report error 120 if so.
2480
2481         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
2482         Error118. 
2483
2484         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
2485         is created, we create the A namespace).
2486
2487         * cs-parser.jay: A namespace also introduces a DeclarationFound.
2488         Fixes #41591
2489
2490 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
2491
2492         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
2493         invocation to ModuleBuilder.GetType with the same values will
2494         return a new type instance, so we need to cache its return
2495         values. 
2496
2497         * expression.cs (Binary.ResolveOperator): Only allow the compare
2498         operators on enums if they are of the same type.
2499
2500         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
2501         types of ValueType on their own case.  Before we were giving them
2502         the same treatment as objects.
2503
2504         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
2505         fullname.  Short name is used to compare against container name.
2506         Fullname is used to check against defined namespace names.
2507         
2508         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
2509         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
2510
2511         (Method.CheckBase): Call parent.
2512         (MemberBase.CheckBase): Check for protected members on sealed
2513         classes.
2514         (PropertyBase.CheckBase): Call parent.
2515         (Field.Define): Call parent.
2516
2517         * report.cs: Negative error codes are now mapped to 8000 - code,
2518         so that the display is render more nicely.
2519
2520         * typemanager.cs: Do not use try/catch, instead report a regular
2521         error. 
2522
2523         (GetPointerType, GetReferenceType): These methods provide
2524         mechanisms to obtain the T* and T& from a T.  We had the code
2525         previously scattered around the code base, and it also used
2526         TypeManager.LookupType that would go through plenty of caches.
2527         This one goes directly to the type source.
2528
2529         In some places we did the Type.GetType followed by
2530         ModuleBuilder.GetType, but not in others, so this unifies the
2531         processing as well.
2532
2533         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
2534         statements now that we have namespace information.
2535
2536         * typemanager.cs (IsNamespace): New method, returns whether the
2537         string presented is a namespace or not.
2538
2539         (ComputeNamespaces): New public entry point, computes the list of
2540         available namespaces, using the GetNamespaces API call in Mono, or
2541         the slower version in MS.NET.   
2542
2543         Now before we start the semantic analysis phase, we have a
2544         complete list of namespaces including everything that the user has
2545         provided.
2546
2547         Deleted old code to cache namespaces in .nsc files.
2548
2549 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
2550
2551         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
2552         class/struct location definition Location for the implicit
2553         constructor location.
2554
2555         (Operator.Define): Use the location of the operator for the
2556         implicit Method definition.
2557
2558         (Constructor.Emit): use the constructor location for the implicit
2559         base initializer constructor.
2560
2561         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
2562         and the Expression class now contains two new methods:
2563
2564         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
2565         isolate type lookup from the rest of the resolution process.
2566
2567         Since we use Expressions to hold type definitions due to the way
2568         we parse the input we have historically overloaded Resolve to
2569         perform the Type lookups if a special flag is passed.  Now this is
2570         eliminated and two methods take their place. 
2571         
2572         The differences in the two methods between xStep and xTerminal is
2573         that xStep is involved in our current lookup system that uses
2574         SimpleNames to compose a name, while xTerminal is used just to
2575         catch the case where the simplename lookup failed.
2576         
2577 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
2578
2579         * expression.cs (ResolveMemberAccess): Remove redundant code.
2580         TypeExpr expressions are always born fully resolved.
2581
2582         * interface.cs (PopulateMethod): Do not lookup the types twice.
2583         We were doing it once during SemanticAnalysis and once during
2584         PopulateMethod.
2585
2586         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
2587         in local variable type definitions, were being returned as a
2588         SimpleName (we decomposed everything into a string), that is
2589         because primary_expression was being used instead of a type in the
2590         grammar (reduce/reduce conflicts).
2591
2592         The part that was wrong is that we converted the expression into a
2593         string (an oversimplification in one hand, compounded with primary
2594         expressions doing string concatenation).
2595
2596         So things like:
2597
2598         A.B.C [] x;
2599
2600         Would return "A.B.C[]" as a SimpleName.  This stopped things like
2601         using clauses from working on this particular context.  And a type
2602         was being matched directly against "A.B.C[]".
2603
2604         We now use the correct approach, and allow for ComposedCast to be
2605         part of the unary expression.  So the "A.B.C []" become a composed
2606         cast of "A.B.C" (as a nested group of MemberAccess with a
2607         SimpleName at the end) plus the rank composition "[]". 
2608
2609         Also fixes 35567
2610         
2611 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
2612
2613         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
2614         for the access level checking.
2615
2616         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
2617         `TypeContainer container', because I kept getting confused when I
2618         was debugging this code.
2619
2620         * expression.cs (Indexers): Instead of tracking getters/setters,
2621         we now track them in parallel.  We create one arraylist less, but
2622         most importantly it is possible now for the LValue code to find a
2623         matching get for a set.
2624
2625         (IndexerAccess.DoResolveLValue): Update the code.
2626         GetIndexersForType has been modified already to extract all the
2627         indexers from a type.  The code assumed it did not.
2628
2629         Also make the code set the correct return type for the indexer.
2630         This was fixed a long time ago for properties, but was missing for
2631         indexers.  It used to be void_type.
2632
2633         (Binary.Emit): Test first for doubles instead of
2634         floats, as they are more common.
2635
2636         (Binary.EmitBranchable): Use the .un version of the branch opcodes
2637         when dealing with floats and the <=, >= operators.  This fixes bug
2638         #39314 
2639
2640         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
2641         to load the array value by emitting a load on the foreach variable
2642         type.  This was incorrect.  
2643
2644         We now emit the code to load an element using the the array
2645         variable type, and then we emit the conversion operator.
2646
2647         Fixed #40176
2648
2649 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
2650
2651         * attribute.cs: Avoid allocation of ArrayLists in the common case.
2652
2653 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
2654
2655         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
2656         test for protection before we test for signatures. 
2657
2658         (MethodSignature.ToString): implement.
2659
2660         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
2661         to the case where we reduced into a LongConstant.
2662
2663         * decl.cs (CheckAccessLevel): If the type is an array, we can not
2664         depend on whether the information is acurrate, because the
2665         Microsoft runtime will always claim that the array type is public,
2666         regardless of the real state.
2667
2668         If the type is a pointer, another problem happens: the type is
2669         reported as non-public in Microsoft.  
2670
2671         In both cases we have to call CheckAccessLevel recursively with
2672         the underlying type as the argument to be tested.
2673
2674 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
2675
2676         * assign.cs (Assign.Emit): If we are dealing with a compound
2677         assignment expression, we should use the code path that stores the
2678         intermediate result in a temporary value.  This fixes #40903.
2679
2680         *expression.cs (Indirection.ToString): Provide ToString method for
2681         debugging. 
2682         
2683 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
2684
2685         * class.cs: Null out fields holding references to Block objects so
2686         they can be garbage collected.
2687
2688         * expression.cs (OverloadResolve): Remove unused local.
2689
2690 2003-04-07  Martin Baulig  <martin@ximian.com>
2691
2692         * codegen.cs (EmitContext.CurrentFile): New public field.
2693         (EmitContext.Mark): Use the CurrentFile to check whether the
2694         location is in the correct file.
2695         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
2696
2697 2003-04-07  Martin Baulig  <martin@ximian.com>
2698
2699         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
2700
2701         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
2702         location.  [FIXME: The location argument which gets passed to this
2703         method is sometimes wrong!]
2704
2705 2003-04-07  Nick Drochak <ndrochak@gol.com>
2706
2707         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
2708
2709 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
2710
2711         * expression.cs (Indirection.EmitAssign): We were using the
2712         temporary, but returning immediately instead of continuing the
2713         EmitAssing flow.
2714
2715 2003-04-06  Martin Baulig  <martin@ximian.com>
2716
2717         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
2718         if it's a nested child, but also deriving from the outer class.
2719         See test 190.cs.
2720
2721         * typemanager.cs (IsNestedChildOf): Make this work if it's a
2722         nested child, but also deriving from the outer class.  See
2723         test-190.cs.
2724         (FilterWithClosure): We may access private members of the outer
2725         class if we're a nested child and deriving from the outer class.
2726         (RealMemberLookup): Only set `closure_private_ok' if the
2727         `original_bf' contained BindingFlags.NonPublic.
2728
2729 2003-04-05  Martin Baulig  <martin@ximian.com>
2730
2731         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
2732
2733 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
2734
2735         * class.cs (Event.Define): Do not allow abstract events to have
2736         initializers. 
2737
2738 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
2739
2740         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
2741         block in event declarations.
2742
2743         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
2744         value type, get its address.
2745
2746         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
2747         leaving a class on the stack instead of a boolean value (int
2748         0/1).  Change the code so we compare against null, and then the
2749         result against zero.
2750
2751         * class.cs (TypeContainer.GetClassBases): We were checking for the
2752         parent class being sealed too late.
2753
2754         * expression.cs (Binary.Emit): For <= and >= when dealing with
2755         floating point values, use cgt.un and clt.un instead of cgt and
2756         clt alone.
2757
2758 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
2759
2760         * statement.cs: Apply the same optimization as MS: skip the 
2761         GetEnumerator returning an IEnumerator, and use the one returning a 
2762         CharEnumerator instead. This allows us to avoid the try-finally block 
2763         and the boxing.
2764
2765 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
2766
2767         * cs-parser.jay: Attributes cannot be applied to
2768                          namespaces. Fixes #40473
2769
2770 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2771
2772         * class.cs:
2773         (Add*): check if the name is valid using the full name for constants,
2774         fields, properties and events.
2775
2776 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
2777
2778         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
2779         char constants to be part of the enumeration.
2780
2781         * expression.cs (Conditional.DoResolve): Add support for operator
2782         true. Implements the missing functionality from 14.12
2783
2784         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
2785         operator true/false as required by the spec.
2786
2787         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
2788         implicit conversion to boolean.
2789
2790         * statement.cs (Statement.ResolveBoolean): A boolean expression is
2791         also one where the type implements `operator true'. 
2792
2793         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
2794         get an expression that will invoke operator true based on an
2795         expression.  
2796
2797         (GetConversionOperators): Removed the hack that called op_True
2798         here.  
2799
2800         (Expression.ResolveBoolean): Move this from Statement.
2801
2802 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
2803
2804         * ecore.cs (FieldExpr): do not allow initialization of initonly
2805         fields on derived classes
2806
2807 2003-03-13  Martin Baulig  <martin@ximian.com>
2808
2809         * statement.cs (Block.Emit): Call ig.BeginScope() and
2810         ig.EndScope() when compiling with debugging info; call
2811         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
2812
2813 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
2814
2815         * expression.cs (Indexers): Do not construct immediately, allow
2816         for new members to be appended as we go.  Fixes 38143
2817
2818 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2819
2820         * expression.cs: save/restore context when resolving an unchecked
2821         expression.
2822
2823 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
2824
2825         * cfold.cs: Catch division by zero in modulus operator during
2826         constant folding.
2827
2828 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
2829
2830         * interface.cs (Interface.DefineMembers): Avoid defining members
2831         twice. 
2832
2833 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
2834
2835         * driver.cs: handle the +/- options for -noconfig
2836
2837         * statement.cs (Unckeched.Resolve): Also track the state of
2838         unchecked in the Resolve phase.
2839
2840 2003-02-27  Martin Baulig  <martin@ximian.com>
2841
2842         * ecore.cs (Expression.MemberLookup): Don't create a
2843         MethodGroupExpr for something which is not a method.  Fixes #38291.
2844
2845 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
2846
2847         * class.cs (MemberBase.CheckParameters): Also check that the type
2848         is unmanaged if it is a pointer.
2849
2850         * expression.cs (SizeOf.Resolve): Add location information.
2851
2852         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
2853         a managed type is declared.
2854
2855         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
2856         parameter modifiers as well.  Fixes bug 38606
2857
2858         * class.cs: Very sad.  Am backing out the speed up changes
2859         introduced by the ArrayList -> Array in the TypeContainer, as they
2860         were not actually that much faster, and introduced a bug (no error
2861         reports on duplicated methods).
2862
2863         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
2864         source first, this will guarantee that we have a valid expression
2865         before calling in lower levels functions that will require a
2866         resolved object.  Then use this original_source in the
2867         target.ResolveLValue instead of the original source that was
2868         passed to us.
2869
2870         Another change.  Use target.Resolve instead of LValueResolve.
2871         Although we are resolving for LValues, we will let the Assign code
2872         take care of that (it will be called again from Resolve).  This
2873         basically allows code like this:
2874
2875         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
2876         class Y { void A (X x) { x [0] += o; }
2877
2878         The problem was that the indexer was trying to resolve for
2879         set_Item (idx, object o) and never finding one.  The real set_Item
2880         was set_Item (idx, X).  By delaying the process we get the right
2881         semantics. 
2882
2883         Fixes bug 36505
2884         
2885 2003-02-23  Martin Baulig  <martin@ximian.com>
2886
2887         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
2888         while calling DoEmit ().
2889
2890         * codegen.cs (EmitContext.Mark): Don't mark locations in other
2891         source files; if you use the #line directive inside a method, the
2892         compiler stops emitting line numbers for the debugger until it
2893         reaches the end of the method or another #line directive which
2894         restores the original file.
2895
2896 2003-02-23  Martin Baulig  <martin@ximian.com>
2897
2898         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
2899
2900 2003-02-23  Martin Baulig  <martin@ximian.com>
2901
2902         * statement.cs (Block.AddChildVariableNames): We need to call this
2903         recursively, not just for our immediate children.
2904
2905 2003-02-23  Martin Baulig  <martin@ximian.com>
2906
2907         * class.cs (Event.Define): Always make the field private, like csc does.
2908
2909         * typemanager.cs (TypeManager.RealMemberLookup): Make events
2910         actually work, fixes bug #37521.
2911
2912 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
2913
2914         * delegate.cs: When creating the various temporary "Parameters"
2915         classes, make sure that we call the ComputeAndDefineParameterTypes
2916         on those new parameters (just like we do with the formal ones), to
2917         allow them to be resolved in the context of the DeclSpace.
2918
2919         This fixes the bug that Dick observed in Bugzilla #38530.
2920
2921 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
2922
2923         * expression.cs (ResolveMemberAccess): When resolving a constant,
2924         do not attempt to pull a constant if the value was not able to
2925         generate a valid constant.
2926
2927         * const.cs (LookupConstantValue): Do not report more errors than required.
2928
2929 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2930
2931         * expression.cs: fixes bug #38328.
2932
2933 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2934
2935         * class.cs: Changed all the various members that can be part of a
2936         class from being an ArrayList to be an Array of the right type.
2937         During the DefineType type_list, interface_list, delegate_list and
2938         enum_list are turned into types, interfaces, delegates and enums
2939         arrays.  
2940
2941         And during the member population, indexer_list, event_list,
2942         constant_list, field_list, instance_constructor_list, method_list,
2943         operator_list and property_list are turned into their real arrays.
2944
2945         Although we could probably perform this operation earlier, for
2946         good error reporting we need to keep the lists and remove the
2947         lists for longer than required.
2948
2949         This optimization was triggered by Paolo profiling the compiler
2950         speed on the output of `gen-sample-program.pl' perl script. 
2951
2952         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
2953         not crash in methods like MemberLookupFailed that use this field.  
2954
2955         This problem arises when the compiler fails to resolve a type
2956         during interface type definition for example.
2957
2958 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2959
2960         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
2961         inherit from System.Object, so we have to stop at null, not only
2962         when reaching System.Object.
2963
2964 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
2965
2966         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
2967         DeclaredOnly because the parent indexer might have had a different
2968         name, but did not loop until the top of the hierarchy was reached.
2969
2970         The problem this one fixes is 35492: when a class implemented an
2971         indexer from an interface, we were getting the interface method
2972         (which was abstract) and we were flagging an error (can not invoke
2973         abstract method).
2974
2975         This also keeps bug 33089 functioning, and test-148 functioning.
2976
2977         * typemanager.cs (IsSpecialMethod): The correct way of figuring
2978         out if a method is special is to see if it is declared in a
2979         property or event, or whether it is one of the predefined operator
2980         names.   This should fix correctly #36804.
2981
2982 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
2983
2984         The goal here is to remove the dependency on EmptyCast.Peel ().
2985         Killing it completely.
2986         
2987         The problem is that currently in a number of places where
2988         constants are expected, we have to "probe" for an EmptyCast, and
2989         Peel, which is not the correct thing to do, as this will be
2990         repetitive and will likely lead to errors. 
2991
2992         The idea is to remove any EmptyCasts that are used in casts that
2993         can be reduced to constants, so we only have to cope with
2994         constants. 
2995
2996         This bug hunt was triggered by Bug 37363 and the desire to remove
2997         the duplicate pattern where we were "peeling" emptycasts to check
2998         whether they were constants.  Now constants will always be
2999         constants.
3000         
3001         * ecore.cs: Use an enumconstant here instead of wrapping with
3002         EmptyCast.  
3003
3004         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
3005         throwing me off.  By handling this we can get rid of a few hacks.
3006         
3007         * statement.cs (Switch): Removed Peel() code.
3008
3009 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
3010
3011         * class.cs: Location information for error 508
3012
3013         * expression.cs (New.DoResolve): Add a guard against double
3014         resolution of an expression.  
3015
3016         The New DoResolve might be called twice when initializing field
3017         expressions (see EmitFieldInitializers, the call to
3018         GetInitializerExpression will perform a resolve on the expression,
3019         and later the assign will trigger another resolution
3020
3021         This leads to bugs (#37014)
3022
3023         * delegate.cs: The signature for EndInvoke should contain any ref
3024         or out parameters as well.  We were not doing this in the past. 
3025
3026         * class.cs (Field.Define): Do not overwrite the type definition
3027         inside the `volatile' group.  Turns out that volatile enumerations
3028         were changing the type here to perform a validity test, which
3029         broke conversions. 
3030
3031 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
3032
3033         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
3034         and structs, we do not want to load the instance variable
3035
3036         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
3037         enum_type has to be handled like an object reference (implicit
3038         conversions exists from this to object), but the regular IsClass
3039         and IsValueType tests will never return true for this one.
3040
3041         Also we use TypeManager.IsValueType instead of type.IsValueType,
3042         just for consistency with the rest of the code (this is only
3043         needed if we ever use the construct exposed by test-180.cs inside
3044         corlib, which we dont today).
3045
3046 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
3047
3048         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
3049         just InternalCall.
3050
3051 2003-02-09  Martin Baulig  <martin@ximian.com>
3052
3053         * namespace.cs (Namespace..ctor): Added SourceFile argument.
3054         (Namespace.DefineNamespaces): New static public method; this is
3055         called when we're compiling with debugging to add all namespaces
3056         to the symbol file.
3057
3058         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
3059         pass it to the Namespace's .ctor.
3060
3061         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
3062         and MethodBase arguments; pass the namespace ID to the symwriter;
3063         pass the MethodBase instead of the token to the symwriter.
3064         (SymbolWriter.DefineNamespace): New method to add a namespace to
3065         the symbol file.
3066
3067 2003-02-09  Martin Baulig  <martin@ximian.com>
3068
3069         * symbolwriter.cs: New file.  This is a wrapper around
3070         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
3071         methods here in near future.
3072
3073 2003-02-09  Martin Baulig  <martin@ximian.com>
3074
3075         * codegen.cs (EmitContext.Mark): Just pass the arguments to
3076         ILGenerator.MarkSequencePoint() which are actually used by the
3077         symbol writer.
3078
3079 2003-02-09  Martin Baulig  <martin@ximian.com>
3080
3081         * location.cs (SourceFile): New public sealed class.  This
3082         contains the name and an index which is used in the location's token.
3083         (Location): Reserve an appropriate number of bits in the token for
3084         the source file instead of walking over that list, this gives us a
3085         really huge performance improvement when compiling with debugging.
3086
3087         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
3088         `SourceFile' argument instead of a string.
3089         (Driver.ProcessFile): Add all the files via Location.AddFile(),
3090         but don't parse/tokenize here, we need to generate the list of all
3091         source files before we do that.
3092         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
3093         the files.
3094
3095         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
3096         instead of a string.
3097
3098         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
3099         of a string.
3100
3101 2003-02-09  Martin Baulig  <martin@ximian.com>
3102
3103         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
3104         filename on `#line default'.
3105
3106 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
3107
3108         * statement.cs: don't clear the pinned var when the fixed statement
3109         returns from the method (fixes bug#37752).
3110
3111 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
3112
3113         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
3114         to IsValueType.
3115
3116 2003-02-07  Martin Baulig  <martin@ximian.com>
3117
3118         * driver.cs: Removed the `--debug-args' command line argument.
3119
3120         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
3121         automatically by the AsssemblyBuilder.
3122         (CodeGen.InitializeSymbolWriter): We don't need to call any
3123         initialization function on the symbol writer anymore.  This method
3124         doesn't take any arguments.
3125
3126 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
3127
3128         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
3129         from referenced assemblies as well.
3130
3131 2003-02-02  Martin Baulig  <martin@ximian.com>
3132
3133         * class.cs (MethodData.Emit): Generate debugging info for external methods.
3134
3135 2003-02-02  Martin Baulig  <martin@ximian.com>
3136
3137         * class.cs (Constructor.Emit): Open the symbol writer before
3138         emitting the constructor initializer.
3139         (ConstructorInitializer.Emit): Call ec.Mark() to allow
3140         single-stepping through constructor initializers.
3141
3142 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
3143
3144         * class.cs: Handle error 549: do not allow virtual methods in
3145         sealed classes. 
3146
3147 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
3148
3149         * decl.cs: Check access levels when resolving types
3150         
3151 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
3152
3153         * statement.cs: Add parameters and locals set in catch blocks that might 
3154         return to set vector
3155
3156 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
3157
3158         * class.cs (Operator): Set the SpecialName flags for operators.
3159         
3160         * expression.cs (Invocation.DoResolve): Only block calls to
3161         accessors and operators on SpecialName methods.
3162
3163         (Cast.TryReduce): Handle conversions from char constants.
3164
3165
3166 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
3167
3168         * statement.cs: small memory and time optimization in FlowBranching.
3169         
3170 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
3171
3172         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
3173         problem that the last fix but in the other sid (Set).
3174
3175         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
3176         access when there is no indexer in the hierarchy.
3177         
3178 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
3179
3180         * class.cs: Combine some if statements.
3181
3182 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3183
3184         * driver.cs: fixed bug #37187.
3185
3186 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
3187
3188         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
3189         any indexer, it's needed to build a list with all the indexers in the
3190         hierarchy (AllGetters), else we have problems. Fixes #35653.
3191
3192 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
3193
3194         * class.cs (MethodData.Define): It is wrong for an interface
3195         implementation to be static in both cases: explicit and implicit.
3196         We were only handling this in one case.
3197
3198         Improve the if situation there to not have negations.
3199         
3200         * class.cs (Field.Define): Turns out that we do not need to check
3201         the unsafe bit on field definition, only on usage.  Remove the test.
3202
3203 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3204
3205         * driver.cs: use assembly.Location instead of Codebase (the latest
3206         patch made mcs fail when using MS assemblies).
3207
3208 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
3209
3210         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
3211         get the path to *corlib.dll.
3212
3213 2003-01-21  Nick Drochak <ndrochak@gol.com>
3214
3215         * cs-tokenizer.cs:
3216         * pending.cs:
3217         * typemanager.cs: Remove compiler warnings
3218
3219 2003-01-20  Duncan Mak  <duncan@ximian.com>
3220
3221         * AssemblyInfo.cs: Bump the version number to 0.19.
3222         
3223 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3224
3225         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
3226
3227 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
3228
3229         * class.cs (Constructor::Emit): Emit debugging info for constructors.
3230
3231 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
3232
3233         * cs-parser.jay: Small fix: we were not comparing the constructor
3234         name correctly.   Thanks to Zoltan for the initial pointer.
3235
3236 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
3237
3238         * cs-tokenizer.cs: Set file name when specified with #line
3239
3240 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
3241
3242         * cs-parser.jay: Only perform the constructor checks here if we
3243         are named like the class;  This will help provider a better
3244         error.  The constructor path is taken when a type definition is
3245         not found, but most likely the user forgot to add the type, so
3246         report that rather than the constructor error.
3247
3248 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
3249
3250         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
3251         allocations.
3252
3253 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
3254
3255         * cs-parser.jay: Add cleanup call.
3256
3257 2003-01-13  Duncan Mak  <duncan@ximian.com>
3258
3259         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
3260         consistent with other methods.
3261
3262 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
3263
3264         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
3265         
3266 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
3267
3268         * attribute.cs: only set GuidAttr to true when we have a
3269         GuidAttribute.
3270
3271 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3272
3273         * ecore.cs:
3274         * expression.cs:
3275         * typemanager.cs: fixes to allow mcs compile corlib with the new
3276         Type.IsSubclassOf fix.
3277
3278 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
3279
3280         * expression.cs (LocalVariableReference.DoResolve): Classify a
3281         constant as a value, not as a variable.   Also, set the type for
3282         the variable.
3283
3284         * cs-parser.jay (fixed_statement): take a type instead of a
3285         pointer_type, so we can produce a better error message later.
3286         
3287         * statement.cs (Fixed.Resolve): Flag types that are not pointers
3288         as an error.  
3289         
3290         (For.DoEmit): Make inifinite loops have a
3291         non-conditional branch back.
3292
3293         (Fixed.DoEmit): First populate the pinned variables, then emit the
3294         statement, then clear the variables.  Before I was emitting the
3295         code once for each fixed piece.
3296
3297
3298 2003-01-08  Martin Baulig  <martin@ximian.com>
3299
3300         * statement.cs (FlowBranching.MergeChild): A break in a
3301         SWITCH_SECTION does not leave a loop.  Fixes #36155.
3302
3303 2003-01-08  Martin Baulig  <martin@ximian.com>
3304
3305         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
3306         lives in the same number space than `param_map'.  Fixes #36154.
3307
3308 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
3309
3310         * cs-parser.jay (constructor_declaration): Set the
3311         Constructor.ModFlags before probing for it.  This makes the
3312         compiler report 514, 515 and 132 (the code was there, but got
3313         broken). 
3314
3315         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
3316         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
3317         (GotoCase.Resolve): Set `Returns' to ALWAYS.
3318
3319 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
3320
3321         * enum.cs: create the enum static fields using the enum type.
3322
3323 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
3324
3325         * class.cs: don't try to create the ParamBuilder for the return
3326         type if it's not needed (and handle it breaking for the ms runtime
3327         anyway).
3328
3329 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
3330
3331         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
3332
3333 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
3334
3335         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
3336         the command.   This showed up while compiling the JANET source
3337         code, which used \r as its only newline separator.
3338
3339 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
3340
3341         * class.cs (Method.Define): If we are an operator (because it
3342         reuses our code), then set the SpecialName and HideBySig.  #36128
3343
3344 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
3345
3346         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
3347         exception, report error 120 `object reference required'.
3348
3349         * driver.cs: Add --pause option, used during to measure the size
3350         of the process as it goes with --timestamp.
3351
3352         * expression.cs (Invocation.DoResolve): Do not allow methods with
3353         SpecialName to be invoked.
3354
3355 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
3356
3357         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
3358         number before adding it.
3359
3360 2002-12-21  Ravi Pratap  <ravi@ximian.com>
3361
3362         * ecore.cs (StandardImplicitConversion): When in an unsafe
3363         context, we allow conversion between void * to any other pointer
3364         type. This fixes bug #35973.
3365
3366 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
3367
3368         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
3369         is not thrown when extensionless outputs are used 
3370
3371 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3372
3373         * rootcontext.cs: fixed compilation of corlib.
3374
3375 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
3376
3377         * attribute.cs (Attributes.Contains): Add new method.
3378
3379         * class.cs (MethodCore.LabelParameters): if the parameter is an
3380         `out' parameter, check that no attribute `[In]' has been passed.
3381
3382         * enum.cs: Handle the `value__' name in an enumeration.
3383
3384 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
3385
3386         * decl.cs: Added special case to allow overrides on "protected
3387         internal" methods
3388         
3389 2002-12-18  Ravi Pratap  <ravi@ximian.com>
3390
3391         * attribute.cs (Attributes.AddAttributeSection): Rename to this
3392         since it makes much more sense.
3393
3394         (Attributes.ctor): Don't require a Location parameter.
3395         
3396         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
3397
3398         * attribute.cs (ApplyAttributes): Remove extra Location parameters
3399         since we already have that information per attribute.
3400
3401         * everywhere : make appropriate changes.
3402
3403         * class.cs (LabelParameters): Write the code which actually
3404         applies attributes to the return type. We can't do this on the MS
3405         .NET runtime so we flag a warning in the case an exception is
3406         thrown.
3407
3408 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
3409
3410         * const.cs: Handle implicit null conversions here too.
3411
3412 2002-12-17  Ravi Pratap  <ravi@ximian.com>
3413
3414         * class.cs (MethodCore.LabelParameters): Remove the extra
3415         Type [] parameter since it is completely unnecessary. Instead
3416         pass in the method's attributes so that we can extract
3417         the "return" attribute.
3418
3419 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
3420
3421         * cs-parser.jay (parse): Use Report.Error to flag errors instead
3422         of ignoring it and letting the compile continue.
3423
3424         * typemanager.cs (ChangeType): use an extra argument to return an
3425         error condition instead of throwing an exception.
3426
3427 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
3428
3429         * expression.cs (Unary.TryReduce): mimic the code for the regular
3430         code path.  Perform an implicit cast in the cases where we can
3431         implicitly convert to one of the integral types, and then reduce
3432         based on that constant.   This fixes bug #35483.
3433
3434 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3435
3436         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
3437
3438 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3439
3440         * namespace.cs: fixed bug #35489.
3441
3442 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
3443
3444         * class.cs: Remove some dead code.
3445
3446         * cs-parser.jay: Estimate the number of methods needed
3447         (RootContext.MethodCount);
3448
3449         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
3450         numbers instead of StringBuilders.
3451
3452         * support.cs (PtrHashtable): Add constructor with initial size;
3453         We can now reduce reallocations of the method table.
3454
3455 2002-12-10  Ravi Pratap  <ravi@ximian.com>
3456
3457         * attribute.cs (ApplyAttributes): Keep track of the emitted
3458         attributes on a per-target basis. This fixes bug #35413.
3459
3460 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
3461
3462         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
3463         default to the Windows 1252 encoding.
3464
3465         (UnixParseOption): Support version, thanks to Alp for the missing
3466         pointer. 
3467
3468         * AssemblyInfo.cs: Add nice assembly information.
3469
3470         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
3471         (bug 35169).
3472
3473         * cs-parser.jay: Allow a trailing comma before the close bracked
3474         in the attribute_section production.
3475
3476         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
3477         address of the instance was being taken, I will take this out,
3478         because we take the address of the object immediately here.
3479
3480 2002-12-09  Ravi Pratap  <ravi@ximian.com>
3481
3482         * typemanager.cs (AreMultipleAllowed): Take care of the most
3483         obvious case where attribute type is not in the current assembly -
3484         stupid me ;-)
3485
3486 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
3487
3488         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
3489         definitions, instead of doing that afterwards.  
3490
3491         Also we use a nice little hack, depending on the constructor, we
3492         know if we are a "composed" name or a simple name.  Hence, we
3493         avoid the IndexOf test, and we avoid 
3494
3495         * codegen.cs: Add code to assist in a bug reporter to track down
3496         the source of a compiler crash. 
3497
3498 2002-12-07  Ravi Pratap  <ravi@ximian.com>
3499
3500         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
3501         types have been emitted for a given element and flag an error
3502         if something which does not have AllowMultiple set is used more
3503         than once.
3504
3505         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
3506         attribute types and their corresponding AllowMultiple properties
3507
3508         (AreMultipleAllowed): Check the property for a given type.
3509
3510         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
3511         property in the case we have a TypeContainer.
3512
3513         (Attributes.AddAttribute): Detect duplicates and just skip on
3514         adding them. This trivial fix catches a pretty gross error in our
3515         attribute emission - global attributes were being emitted twice!
3516
3517         Bugzilla bug #33187 is now fixed.
3518
3519 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
3520
3521         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
3522         instead of pp_and).
3523
3524         * expression.cs (Binary.ResolveOperator): I can only use the
3525         Concat (string, string, string) and Concat (string, string,
3526         string, string) if the child is actually a concatenation of
3527         strings. 
3528
3529 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
3530
3531         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
3532         context where we need a 2-character lookahead.
3533
3534         * pending.cs (PendingImplementation): Rework so we can keep track
3535         of interface types all the time, and flag those which were
3536         implemented by parents as optional.
3537
3538 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
3539
3540         * expression.cs (Binary.ResolveOperator): Use
3541         String.Concat(string,string,string) or
3542         String.Concat(string,string,string,string) when possible. 
3543
3544         * typemanager: More helper methods.
3545
3546
3547 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
3548
3549         * pending.cs: remove the bogus return from GetMissingInterfaces()
3550         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
3551
3552 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3553
3554         * namespace.cs: avoid duplicated 'using xxx' being added to
3555         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
3556         when we get more than one 'using' statement for the same namespace.
3557         Report a CS0105 warning for it.
3558
3559 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
3560
3561         * cs-tokenizer.cs (consume_identifier): use read directly, instead
3562         of calling getChar/putback, uses internal knowledge of it.    
3563
3564         (xtoken): Reorder tokenizer so most common patterns are checked
3565         first.  This reduces the compilation time in another 5% (from 8.11s
3566         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
3567
3568         The parsing time is 22% of the compilation in mcs, and from that
3569         64% is spent on the tokenization process.  
3570
3571         I tried using a binary search for keywords, but this is slower
3572         than the hashtable.  Another option would be to do a couple of
3573         things:
3574
3575                 * Not use a StringBuilder, instead use an array of chars,
3576                   with a set value.  Notice that this way we could catch
3577                   the 645 error without having to do it *afterwards*.
3578
3579                 * We could write a hand-parser to avoid the hashtable
3580                   compares altogether.
3581
3582         The identifier consumption process takes 37% of the tokenization
3583         time.  Another 15% is spent on is_number.  56% of the time spent
3584         on is_number is spent on Int64.Parse:
3585
3586                 * We could probably choose based on the string length to
3587                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
3588                   computations. 
3589
3590         Another 3% is spend on wrapping `xtoken' in the `token' function.
3591
3592         Handle 0xa0 as whitespace (#34752)
3593         
3594 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
3595
3596         * typemanager.cs (IsCLRType): New routine to tell whether a type
3597         is one of the builtin types.  
3598
3599         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
3600         typecode in more places instead of doing pointer comparissions.
3601         We could leverage some knowledge about the way the typecodes are
3602         laid out.
3603
3604         New code to cache namespaces in assemblies, it is currently not
3605         invoked, to be used soon.
3606
3607         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
3608
3609         * expression.cs (Binary.ResolveOperator): specially handle
3610         strings, and do not perform user-defined operator overloading for
3611         built-in types.
3612
3613 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
3614
3615         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
3616         internalcall as it is a pretty simple operation;  Avoid whenever
3617         possible to call Char.IsLetter.
3618
3619         (consume_identifier): Cut by half the number of
3620         hashtable calls by merging the is_keyword and GetKeyword behavior.
3621
3622         Do not short-circuit, because if we do, we
3623         report errors (ie, #if false && true would produce an invalid
3624         directive error);
3625         
3626
3627 2002-11-24  Martin Baulig  <martin@ximian.com>
3628
3629         * expression.cs (Cast.TryReduce): If we're in checked syntax,
3630         check constant ranges and report a CS0221.  Fixes #33186.
3631
3632 2002-11-24  Martin Baulig  <martin@ximian.com>
3633
3634         * cs-parser.jay: Make this work for uninitialized variable
3635         declarations in the `for' initializer.  Fixes #32416.
3636
3637 2002-11-24  Martin Baulig  <martin@ximian.com>
3638
3639         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
3640         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
3641
3642 2002-11-24  Martin Baulig  <martin@ximian.com>
3643
3644         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
3645         argument; if true, we also check for user-defined conversions.
3646         This is only needed if both arguments are of a user-defined type.
3647         Fixes #30443, added test-175.cs.
3648         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
3649
3650         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
3651
3652 2002-11-24  Martin Baulig  <martin@ximian.com>
3653
3654         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
3655         function to get the store opcode.
3656         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
3657         only emit the Ldelema if the store opcode is Stobj.  You must run
3658         both test-34 and test-167 to test this.  Fixes #34529.
3659
3660 2002-11-23  Martin Baulig  <martin@ximian.com>
3661
3662         * ecore.cs (Expression.MemberLookup): Added additional
3663         `qualifier_type' argument which is used when we're being called
3664         from MemberAccess.DoResolve() and null if we're called from a
3665         SimpleName lookup.
3666         (Expression.MemberLookupFailed): New method to report errors; this
3667         does the CS1540 check and reports the correct error message.
3668
3669         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
3670         argument for the CS1540 check and redone the way how we're dealing
3671         with private members.  See the comment in the source code for details.
3672         (FilterWithClosure): Reverted this back to revision 1.197; renamed
3673         `closure_start_type' to `closure_qualifier_type' and check whether
3674         it's not null.  It was not this filter being broken, it was just
3675         being called with the wrong arguments.
3676
3677         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
3678         and pass it the correct `qualifier_type'; this also does the error
3679         handling for us.
3680
3681 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
3682
3683         * expression.cs (Invocation.EmitParams): If the we are dealing
3684         with a non-built-in value type, load its address as well.
3685
3686         (ArrayCreation): Use a a pretty constant instead
3687         of the hardcoded value 2.   Use 6 instead of 2 for the number of
3688         static initializers.  
3689
3690         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
3691         because they are not really value types, just glorified integers. 
3692
3693         * driver.cs: Do not append .exe, the CSC compiler does not do it.
3694
3695         * ecore.cs: Remove redundant code for enumerations, make them use
3696         the same code path as everything else, fixes the casting issue
3697         with enumerations in Windows.Forms.
3698
3699         * attribute.cs: Do only cast to string if it is a string, the
3700         validation happens later.
3701
3702         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
3703         people upgrade their corlibs.
3704
3705         * ecore.cs: Oops, enumerations were not following the entire code path
3706
3707 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
3708
3709         * typemanager.cs (FilterWithClosure): Commented out the test for
3710         1540 in typemanager.cs, as it has problems when accessing
3711         protected methods from a parent class (see test-174.cs). 
3712
3713         * attribute.cs (Attribute.ValidateGuid): new method.
3714         (Attribute.Resolve): Use above.
3715
3716 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
3717
3718         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
3719
3720         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
3721         handling for enumerations, as we only needed the TypeContainer
3722         functionality to begin with (this is required for the fix below to
3723         work for enums that reference constants in a container class for
3724         example). 
3725
3726         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
3727
3728         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
3729         a valid TypeBuilder to perform lookups on.o
3730
3731         * class.cs (InheritableMemberSignatureCompare): Use true in the
3732         call to GetGetMethod and GetSetMethod, because we are comparing
3733         the signature, and we need to get the methods *even* if they are
3734         private. 
3735
3736         (PropertyBase.CheckBase): ditto.
3737
3738         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
3739         GotoCase.Resolve): Use Peel on EmpytCasts.
3740
3741         * ecore.cs (EmptyCast): drop child, add Peel method.
3742
3743 2002-11-17  Martin Baulig  <martin@ximian.com>
3744
3745         * ecore.cs (EmptyCast.Child): New public property.
3746
3747         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
3748         label resolved to an EmptyCast.  Fixes #34162.
3749         (GotoCase.Resolve): Likewise.
3750         (Block.EmitMeta): Likewise.
3751
3752 2002-11-17  Martin Baulig  <martin@ximian.com>
3753
3754         * expression.cs (Invocation.BetterConversion): Prefer int over
3755         uint; short over ushort; long over ulong for integer literals.
3756         Use ImplicitConversionExists instead of StandardConversionExists
3757         since we also need to check for user-defined implicit conversions.
3758         Fixes #34165.  Added test-173.cs.
3759
3760 2002-11-16  Martin Baulig  <martin@ximian.com>
3761
3762         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
3763         with the `true' and `false' literals.  Fixes #33151.
3764
3765 2002-11-16  Martin Baulig  <martin@ximian.com>
3766
3767         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
3768         October 22nd; don't do the cs1540 check for static members.
3769
3770         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
3771         now using our own filter here and doing the cs1540 check again.
3772
3773 2002-11-16  Martin Baulig  <martin@ximian.com>
3774
3775         * support.cs (InternalParameters): Don't crash if we don't have
3776         any fixed parameters.  Fixes #33532.
3777
3778 2002-11-16  Martin Baulig  <martin@ximian.com>
3779
3780         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
3781         when looking up static methods to make this work on Windows.
3782         Fixes #33773.
3783
3784 2002-11-16  Martin Baulig  <martin@ximian.com>
3785
3786         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
3787         a setter rather than using PropertyInfo.CanWrite.
3788
3789 2002-11-15  Nick Drochak  <ndrochak@gol.com>
3790
3791         * class.cs: Allow acces to block member by subclasses. Fixes build
3792         breaker.
3793
3794 2002-11-14  Martin Baulig  <martin@ximian.com>
3795
3796         * class.cs (Constructor.Emit): Added the extern/block check.
3797         Fixes bug #33678.
3798
3799 2002-11-14  Martin Baulig  <martin@ximian.com>
3800
3801         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
3802         iteration while looking for indexers, this is needed because the
3803         indexer may have a different name in our base classes.  Fixed the
3804         error reporting (no indexers at all, not get accessor, no
3805         overloaded match).  Fixes bug #33089.
3806         (IndexerAccess.DoResolveLValue): Likewise.
3807
3808 2002-11-14  Martin Baulig  <martin@ximian.com>
3809
3810         * class.cs (PropertyBase.CheckBase): Make this work for multiple
3811         indexers.  Fixes the first part of bug #33089.
3812         (MethodSignature.InheritableMemberSignatureCompare): Added support
3813         for properties.
3814
3815 2002-11-13  Ravi Pratap  <ravi@ximian.com>
3816
3817         * attribute.cs (Attribute.Resolve): Catch the
3818         NullReferenceException and report it since it isn't supposed to
3819         happen. 
3820         
3821 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
3822
3823         * expression.cs (Binary.EmitBranchable): Also handle the cases for
3824         LogicalOr and LogicalAnd that can benefit from recursively
3825         handling EmitBranchable.  The code now should be nice for Paolo.
3826
3827 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
3828
3829         * typemanager.cs (LookupType): Added a negative-hit hashtable for
3830         the Type lookups, as we perform quite a number of lookups on
3831         non-Types.  This can be removed once we can deterministically tell
3832         whether we have a type or a namespace in advance.
3833
3834         But this might require special hacks from our corlib.
3835
3836         * TODO: updated.
3837
3838         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
3839         and double which avoids a conversion from an integer to a double.
3840
3841         * expression.cs: tiny optimization, avoid calling IsConstant,
3842         because it effectively performs the lookup twice.
3843
3844 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
3845
3846         But a bogus return here to keep the semantics of the old code
3847         until the Mono runtime is fixed.
3848         
3849         * pending.cs (GetMissingInterfaces): New method used to remove all
3850         the interfaces that are already implemented by our parent
3851         classes from the list of pending methods. 
3852
3853         * interface.cs: Add checks for calls after ResolveTypeExpr.
3854
3855 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
3856
3857         * class.cs (Class.Emit): Report warning 67: event not used if the
3858         warning level is beyond 3.
3859
3860         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
3861         being a NullLiteral.
3862
3863         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
3864         specifiers. 
3865
3866         * class.cs (TypeContainer.GetClassBases): Cover a missing code
3867         path that might fail if a type can not be resolved.
3868
3869         * expression.cs (Binary.Emit): Emit unsigned versions of the
3870         operators. 
3871
3872         * driver.cs: use error 5.
3873         
3874 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
3875
3876         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
3877
3878 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
3879
3880         * cs-parser.jay (switch_section): A beautiful patch from Martin
3881         Baulig that fixed 33094.
3882
3883 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
3884
3885         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
3886         Check whether the base is abstract and report an error if so.
3887
3888         * expression.cs (IndexerAccess.DoResolveLValue,
3889         IndexerAccess.DoResolve): ditto. 
3890
3891         (Invocation.DoResolve): ditto.
3892         
3893         (Invocation.FullMethodDesc): Improve the report string.
3894
3895         * statement.cs (Block): Eliminate IsVariableDefined as it is
3896         basically just a wrapper for GetVariableInfo.
3897
3898         * ecore.cs (SimpleName): Use new 
3899
3900         * support.cs (ReflectionParamter.ParameterType): We unwrap the
3901         type, as we return the actual parameter ref/unref state on a
3902         different call.
3903
3904 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
3905
3906         * support.cs: Return proper flags REF/OUT fixing the previous
3907         commit.  
3908
3909         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
3910         not used to mean `ref' but `ref or out' in ParameterReference
3911         
3912         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
3913         full type signature instead of calling TypeManger.CSharpName
3914         ourselves. 
3915
3916         * support.cs (InternalParameters.ParameterDesc): Do not compare
3917         directly to the modflags, because REF/OUT will actually be bitsets
3918         if set. 
3919
3920         * delegate.cs (VerifyMethod): Check also the modifiers.
3921
3922         * cs-tokenizer.cs: Fix bug where floating point values with an
3923         exponent where a sign was missing was ignored.
3924
3925         * driver.cs: Allow multiple assemblies to be specified in a single
3926         /r: argument
3927
3928 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
3929
3930         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
3931         because identifiers after a parenthesis would end up in this kind
3932         of production, and we needed to desamiguate it for having casts
3933         like:
3934
3935                 (UserDefinedType *) xxx
3936
3937 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
3938
3939         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
3940         we should set on the Bindingflags.NonPublic, but not turn on
3941         private_ok.  private_ok controls whether a Private member is
3942         returned (this is chekced on the filter routine), while the
3943         BindingFlags.NonPublic just controls whether private/protected
3944         will be allowed.   This fixes the problem part of the problem of
3945         private properties being allowed to be used in derived classes.
3946
3947         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
3948         so we can call the children DoResolveLValue method (this will
3949         properly signal errors on lvalue assignments to base properties)
3950         
3951         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
3952         getter are null, and we have a property info, we know that this
3953         happened because the lookup failed, so we report an error 122 for
3954         protection level violation.
3955
3956         We also silently return if setter and getter are null in the
3957         resolve functions, this condition only happens if we have flagged
3958         the error before.  This is the other half of the problem. 
3959
3960         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
3961         not have accessibility information, that is why we were returning
3962         true in the filter function in typemanager.cs.
3963
3964         To properly report 122 (property is inaccessible because of its
3965         protection level) correctly, we report this error in ResolveAccess
3966         by failing if both the setter and the getter are lacking (ie, the
3967         lookup failed). 
3968
3969         DoResolve and DoLResolve have been modified to check for both
3970         setter/getter being null and returning silently, the reason being
3971         that I did not want to put the knowledge about this error in upper
3972         layers, like:
3973
3974         int old = Report.Errors;
3975         x = new PropertyExpr (...);
3976         if (old != Report.Errors)
3977                 return null;
3978         else
3979                 return x;
3980
3981         So the property expr is returned, but it is invalid, so the error
3982         will be flagged during the resolve process. 
3983
3984         * class.cs: Remove InheritablePropertySignatureCompare from the
3985         class, as we no longer depend on the property signature to compute
3986         whether it is possible to implement a method or not.
3987
3988         The reason is that calling PropertyInfo.GetGetMethod will return
3989         null (in .NET, in Mono it works, and we should change this), in
3990         cases where the Get Method does not exist in that particular
3991         class.
3992
3993         So this code:
3994
3995         class X { public virtual int A { get { return 1; } } }
3996         class Y : X { }
3997         class Z : Y { public override int A { get { return 2; } } }
3998
3999         Would fail in Z because the parent (Y) would not have the property
4000         defined.  So we avoid this completely now (because the alternative
4001         fix was ugly and slow), and we now depend exclusively on the
4002         method names.
4003
4004         (PropertyBase.CheckBase): Use a method-base mechanism to find our
4005         reference method, instead of using the property.
4006
4007         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
4008         routines are gone now.
4009
4010         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
4011         names, they were incorrectly named.
4012
4013         * cs-tokenizer.cs: Return are more gentle token on failure. 
4014
4015         * pending.cs (PendingImplementation.InterfaceMethod): This routine
4016         had an out-of-sync index variable, which caused it to remove from
4017         the list of pending methods the wrong method sometimes.
4018
4019 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
4020
4021         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
4022         CanWrite, because those refer to this particular instance of the
4023         property, and do not take into account the fact that we can
4024         override single members of a property.
4025
4026         Constructor requires an EmitContext.  The resolution process does
4027         not happen here, but we need to compute the accessors before,
4028         because the resolution does not always happen for properties.
4029         
4030         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
4031         subclass, before we did not update this flag, but we did update
4032         bindingflags. 
4033
4034         (GetAccessors): Drop this routine, as it did not work in the
4035         presence of partially overwritten set/get methods. 
4036
4037         Notice that this broke the cs1540 detection, but that will require
4038         more thinking. 
4039         
4040 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4041
4042         * class.cs:
4043         * codegen.cs:
4044         * driver.cs: issue a warning instead of an error if we don't support
4045         debugging for the platform. Also ignore a couple of errors that may
4046         arise when trying to write the symbols. Undo my previous patch.
4047
4048 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4049
4050         * driver.cs: ignore /debug switch except for Unix platforms.
4051
4052 2002-10-23  Nick Drochak  <ndrochak@gol.com>
4053
4054         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
4055
4056 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
4057
4058         * driver.cs: Do not make mcs-debug conditional, so we do not break
4059         builds that use it.
4060
4061         * statement.cs (UsageVector.MergeChildren): I would like Martin to
4062         review this patch.  But basically after all the children variables
4063         have been merged, the value of "Breaks" was not being set to
4064         new_breaks for Switch blocks.  I think that it should be set after
4065         it has executed.  Currently I set this to the value of new_breaks,
4066         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
4067         conservative, but I do not understand this code very well.
4068
4069         I did not break anything in the build, so that is good ;-)
4070
4071         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
4072
4073 2002-10-20  Mark Crichton  <crichton@gimp.org>
4074
4075         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
4076
4077 2002-10-20  Nick Drochak  <ndrochak@gol.com>
4078
4079         * cfold.cs: Fixed compile blocker.
4080
4081 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
4082
4083         * driver.cs: I was chekcing the key, not the file.
4084
4085 2002-10-19  Ravi Pratap  <ravi@ximian.com>
4086
4087         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
4088         message that we were generating - we just need to silently return
4089         a null.
4090
4091 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
4092
4093         * class.cs (Event.Define): Change my previous commit, as this
4094         breaks the debugger.  This is a temporary hack, as it seems like
4095         the compiler is generating events incorrectly to begin with.
4096
4097         * expression.cs (Binary.ResolveOperator): Added support for 
4098         "U operator - (E x, E y)"
4099
4100         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
4101         y)".
4102
4103         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
4104         init-only variables, but this path did not take into account that
4105         there might be also instance readonly variables.  Correct this
4106         problem. 
4107
4108         This fixes bug 32253
4109
4110         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
4111         delegates as well.
4112
4113         * driver.cs: Change the extension for modules to `netmodule'
4114
4115         * cs-parser.jay: Improved slightly the location tracking for
4116         the debugger symbols.
4117
4118         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
4119         modifiers that were specified instead of the hardcoded value
4120         (FamAndAssem).  This was basically ignoring the static modifier,
4121         and others.  Fixes 32429.
4122
4123         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
4124         fixed a bug in the process (32476)
4125
4126         * expression.cs (ArrayAccess.EmitAssign): Patch from
4127         hwang_rob@yahoo.ca that fixes bug 31834.3
4128
4129 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
4130
4131         * driver.cs: Make the module extension .netmodule.
4132
4133 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
4134
4135         * driver.cs: Report an error if the resource file is not found
4136         instead of crashing.
4137
4138         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
4139         false, like Emit does.
4140
4141 2002-10-16  Nick Drochak  <ndrochak@gol.com>
4142
4143         * typemanager.cs: Remove unused private member.  Also reported mcs
4144         bug to report this as a warning like csc.
4145
4146 2002-10-15  Martin Baulig  <martin@gnome.org>
4147
4148         * statement.cs (Statement.Emit): Made this a virtual method; emits
4149         the line number info and calls DoEmit().
4150         (Statement.DoEmit): New protected abstract method, formerly knows
4151         as Statement.Emit().
4152
4153         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
4154
4155 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
4156
4157         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
4158         have fixed a remaining problem: not every AddXXXX was adding a
4159         fully qualified name.  
4160
4161         Now everyone registers a fully qualified name in the DeclSpace as
4162         being defined instead of the partial name.  
4163
4164         Downsides: we are slower than we need to be due to the excess
4165         copies and the names being registered this way.  
4166
4167         The reason for this is that we currently depend (on the corlib
4168         bootstrap for instance) that types are fully qualified, because
4169         we dump all the types in the namespace, and we should really have
4170         types inserted into the proper namespace, so we can only store the
4171         basenames in the defined_names array.
4172
4173 2002-10-10  Martin Baulig  <martin@gnome.org>
4174
4175         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
4176         from bug #31834, see the bug report for a testcase which is
4177         miscompiled.
4178
4179 2002-10-10  Martin Baulig  <martin@gnome.org>
4180
4181         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
4182         flow analysis code for this.
4183
4184         * statement.cs (Do, While, For): Tell the flow analysis code about
4185         infinite loops.
4186         (FlowBranching.UsageVector): Added support for infinite loops.
4187         (Block.Resolve): Moved the dead code elimination here and use flow
4188         analysis to do it.
4189
4190 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
4191
4192         * class.cs (Field.Define): Catch cycles on struct type
4193         definitions. 
4194
4195         * typemanager.cs (IsUnmanagedtype): Do not recursively check
4196         fields if the fields are static.  We only need to check instance
4197         fields. 
4198
4199         * expression.cs (As.DoResolve): Test for reference type.
4200
4201         * statement.cs (Using.ResolveExpression): Use
4202         ConvertImplicitRequired, not ConvertImplicit which reports an
4203         error on failture
4204         (Using.ResolveLocalVariableDecls): ditto.
4205
4206         * expression.cs (Binary.ResolveOperator): Report errors in a few
4207         places where we had to.
4208
4209         * typemanager.cs (IsUnmanagedtype): Finish implementation.
4210
4211 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
4212
4213         * expression.cs: Use StoreFromPtr instead of extracting the type
4214         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
4215
4216         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
4217         an enumeration value to a System.Enum, but System.Enum is not a
4218         value type, but an class type, so we need to box.
4219
4220         (Expression.ConvertExplicit): One codepath could return
4221         errors but not flag them.  Fix this.  Fixes #31853
4222
4223         * parameter.cs (Resolve): Do not allow void as a parameter type.
4224
4225 2002-10-06  Martin Baulig  <martin@gnome.org>
4226
4227         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
4228         if it's a class type and not a struct.  Fixes #31815.
4229
4230 2002-10-06  Martin Baulig  <martin@gnome.org>
4231
4232         * statement.cs: Reworked the flow analysis code a bit to make it
4233         usable for dead code elimination.
4234
4235 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4236
4237         * cs-parser.jay: allow empty source files. Fixes bug #31781.
4238
4239 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
4240
4241         * expression.cs (ComposedCast.DoResolveType): A quick workaround
4242         to fix the test 165, will investigate deeper.
4243
4244 2002-10-04  Martin Baulig  <martin@gnome.org>
4245
4246         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
4247         finally blocks actually work.
4248         (Try.Resolve): We don't need to create a sibling for `finally' if
4249         there is no finally block.
4250
4251 2002-10-04  Martin Baulig  <martin@gnome.org>
4252
4253         * class.cs (Constructor.Define): The default accessibility for a
4254         non-default constructor is private, not public.
4255
4256 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
4257
4258         * class.cs (Constructor): Make AllowedModifiers public, add
4259         EXTERN.
4260
4261         * cs-parser.jay: Perform the modifiers test here, as the
4262         constructor for the Constructor class usually receives a zero
4263         because of the way we create it (first we create, later we
4264         customize, and we were never checking the modifiers).
4265
4266         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
4267         is a version of LookupTypeReflection that includes the type-name
4268         cache.  This can be used as a fast path for functions that know
4269         the fully qualified name and are only calling into *.GetType() to
4270         obtain a composed type.
4271
4272         This is also used by TypeManager.LookupType during its type
4273         composition.
4274
4275         (LookupType): We now also track the real type name, as sometimes
4276         we can get a quey for the real type name from things like
4277         ComposedCast.  This fixes bug 31422.
4278         
4279         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
4280         complete type fullname, it does not have to go through the type
4281         resolution system to obtain the composed version of the type (for
4282         obtaining arrays or pointers).
4283         
4284         (Conditional.Emit): Use the EmitBoolExpression to
4285         generate nicer code, as requested by Paolo.
4286
4287         (ArrayCreation.CheckIndices): Use the patch from
4288         hwang_rob@yahoo.ca to validate the array initializers. 
4289
4290 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
4291
4292         * class.cs (ConstructorInitializer.Emit): simplify code by using
4293         Invocation.EmitCall, and at the same time, fix the bugs in calling
4294         parent constructors that took variable arguments. 
4295
4296         * ecore.cs (Expression.ConvertNumericExplicit,
4297         Expression.ImplicitNumericConversion): Remove the code that
4298         manually wrapped decimal (InternalTypeConstructor call is now gone
4299         as well).
4300
4301         * expression.cs (Cast.TryReduce): Also handle decimal types when
4302         trying to perform a constant fold on the type.
4303
4304         * typemanager.cs (IsUnmanagedtype): Partially implemented.
4305
4306         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
4307         that only turned off an error report, and did nothing else. 
4308
4309 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
4310
4311         * driver.cs: Handle and ignore /fullpaths
4312
4313 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
4314
4315         * expression.cs (Binary.ResolveOperator): Catch the case where
4316         DoNumericPromotions returns true, 
4317
4318         (Binary.DoNumericPromotions): Simplify the code, and the tests.
4319
4320 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
4321
4322         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
4323         report error 70.
4324
4325 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
4326
4327         * ecore.cs (ConvertNumericExplicit): It is not enough that the
4328         conversion exists, but it is also required that the conversion be
4329         performed.  This manifested in "(Type64Enum) 2".  
4330
4331         * class.cs (TypeManager.AddMethod): The fix is not to change
4332         AddEnum, because that one was using a fully qualified name (every
4333         DeclSpace derivative does), but to change the AddMethod routine
4334         that was using an un-namespaced name.  This now correctly reports
4335         the duplicated name.
4336
4337         Revert patch until I can properly fix it.  The issue
4338         is that we have a shared Type space across all namespaces
4339         currently, which is wrong.
4340
4341         Options include making the Namespace a DeclSpace, and merge
4342         current_namespace/current_container in the parser.
4343
4344 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
4345
4346         * cs-parser.jay: Improve error reporting when we get a different
4347         kind of expression in local_variable_type and
4348         local_variable_pointer_type. 
4349
4350         Propagate this to avoid missleading errors being reported.
4351
4352         * ecore.cs (ImplicitReferenceConversion): treat
4353         TypeManager.value_type as a target just like object_type.   As
4354         code like this:
4355
4356         ValueType v = 1;
4357
4358         Is valid, and needs to result in the int 1 being boxed before it
4359         is assigned to the value type v.
4360
4361         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
4362         to validate the enumeration name.
4363
4364         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
4365         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
4366         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
4367
4368         * ecore.cs (TryImplicitIntConversion): When doing an
4369         implicit-enumeration-conversion, check if the type is 64-bits and
4370         perform a conversion before passing to EnumConstant.
4371
4372 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
4373
4374         * decl.cs (Error_AmbiguousTypeReference); New routine used to
4375         report ambiguous type references.  Unlike the MS version, we
4376         report what the ambiguity is.   Innovation at work ;-)
4377
4378         (DeclSpace.FindType): Require a location argument to
4379         display when we display an ambiguous error.
4380
4381         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
4382
4383         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
4384
4385         * expression.cs (EmitDynamicInitializers): Apply patch from
4386         hwang_rob@yahoo.ca that fixes the order in which we emit our
4387         initializers. 
4388
4389 2002-09-21  Martin Baulig  <martin@gnome.org>
4390
4391         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
4392         delegate takes no arguments.
4393
4394 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
4395
4396         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
4397         from integers.
4398
4399         * expression.cs: Extract the underlying type.
4400
4401         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
4402
4403         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
4404
4405 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
4406
4407         * class.cs (TypeContainer.DefineType): We can not use the nice
4408         PackingSize with the size set to 1 DefineType method, because it
4409         will not allow us to define the interfaces that the struct
4410         implements.
4411
4412         This completes the fixing of bug 27287
4413
4414         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
4415         means also structs.  This fixes part of the problem. 
4416         (Expresion.ImplicitReferenceConversionExists): ditto.
4417
4418         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
4419         error if there were no errors reported during the type lookup
4420         process, to avoid duplicates or redundant errors.  Without this
4421         you would get an ambiguous errors plus a type not found.  We have
4422         beaten the user enough with the first error.  
4423
4424         (DeclSparce.FindType): Emit a warning if we have an ambiguous
4425         reference. 
4426
4427         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
4428         during the resolution process, stop the lookup, this avoids
4429         repeated error reports (same error twice).
4430
4431         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
4432
4433         * typemanager.cs (LookupType): Redo the type lookup code to match
4434         the needs of System.Reflection.  
4435
4436         The issue is that System.Reflection requires references to nested
4437         types to begin with a "+" sign instead of a dot.  So toplevel
4438         types look like: "NameSpace.TopLevelClass", and nested ones look
4439         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
4440         levels. 
4441
4442 2002-09-19  Martin Baulig  <martin@gnome.org>
4443
4444         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
4445         says that a method always returns or always throws an exception,
4446         don't report the CS0161.
4447
4448         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
4449         set `Returns = new_returns'.
4450
4451 2002-09-19  Martin Baulig  <martin@gnome.org>
4452
4453         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
4454         to an enum constant, check for a CS0176.
4455
4456 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
4457
4458         * class.cs (TypeContainer.CheckPairedOperators): Now we check
4459         for operators that must be in pairs and report errors.
4460
4461         * ecore.cs (SimpleName.DoResolveType): During the initial type
4462         resolution process, when we define types recursively, we must
4463         check first for types in our current scope before we perform
4464         lookups in the enclosing scopes.
4465
4466         * expression.cs (MakeByteBlob): Handle Decimal blobs.
4467
4468         (Invocation.VerifyArgumentsCompat): Call
4469         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
4470         I thought we were supposed to always call this, but there are a
4471         few places in the code where we dont do it.
4472
4473 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
4474
4475         * driver.cs: Add support in -linkres and -resource to specify the
4476         name of the identifier.
4477
4478 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
4479
4480         * ecore.cs (StandardConversionExists): Sync with the conversion
4481         code: allow anything-* to void* conversions.
4482
4483         (FindMostSpecificSource): Use an Expression argument
4484         instead of a Type, because we might be handed over a Literal which
4485         gets a few more implicit conversions that plain types do not.  So
4486         this information was being lost.
4487
4488         Also, we drop the temporary type-holder expression when not
4489         required.
4490
4491 2002-09-17  Martin Baulig  <martin@gnome.org>
4492
4493         * class.cs (PropertyBase.CheckBase): Don't check the base class if
4494         this is an explicit interface implementation.
4495
4496 2002-09-17  Martin Baulig  <martin@gnome.org>
4497
4498         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
4499         different `IndexerName' attributes.
4500
4501         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
4502         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
4503         virtual CommonResolve().
4504
4505 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
4506
4507         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
4508         and convert that to the UnderlyingType.
4509
4510         * statement.cs (Foreach.Resolve): Indexers are just like variables
4511         or PropertyAccesses.
4512
4513         * cs-tokenizer.cs (consume_string): Track line numbers and columns
4514         inside quoted strings, we were not doing this before.
4515
4516 2002-09-16  Martin Baulig  <martin@gnome.org>
4517
4518         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
4519         resolve it.  This is needed for the definite assignment check of the
4520         instance expression, fixes bug #29846.
4521         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
4522
4523 2002-09-16  Nick Drochak  <ndrochak@gol.com>
4524
4525         * parameter.cs: Fix compile error.  Cannot reference static member
4526         from an instance object.  Is this an mcs bug?
4527
4528 2002-09-14  Martin Baulig  <martin@gnome.org>
4529
4530         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
4531         multiple times.  Fixes bug #30295, added test-166.cs.
4532
4533 2002-09-14  Martin Baulig  <martin@gnome.org>
4534
4535         * statement.cs (Block.Emit): Don't emit unreachable code.
4536         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
4537         `break' statements.
4538         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
4539
4540 2002-09-14  Martin Baulig  <martin@gnome.org>
4541
4542         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
4543         is set.
4544
4545 2002-09-14  Martin Baulig  <martin@gnome.org>
4546
4547         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
4548         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
4549         be false on the ms runtime.
4550
4551 2002-09-13  Martin Baulig  <martin@gnome.org>
4552
4553         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
4554         the CS0038 error message.
4555
4556 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
4557
4558         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
4559         constant inside, return it.
4560
4561 2002-09-12  Martin Baulig  <martin@gnome.org>
4562
4563         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
4564         implicit conversion can be done between enum types.
4565
4566         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
4567         check whether an implicit conversion to the current enum's UnderlyingType
4568         exists and report an error if not.
4569
4570         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
4571         without debugging support.
4572
4573         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
4574         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
4575
4576 2002-09-12  Martin Baulig  <martin@gnome.org>
4577
4578         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
4579
4580         * ecore.cs (IMemberExpr.DeclaringType): New property.
4581         (SimpleName.SimpleNameResolve): Check whether we're accessing a
4582         nonstatic member of an outer type (CS0038).
4583
4584 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
4585
4586         * driver.cs: Activate the using-error detector at warning level
4587         4 (at least for MS-compatible APIs).
4588
4589         * namespace.cs (VerifyUsing): Small buglett fix.
4590
4591         * pending.cs (PendingImplementation): pass the container pointer. 
4592
4593         * interface.cs (GetMethods): Allow for recursive definition.  Long
4594         term, I would like to move every type to support recursive
4595         definitions, not the current ordering mechanism that we have right
4596         now.
4597
4598         The situation is this: Attributes are handled before interfaces,
4599         so we can apply attributes to interfaces.  But some attributes
4600         implement interfaces, we will now handle the simple cases
4601         (recursive definitions will just get an error).  
4602
4603         * parameter.cs: Only invalidate types at the end if we fail to
4604         lookup all types.  
4605
4606 2002-09-09  Martin Baulig  <martin@gnome.org>
4607
4608         * ecore.cs (PropertyExpr.Emit): Also check for
4609         TypeManager.system_int_array_get_length so this'll also work when
4610         compiling corlib.  Fixes #30003.
4611
4612 2002-09-09  Martin Baulig  <martin@gnome.org>
4613
4614         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
4615         and throw an exception if we can't get the type's size.  Fixed #30040,
4616         added test-165.cs.
4617
4618 2002-09-09  Martin Baulig  <martin@gnome.org>
4619
4620         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
4621
4622         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
4623         context.  Fixes bug #30027.
4624
4625         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
4626         virtual functions.  Fixes bug #30043, added test-164.cs.
4627
4628 2002-09-08  Ravi Pratap  <ravi@ximian.com>
4629
4630         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
4631
4632 2002-09-08  Nick Drochak  <ndrochak@gol.com>
4633
4634         * driver.cs: Use an object to get the windows codepage since it's not a
4635         static property.
4636
4637 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
4638
4639         * statement.cs (For.Emit): for infinite loops (test == null)
4640         return whether there is a break inside, not always "true".
4641
4642         * namespace.cs (UsingEntry): New struct to hold the name of the
4643         using definition, the location where it is defined, and whether it
4644         has been used in a successful type lookup.
4645         
4646         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
4647         strings.
4648
4649         * decl.cs: ditto.
4650
4651 2002-09-06  Ravi Pratap  <ravi@ximian.com>
4652
4653         * attribute.cs : Fix incorrect code which relied on catching
4654         a NullReferenceException to detect a null being passed in
4655         where an object was expected.
4656
4657 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
4658
4659         * statement.cs (Try): flag the catch variable as assigned
4660
4661         * expression.cs (Cast): Simplified by using ResolveType instead of
4662         manually resolving.
4663
4664         * statement.cs (Catch): Fix bug by using ResolveType.
4665
4666 2002-09-06  Ravi Pratap  <ravi@ximian.com>
4667
4668         * expression.cs (BetterConversion): Special case for when we have
4669         a NullLiteral as the argument and we have to choose between string
4670         and object types - we choose string the way csc does.
4671
4672         * attribute.cs (Attribute.Resolve): Catch the
4673         NullReferenceException and report error #182 since the Mono
4674         runtime no more has the bug and having this exception raised means
4675         we tried to select a constructor which takes an object and is
4676         passed a null.
4677
4678 2002-09-05  Ravi Pratap  <ravi@ximian.com>
4679
4680         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
4681         message (1502, 1503) when we can't locate a method after overload
4682         resolution. This is much more informative and closes the bug
4683         Miguel reported.
4684
4685         * interface.cs (PopulateMethod): Return if there are no argument
4686         types. Fixes a NullReferenceException bug.
4687
4688         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
4689         expressions too. Previously we were checking only in one place for
4690         positional arguments leaving out named arguments.
4691
4692         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
4693         type to the enum type is not allowed. Remove code corresponding to
4694         that.
4695
4696         (ConvertNumericExplicit): Allow explicit conversions from
4697         the underlying type to enum type. This precisely follows the spec
4698         and closes a bug filed by Gonzalo.
4699         
4700 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4701
4702         * compiler.csproj:
4703         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
4704
4705 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
4706
4707         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
4708         it was important that we stored the right value after the
4709         reduction in `converted'.
4710
4711 2002-09-04  Martin Baulig  <martin@gnome.org>
4712
4713         * location.cs (Location.SymbolDocument): Use full pathnames for the
4714         source files.
4715
4716 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
4717
4718         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
4719         of the expression resolve mechanism, because that will catch the
4720         SimpleName error failures.
4721
4722         (Conditional): If we can not resolve the
4723         expression, return, do not crash.
4724
4725 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4726
4727         * cs-tokenizer.cs:
4728         (location): display token name instead of its number.
4729
4730 2002-08-28  Martin Baulig  <martin@gnome.org>
4731
4732         * expression.cs (Binary.ResolveOperator): Don't silently return
4733         but return an error if an operator cannot be applied between two
4734         enum types.
4735
4736 2002-08-28  Martin Baulig  <martin@gnome.org>
4737
4738         * class.cs (Constructor.Define): Set the permission attributes
4739         correctly instead of making all constructors public.
4740
4741 2002-08-28  Martin Baulig  <martin@gnome.org>
4742
4743         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
4744         for private members before reporting a CS0103; if we find anything,
4745         it's a CS0122.
4746
4747 2002-08-28  Martin Baulig  <martin@gnome.org>
4748
4749         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
4750         to check whether `closure_start_type == closure_invocation_type',
4751         we also need to check whether `m.DeclaringType == closure_invocation_type'
4752         before bypassing the permission checks.  We might be accessing
4753         protected/private members from the base class.
4754         (TypeManager.RealMemberLookup): Only set private_ok if private
4755         members were requested via BindingFlags.NonPublic.
4756
4757         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
4758
4759         * expression.cs (MemberAccess.ResolveMemberAccess): Set
4760         MethodGroupExpr.IsExplicitImpl if appropriate.
4761         (Invocation.DoResolve): Don't report the CS0120 for explicit
4762         interface implementations.
4763
4764 2002-08-27  Martin Baulig  <martin@gnome.org>
4765
4766         * expression.cs (Invocation.DoResolve): If this is a static
4767         method and we don't have an InstanceExpression, we must report
4768         a CS0120.
4769
4770 2002-08-25  Martin Baulig  <martin@gnome.org>
4771
4772         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
4773         `==' between a valuetype and an object.
4774
4775 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
4776
4777         * ecore.cs (TypeExpr): Provide a ToString method.
4778
4779 2002-08-24  Martin Baulig  <martin@gnome.org>
4780
4781         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
4782         now called proggie.dbg and it's a binary file.
4783
4784 2002-08-23  Martin Baulig  <martin@gnome.org>
4785
4786         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
4787
4788 2002-08-23  Martin Baulig  <martin@gnome.org>
4789
4790         * struct.cs (MyStructInfo.ctor): Make this work with empty
4791         structs; it's not allowed to use foreach() on null.
4792
4793 2002-08-23  Martin Baulig  <martin@gnome.org>
4794
4795         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
4796         writer the full pathname of the generated assembly.
4797
4798 2002-08-23  Martin Baulig  <martin@gnome.org>
4799
4800         * statements.cs (FlowBranching.UsageVector.MergeChildren):
4801         A `finally' block never returns or breaks; improved handling of
4802         unreachable code.
4803
4804 2002-08-23  Martin Baulig  <martin@gnome.org>
4805
4806         * statement.cs (Throw.Resolve): Allow `throw null'.
4807
4808 2002-08-23  Martin Baulig  <martin@gnome.org>
4809
4810         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
4811         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
4812         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
4813         MemberLookup would return a wrong event if this is an explicit
4814         interface implementation and the class has an event with the same
4815         name.
4816
4817 2002-08-23  Martin Baulig  <martin@gnome.org>
4818
4819         * statement.cs (Block.AddChildVariableNames): New public method.
4820         (Block.AddChildVariableName): Likewise.
4821         (Block.IsVariableNameUsedInChildBlock): Likewise.
4822         (Block.AddVariable): Check whether a variable name has already
4823         been used in a child block.
4824
4825         * cs-parser.jay (declare_local_variables): Mark all variable names
4826         from the current block as being used in a child block in the
4827         implicit block.
4828
4829 2002-08-23  Martin Baulig  <martin@gnome.org>
4830
4831         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
4832         find the symbol writer.
4833
4834         * driver.cs: csc also allows the arguments to /define being
4835         separated by commas, not only by semicolons.
4836
4837 2002-08-23  Martin Baulig  <martin@gnome.org>
4838
4839         * interface.cs (Interface.GetMembers): Added static check for events.
4840
4841 2002-08-15  Martin Baulig  <martin@gnome.org>
4842
4843         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
4844         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
4845
4846         * ecore.cs (Expression.MemberLookup): Added documentation and explained
4847         why the MethodData.EmitDestructor() change was necessary.
4848
4849 2002-08-20  Martin Baulig  <martin@gnome.org>
4850
4851         * class.cs (TypeContainer.FindMembers): Added static check for events.
4852
4853         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
4854
4855         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
4856         use Type.GetEvents(), not Type.FindMembers().
4857
4858 2002-08-20  Martin Baulig  <martin@gnome.org>
4859
4860         * decl.cs (MemberCache): Added a special method cache which will
4861         be used for method-only searched.  This ensures that a method
4862         search will return a MethodInfo with the correct ReflectedType for
4863         inherited methods.      
4864
4865 2002-08-20  Martin Baulig  <martin@gnome.org>
4866
4867         * decl.cs (DeclSpace.FindMembers): Made this public.
4868
4869 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4870
4871         * delegate.cs: fixed build on windows.
4872         [FIXME:  Filed as bug #29150: MCS must report these errors.]
4873
4874 2002-08-19  Ravi Pratap  <ravi@ximian.com>
4875
4876         * ecore.cs (StandardConversionExists): Return a false
4877         if we are trying to convert the void type to anything else
4878         since that is not allowed.
4879
4880         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
4881         we flag error 70 in the event an event is trying to be accessed
4882         directly from outside the declaring type.
4883
4884 2002-08-20  Martin Baulig  <martin@gnome.org>
4885
4886         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
4887         MemberCache from typemanager.cs to decl.cs.
4888
4889 2002-08-19  Martin Baulig  <martin@gnome.org>
4890
4891         * class.cs (TypeContainer): Implement IMemberContainer.
4892         (TypeContainer.DefineMembers): Create the MemberCache.
4893         (TypeContainer.FindMembers): Do better BindingFlags checking; only
4894         return public members if BindingFlags.Public was given, check
4895         whether members are static.
4896
4897 2002-08-16  Martin Baulig  <martin@gnome.org>
4898
4899         * decl.cs (DeclSpace.Define): Splitted this in Define and
4900         DefineMembers.  DefineMembers is called first and initializes the
4901         MemberCache.
4902
4903         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
4904         DefineMembers() on all our DeclSpaces.
4905
4906         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
4907         but call DefineMembers() on all nested interfaces.  We call their
4908         Define() in our new Define() function.
4909
4910         * interface.cs (Interface): Implement IMemberContainer.
4911         (Interface.Define): Moved all code except the attribute stuf to
4912         DefineMembers().
4913         (Interface.DefineMembers): Initialize the member cache.
4914
4915         * typemanager.cs (IMemberFinder): Removed this interface, we don't
4916         need this anymore since we can use MemberCache.FindMembers directly.
4917
4918 2002-08-19  Martin Baulig  <martin@gnome.org>
4919
4920         * typemanager.cs (MemberCache): When creating the cache for an
4921         interface type, add all inherited members.
4922         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
4923         to `out bool used_cache' and documented it.
4924         (TypeManager.MemberLookup): If we already used the cache in the first
4925         iteration, we don't need to do the interfaces check.
4926
4927 2002-08-19  Martin Baulig  <martin@gnome.org>
4928
4929         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
4930         here from IMemberFinder and don't implement this interface anymore.
4931         (DeclSpace.MemberCache): Moved here from IMemberFinder.
4932
4933         * typemanager.cs (IMemberFinder): This interface is now only used by
4934         classes which actually support the member cache.
4935         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
4936         since we only put DeclSpaces into this Hashtable.
4937         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
4938         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
4939
4940 2002-08-16  Martin Baulig  <martin@gnome.org>
4941
4942         * typemanager.cs (ICachingMemberFinder): Removed.
4943         (IMemberFinder.MemberCache): New property.
4944         (TypeManager.FindMembers): Merged this with RealFindMembers().
4945         This function will never be called from TypeManager.MemberLookup()
4946         so we can't use the cache here, just the IMemberFinder.
4947         (TypeManager.MemberLookup_FindMembers): Check whether the
4948         IMemberFinder has a MemberCache and call the cache's FindMembers
4949         function.
4950         (MemberCache): Rewrote larger parts of this yet another time and
4951         cleaned it up a bit.
4952
4953 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
4954
4955         * driver.cs (LoadArgs): Support quoting.
4956
4957         (Usage): Show the CSC-like command line arguments.
4958
4959         Improved a few error messages.
4960
4961 2002-08-15  Martin Baulig  <martin@gnome.org>
4962
4963         * typemanager.cs (IMemberContainer.Type): New property.
4964         (IMemberContainer.IsInterface): New property.
4965
4966         The following changes are conditional to BROKEN_RUNTIME, which is
4967         defined at the top of the file.
4968
4969         * typemanager.cs (MemberCache.MemberCache): Don't add the base
4970         class'es members, but add all members from TypeHandle.ObjectType
4971         if we're an interface.
4972         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
4973         is the current type.
4974         (MemberCache.CacheEntry.Container): Removed this field.
4975         (TypeHandle.GetMembers): Include inherited members.
4976
4977 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4978
4979         * typemanager.cs: fixed compilation and added a comment on a field that
4980         is never used.
4981
4982 2002-08-15  Martin Baulig  <martin@gnome.org>
4983
4984         * class.cs (ConstructorInitializer.Resolve): In the
4985         Expression.MemberLookup call, use the queried_type as
4986         invocation_type.
4987
4988         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
4989         declared' attribute, it's always true.
4990         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
4991         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
4992         temporary wrapper for FindMembers which tells MemberLookup whether
4993         members from the base classes are included in the return value.
4994         This will go away soon.
4995         (TypeManager.MemberLookup): Use this temporary hack here; once the
4996         new MemberCache is completed, we don't need to do the DeclaredOnly
4997         looping here anymore since the MemberCache will take care of this.
4998         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
4999         (MemberCache): When creating the MemberCache for a class, get
5000         members from the current class and all its base classes.
5001         (MemberCache.CacheEntry.Container): New field.  This is a
5002         temporary hack until the Mono runtime is fixed to distinguish
5003         between ReflectedType and DeclaringType.  It allows us to use MCS
5004         with both the MS runtime and the unfixed Mono runtime without
5005         problems and without accecting performance.
5006         (MemberCache.SearchMembers): The DeclaredOnly looping from
5007         TypeManager.MemberLookup is now done here.      
5008
5009 2002-08-14  Martin Baulig  <martin@gnome.org>
5010
5011         * statement.cs (MyStructInfo.MyStructInfo): Don't call
5012         Type.GetFields on dynamic types but get the fields from the
5013         corresponding TypeContainer.
5014         (MyStructInfo.GetStructInfo): Added check for enum types.
5015
5016         * typemanager.cs (MemberList.IsSynchronized): Implemented.
5017         (MemberList.SyncRoot): Implemented.
5018         (TypeManager.FilterWithClosure): No need to check permissions if
5019         closure_start_type == closure_invocation_type, don't crash if
5020         closure_invocation_type is null.
5021
5022 2002-08-13  Martin Baulig  <martin@gnome.org>
5023
5024         Rewrote TypeContainer.FindMembers to use a member cache.  This
5025         gives us a speed increase of about 35% for the self-hosting MCS
5026         build and of about 15-20% for the class libs (both on GNU/Linux).
5027
5028         * report.cs (Timer): New class to get enhanced profiling.  This
5029         whole class is "TIMER" conditional since it remarkably slows down
5030         compilation speed.
5031
5032         * class.cs (MemberList): New class.  This is an IList wrapper
5033         which we're now using instead of passing MemberInfo[]'s around to
5034         avoid copying this array unnecessarily.
5035         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
5036         (ICachingMemberFinder, IMemberContainer): New interface.
5037         (TypeManager.FilterWithClosure): If `criteria' is null, the name
5038         has already been checked, otherwise use it for the name comparision.
5039         (TypeManager.FindMembers): Renamed to RealMemberFinder and
5040         provided wrapper which tries to use ICachingMemberFinder.FindMembers
5041         if possible.  Returns a MemberList, not a MemberInfo [].
5042         (TypeHandle): New class, implements IMemberContainer.  We create
5043         one instance of this class per type, it contains a MemberCache
5044         which is used to do the member lookups.
5045         (MemberCache): New class.  Each instance of this class contains
5046         all members of a type and a name-based hash table.
5047         (MemberCache.FindMembers): This is our new member lookup
5048         function.  First, it looks up all members of the requested name in
5049         the hash table.  Then, it walks this list and sorts out all
5050         applicable members and returns them.
5051
5052 2002-08-13  Martin Baulig  <martin@gnome.org>
5053
5054         In addition to a nice code cleanup, this gives us a performance
5055         increase of about 1.4% on GNU/Linux - not much, but it's already
5056         half a second for the self-hosting MCS compilation.
5057
5058         * typemanager.cs (IMemberFinder): New interface.  It is used by
5059         TypeManager.FindMembers to call FindMembers on a TypeContainer,
5060         Enum, Delegate or Interface.
5061         (TypeManager.finder_to_member_finder): New PtrHashtable.
5062         (TypeManager.finder_to_container): Removed.
5063         (TypeManager.finder_to_delegate): Removed.
5064         (TypeManager.finder_to_interface): Removed.
5065         (TypeManager.finder_to_enum): Removed.
5066
5067         * interface.cs (Interface): Implement IMemberFinder.
5068
5069         * delegate.cs (Delegate): Implement IMemberFinder.
5070
5071         * enum.cs (Enum): Implement IMemberFinder.
5072
5073         * class.cs (TypeContainer): Implement IMemberFinder.
5074
5075 2002-08-12  Martin Baulig  <martin@gnome.org>
5076
5077         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
5078
5079 2002-08-12  Martin Baulig  <martin@gnome.org>
5080
5081         * ecore.cs (ITypeExpression): New interface for expressions which
5082         resolve to a type.
5083         (TypeExpression): Renamed to TypeLookupExpression.
5084         (Expression.DoResolve): If we're doing a types-only lookup, the
5085         expression must implement the ITypeExpression interface and we
5086         call DoResolveType() on it.
5087         (SimpleName): Implement the new ITypeExpression interface.
5088         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
5089         hack, the situation that we're only looking up types can't happen
5090         anymore when this method is called.  Moved the type lookup code to
5091         DoResolveType() and call it.
5092         (SimpleName.DoResolveType): This ITypeExpression interface method
5093         is now doing the types-only lookup.
5094         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
5095         (ResolveFlags): Added MaskExprClass.
5096
5097         * expression.cs (MemberAccess): Implement the ITypeExpression
5098         interface.
5099         (MemberAccess.DoResolve): Added support for a types-only lookup
5100         when we're called via ITypeExpression.DoResolveType().
5101         (ComposedCast): Implement the ITypeExpression interface.
5102
5103         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
5104         Expression.Resolve() with ResolveFlags.Type instead.
5105
5106 2002-08-12  Martin Baulig  <martin@gnome.org>
5107
5108         * interface.cs (Interface.Define): Apply attributes.
5109
5110         * attribute.cs (Attribute.ApplyAttributes): Added support for
5111         interface attributes.
5112
5113 2002-08-11  Martin Baulig  <martin@gnome.org>
5114
5115         * statement.cs (Block.Emit): Only check the "this" variable if we
5116         do not always throw an exception.
5117
5118         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
5119         whether the property has a set accessor.
5120
5121 2002-08-11  Martin Baulig  <martin@gnome.org>
5122
5123         Added control flow analysis support for structs.
5124
5125         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
5126         with control flow analysis turned off.
5127         (IVariable): New interface.
5128         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
5129         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
5130         (FieldExpr.DoResolve): Resolve the instance expression with flow
5131         analysis turned off and do the definite assignment check after the
5132         resolving when we know what the expression will resolve to.
5133
5134         * expression.cs (LocalVariableReference, ParameterReference):
5135         Implement the new IVariable interface, only call the flow analysis
5136         code if ec.DoFlowAnalysis is true.
5137         (This): Added constructor which takes a Block argument.  Implement
5138         the new IVariable interface.
5139         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
5140         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
5141         This does the definite assignment checks for struct members.
5142
5143         * class.cs (Constructor.Emit): If this is a non-static `struct'
5144         constructor which doesn't have any initializer, call
5145         Block.AddThisVariable() to tell the flow analysis code that all
5146         struct elements must be initialized before control returns from
5147         the constructor.
5148
5149         * statement.cs (MyStructInfo): New public class.
5150         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
5151         argument to this indexer.  If non-zero, check an individual struct
5152         member, not the whole struct.
5153         (FlowBranching.CheckOutParameters): Check struct members.
5154         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
5155         overloaded versions of these methods which take an additional
5156         `int field_idx' argument to check struct members.
5157         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
5158         overloaded versions of these methods which take an additional
5159         `string field_name' argument to check struct member.s
5160         (VariableInfo): Implement the IVariable interface.
5161         (VariableInfo.StructInfo): New public property.  Returns the
5162         MyStructInfo instance of the variable if it's a struct or null.
5163         (Block.AddThisVariable): New public method.  This is called from
5164         Constructor.Emit() for non-static `struct' constructor which do
5165         not have any initializer.  It creates a special variable for the
5166         "this" instance variable which will be checked by the flow
5167         analysis code to ensure that all of the struct's fields are
5168         initialized before control returns from the constructor.
5169         (UsageVector): Added support for struct members.  If a
5170         variable/parameter is a struct with N members, we reserve a slot
5171         in the usage vector for each member.  A struct is considered fully
5172         initialized if either the struct itself (slot 0) or all its
5173         members are initialized.
5174
5175 2002-08-08  Martin Baulig  <martin@gnome.org>
5176
5177         * driver.cs (Driver.MainDriver): Only report an error CS5001
5178         if there were no compilation errors.
5179
5180         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
5181         `UnsafeContext' property to determine whether the parent is in
5182         unsafe context rather than checking the parent's ModFlags:
5183         classes nested in an unsafe class are unsafe as well.
5184
5185 2002-08-08  Martin Baulig  <martin@gnome.org>
5186
5187         * statement.cs (UsageVector.MergeChildren): Distinguish between
5188         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
5189         we return.  Added test17() and test18() to test-154.cs.
5190
5191 2002-08-08  Martin Baulig  <martin@gnome.org>
5192
5193         * typemanager.cs (TypeManager.FilterWithClosure): If we have
5194         Family access, make sure the invoking type isn't a subclass of the
5195         queried type (that'd be a CS1540).
5196
5197         * ecore.cs (Expression.MemberLookup): Added overloaded version of
5198         this method which takes an additional `Type invocation_type'.
5199
5200         * expression.cs (BaseAccess.DoResolve): Use the base type as
5201         invocation and query type.
5202         (MemberAccess.DoResolve): If the lookup failed and we're about to
5203         report a CS0122, try a lookup with the ec.ContainerType - if this
5204         succeeds, we must report a CS1540.
5205
5206 2002-08-08  Martin Baulig  <martin@gnome.org>
5207
5208         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
5209         (MethodGroupExpr): Implement the IMemberExpr interface.
5210
5211         * expression (MemberAccess.ResolveMemberAccess): No need to have
5212         any special code for MethodGroupExprs anymore, they're now
5213         IMemberExprs.   
5214
5215 2002-08-08  Martin Baulig  <martin@gnome.org>
5216
5217         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
5218         Family, FamANDAssem and FamORAssem permissions.
5219         (TypeManager.IsSubclassOrNestedChildOf): New public method.
5220
5221 2002-08-08  Martin Baulig  <martin@gnome.org>
5222
5223         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
5224         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
5225         or loop block.
5226
5227 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
5228
5229         * driver.cs: implemented /resource option to embed managed resources.
5230
5231 2002-08-07  Martin Baulig  <martin@gnome.org>
5232
5233         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
5234         (FieldBase.HasFieldInitializer): New public property.
5235         (FieldBase.GetInitializerExpression): New public method.  Resolves and
5236         returns the field initializer and makes sure it is only resolved once.
5237         (TypeContainer.EmitFieldInitializers): Call
5238         FieldBase.GetInitializerExpression to get the initializer, this ensures
5239         that it isn't resolved multiple times.
5240
5241         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
5242         the resolving process (SimpleName/MemberLookup) that we're currently
5243         emitting a field initializer (which must not access any instance members,
5244         this is an error CS0236).
5245
5246         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
5247         argument, if the `IsFieldInitializer' flag is set, we must report and
5248         error CS0236 and not an error CS0120.   
5249
5250 2002-08-07  Martin Baulig  <martin@gnome.org>
5251
5252         * ecore.cs (IMemberExpr): New public interface.
5253         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
5254         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
5255         if the expression is an IMemberExpr.
5256
5257         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
5258         to be null, implicitly default to `this' if we're non-static in
5259         this case.  Simplified the code a lot by using the new IMemberExpr
5260         interface.  Also fixed bug #28176 here.
5261
5262 2002-08-06  Martin Baulig  <martin@gnome.org>
5263
5264         * cs-parser.jay (SimpleLookup): Removed.  We need to create
5265         ParameterReferences during semantic analysis so that we can do a
5266         type-only search when resolving Cast, TypeOf and SizeOf.
5267         (block): Pass the `current_local_parameters' to the Block's
5268         constructor.
5269
5270         * class.cs (ConstructorInitializer): Added `Parameters parameters'
5271         argument to the constructor.
5272         (ConstructorInitializer.Resolve): Create a temporary implicit
5273         block with the parameters.
5274
5275         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
5276         references here if we aren't doing a type-only search.
5277
5278         * statement.cs (Block): Added constructor which takes a
5279         `Parameters parameters' argument.
5280         (Block.Parameters): New public property.
5281
5282         * support.cs (InternalParameters.Parameters): Renamed `parameters'
5283         to `Parameters' and made it public readonly.
5284
5285 2002-08-06  Martin Baulig  <martin@gnome.org>
5286
5287         * ecore.cs (Expression.Warning): Made this public as well.
5288
5289         * report.cs (Report.Debug): Print the contents of collections.
5290
5291 2002-08-06  Martin Baulig  <martin@gnome.org>
5292
5293         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
5294         used to tell Resolve() which kinds of expressions it may return.
5295         (Expression.Resolve): Added overloaded version of this method which
5296         takes a `ResolveFlags flags' argument.  This can be used to tell
5297         Resolve() which kinds of expressions it may return.  Reports a
5298         CS0118 on error.
5299         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
5300         ResolveFlags.SimpleName.
5301         (Expression.Error118): Added overloaded version of this method which
5302         takes a `ResolveFlags flags' argument.  It uses the flags to determine
5303         which kinds of expressions are allowed.
5304
5305         * expression.cs (Argument.ResolveMethodGroup): New public method.
5306         Resolves an argument, but allows a MethodGroup to be returned.
5307         This is used when invoking a delegate.
5308
5309         * TODO: Updated a bit.
5310
5311 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5312
5313         Fixed compilation with csc.
5314
5315         * ecore.cs: Expression.Error made public. Is this correct? Should
5316         Warning be made public too?
5317
5318         * expression.cs: use ea.Location instead of ea.loc.
5319         [FIXME:  Filed as bug #28607: MCS must report these errors.]
5320
5321 2002-08-06  Martin Baulig  <martin@gnome.org>
5322
5323         * ecore.cs (Expression.loc): Moved the location here instead of
5324         duplicating it in all derived classes.
5325         (Expression.Location): New public property.
5326         (Expression.Error, Expression.Warning): Made them non-static and
5327         removed the location argument.
5328         (Expression.Warning): Added overloaded version which takes an
5329         `int level' argument.
5330         (Expression.Error118): Make this non-static and removed the
5331         expression and location arguments.
5332         (TypeExpr): Added location argument to the constructor.
5333
5334         * expression.cs (StaticCallExpr): Added location argument to
5335         the constructor.
5336         (Indirection, PointerArithmetic): Likewise.
5337         (CheckedExpr, UnCheckedExpr): Likewise.
5338         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
5339         (StringPtr): Likewise.
5340
5341
5342 2002-08-05  Martin Baulig  <martin@gnome.org>
5343
5344         * expression.cs (BaseAccess.DoResolve): Actually report errors.
5345
5346         * assign.cs (Assign.DoResolve): Check whether the source
5347         expression is a value or variable.
5348
5349         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
5350         while resolving the corresponding blocks.
5351
5352         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
5353         an error, don't silently return null.
5354
5355         * statement.cs (Block.AddVariable): Do the error reporting here
5356         and distinguish between CS0128 and CS0136.
5357         (Block.DoResolve): Report all unused labels (warning CS0164).
5358         (LabeledStatement): Pass the location to the constructor.
5359         (LabeledStatement.HasBeenReferenced): New property.
5360         (LabeledStatement.Resolve): Set it to true here.
5361
5362         * statement.cs (Return.Emit): Return success even after reporting
5363         a type mismatch error (CS0126 or CS0127), this is what csc does and
5364         it avoids confusing the users with any consecutive errors.
5365
5366 2002-08-05  Martin Baulig  <martin@gnome.org>
5367
5368         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
5369
5370         * const.cs (Const.LookupConstantValue): Catch circular definitions.
5371
5372         * expression.cs (MemberAccess.DoResolve): Silently return if an
5373         error has already been reported.
5374
5375         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
5376         error has already been reported.
5377
5378 2002-08-05  Martin Baulig  <martin@gnome.org>
5379
5380         * statement.cs (UsageVector): Only initialize the `parameters'
5381         vector if we actually have any "out" parameters.
5382
5383 2002-08-05  Martin Baulig  <martin@gnome.org>
5384
5385         * expression.cs (Binary.ResolveOperator): When combining delegates,
5386         they must have the same type.
5387
5388 2002-08-05  Martin Baulig  <martin@gnome.org>
5389
5390         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
5391         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
5392         work with the ms runtime and we also don't need it: if we're a
5393         PropertyBuilder and not in the `indexer_arguments' hash, then we
5394         are a property and not an indexer.
5395
5396         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
5397         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
5398         since the latter one doesn't work with the ms runtime.
5399
5400 2002-08-03  Martin Baulig  <martin@gnome.org>
5401
5402         Fixed bugs #27998 and #22735.
5403
5404         * class.cs (Method.IsOperator): New public field.
5405         (Method.CheckBase): Report CS0111 if there's already a method
5406         with the same parameters in the current class.  Report CS0508 when
5407         attempting to change the return type of an inherited method.
5408         (MethodData.Emit): Report CS0179 if a method doesn't have a body
5409         and it's not marked abstract or extern.
5410         (PropertyBase): New abstract base class for Property and Indexer.
5411         (PropertyBase.CheckBase): Moved here from Property and made it work
5412         for indexers.
5413         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
5414         the same so we can reuse it there.
5415         (Property, Indexer): Derive from PropertyBase.
5416         (MethodSignature.inheritable_property_signature_filter): New delegate
5417         to find properties and indexers.
5418
5419         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
5420         argument and improved error reporting.
5421
5422         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
5423         EmptyReadOnlyParameters and made it a property.
5424
5425         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
5426         version of this method which takes a `PropertyInfo indexer'.
5427         (TypeManager.RegisterIndexer): New method.
5428
5429         * class.cs: Added myself as author of this file :-)
5430
5431 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5432
5433         * class.cs: fixed compilation on windoze.
5434
5435 2002-08-03  Martin Baulig  <martin@gnome.org>
5436
5437         * interface.cs (Interface.GetInterfaceBases): Check whether all
5438         base interfaces are at least as accessible than the current one.
5439
5440         * class.cs (TypeContainer.GetClassBases): Check whether base types
5441         are at least as accessible than the current type.
5442         (TypeContainer.AsAccessible): Implemented and made non-static.
5443         (MemberBase.CheckParameters): Report errors if the accessibility
5444         checks fail.
5445
5446         * delegate.cs (Delegate.Delegate): The default visibility is
5447         internal for top-level types and private for nested types.
5448         (Delegate.Define): Report errors if the accessibility checks fail.
5449
5450         * enum.cs (Enum.Enum): The default visibility is internal for
5451         top-level types and private for nested types.
5452         (Enum.DefineType): Compute the correct visibility.
5453
5454         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
5455         function which takes a `bool is_toplevel' instead of a TypeContainer.
5456
5457         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
5458         builtin type.
5459
5460 2002-08-02  Martin Baulig  <martin@gnome.org>
5461
5462         * expression.cs (LocalVariableReferenc): Added constructor which
5463         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
5464         (LocalVariableReference.IsReadOnly): New property.
5465         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
5466         variable is readonly, use our own readonly flag to do this; you can
5467         use the new constructor to get a writable reference to a read-only
5468         variable.
5469
5470         * cs-parser.jay (foreach_statement, using_statement): Get a writable
5471         reference to the local variable.
5472
5473 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
5474
5475         * rootcontext.cs (ResolveCore): Also include System.Exception
5476
5477         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
5478         we reach an EmptyStatement.
5479
5480         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
5481         is also fine.
5482
5483         * expression.cs (Binary.ResolveOperator): Check error result in
5484         two places.
5485
5486         use brtrue/brfalse directly and avoid compares to null.
5487
5488 2002-08-02  Martin Baulig  <martin@gnome.org>
5489
5490         * class.cs (TypeContainer.Define): Define all nested interfaces here.
5491         Fixes bug #28407, added test-155.cs.
5492
5493 2002-08-01  Martin Baulig  <martin@gnome.org>
5494
5495         * class.cs (Event.EmitDefaultMethod): Make this work with static
5496         events.  Fixes #28311, added verify-3.cs.
5497
5498 2002-08-01  Martin Baulig  <martin@gnome.org>
5499
5500         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
5501         `is_disposable' fields.
5502         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
5503         `hm.is_disposable' if we're using the collection pattern.
5504         (Foreach.EmitCollectionForeach): Use the correct type for the
5505         enumerator's local variable, only emit the try/finally block if
5506         necessary (fixes #27713).
5507
5508 2002-08-01  Martin Baulig  <martin@gnome.org>
5509
5510         * ecore.cs (Expression.report118): Renamed to Error118 and made
5511         it public static.
5512
5513         * statement.cs (Throw.Resolve): Check whether the expression is of
5514         the correct type (CS0118) and whether the type derives from
5515         System.Exception (CS0155).
5516         (Catch.Resolve): New method.  Do the type lookup here and check
5517         whether it derives from System.Exception (CS0155).
5518         (Catch.CatchType, Catch.IsGeneral): New public properties.
5519
5520         * typemanager.cs (TypeManager.exception_type): Added.
5521
5522 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
5523
5524         * driver.cs: Updated About function.
5525
5526 2002-07-31  Martin Baulig  <martin@gnome.org>
5527
5528         Implemented Control Flow Analysis.
5529
5530         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
5531         (EmitContext.CurrentBranching): Added.
5532         (EmitContext.StartFlowBranching): Added.
5533         (EmitContext.EndFlowBranching): Added.
5534         (EmitContext.KillFlowBranching): Added.
5535         (EmitContext.IsVariableAssigned): Added.
5536         (EmitContext.SetVariableAssigned): Added.
5537         (EmitContext.IsParameterAssigned): Added.
5538         (EmitContext.SetParameterAssigned): Added.
5539         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
5540         Added control flow analysis stuff here.
5541
5542         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
5543         resolve the expression as lvalue.
5544         (LocalVariableReference.DoResolve): Check whether the variable has
5545         already been assigned.
5546         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
5547         the parameter as assigned here.
5548         (ParameterReference.DoResolve): Check whether the parameter has already
5549         been assigned.
5550         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
5551         expression as lvalue.
5552
5553         * statement.cs (FlowBranching): New class for the flow analysis code.
5554         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
5555         (LabeledStatement.IsDefined): New public property.
5556         (LabeledStatement.AddUsageVector): New public method to tell flow
5557         analyis that the label may be reached via a forward jump.
5558         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
5559         flow analysis.
5560         (VariableInfo.Number): New public field.  This is used by flow analysis
5561         to number all locals of a block.
5562         (Block.CountVariables): New public property.  This is the number of
5563         local variables in this block (including the locals from all parent
5564         blocks).
5565         (Block.EmitMeta): Number all the variables.
5566
5567         * statement.cs: Added flow analysis support to all classes.
5568
5569 2002-07-31  Martin Baulig  <martin@gnome.org>
5570
5571         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
5572         To get debugging messages, compile mcs with /define:MCS_DEBUG and
5573         then use this argument.
5574
5575         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
5576
5577         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
5578         use this to specify /define options.
5579
5580 2002-07-29  Martin Baulig  <martin@gnome.org>
5581
5582         * statement.cs (Fixed): Moved all code that does variable lookups
5583         and resolvings from Emit to Resolve.
5584
5585         * statement.cs (For): Moved all code that does variable lookups
5586         and resolvings from Emit to Resolve.
5587
5588         * statement.cs (Using): Moved all code that does variable lookups
5589         and resolvings from Emit to Resolve.
5590
5591 2002-07-29  Martin Baulig  <martin@gnome.org>
5592
5593         * attribute.cs (Attribute.Resolve): Explicitly catch a
5594         System.NullReferenceException when creating the
5595         CustromAttributeBuilder and report a different warning message.
5596
5597 2002-07-29  Martin Baulig  <martin@gnome.org>
5598
5599         * support.cs (ParameterData.ParameterName): Added method to
5600         get the name of a parameter.
5601
5602         * typemanager.cs (TypeManager.IsValueType): New public method.
5603
5604 2002-07-29  Martin Baulig  <martin@gnome.org>
5605
5606         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
5607         is a flag which specifies that it's either ref or out.
5608         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
5609         the out parameter to `out Parameter.Modifier mod', also set the
5610         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
5611
5612         * support.cs (InternalParameters.ParameterModifier): Distinguish
5613         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
5614         Parameter.Modifier.ISBYREF flag if it's either ref or out.
5615
5616         * expression.cs (Argument.GetParameterModifier): Distinguish
5617         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
5618         Parameter.Modifier.ISBYREF flag if it's either ref or out.
5619
5620 2002-07-29  Martin Baulig  <martin@gnome.org>
5621
5622         * expression.cs (ParameterReference.ParameterReference): Added
5623         `Location loc' argument to the constructor.
5624
5625         * cs-parser.jay: Pass location to ParameterReference.
5626
5627 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
5628
5629         * statement.cs (Try): Initialize the location.
5630
5631         * cs-parser.jay: pass location to Try.
5632
5633         * expression.cs (Unary.Reduce): Change the prototype to return
5634         whether a constant fold could be performed or not.  The result is
5635         returned in an out parameters.  In the case of Indirection and
5636         AddressOf, we want to perform the full tests.
5637
5638 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
5639
5640         * statement.cs (Statement.Emit): Flag dead code.
5641
5642 2002-07-27  Andrew Birkett  <andy@nobugs.org>
5643
5644         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
5645
5646 2002-07-27  Martin Baulig  <martin@gnome.org>
5647
5648         * class.cs (MethodData.Define): Put back call to
5649         TypeManager.AddMethod(), accidentally commented this out.
5650
5651         * report.cs (Debug): New public method to print debugging information,
5652         this is `[Conditional ("DEBUG")]'.
5653
5654 2002-07-26  Martin Baulig  <martin@gnome.org>
5655
5656         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
5657         (switch_statement): Push the current_block to the switch_stack and
5658         pop it again when we're done with the switch.
5659         (switch_section): The new block is a child of the current_block.
5660         Fixes bug #24007, added test-152.cs.
5661
5662 2002-07-27  Martin Baulig  <martin@gnome.org>
5663
5664         * expression.cs (Invocation.EmitArguments): When calling a varargs
5665         function with only its fixed arguments, we need to pass an empty
5666         array.
5667
5668 2002-07-27  Martin Baulig  <martin@gnome.org>
5669
5670         Mono 0.13 has been released.
5671
5672 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
5673
5674         * driver.cs: Rename --resource to --linkres, because that is what
5675         we do currently, we dont support --resource yet.
5676
5677         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
5678
5679 2002-07-25  Martin Baulig  <martin@gnome.org>
5680
5681         * class.cs (MethodData): New public class.  This is a `method builder'
5682         class for a method or one accessor of a Property/Indexer/Event.
5683         (MethodData.GetMethodFlags): Moved here from MemberBase.
5684         (MethodData.ApplyAttributes): Likewise.
5685         (MethodData.ApplyObsoleteAttribute): Likewise.
5686         (MethodData.ApplyConditionalAttribute): Likewise.
5687         (MethodData.ApplyDllImportAttribute): Likewise.
5688         (MethodData.CheckAbstractAndExternal): Likewise.
5689         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
5690         (MethodData.Emit): Formerly known as Method.Emit().
5691         (MemberBase): Moved everything which was specific to a single
5692         accessor/method to MethodData.
5693         (Method): Create a new MethodData and call Define() and Emit() on it.
5694         (Property, Indexer, Event): Create a new MethodData objects for each
5695         accessor and call Define() and Emit() on them.
5696
5697 2002-07-25  Martin Baulig  <martin@gnome.org>
5698
5699         Made MethodCore derive from MemberBase to reuse the code from there.
5700         MemberBase now also checks for attributes.
5701
5702         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
5703         (MemberBase.GetMethodFlags): Moved here from class Method and marked
5704         as virtual.
5705         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
5706         `CallingConventions cc' and `Attributes opt_attrs' arguments.
5707         (MemberBase.ApplyAttributes): New virtual method; applies the
5708         attributes to a method or accessor.
5709         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
5710         (MemberBase.ApplyConditionalAttribute): Likewise.
5711         (MemberBase.ApplyDllImportAttribute): Likewise.
5712         (MemberBase.CheckAbstractAndExternal): Likewise.
5713         (MethodCore.ParameterTypes): This is now a property instead of a
5714         method, it's initialized from DoDefineParameters().
5715         (MethodCore.ParameterInfo): Removed the set accessor.
5716         (MethodCore.DoDefineParameters): New protected virtual method to
5717         initialize ParameterTypes and ParameterInfo.
5718         (Method.GetReturnType): We can now simply return the MemberType.
5719         (Method.GetMethodFlags): Override the MemberBase version and add
5720         the conditional flags.
5721         (Method.CheckBase): Moved some code from Define() here, call
5722         DoDefineParameters() here.
5723         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
5724         here to avoid some larger code duplication.
5725         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
5726         ensure that abstract and external accessors don't declare a body.
5727
5728         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
5729         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
5730         lookup in the attribute's parent classes, so we need to abort as soon
5731         as we found the first match.
5732         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
5733         the attribute has no arguments.
5734
5735         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
5736         of a Method.
5737
5738 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5739
5740         * cs-parser.jay: reverted previous patch.
5741
5742 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5743
5744         * cs-parser.jay: fixed bug #22119.
5745
5746 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5747
5748         * attribute.cs: fixed compilation. The error was:
5749         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
5750         be assigned to before control leaves the current method."
5751         [FIXME:  Filed as bug #28186: MCS must report this error.]
5752
5753 2002-07-25  Martin Baulig  <martin@gnome.org>
5754
5755         * attribute.cs (Attribute.Conditional_GetConditionName): New static
5756         method to pull the condition name ouf of a Conditional attribute.
5757         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
5758         the obsolete message and error flag out of an Obsolete attribute.
5759
5760         * class.cs (Method.GetMethodFlags): New public method to get the
5761         TypeManager.MethodFlags for this method.
5762         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
5763         private methods.
5764         (Method.Define): Get and apply the Obsolete and Conditional attributes;
5765         if we're overriding a virtual function, set the new private variable
5766         `parent_method'; call the new TypeManager.AddMethod().
5767
5768         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
5769         the MethodBuilder and the Method in a PtrHashtable.
5770         (TypeManager.builder_to_method): Added for this purpose.
5771         (TypeManager.MethodFlags): Added IsObsoleteError.
5772         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
5773         Obsolete and Conditional arguments in MethodBuilders.  If we discover
5774         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
5775         the message from the attribute.
5776
5777 2002-07-24  Martin Baulig  <martin@gnome.org>
5778
5779         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
5780         preprocessor directives, ensure that the argument to #define/#undef is
5781         exactly one identifier and that it's actually an identifier.
5782
5783         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
5784         did not work ....
5785
5786 2002-07-24  Martin Baulig  <martin@gnome.org>
5787
5788         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
5789         initialize it to TypeManager.object_type in the constructor.
5790         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
5791         of the `hm.get_current' method if we're using the collection pattern.
5792         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
5793         for the explicit conversion to make it work when we're using the collection
5794         pattern and the `Current' property has a different return type than `object'.
5795         Fixes #27713.
5796
5797 2002-07-24  Martin Baulig  <martin@gnome.org>
5798
5799         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
5800         does not match, but don't report any errors.  This method is called in
5801         order for all methods in a MethodGroupExpr until a matching method is
5802         found, so we don't want to bail out if the first method doesn't match.
5803         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
5804         matches, report the 123.  Fixes #28070.
5805
5806 2002-07-24  Martin Baulig  <martin@gnome.org>
5807
5808         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
5809         TypeManager.TypeToCoreType() to the top of the method so the
5810         following equality checks will work.  Fixes #28107.
5811
5812 2002-07-24  Martin Baulig  <martin@gnome.org>
5813
5814         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
5815         operand is of type uint, and the other operand is of type sbyte,
5816         short or int, the operands are converted to type long." -
5817         Actually do what this comment already told us.  Fixes bug #28106,
5818         added test-150.cs.
5819
5820 2002-07-24  Martin Baulig  <martin@gnome.org>
5821
5822         * class.cs (MethodBase): New abstract class.  This is now a base
5823         class for Property, Indexer and Event to avoid some code duplication
5824         in their Define() and DefineMethods() methods.
5825         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
5826         generic methods for Define() and DefineMethods().
5827         (FieldBase): Derive from MemberBase, not MemberCore.
5828         (Property): Derive from MemberBase, not MemberCore.
5829         (Property.DefineMethod): Moved all the code from this method to the
5830         new MethodBase.DefineAccessor(), just call it with appropriate
5831         argumetnts.
5832         (Property.Define): Call the new Property.DoDefine(), this does some
5833         sanity checks and we don't need to duplicate the code everywhere.
5834         (Event): Derive from MemberBase, not MemberCore.
5835         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
5836         accessors, this will also make them work with interface events.
5837         (Indexer): Derive from MemberBase, not MemberCore.
5838         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
5839         (Indexer.Define): Use the new MethodBase functions.
5840
5841         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
5842         argument to the constructor.
5843         (Interface.FindMembers): Added support for interface events.
5844         (Interface.PopluateEvent): Implemented.
5845
5846         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
5847
5848 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
5849
5850         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
5851         but this is required to check for a method name being the same as
5852         the containing class.  
5853
5854         Handle this now.
5855
5856 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5857
5858         * interface.cs: initialize variable.
5859
5860 2002-07-23  Martin Baulig  <martin@gnome.org>
5861
5862         Implemented the IndexerName attribute in interfaces.
5863
5864         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
5865         name if this is an explicit interface implementation.
5866         (Indexer.InterfaceIndexerName): New public variable.  If we're
5867         implementing an interface indexer, this is the IndexerName in that
5868         interface.  Otherwise, it's the IndexerName.
5869         (Indexer.DefineMethod): If we're implementing interface indexer,
5870         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
5871         and Pending.ImplementIndexer methods.
5872         (Indexer.Define): Also define the PropertyBuilder if we're
5873         implementing an interface indexer and this is neither an explicit
5874         interface implementation nor do the IndexerName match the one in
5875         the interface.
5876
5877         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
5878         If a method is defined here, then we always need to create a proxy
5879         for it.  This is used when implementing interface indexers.
5880         (Pending.IsInterfaceIndexer): New public method.
5881         (Pending.ImplementIndexer): New public method.
5882         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
5883         This is used when implementing interface indexers to define a proxy
5884         if necessary.
5885         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
5886         define a proxy if necessary.
5887
5888         * interface.cs (Interface.IndexerName): New public variable.
5889         (Interface.PopulateIndexer): Set the IndexerName.
5890         (Interface.DefineIndexers): New private method.  Populate all the
5891         indexers and make sure their IndexerNames match.
5892
5893         * typemanager.cs (IndexerPropertyName): Added support for interface
5894         indexers.
5895
5896 2002-07-22  Martin Baulig  <martin@gnome.org>
5897
5898         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
5899         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
5900         ret if HasReturnLabel.
5901         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
5902         variables.
5903
5904         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
5905         and set the ec.LoopBeginTryCatchLevel.
5906         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
5907         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
5908         the current ec.TryCatchLevel, the branch goes out of an exception
5909         block.  In this case, we need to use Leave and not Br.
5910
5911 2002-07-22  Martin Baulig  <martin@gnome.org>
5912
5913         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
5914         block unless the block does not always return or it is contained in
5915         another try { ... } catch { ... } block.  Fixes bug #26506.
5916         Added verify-1.cs to the test suite.
5917
5918 2002-07-22  Martin Baulig  <martin@gnome.org>
5919
5920         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
5921         then we do not always return.  Fixes bug #24985.
5922
5923 2002-07-22  Martin Baulig  <martin@gnome.org>
5924
5925         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
5926         lookup on a per-class level; ie. walk up the class hierarchy until we
5927         found at least one applicable method, then choose the best among them.
5928         Fixes bug #24463 and test-29.cs.
5929
5930 2002-07-22  Martin Baulig  <martin@gnome.org>
5931
5932         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
5933         return types of the methods.  The return type is not part of the
5934         signature and we must not check it to make the `new' modifier work.
5935         Fixes bug #27999, also added test-147.cs.
5936         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
5937
5938         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
5939         on the method's return type.
5940
5941 2002-07-21  Martin Baulig  <martin@gnome.org>
5942
5943         * assign.cs: Make this work if the rightmost source is a constant and
5944         we need to do an implicit type conversion.  Also adding a few more tests
5945         to test-38.cs which should have caught this.
5946
5947         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
5948         target in the makefile for this.  The makefile.gnu is primarily intended
5949         for end-users who don't want to debug the compiler.
5950
5951 2002-07-21  Martin Baulig  <martin@gnome.org>
5952
5953         * assign.cs: Improved the Assign class so it can now handle embedded
5954         assignments (X = Y = Z = something).  As a side-effect this'll now also
5955         consume less local variables.  test-38.cs now passes with MCS, added
5956         a few new test cases to that test.
5957
5958 2002-07-20  Martin Baulig  <martin@gnome.org>
5959
5960         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
5961         instructions.  Fixes bug #27977, also added test-146.cs.
5962
5963 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5964
5965         * cs-tokenizer.cs: fixed getHex ().
5966
5967 2002-07-19  Martin Baulig  <martin@gnome.org>
5968
5969         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
5970         not Type.GetType() to lookup the array type.  This is needed when
5971         we're constructing an array of a user-defined type.
5972         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
5973         single-dimensional arrays, but also for single-dimensial arrays of
5974         type decimal.
5975
5976 2002-07-19  Martin Baulig  <martin@gnome.org>
5977
5978         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
5979         this function is called, it's not allowed to share LocalBuilders
5980         among ILGenerators.
5981
5982 2002-07-19  Martin Baulig  <martin@gnome.org>
5983
5984         * expression.cs (Argument.Resolve): Report an error 118 when trying
5985         to pass a type as argument.
5986
5987 2002-07-18  Martin Baulig  <martin@gnome.org>
5988
5989         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
5990         Conv_R_Un for the signed `long' type.
5991
5992 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
5993
5994         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
5995         `expr' for the temporary result, as that will fail if we do
5996         multiple resolves on the same expression.
5997
5998 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
5999
6000         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
6001         ec.TypeContainer for looking up aliases. 
6002
6003         * class.cs (TypeContainer): Remove LookupAlias from here.
6004
6005         * decl.cs (DeclSpace); Move here.
6006
6007 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
6008
6009         * class.cs (FindMembers): Only call filter if the constructor
6010         bulider is not null.
6011
6012         Also handle delegates in `NestedTypes' now.  Now we will perform
6013         type lookups using the standard resolution process.  This also
6014         fixes a bug.
6015
6016         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
6017         This uses Expressions (the limited kind that can be parsed by the
6018         tree) instead of strings.
6019
6020         * expression.cs (ComposedCast.ToString): Implement, used to flag
6021         errors since now we have to render expressions.
6022
6023         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
6024         FormArrayType. 
6025
6026         * ecore.cs (SimpleName.ToString): ditto.
6027
6028         * cs-parser.jay: Instead of using strings to assemble types, use
6029         Expressions to assemble the type (using SimpleName, ComposedCast,
6030         MemberAccess).  This should fix the type lookups in declarations,
6031         because we were using a different code path for this.
6032
6033         * statement.cs (Block.Resolve): Continue processing statements
6034         even when there is an error.
6035
6036 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
6037
6038         * class.cs (Event.Define): Also remove the `remove' method from
6039         the list of pending items.
6040
6041         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
6042         generate more compact code. 
6043
6044 2002-07-17  Martin Baulig  <martin@gnome.org>
6045
6046         * const.cs (Const.LookupConstantValue): Add support for constant
6047         `unchecked' and `checked' expressions.
6048         Also adding test case test-140.cs for this.
6049
6050 2002-07-17  Martin Baulig  <martin@gnome.org>
6051
6052         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
6053         check whether mi.ReturnType implements the IEnumerator interface; the
6054         `==' and the IsAssignableFrom() will fail in this situation.
6055
6056 2002-07-16  Ravi Pratap  <ravi@ximian.com>
6057
6058         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
6059         here too.
6060
6061 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6062
6063         * expression.cs: fixed bug #27811.
6064
6065 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
6066
6067         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
6068         Molaro: when we are a ref, the value already contains a pointer
6069         value, do not take the address of it.
6070
6071 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
6072         * removed mb-parser.jay and mb-tokenizer.cs
6073
6074 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
6075
6076         * expression.cs: check against the building corlib void type.
6077
6078 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
6079
6080         * ecore.cs: fix for valuetype static readonly fields: when 
6081         initializing them, we need their address, not the address of a copy.
6082
6083 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
6084
6085         * typemanager.cs: register also enum_type in corlib.
6086
6087 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
6088
6089         * class.cs: allow calling this (but not base) initializers in structs.
6090
6091 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
6092
6093         * ecore.cs: make sure we compare against the building base types
6094         in GetTypeSize ().
6095
6096 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
6097
6098         * typemanager.cs: fix TypeToCoreType() to handle void and object
6099         (corlib gets no more typerefs after this change).
6100
6101 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
6102
6103         * expression.cs (ArrayCreation.EmitArrayArguments): use
6104         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
6105
6106         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
6107         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
6108         array indexes, the runtime actually forbids them.
6109
6110         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
6111         for array arguments here.
6112
6113         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
6114         instead of the default for ValueTypes.
6115
6116         (New.DoEmit): Use IsValueType instead of
6117         IsSubclassOf (value_type)
6118         (New.DoResolve): ditto.
6119         (Invocation.EmitCall): ditto.
6120
6121         * assign.cs (Assign): ditto.
6122
6123         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
6124         Statements *are* currently doing part of their resolution during
6125         Emit.  
6126
6127         Expressions do always resolve during resolve, but statements are
6128         only required to propagate resolution to their children.
6129
6130 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
6131
6132         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
6133
6134         (LoadAssembly): Do not add the dll if it is already specified
6135         
6136         (MainDriver): Add the System directory to the link path at the end,
6137         after all the other -L arguments. 
6138
6139         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
6140         wrong opcode for loading bytes and bools (ldelem.i1 instead of
6141         ldelem.u1) and using the opposite for sbytes.
6142
6143         This fixes Digger, and we can finally run it.
6144
6145         * driver.cs (UnixParseOption): Move the option parsing here.  
6146         (CSCParseOption): Implement CSC-like parsing of options.
6147
6148         We now support both modes of operation, the old Unix way, and the
6149         new CSC-like way.  This should help those who wanted to make cross
6150         platform makefiles.
6151
6152         The only thing broken is that /r:, /reference: and /lib: are not
6153         implemented, because I want to make those have the same semantics
6154         as the CSC compiler has, and kill once and for all the confussion
6155         around this.   Will be doing this tomorrow.
6156
6157         * statement.cs (Unsafe.Resolve): The state is checked during
6158         resolve, not emit, so we have to set the flags for IsUnsfe here.
6159
6160 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
6161
6162         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
6163         not catch the Error_ObjectRefRequired in SimpleName (as it is
6164         possible to have a class/instance variable name that later gets
6165         deambiguated), we have to check this here.      
6166
6167 2002-07-10  Ravi Pratap  <ravi@ximian.com>
6168
6169         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
6170         make static and put into Expression.
6171
6172         (Event.Define): Register the private field of the event with the 
6173         TypeManager so that GetFieldFromEvent can get at it.
6174
6175         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
6176         keep track of the private field associated with an event which
6177         has no accessors.
6178
6179         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
6180         private field.
6181
6182         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
6183         
6184 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
6185
6186         * expression.cs (Binary.EmitBranchable): this routine emits the
6187         Binary expression in a branchable context.  This basically means:
6188         we need to branch somewhere, not just get the value on the stack.
6189
6190         This works together with Statement.EmitBoolExpression.
6191
6192         * statement.cs (Statement.EmitBoolExpression): Use
6193         EmitBranchable. 
6194
6195 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
6196
6197         * statement.cs (For): Reduce the number of jumps in loops.
6198
6199         (For): Implement loop inversion for the For statement.
6200
6201         (Break): We can be breaking out of a Try/Catch controlled section
6202         (foreach might have an implicit try/catch clause), so we need to
6203         use Leave instead of Br.
6204
6205         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
6206         now).  If the instace expression supports IMemoryLocation, we use
6207         the AddressOf method from the IMemoryLocation to extract the
6208         address instead of emitting the instance.
6209
6210         This showed up with `This', as we were emitting the instance
6211         always (Emit) instead of the Address of This.  Particularly
6212         interesting when This is a value type, as we dont want the Emit
6213         effect (which was to load the object).
6214         
6215 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
6216
6217         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
6218
6219         * statement.cs (Checked): Set the CheckedState during the resolve
6220         process too, as the ConvCast operations track the checked state on
6221         the resolve process, and not emit.
6222
6223         * cs-parser.jay (namespace_member_declaration): Flag that we have
6224         found a declaration when we do.  This is used to flag error 1529
6225
6226         * driver.cs: Report ok when we display the help only.
6227
6228 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
6229
6230         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
6231
6232 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
6233
6234         * cs-tokenizer.cs (define): We also have to track locally the
6235         defines.  AllDefines is just used for the Conditional Attribute,
6236         but we also need the local defines for the current source code. 
6237
6238 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
6239
6240         * statement.cs (While, For, Do): These loops can exit through a
6241         Break statement, use this information to tell whether the
6242         statement is the last piece of code.
6243
6244         (Break): Flag that we break.
6245
6246         * codegen.cs (EmitContexts): New `Breaks' state variable.
6247
6248 2002-07-03  Martin Baulig  <martin@gnome.org>
6249
6250         * class.cs (TypeContainer.MethodModifiersValid): Allow override
6251         modifiers in method declarations in structs.  Otherwise, you won't
6252         be able to override things like Object.Equals().
6253
6254 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
6255
6256         * class.cs (Method, Property, Indexer): Do not allow the public
6257         modifier to be used in explicit interface implementations.
6258
6259         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
6260         override modifiers in method declarations in structs
6261
6262 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
6263
6264         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
6265         integer or real overflow, report an error
6266
6267 2002-07-02  Martin Baulig  <martin@gnome.org>
6268
6269         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
6270         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
6271         to tell the runtime about our newly created System.Object and
6272         System.ValueType types.
6273
6274 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
6275
6276         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
6277         struct instead of Ldarg/Starg.
6278
6279 2002-07-02  Martin Baulig  <martin@gnome.org>
6280
6281         * expression.cs (Indirection.Indirection): Call
6282         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
6283
6284 2002-07-02  Martin Baulig  <martin@gnome.org>
6285
6286         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
6287         ValueType, call TypeManager.TypeToCoreType() on it.
6288         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
6289         the OpCodes.Newarr argument.
6290
6291 2002-07-02  Martin Baulig  <martin@gnome.org>
6292
6293         * expression.cs (Invocation.EmitCall): When compiling corlib,
6294         replace all calls to the system's System.Array type to calls to
6295         the newly created one.
6296
6297         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
6298         System.Array methods.
6299         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
6300         from the system's System.Array type which must be replaced.
6301
6302 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
6303
6304         * typemanager.cs: load unverifiable_code_ctor so we can build
6305         corlib using the correct type. Avoid using GetTypeCode() with
6306         TypeBuilders.
6307         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
6308         TypeManager.object_type to allow building corlib.
6309
6310 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
6311
6312         * ecore.cs: handle System.Enum separately in LoadFromPtr().
6313
6314 2002-07-01  Martin Baulig  <martin@gnome.org>
6315
6316         * class.cs: Make the last change actually work, we need to check
6317         whether `ifaces != null' to avoid a crash.
6318
6319 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
6320
6321         * class.cs: when we build structs without fields that implement
6322         interfaces, we need to add the interfaces separately, since there is
6323         no API to both set the size and add the interfaces at type creation
6324         time.
6325
6326 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
6327
6328         * expression.cs: the dimension arguments to the array constructors
6329         need to be converted if they are a long.
6330
6331 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
6332
6333         * class.cs: don't emit ldarg.0 if there is no parent constructor
6334         (fixes showstopper for corlib).
6335
6336 2002-06-29  Martin Baulig  <martin@gnome.org>
6337
6338         MCS now compiles corlib on GNU/Linux :-)
6339
6340         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
6341         ie. check for MethodImplOptions.InternalCall.
6342
6343         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
6344         and TypeManager.attribute_type are null, so we must explicitly check
6345         whether parent is not null to find out whether it's an attribute type.
6346         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
6347         and SetBuilder, not only if the property is neither abstract nor external.
6348         This is necessary to set the MethodImplOptions on the accessor methods.
6349         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
6350         SetBuilder, see Property.Emit().
6351
6352         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
6353         populate "System.Object", "System.ValueType" and "System.Attribute" since
6354         they've already been populated from BootCorlib_PopulateCoreTypes().
6355
6356 2002-06-29  Martin Baulig  <martin@gnome.org>
6357
6358         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
6359         is the NullLiteral, we also need to make sure that target_type is not
6360         an enum type.   
6361
6362 2002-06-29  Martin Baulig  <martin@gnome.org>
6363
6364         * rootcontext.cs (RootContext.ResolveCore): We must initialize
6365         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
6366         before calling BootstrapCorlib_ResolveDelegate ().
6367
6368 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6369
6370         * statement.cs: fixed build-breaker. All tests passed ok.
6371
6372 2002-06-27  Martin Baulig  <martin@gnome.org>
6373
6374         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
6375         for System.Decimal when compiling corlib.
6376
6377 2002-06-27  Martin Baulig  <martin@gnome.org>
6378
6379         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
6380         switch blocks which contain nothing but a default clause.
6381
6382 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
6383
6384        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
6385
6386 2002-06-27  Martin Baulig  <martin@gnome.org>
6387
6388         * ecore.cs (PropertyExpr.PropertyExpr): Call
6389         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
6390
6391         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
6392         is already a TypeBuilder.
6393
6394 2002-06-27  Martin Baulig  <martin@gnome.org>
6395
6396         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
6397         `target_type == TypeManager.array_type', not IsAssignableFrom() in
6398         the "from an array-type to System.Array" case.  This makes it work
6399         when compiling corlib.
6400
6401 2002-06-27  Martin Baulig  <martin@gnome.org>
6402
6403         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
6404         non-static PropertyExpr, set its InstanceExpression.  This makes
6405         the `ICollection.Count' property work in System/Array.cs.
6406
6407 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
6408
6409         * driver.cs: Made error handling more consistent.  Errors now
6410         tracked by Report class, so many methods which used to return int
6411         now return void.  Main() now prints success/failure and 
6412         errors/warnings message.
6413
6414         Renamed '--probe' compiler argument to '--expect-error'.  Removed
6415         the magic number return values (123 and 124).  Now, if the
6416         expected error occurs, the compiler exits with success (exit value
6417         0).  If the compilation completes without seeing that particular
6418         error, the compiler exits with failure (exit value 1).  The
6419         makefile in mcs/errors has been changed to handle the new behaviour.
6420
6421         * report.cs: Made 'expected error' number a property and renamed
6422         it from 'Probe' to 'ExpectedError'.
6423
6424         * genericparser.cs: Removed error handling support, since it is
6425         now all done by Report class.
6426
6427         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
6428         class, so parse() no longer returns an int.
6429
6430         * namespace.cs: Use Report.Error instead of GenericParser.error
6431
6432 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
6433
6434         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
6435         TypeContainer.AddOperator): At the front of the list put the
6436         explicit implementations, so they get resolved/defined first. 
6437
6438 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
6439
6440         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
6441         interface type is implemented by this TypeContainer.  Used during
6442         explicit interface implementation.
6443
6444         (Property.Define, Indexer.Define, Method.Define): Validate that
6445         the given interface in the explicit implementation is one of the
6446         base classes for the containing type.
6447
6448         Also if we are explicitly implementing an interface, but there is
6449         no match in the pending implementation table, report an error.
6450
6451         (Property.Define): Only define the property if we are
6452         not explicitly implementing a property from an interface.  Use the
6453         correct name also for those properties (the same CSC uses,
6454         although that is really not needed).
6455         
6456         (Property.Emit): Do not emit attributes for explicitly implemented
6457         properties, as there is no TypeBuilder.
6458
6459         (Indexer.Emit): ditto.
6460
6461         Hiding then means that we do not really *implement* a pending
6462         implementation, which makes code fail.
6463
6464 2002-06-22  Martin Baulig  <martin@gnome.org>
6465
6466         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
6467         the return value of Object.GetType().  [FIXME: we need to do this whenever
6468         we get a type back from the reflection library].
6469
6470 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
6471
6472         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
6473
6474 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
6475
6476         * attribute.cs: Return null if we can not look up the type.
6477
6478         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
6479         the interface types found.
6480
6481         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
6482         interface types found.
6483
6484         * typemanager.cs (GetInterfaces): Make this routine returns alll
6485         the interfaces and work around the lame differences between
6486         System.Type and System.Reflection.Emit.TypeBuilder in the results
6487         result for GetInterfaces.
6488         
6489         (ExpandInterfaces): Given an array of interface types, expand and
6490         eliminate repeated ocurrences of an interface.  This expands in
6491         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
6492         be IA, IB, IC.
6493         
6494 2002-06-21  Martin Baulig  <martin@gnome.org>
6495
6496         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
6497         on System.Enum.
6498
6499 2002-06-21  Martin Baulig  <martin@gnome.org>
6500
6501         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
6502         and called with one of the core types, return the corresponding typebuilder for
6503         that type.
6504
6505         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
6506         element type.
6507
6508 2002-06-21  Martin Baulig  <martin@gnome.org>
6509
6510         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
6511         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
6512         (Expression.ConvertReferenceExplicit): Likewise.
6513
6514         * expression.cs (ElementAccess.DoResolve): Likewise.
6515         (ElementAccess.DoResolveLValue): Likewise.
6516
6517 2002-06-10  Martin Baulig  <martin@gnome.org>
6518
6519         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
6520         add the "value" parameter to the parameter list.
6521
6522         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
6523         to our caller.
6524
6525 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
6526
6527         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
6528         the argument to an int, uint, long or ulong, per the spec.  Also
6529         catch negative constants in array creation.
6530
6531 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
6532
6533         * class.cs: do not allow the same interface to appear twice in
6534         the definition list.
6535
6536 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
6537
6538         * ecore.cs: don't use ldlen with System.Array.
6539
6540 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
6541
6542         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
6543
6544 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
6545
6546         * modifiers.cs: produce correct field attributes for protected
6547         internal. Easy fix so miguel can work on ther harder stuff:-)
6548
6549 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
6550
6551         * pending.cs: New file.  Move the code from class.cs here.
6552         Support clearning the pending flag for all methods (when not doing
6553         explicit interface implementation).
6554
6555 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
6556
6557         * rootcontext.cs: added a couple more types needed to bootstrap.
6558
6559 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
6560
6561         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
6562         constructor in the type, instead of any constructor in the type
6563         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
6564         a bug in the Mono runtime when applying the params attribute). 
6565
6566 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
6567         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
6568
6569 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
6570
6571         * expression.cs (Unary.ResolveOperator): Use TypeManager
6572         to resolve the type.
6573         
6574 2002-06-13  Ravi Pratap  <ravi@ximian.com>
6575
6576         * cs-parser.jay (enum_member_declaration): Pass in the attributes
6577         attached.
6578
6579         * enum.cs (AddEnumMember): Add support to store the attributes associated 
6580         with each member too.
6581
6582         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
6583         field builders too - this takes care of the enum member case.
6584
6585 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
6586
6587         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
6588         address-of operator on both value types and pointers.
6589         
6590 2002-06-10  Martin Baulig  <martin@gnome.org>
6591
6592         * interface.cs (Interface.PopulateIndexer): Add the indexer's
6593         PropertyBuilder to the `property_builders' list.
6594
6595         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
6596         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
6597         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
6598         find any indexers which are inherited from an interface.
6599
6600 2002-06-09  Martin Baulig  <martin@gnome.org>
6601
6602         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
6603         the same type as the constant if necessary.  There's also a test-130.cs
6604         for this.
6605
6606         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
6607
6608         * typemanager.cs (TypeManager.ChangeType): Previously known as
6609         Enum.ChangeEnumType().
6610
6611 2002-06-09  Martin Baulig  <martin@gnome.org>
6612
6613         * expression.cs (Cast.TryReduce): Added support for consts.
6614
6615 2002-06-08  Ravi Pratap  <ravi@ximian.com>
6616
6617         * class.cs (Accessor): Hold attributes information so we can pass
6618         it along.
6619
6620         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
6621         Modify to pass in attributes attached to the methods.
6622
6623         (add_accessor_declaration, remove_accessor_declaration): Ditto.
6624
6625         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
6626         to handle the Accessor kind :-)
6627
6628         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
6629         
6630 2002-06-08  Martin Baulig  <martin@gnome.org>
6631
6632         * expression.cs (Unary.TryReduceNegative): Added support for
6633         ULongConstants.
6634
6635 2002-06-08  Martin Baulig  <martin@gnome.org>
6636
6637         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
6638         name can't be found in the `defined_names' - the caller will do a
6639         MemberLookup in this case and thus find methods in System.Enum
6640         such as Enum.IsDefined().
6641
6642 2002-06-08  Martin Baulig  <martin@gnome.org>
6643
6644         * enum.cs (Enum.ChangeEnumType): This is a custom version of
6645         Convert.ChangeType() which works with TypeBuilder created types.
6646         (Enum.LookupEnumValue, Enum.Define): Use it here.
6647
6648         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
6649         `TypeBuilder.BaseType != null' check.
6650         (TypeContainer.FindMembers): Only lookup parent members if we
6651         actually have a parent.
6652         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
6653         (ConstructorInitializer.Resolve): Likewise.
6654
6655         * interface.cs (Interface.FindMembers): Added
6656         `TypeBuilder.BaseType != null' check.
6657
6658         * rootcontext.cs (RootContext.ResolveCore): Added
6659         "System.Runtime.CompilerServices.IndexerNameAttribute" to
6660         classes_second_stage.
6661
6662         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
6663         debug_type and trace_type when compiling with --nostdlib.       
6664
6665 2002-06-07  Martin Baulig  <martin@gnome.org>
6666
6667         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
6668         (AddField): Set it to true when adding a non-static field.
6669         (DefineType): Use `have_nonstatic_fields' to find out whether we
6670         have non-static fields, not `Fields != null'.
6671
6672 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
6673
6674         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
6675         dereferencing a null on the static-field code path)
6676
6677 2002-05-30  Martin Baulig  <martin@gnome.org>
6678
6679         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
6680         to take command line arguments.  Use reflection to call the new
6681         custom `Initialize' function on the symbol writer and pass it the
6682         command line arguments.
6683
6684         * driver.cs (--debug-args): New command line argument to pass command
6685         line arguments to the symbol writer.
6686
6687 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
6688
6689         * assign.cs (DoResolve): Forgot to do the implicit conversion to
6690         the target type for indexers and properties.  Thanks to Joe for
6691         catching this.
6692
6693 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
6694
6695         * typemanager.cs (MethodFlags): returns the method flags
6696         (Obsolete/ShouldIgnore) that control warning emission and whether
6697         the invocation should be made, or ignored. 
6698
6699         * expression.cs (Invocation.Emit): Remove previous hack, we should
6700         not do this on matching a base type, we should do this based on an attribute
6701
6702         Only emit calls to System.Diagnostics.Debug and
6703         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
6704         on the command line.
6705
6706         * rootcontext.cs: Global settings for tracing and debugging.
6707
6708         * cs-tokenizer.cs (define): New utility function to track
6709         defines.   Set the global settings for TRACE and DEBUG if found.
6710
6711 2002-05-25  Ravi Pratap  <ravi@ximian.com>
6712
6713         * interface.cs (Populate*): Pass in the TypeContainer as well as
6714         the DeclSpace as parameters so that we can create EmitContexts and
6715         then use that to apply attributes etc.
6716
6717         (PopulateMethod, PopulateEvent, PopulateProperty)
6718         (PopulateIndexer): Apply attributes everywhere.
6719
6720         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
6721         etc.
6722
6723         (ApplyAttributes): Update accordingly.
6724
6725         We now apply interface attributes for all members too.
6726
6727 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
6728
6729         * class.cs (Indexer.Define); Correctly check if we are explicit
6730         implementation (instead of checking the Name for a ".", we
6731         directly look up if the InterfaceType was specified).
6732
6733         Delay the creation of the PropertyBuilder.
6734
6735         Only create the PropertyBuilder if we are not an explicit
6736         interface implementation.   This means that explicit interface
6737         implementation members do not participate in regular function
6738         lookups, and hence fixes another major ambiguity problem in
6739         overload resolution (that was the visible effect).
6740
6741         (DefineMethod): Return whether we are doing an interface
6742         implementation. 
6743         
6744         * typemanager.cs: Temporary hack until we get attributes in
6745         interfaces (Ravi is working on that) and we get IndexerName
6746         support in interfaces.
6747
6748         * interface.cs: Register the indexers as properties.
6749
6750         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
6751         warning, I have verified that this is a bug in the .NET runtime
6752         (JavaScript suffers of the same problem).
6753
6754         * typemanager.cs (MemberLookup): When looking up members for
6755         interfaces, the parent of an interface is the implicit
6756         System.Object (so we succeed in searches of Object methods in an
6757         interface method invocation.  Example:  IEnumerable x;  x.ToString
6758         ()) 
6759
6760 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
6761
6762         * class.cs (Event): Events should also register if they do
6763         implement the methods that an interface requires.
6764
6765         * typemanager.cs (MemberLookup); use the new GetInterfaces
6766         method. 
6767
6768         (GetInterfaces): The code used to lookup interfaces for a type is
6769         used in more than one place, factor it here. 
6770
6771         * driver.cs: Track the errors at the bottom of the file, we kept
6772         on going.
6773
6774         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
6775         instance if the method we are calling is static!
6776
6777 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
6778
6779         * attribute.cs (ApplyAttributes): Make this function filter out
6780         the IndexerName attribute (as that attribute in reality is never
6781         applied) and return the string constant for the IndexerName
6782         attribute. 
6783
6784         * class.cs (TypeContainer.Emit): Validate that all the indexers
6785         have the same IndexerName attribute, and if so, set the
6786         DefaultName attribute on the class. 
6787
6788         * typemanager.cs: The return value might contain other stuff (not
6789         only methods).  For instance, consider a method with an "Item"
6790         property and an Item method.
6791
6792         * class.cs: If there is a problem with the parameter types,
6793         return. 
6794
6795 2002-05-24  Ravi Pratap  <ravi@ximian.com>
6796
6797         * ecore.cs (ImplicitConversionExists): Wrapper function which also
6798         looks at user defined conversion after making a call to 
6799         StandardConversionExists - we need this for overload resolution.
6800
6801         * expression.cs : Update accordingly the various method calls.
6802
6803         This fixes 2 bugs filed against implicit user defined conversions 
6804
6805 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
6806
6807         * statement.cs: Track the result of the assignment.
6808
6809 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
6810
6811         * expression.cs (MemberAccess): Improved error reporting for
6812         inaccessible members.
6813
6814 2002-05-22  Martin Baulig  <martin@gnome.org>
6815
6816         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
6817         itself with debugging support.
6818
6819 2002-05-22  Martin Baulig  <martin@gnome.org>
6820
6821         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
6822         Removed, this isn't needed anymore.
6823
6824 2002-05-20  Martin Baulig  <martin@gnome.org>
6825
6826         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
6827         be underlying type for an enum.
6828
6829 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
6830
6831         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
6832         that splits out the loading of just the core types.
6833
6834         * rootcontext.cs (ResolveCore): Split the struct resolution in
6835         two, so we can load the enumeration underlying types before any
6836         enums are used.
6837
6838         * expression.cs (Is): Bandaid until we fix properly Switch (see
6839         bug #24985 for details).
6840
6841         * typemanager.cs (ImplementsInterface): The hashtable will contain
6842         a null if there are no interfaces implemented.
6843
6844 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
6845
6846         * cs-parser.jay (indexer_declarator): It is fine to have array
6847         parameters
6848
6849 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
6850
6851         * typemanager.cs: (RegisterBuilder): New function used to register
6852         TypeBuilders that implement interfaces.  Since
6853         TypeBuilder.GetInterfaces (as usual) does not work with lame
6854         Reflection.Emit. 
6855         (AddUserType): register interfaces.
6856
6857         (ImplementsInterface): Use the builder_to_ifaces hash if we are
6858         dealing with TypeBuilder.  Also, arrays are showing up as
6859         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
6860         methods can not be invoked on them!
6861
6862         * ecore.cs (ExplicitReferenceConversionExists): Made public.
6863         (ImplicitReferenceConversionExists): Split out from
6864         StandardConversionExists. 
6865
6866         * expression.cs (As): We were only implementing one of the three
6867         cases for the as operator.  We now implement them all.
6868         (Is): Implement the various other cases for Is as well.
6869
6870         * typemanager.cs (CACHE): New define used to control if we want or
6871         not the FindMembers cache.  Seems to have a negative impact on
6872         performance currently
6873
6874         (MemberLookup): Nested types have full acess to
6875         enclosing type members
6876
6877         Remove code that coped with instance/static returns for events, we
6878         now catch this in RealFindMembers.
6879
6880         (RealFindMembers): only perform static lookup if the instance
6881         lookup did not return a type or an event.  
6882
6883 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
6884
6885         * assign.cs (CompoundAssign): We pass more semantic information
6886         now to Compound Assignments than we did before: now we have all
6887         the information at hand, and now we resolve the target *before* we
6888         do the expression expansion, which allows the "CacheValue" method
6889         to have the effect we intended (before, a [x] += 1 would generate
6890         two differen ArrayAccess expressions from the ElementAccess,
6891         during the resolution process).
6892
6893         (CompoundAssign.DoResolve): Resolve target and original_source here.
6894
6895 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
6896
6897         * expression.cs (ArrayAccess): dropped debugging information. 
6898
6899         * typemanager.cs: Small bug fix: I was always returning i_members,
6900         instead of one of i_members or s_members (depending on which had
6901         the content).
6902
6903         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
6904         method is invoked before any code generation takes place, and it
6905         is a mechanism to inform that the expression will be invoked more
6906         than once, and that the method should use temporary values to
6907         avoid having side effects
6908
6909         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
6910         
6911         * ecore.cs (Expression.CacheTemporaries): Provide empty default
6912         implementation.
6913
6914         * expression.cs (Indirection, ArrayAccess): Add support for
6915         CacheTemporaries in these two bad boys. 
6916
6917         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
6918         ldobj or ldind_ref.  
6919         (StoreFromPtr): Handle stobj as well.
6920
6921         * expression.cs (UnaryMutator): Share more code.
6922         
6923         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
6924         down: I was not tracking the Filter function as well, which
6925         was affecting the results of the cache.
6926
6927 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
6928
6929         * attribute.cs: Remove the hack to handle the CharSet property on
6930         StructLayouts. 
6931
6932 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
6933
6934         * attribute.cs (DoResolve): More uglyness, we now only try to
6935         resolve the attribute partially, to extract the CharSet
6936         information (only if we are a StructLayout attribute).  Otherwise 
6937
6938         (GetExtraTypeInfo): Add some code to conditionally kill in the
6939         future this.   I am more and more convinced that the .NET
6940         framework has special code to handle the attribute setting on
6941         certain elements.
6942
6943         * expression.cs (IsParamsMethodApplicable): Revert my previous
6944         foreach change here, it was wrong.
6945
6946 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
6947
6948         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
6949         (pp_expr): do not abort on unknown input, just return.
6950         (eval): abort if there are pending chars.
6951
6952         * attribute.cs (Attribute.Resolve): Positional parameters are
6953         optional.  Deal with that case.
6954
6955         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
6956         the Ansi/Unicode/Auto information for the type.
6957
6958         (TypeContainer.DefineType): instantiate the EmitContext here, as
6959         we will be using it during the type definition (to resolve
6960         attributes) and during the emit phase.
6961
6962         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
6963         to pull type information out of the attributes
6964
6965         (Attribute.Resolve): track the constructor builder, and allow for
6966         multiple invocations (structs and classes will use this).
6967
6968         * ecore.cs (MemberLookupFinal): new version with all the
6969         parameters customizable.
6970
6971         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
6972         constructors.  Return if the result value is null (as the error
6973         would have been flagged already by MemberLookupFinal)
6974
6975         Do not allow instances of abstract classes or interfaces to be
6976         created.
6977         
6978         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
6979         We have to compare the assembly property here when dealing with
6980         FamANDAssem and Assembly access modifiers, because we might be
6981         creating an assembly from *modules* (that means that we are not
6982         getting TypeBuilders for types defined in other modules that are
6983         part of this assembly).
6984
6985         (Method.Emit): If the method is marked abstract and has a body,
6986         emit an error. 
6987
6988         (TypeContainer.DefineMembers): If both the defined member and the
6989         parent name match are methods, then do not emit any warnings: let
6990         the Method.Define routine take care of flagging warnings.  But if
6991         there is a mismatch (method overrides something else, or method is
6992         overriwritten by something, then emit warning).
6993
6994         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
6995         set to null, this means `do not check for the return type on the
6996         signature'. 
6997
6998         (Method.Define): set the return type for the method signature to
6999         null, so that we get methods with the same name and parameters and
7000         different return types.  This is used to flag warning 114 (you are
7001         hiding a method, and you probably want to use the new/override
7002         keywords instead).
7003
7004         * typemanager.cs (MemberLookup): Implemented proper access
7005         control, closing a long standing set of bug reports.  The problem
7006         was that the Framework only has two bits: Public and NonPublic,
7007         and NonPublic includes private and protected methods, but we need
7008         to enforce the FamANDAssem, FamOrAssem and Family. 
7009
7010 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
7011
7012         * statement.cs (GotoCase): Return true: Ammounts to giving up
7013         knowledge on whether we return or not, and letting the other case
7014         be responsible for it.
7015
7016 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
7017
7018         * driver.cs: Do not load directories for each file processed, only
7019         do it if there is a pattern.
7020
7021         * ecore.cs: Report readonly assigns here as well, as we might have
7022         been resolved only by MemberAccess.
7023
7024         (SimpleName.SimpleNameResolve): Also be useful for LValue
7025         resolution.   We need this to propagate assign to local readonly variables
7026
7027         * typemanager.cs: Use a ptrhashtable for the criteria, because we
7028         do not want to reuse potential criteria memory.
7029
7030         * class.cs (MyEventBuilder): Set reflected_type;
7031
7032         * ecore.cs (Constantify): Added support for constifying bools.
7033
7034         (RootContext.LookupType): Added a cache for values looked up in
7035         the declaration space.
7036
7037         * typemanager.cs (FindMembers): Now is a front-end to
7038         RealFindMembers, and provides a two-level hashtable-based cache to
7039         the request.  
7040
7041         15% performance improvement: from 22.5 to 19.2 seconds.
7042
7043         * expression.cs (IsParamsMethodApplicable): use foreach.
7044         (Invocation.DoResolve): ditto.
7045         (New.DoResolve): ditto.
7046         (ArrayCreation.DoResolve): ditto.
7047
7048         * ecore.cs (FindMostEncompassingType): use foreach.
7049
7050         * delegate.cs (NewDelegate.DoResolve): Use foreach
7051
7052         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
7053         (RemoveMethods): use foreach.
7054
7055         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
7056         nested foreach statements instead of for, and also break out of
7057         the inner loop once a match is found.
7058         
7059         (Invocation.OverloadResolve): Use foreach, simplify the code. 
7060
7061 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
7062
7063         * cfold.cs (BinaryFold): During an enumeration evaluation context,
7064         we actually unwrap the expression to allow for extra information
7065         to be extracted. 
7066
7067         * expression.cs: Use Shr_Un on unsigned operations. 
7068
7069 2002-05-08  Ravi Pratap  <ravi@ximian.com>
7070
7071         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
7072         applicable operators was not being considered correctly. This closes
7073         the bug Miguel reported.
7074
7075 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
7076
7077         * attribute.cs: check that the type derives from System.Attribute
7078         and report the correct error in that case (moved the duplicate code to
7079         its own method, too).
7080
7081 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
7082
7083         * attribute.cs: lookup attribute type name as the spec says: first the
7084         bare attribute name and then name + "Attribute" (nant compiles with
7085         mcs after this fix).
7086
7087 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
7088
7089         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
7090         Because of the way we parse things, we should try to see if a
7091         UIntConstant can fit in an integer.
7092
7093 2002-05-07  Ravi Pratap  <ravi@ximian.com>
7094
7095         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
7096         when we are in an explicit context.
7097
7098         (ConvertReferenceExplicit): When converting from Iface type S to Class
7099         T make sure the rules are implemented as an OR.
7100
7101         * parameter.cs (ParameterType): Make it a property for now although the
7102         purpose really isn't anything immediate.
7103         
7104         * expression.cs (Is*Applicable): Do better checking on the parameter type
7105         of a ref/out parameter. The ones from the system assemblies are already 
7106         marked with the correct type so we don't need to do any correction.
7107
7108         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
7109         the object type is standard too so include that.
7110
7111 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
7112
7113         * ecore.cs (StandardConversionExists): Augment with missing code:
7114         deal with IntConstant, LongConstants and Enumerations.
7115
7116         * assign.cs: Report the error, instead of failing silently
7117
7118         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
7119         typecontainer that they are declared, because the
7120         typecontainer/namespace will have the list of using clauses that
7121         need to be applied.
7122
7123         Assembly Attributes were escaping the normal registration
7124         mechanism. 
7125
7126         (EmitCode): Apply attributes within an EmitContext that represents
7127         the container they were declared on.
7128         
7129         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
7130
7131 2002-05-06  Ravi Pratap  <ravi@ximian.com>
7132
7133         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
7134         Revamp completely - make much cleaner as we now operate only
7135         on a set of Types.
7136
7137         (FindMostSpecificSource, FindMostSpecificTarget): New methods
7138         to implement the logic detailed in the spec more correctly.
7139
7140         (UserDefinedConversion): Update accordingly.
7141
7142 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
7143
7144         * statement.cs: Return flow analysis information up.
7145
7146         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
7147         and the default.
7148
7149         (token): Do not consume an extra character before calling
7150         decimal_digits.
7151
7152 2002-05-06  Piers Haken <piersh@friskit.com>
7153
7154         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
7155
7156 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
7157
7158         * class.cs (Constructor.Emit): Set the IsStatic flag in the
7159         EmitContext during the instance constructor initializer
7160         resolution, to stop access to instance variables.
7161
7162         This is mandated by the spec, last paragraph of the `constructor
7163         initializers' section. 
7164
7165 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
7166
7167         * cs-parser.jay, class.cs (Accessor): new class used to represent
7168         an accessor (get or set).  In the past we used `null' to represent
7169         a missing accessor.  But this is ambiguous because there was no
7170         way to tell in abstract indexers/properties if one of them was
7171         specified.
7172
7173         Now there is a way of addressing that.
7174
7175         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
7176         instead of FindMembers.
7177
7178         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
7179         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
7180
7181         * attribute.cs: Treat indexers and properties as the same in terms
7182         of applying attributes
7183
7184         * ecore.cs (FindMostEncompassedType): Use statically initialized
7185         EmptyExpressions()s like we do elsewhere to avoid creating useless
7186         objects (and we take this out of the tight loop).
7187
7188         (GetConversionOperators): Move the code to extract the actual
7189         operators to a separate routine to clean things up.
7190
7191 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
7192
7193         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
7194         events are always registered FieldBuilders.
7195         
7196         * class.cs (FieldBase): New class shared by Fields 
7197
7198         * delegate.cs: If we are a toplevel delegate, use our full name.
7199         If we are a nested delegate, then only use our tail name.
7200
7201 2002-05-02  Ravi Pratap  <ravi@ximian.com>
7202
7203         * expression.cs (IsApplicable): Ensure that we add the "&" to
7204         ref/out types before comparing it with the type of the argument.
7205
7206         (IsParamsMethodApplicable): Ditto.
7207
7208         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
7209         silly me ;-)
7210
7211         * delegate.cs : Handle the case when we have more than one applicable
7212         method. Flag an error only when we finish checking all.
7213
7214 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
7215
7216         * expression.cs: Add support for boolean static initializers.
7217
7218 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
7219
7220         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
7221
7222         * parameter.cs (ComputeParameterTypes,
7223         ComputeAndDefineParameterTypes): Better error handling: now we
7224         clear the `types' cache if we fail during any of the type lookups.
7225         We also return the status code correctly to our caller
7226
7227         * delegate.cs: If we fail to define a delegate, abort the extra
7228         steps. 
7229
7230         * expression.cs (Binary.ResolveOperator): for
7231         operator==(object,object) and operator !=(object, object) we also
7232         have to verify that there is an implicit conversion from one to
7233         the other.
7234
7235         (ArrayAccess.DoResolve): Array Access can operate on
7236         non-variables. 
7237
7238 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
7239
7240         * assign.cs (CompoundAssign): A new class used as a "flag" that
7241         the assignment actually is happening as part of a compound
7242         assignment operator.
7243
7244         During compound assignment, a few new rules exist to enable things
7245         like:
7246
7247         byte b |= 1 + 2
7248
7249         From the spec:
7250         
7251         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
7252         to the type of x) if y is implicitly convertible to the type of x,
7253         and the operator is a builtin operator and the return type of the
7254         operator is explicitly convertible to the type of x. 
7255
7256         * rootcontext.cs: Reset warning level to 2.  4 catches various
7257         "interesting" features in mcs, we must clean this up at some
7258         point, but currently am trying to kill other bugs ;-)
7259
7260         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
7261         in container classes as well.  
7262
7263         * expression.cs (Binary.ResolveOperator): Handle string case
7264         before anything else (as operator overloading does emit an error
7265         before doing anything else).
7266
7267         This code could go away when we move to a table driven model, but
7268         i could not come up with a good plan last night.
7269         
7270 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
7271
7272         * typemanager.cs (CSharpName): reimplementation using regex.
7273         * class.cs: added null check for fields in Emit
7274         * rootcontext.cs: set warninglevel to 4
7275
7276 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
7277
7278         * typemanager.cs (CSharpName): reimplemented with Lupus
7279         suggestion.
7280
7281 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
7282
7283         * statement.cs (If): correclty implement Resolve, because we were
7284         not catching sem errors in there.  The same process is needed
7285         everywhere else. 
7286         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
7287         
7288
7289         (Statement.Warning_DeadCodeFound): Factorize code.
7290         (While): Report dead code here too.
7291
7292         (Statement): Added Resolve virtual method to allow
7293         for resolution split from the emit code.
7294
7295 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
7296
7297         * statement.cs (EmitBoolExpression): No longer try to resolve the
7298         expression here.    
7299         (MakeBoolean): New utility function that resolve, implicitly
7300         converts to boolean and tags the expression. 
7301         
7302
7303         (If, Do): Implement dead code elimination.
7304         (While): Implement loop inversion
7305
7306         (Do, While, For, If): Resolve the expression prior to calling our
7307         code generation.
7308
7309 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
7310
7311         * class.cs:
7312           - added method Report28 (warning: program has more than one entry point)
7313           - added method IsEntryPoint, implements paragraph 10.1 of the spec
7314           - modified method Method.Define, the part at the end of the method
7315
7316         * rootcontext.cs: added static public Location EntryPointLocation;
7317           
7318         * ../errors/cs0028.cs : Add test case for the above warning.              
7319
7320         * typemanager.cs:
7321           - modified method CSharpName to allow arrays of primitive type to
7322             be printed nicely (e.g. instead of System.Int32[][] it now prints
7323             int[][])
7324           - added method CSharpSignature: returns the signature of a method
7325             in string format to be used in reporting errors, warnings, etc.
7326
7327         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
7328         with String.Empty.
7329         
7330 2002-04-26  Ravi Pratap  <ravi@ximian.com>
7331
7332         * delegate.cs (Define): Fix extremely silly bug where I was
7333         setting the type of the 'object' parameter of the BeginInvoke
7334         method to System.IAsyncResult instead of System.Object ;-)
7335
7336 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
7337
7338         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
7339         here. 
7340
7341         (Constructor.Emit): return if we fail to initialize the
7342         constructor.  Another door closed!  
7343
7344         * expression.cs (New.DoResolve): Improve error message (from -6 to
7345         1501).  Use DeclaredOnly lookup to find the exact constructor.
7346
7347         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
7348         loop.  This is useful.
7349
7350         * cs-parser.jay: Adjust the default parameters so that destructors
7351         have the proper signature.
7352
7353 2002-04-26  Martin Baulig  <martin@gnome.org>
7354
7355         * driver.cs (LoadAssembly): If `assembly' contains any characters
7356         which are only valid in path names and not in assembly names
7357         (currently slash, backslash and point), use Assembly.LoadFrom ()
7358         instead of Assembly.Load () on the `assembly' (before iteration
7359         over the link_paths).
7360
7361 2002-04-26  Martin Baulig  <martin@gnome.org>
7362
7363         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
7364
7365 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
7366
7367         * class.cs (Property): use the new typemanager.MemberLookup
7368
7369         (TypeContainer.MemberLookup): Implement using the
7370         TypeManager.MemberLookup now. 
7371         
7372         * typemanager.cs: Make MemberLookup a function of the TypeManager,
7373         and return MemberInfos, so that these can be used without an
7374         EmitContext (what we had before).
7375
7376 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
7377
7378         * expression.cs: Fix the case where the argument to params if the
7379         type of the params.  I omitted handling this before.   Fixed
7380
7381 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
7382
7383         * driver.cs: Call BootCorlib_PopulateCoreType
7384
7385         * class.cs (Property.CheckBase): Check for properties only, not
7386         for all members. 
7387
7388         * interface.cs: Temporary hack: try/catch around the
7389         CustomAttributeBuilder, because I am getting an exception that I
7390         do not understand.
7391
7392         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
7393         types whose definitions are required to be there (attributes are
7394         defined before standard types).
7395
7396         Compute definitions as we boot the various types, as they are used
7397         immediately (value_type class will need object_type, but if we do
7398         not initialize object_type, we will pass a null, which will let
7399         the runtime pick the System.Object from the existing corlib, which
7400         is not what we want).
7401
7402 2002-04-22  Patrik Torstensson <totte@labs2.com>
7403
7404         * cs-tokenizer.cs: fixed a number of trim() issues.
7405
7406 2002-04-22  Ravi Pratap  <ravi@ximian.com>
7407
7408         * expression.cs (Argument.Type): Ensure that we return the correct
7409         type when we have out or ref parameters [in which case we 
7410         append a "&"].
7411         
7412 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
7413
7414         * class.cs (Property, Indexer): Allow extern modifier in there. 
7415
7416         * typemanager.cs (InitBaseTypes): Initializes object_type and
7417         value_type, since those will be used early on during the bootstrap
7418         process to compile corlib.
7419
7420         (InitCoreTypes): Move code from here to InitBaseTypes.
7421
7422 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
7423
7424         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
7425         single-dimension arrays as using the ldlen opcode.  
7426
7427         Daniel Lewis discovered this optimization.  
7428
7429         * typemanager.cs: Add signature for System.Array::get_Length
7430
7431 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7432
7433         * statement.cs: report the error when the foreach does not apply to an
7434         array nor a collection.
7435
7436 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
7437
7438         * expression.cs: Add implicit conversions to the operator ~.
7439
7440         * constant.cs (DecimalConstant.Emit): Emit decimal value.
7441
7442         * typemanager.cs: Locate the decimal constructor.
7443
7444 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7445
7446         * attribute.cs: use the new property of TypeOf.
7447         * expression.cs: added 'get' property around typearg.
7448
7449         These changes fix a build breaker reported by NickD. Is this the
7450         correct way to fix?  If not, please, revert my changes and make it
7451         work :-).
7452
7453 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
7454
7455         * attribute.cs: Add support for typeof in attribute invocations.
7456         I am not sure that this is right though.
7457
7458 2002-04-14  Duncan Mak  <duncan@ximian.com>
7459
7460         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
7461         Binary.Operator.Division case.
7462
7463 2002-04-13  Ravi Pratap  <ravi@ximian.com>
7464
7465         * class.cs (DefineType): Ensure that we do a proper check on
7466         attribute types and also register it with the TypeManager.
7467
7468         (TypeContainer.Targets): The default for attribute types is
7469         AttributeTargets.All.
7470         
7471         * attribute.cs (ApplyAttributes): Registering the attribute type
7472         is done elsewhere, not when we discover we have a Usage attribute.
7473
7474 2002-04-12  Ravi Pratap  <ravi@ximian.com>
7475
7476         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
7477         and get rid of is_delegate parameter.
7478
7479         * everywhere : update.
7480         
7481 2002-04-12  Ravi Pratap  <ravi@ximian.com>
7482
7483         * cs-parser.jay (compilation_unit): Revamp completely to use
7484         some new ideas that I got from Rhys' grammar to solve the problems
7485         with assembly level attributes.
7486
7487         (outer_declaration): New grammar production.
7488
7489         (attribute_sections): Add.
7490
7491         (opt_attributes): Base on attribute_sections
7492
7493         (namespace_declaration): Allow opt_attributes to tackle the case
7494         when we have assembly level attributes - we are clever in this
7495         regard now ;-)
7496
7497         * attribute.cs (ApplyAttributes): Do not worry about assembly 
7498         attributes in the non-global context.
7499
7500         * rootcontext.cs (AddGlobalAttributes): Go back to using this
7501         instead of SetGlobalAttributes.
7502
7503         * class.cs, rootcontext.cs : Ensure we define and generate 
7504         attribute types before anything else.
7505
7506         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
7507         and flag the new error -20 for the case when the attribute type
7508         does not have valid targets specified. csc does not catch this.
7509
7510         * ../errors/errors.txt : update for error # -20
7511
7512 2002-04-11  Ravi Pratap  <ravi@ximian.com>
7513
7514         * support.cs (InternalParameters.ParameterModifier): Do some null
7515         checking and return sane values.
7516
7517         * class.cs (Method.Define): If we are a PInvoke method, ensure
7518         that we are static and extern. Report error # 601
7519
7520         * ../errors/cs0601.cs : Add test case for the above error.
7521
7522 2002-04-07  Ravi Pratap  <ravi@ximian.com>
7523
7524         * rootcontext.cs (attribute_types): We need to keep type of
7525         all attribute types separately and emit code for them first.
7526
7527         (RegisterAttribute) : Implement.
7528
7529         * class.cs (DefineType): Check if the current Type is a custom
7530         attribute type and register it accordingly.
7531
7532         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
7533         adding the first attribute twice and rename to
7534
7535         (SetGlobalAttributes): this.
7536
7537         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
7538         lookups.
7539
7540         * attribute.cs (ApplyAttributes): Take an additional argument telling us
7541         if we are processing global arguments. Hmm, I am unsure of this.
7542
7543 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7544
7545         * expression.cs: added static array of strings to avoid calling
7546         Enum.ToString () for Operator in Binary. Significant recover of
7547         performance.
7548
7549 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
7550
7551         * class.cs (FindMembers): Allow the Builders of the various
7552         members to be null.  If they are skip them.  This only happens
7553         during the PInvoke declaration.
7554
7555 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
7556
7557         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
7558         failure, so we do not keep going afterwards.
7559
7560         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
7561         wanted to pass `false' as the `is_delegate' argument.  If this is
7562         the case, why not use delegate_type == null to mean `is_delegate =
7563         false' and anything else as is_delegate = true.
7564
7565 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
7566
7567         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
7568         code for the section, not the beginning of the tests.
7569
7570 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
7571
7572         * cfold.cs: Handle operator + (Enum x, Underlying x) 
7573
7574         * expression.cs (Binary): same.  Warn about errors where we have
7575         Enum/Enum in operator + as well.
7576
7577 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
7578
7579         * statement.cs:
7580                 - added support for switch(bool)
7581                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
7582                 - add TableSwitchEmit() to handle table-based switch statements
7583
7584 2002-04-05  Ravi Pratap  <ravi@ximian.com>
7585
7586         * expression.cs (Invocation.OverloadResolve): Factor out code which
7587         does parameter compatibility checking with arguments so that we can 
7588         re-use the code even from Delegate.VerifyApplicability
7589
7590         (VerifyArgumentsCompat): Move above code here.
7591
7592         * delegate.cs (VerifyApplicability): Get rid of duplicate code
7593         and instead make a call to the above method.
7594
7595 2002-03-31  Ravi Pratap  <ravi@ximian.com>
7596
7597         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
7598         We use it to keep track of classes which are attribute types.
7599
7600 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
7601
7602         * delegate.cs (Delegate.Define): Correctly define the types in the
7603         presence of fixed and array parameters.
7604
7605         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
7606         doing FindMembers.
7607
7608         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
7609         include NonPublic after the first iteration.
7610
7611         * class.cs (Indexer.CheckBase): Only check if both parents are
7612         non-null. 
7613         
7614         * cs-parser.jay (accessor_body): If empty, set to null.
7615
7616         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
7617         same code path here to resolve constants names that we did have in
7618         MemberAccess.DoResolve.  There is too much code duplicated here.
7619
7620 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
7621
7622         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
7623
7624         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
7625         to MakeUnionSet.
7626
7627         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
7628         tokens, numbers and strings.
7629
7630         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
7631         parenthesis.
7632
7633         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
7634         asyncronous parameters and the regular parameters.  
7635
7636         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
7637         specify the target directory.
7638
7639         * expression.cs: (This.DoResolve): Simplify
7640         (As.Emit): Optimize, do not generate IsInst if the expression is
7641         always of the given type.
7642
7643         (Is.DoResolve): Bug fix, we were reporting both always/never for
7644         the is expression.
7645
7646         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
7647         creating too many unnecessary arrays.
7648
7649 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
7650
7651         * class.cs (EmitFieldInitializer): Use Assign expression to assign
7652         fields instead of rolling our own initializer.   Takes care of all
7653         implicit conversions, and drops unnecessary static checks/argument.
7654
7655 2002-03-31  Dick Porter  <dick@ximian.com>
7656
7657         * driver.cs: use the GetDirectories() return values properly, and
7658         use "/" as path separator.
7659
7660 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
7661
7662         * expression.cs (Unary): Optimize - - expr into expr.
7663         (Binary): Optimize a + (-b) into a -b.
7664
7665         * codegen.cs (CodeGen): Made all methods static.
7666
7667 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
7668
7669         * rootcontext.cs: 
7670
7671         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
7672         TypeBuilder property.
7673
7674         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
7675         instead. 
7676
7677         * tree.cs: Removed the various RecordXXXX, and replaced with a
7678         single RecordDecl.  Removed all the accessor methods, and just
7679         left a single access point Type 
7680
7681         * enum.cs: Rename DefineEnum to DefineType.
7682
7683         * decl.cs: New abstract method `DefineType' used to unify the
7684         Defines for Enumerations, Interfaces, TypeContainers and
7685         Delegates.
7686
7687         (FindType): Moved LookupInterfaceOrClass here.  Moved the
7688         LookupBaseClasses method that used to live in class.cs and
7689         interface.cs here, and renamed to FindType.
7690         
7691         * delegate.cs: Implement DefineType.  Take advantage of the
7692         refactored pattern for locating the parent builder without taking
7693         the parent_builder argument (which we know does not work if we are
7694         nested, and triggering a toplevel definition).
7695
7696 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
7697
7698         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
7699         accessibility of a member has changed during override and report
7700         an error if so.
7701
7702         * class.cs (Method.Define, Property.Define): Only complain on
7703         overrides if the method is private, any other accessibility is
7704         fine (and since we just checked the permission is the same, we are
7705         good to go).
7706
7707         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
7708         and elif are processed always.  The other pre-processing
7709         directives are only processed if we are "taking" the path
7710
7711 2002-03-29  Martin Baulig  <martin@gnome.org>
7712
7713         * class.cs (Method.Emit): Only emit symbolic debugging info if the
7714         current location is not Null.
7715
7716         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
7717         a separate method so we can profile it.
7718
7719         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
7720         `span.Seconds' are just seconds, but no minutes or hours.
7721         (MainDriver): Profile the CodeGen.SaveSymbols calls.
7722
7723 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
7724
7725         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
7726         Remove the gratuitous set of Final:
7727
7728                                 // If an interface implementation, then we can set Final.
7729                                 if (((flags & MethodAttributes.Abstract) == 0) &&
7730                                     implementing.DeclaringType.IsInterface)
7731                                         flags |= MethodAttributes.Final;
7732
7733         I do not know what I was smoking when I used that.
7734         
7735
7736         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
7737         step into fixing the name resolution issues for delegates and
7738         unifying the toplevel name resolution.
7739
7740 2002-03-28  Martin Baulig  <martin@gnome.org>
7741
7742         * class.cs (Method.Emit): If we have a symbol writer, call its
7743         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
7744         tell it about the current method.
7745
7746         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
7747         writer that we're going to emit the first byte of IL code for a new
7748         statement (a new source line).
7749         (EmitContext.EmitTopBlock): If we have a symbol writer, call
7750         EmitContext.Mark() before emitting any code.
7751
7752         * location.cs (SymbolDocument): Return null when we're Null.
7753
7754         * statement.cs (Statement): Moved the `Location loc' variable here.
7755         (Statement.EmitBoolExpression): If we have a symbol writer, call
7756         ec.Mark() before emitting any code to tell it that we're at the
7757         beginning of a new statement.
7758         (StatementExpression): Added `Location' argument to the constructor.
7759         (Block): Added public readonly variable `StartLocation' and public
7760         variable `EndLocation'.  The latter is to be set using SetEndLocation().
7761         (Block): Added constructor which takes a start and end location.
7762         (Block.SetEndLocation): New method. This sets the end location.
7763         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
7764         local variables we create.
7765         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
7766         each statement and do also mark the begin and end of the block.
7767
7768         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
7769         tell it the current lexer.Location, use Location.Null for the end of the
7770         block.
7771         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
7772         current block, set its end location using SetEndLocation().
7773         (statement_expression): StatementExpression constructor now takes the
7774         lexer.Location as additional argument.
7775         (for_statement, declare_local_variables): Likewise.
7776         (declare_local_variables): When creating a new implicit block, use the
7777         new Block constructor and pass it the lexer.Location.
7778
7779 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
7780
7781         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
7782         members also on the parent interfaces recursively.
7783
7784 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
7785
7786         * report.cs: Use new formats, since Gonzalo finished the missing
7787         bits. 
7788
7789         * expression.cs (Binary.ResolveOperator): added missing operator|
7790         operator& and operator^ for bool/bool.
7791
7792         * cs-parser.jay: CheckDef now takes a Location argument that is
7793         used to report errors more precisly (instead of reporting the end
7794         of a definition, we try to track something which is a lot closer
7795         to the source of the problem).
7796
7797         * cs-tokenizer.cs: Track global token use, so we can properly flag
7798         the use of #define/#undef after the first token has been seen.
7799
7800         Also, rename the reportXXXX to Error_DescriptiveName
7801
7802         * decl.cs (DeclSpace.IsTopLevel): Move property here from
7803         TypeContainer, so that Enum and Interface can use this too.
7804
7805         * class.cs (TypeContainer.LookupInterfaceOrClass,
7806         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
7807         `builder' argument.  Typically this was used to pass the parent
7808         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
7809         the definition).  
7810
7811         The problem is that a nested class could trigger the definition of
7812         a toplevel class, and the builder would be obviously wrong in that
7813         case. 
7814
7815         So we drop this argument, and we compute dynamically the
7816         TypeBuilder/ModuleBuilder (the correct information was available
7817         to us anyways from DeclSpace.Parent)
7818
7819         * interface.cs (Interface.DefineInterface): Drop builder
7820         parameter cleanup like class.cs
7821
7822         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
7823         like class.cs
7824
7825         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
7826         values. 
7827
7828         (Try.Emit): Propagate the returns value from the statement.
7829
7830         (Return.Emit): Even if we are leavning 
7831
7832         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
7833
7834         * modifiers.cs: Fix the computation of MethodAttributes flags.
7835
7836 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
7837
7838         * driver.cs: allow compilation of files that start with '/'.
7839         Add a default case when checking the argument of --target.
7840
7841 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
7842
7843         * interface.cs: Implement the same search algorithm for types in
7844         the interface code.
7845
7846         * delegate.cs: Do not allow multiple definition.
7847
7848         * Recovered ChangeLog that got accidentally amputated
7849
7850         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
7851
7852         * rootcontext.cs: Load manually enum to allow core classes to
7853         contain enumerations.
7854
7855         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
7856         Update to new static methods in TypeManager.
7857
7858         * typemanager.cs (GetMethod, GetConstructor): Use our
7859         implementation of FindMembers to find the members, since during
7860         corlib compilation, the types are TypeBuilders and GetMethod and
7861         GetConstructor do not work.
7862
7863         Make all methods in TypeManager static.
7864
7865         (InitCodeHelpers): Split the functionality from
7866         the InitCodeTypes function.
7867
7868         * driver.cs: Call InitCodeHelpers after we have populated the
7869         types. 
7870
7871         * cs-parser.jay (delegate_declaration): we did not used to compute
7872         the delegate name correctly for void delegates.
7873
7874 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
7875
7876         * rootcontext.cs (RootContext): Init the interface_resolve_order
7877         and type_container_resolve_order always.
7878
7879         (ResolveCore, BootstrapCorlib_ResolveClass,
7880         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
7881         compiler when compiling with --nostdlib
7882
7883         * class.cs (TypeContainer.DefineType): Check that our parent is
7884         not null.  This test is most important when we are bootstraping
7885         the core types.
7886
7887         * codegen.cs: Split out the symbol writing code.
7888
7889 2002-03-25  Martin Baulig  <martin@gnome.org>
7890
7891         * driver.cs (-g): Made -g an alias for --debug.
7892
7893 2002-03-24  Martin Baulig  <martin@gnome.org>
7894
7895         * codegen.cs (SymbolWriter): New public variable. Returns the
7896         current symbol writer.
7897         (CodeGen): Added `bool want_debugging_support' argument to the
7898          constructor. If true, tell the ModuleBuild that we want debugging
7899         support and ask it for the ISymbolWriter.
7900         (Save): If we have a symbol writer, call it's Close() method after
7901         saving the assembly.
7902
7903         * driver.c (--debug): New command line argument to create a
7904         debugger information file.
7905
7906         * location.cs (SymbolDocument): New public property. Returns an
7907         ISymbolDocumentWriter object for the current source file or null
7908         if we don't have a symbol writer.
7909
7910 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
7911
7912         * driver.cs (LoadAssembly): Correctly return when all the paths
7913         have been tried and not before.
7914
7915         * statement.cs (Switch.Emit): return the actual coverage for this
7916         statement (returns/not-returns)
7917
7918         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
7919         switch of the statement if we are the last switch section.  That
7920         kills two problems: try/catch problems (we used to emit an empty
7921         nop at the end) and switch statements where all branches would
7922         return. 
7923
7924 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
7925
7926         * driver.cs: Add default assemblies (the equivalent to the
7927         Microsoft CSC.RSP file)
7928
7929         * cs-tokenizer.cs: When updating `cols and setting it to zero,
7930         also update tokens_seen and set it to false.
7931
7932         * driver.cs: Implement --recurse for Mike.
7933
7934         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
7935         correctly splitting out the paths.
7936
7937 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
7938
7939         * interface.cs (Interface.PopulateProperty): Instead of using
7940         `parent' as the declaration space for the set parameters, use
7941         `this' 
7942
7943         * support.cs (InternalParameters): InternalParameters constructor
7944         takes a DeclSpace instead of a TypeContainer.
7945
7946         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
7947         types are being initialized, load the address of it before calling
7948         the function.  
7949
7950         (New): Provide a mechanism to disable the generation of local
7951         value type temporaries when the caller will be providing us with
7952         an address to store it.
7953
7954         (ArrayCreation.EmitDynamicInitializers): Use it.
7955
7956 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
7957
7958         * expression.cs (Invocation.EmitArguments): Only probe for array
7959         property if there is more than one argument.  Sorry about that.
7960
7961         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
7962         empty param arrays.
7963         
7964         * class.cs (Method.LabelParameters): Fix incorrect code path that
7965         prevented the `ParamArrayAttribute' from being applied to the
7966         params attribute.
7967
7968 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
7969
7970         * support.cs (ReflectionParameters): Correctly compute whether the
7971         last argument is a params array.  Fixes the problem with
7972         string.Split ('a')
7973
7974         * typemanager.cs: Make the assemblies array always be non-null
7975         (empty, but non-null)
7976
7977         * tree.cs (RecordDecl): New function that abstracts the recording
7978         of names.  This reports error 101, and provides a pointer to the
7979         previous declaration.  Fixes a crash in the compiler.
7980
7981         * cs-parser.jay (constructor_declaration): Update to new grammar,
7982         and provide a constructor_body that can be empty.
7983
7984 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
7985
7986         * driver.cs: Add support for --resources.
7987
7988         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
7989         Make all types for the various array helper methods be integer.
7990
7991         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
7992         CheckState to ConvCast.
7993
7994         (ConvCast): Now it takes a `checked' state argument, to avoid
7995         depending on the emit context for the conversion, and just using
7996         the resolve time setting.
7997
7998         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
7999         instead of Invocation.EmitArguments.  We do not emit the original
8000         arguments, instead we emit those which have been converted to
8001         unsigned int expressions.
8002
8003         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
8004
8005         * codegen.cs: ditto.
8006
8007         * expression.cs (LocalVariableReference): Drop the use of the
8008         Store function that depended on the variable index.
8009
8010         * statement.cs (VariableInfo): Drop the `Idx' property from this
8011         class, as this is not taking into account the indexes for
8012         temporaries tat we generate during the execution, getting the
8013         indexes wrong.
8014
8015         * class.cs: First emit class initializers, then call the parent
8016         constructor. 
8017
8018         * expression.cs (Binary): Fix opcode emision.
8019         (UnaryMutator.EmitCode): Support checked code generation
8020
8021         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
8022         matches for events for both the Static and Instance scans,
8023         pointing to the same element.   Fix that.
8024
8025 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
8026
8027         * rootcontext.cs (ResolveTree): Always set the
8028         interface_resolve_order, because nested interfaces will be calling
8029         into us.
8030
8031         * class.cs (GetInterfaceOrClass): Track the same resolution
8032         process used by TypeManager.LookupType.  This fixes the nested
8033         type lookups in class declarations (separate path from
8034         LookupType). 
8035
8036         (TypeContainer.DefineType): Also define nested interfaces.
8037         (TypeContainer.RegisterOrder): New public function used to
8038         register the order in which child interfaces need to be closed.
8039
8040         Nested interfaces need to be closed after their parents have been
8041         created. 
8042         
8043         * interface.cs (InterfaceAttr): Put all the logic for computing
8044         the interface attribute here. 
8045
8046         (DefineInterface): Register our interface order with the
8047         RootContext or with the TypeContainer depending on the case.
8048
8049 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
8050
8051         * cs-parser.jay: rework foreach statement to work with the new
8052         changes to the policy on SimpleNames.
8053         
8054         * report.cs: support Stacktrace on warnings as well.
8055
8056         * makefile: drop --unsafe and /unsafe from the compile.
8057
8058 2002-03-13  Ravi Pratap  <ravi@ximian.com>
8059
8060         * ecore.cs (StandardConversionExists): Modify to take an Expression
8061         as the first parameter. Ensure we do null -> reference type conversion
8062         checking.
8063
8064         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
8065         temporary Expression objects.
8066
8067 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
8068
8069         * interface.cs: workaround bug in method overloading resolution
8070         (there is already a bugzilla bug for it).
8071
8072 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
8073
8074         We could also solve this problem by having a separate path for
8075         performing type lookups, instead of DoResolve, we could have a
8076         ResolveType entry point, and only participating pieces of the
8077         production (simplename, deref, array) would implement this. 
8078         
8079         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
8080         signal SimpleName to only resolve type names and not attempt to
8081         resolve anything else.
8082
8083         * expression.cs (Cast): Set the flag.
8084
8085         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
8086
8087         * class.cs: Only report 108 if there is no `new' modifier.
8088
8089         * cs-parser.jay: rework foreach statement to work with the new
8090         changes to the policy on SimpleNames.
8091         
8092         * report.cs: support Stacktrace on warnings as well.
8093
8094         * makefile: drop --unsafe and /unsafe from the compile.
8095
8096 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
8097
8098         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
8099         lookups here, instead of doing that at parse time.  This means
8100         that our grammar will not introduce `LocalVariableReferences' as
8101         expressions at this point.  That solves the problem of code like
8102         this:
8103
8104         class X {
8105            static void Main ()
8106            { int X = 1;
8107             { X x = null }}}
8108
8109         This is only half the fix.  The full fix requires parameters to
8110         also be handled in this way.
8111
8112         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
8113         makes the use more obvious of the DeclSpace.  The
8114         ec.TypeContainer.TypeBuilder is now only used to pull the
8115         TypeBuilder for it.
8116
8117         My theory is that I can get rid of the TypeBuilder completely from
8118         the EmitContext, and have typecasts where it is used (from
8119         DeclSpace to where it matters).  
8120
8121         The only pending problem is that the code that implements Aliases
8122         is on TypeContainer, and probably should go in DeclSpace.
8123
8124         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
8125         lookups here, instead of doing that at parse time.  This means
8126         that our grammar will not introduce `LocalVariableReferences' as
8127         expressions at this point.  That solves the problem of code like
8128         this:
8129
8130         class X {
8131            static void Main ()
8132            { int X = 1;
8133             { X x = null }}}
8134
8135         This is only half the fix.  The full fix requires parameters to
8136         also be handled in this way.
8137
8138         * class.cs (Property.DefineMethod): When implementing an interface
8139         method, set newslot, when implementing an abstract method, do not
8140         set the flag (before we tried never setting it, or always setting
8141         it, which is the difference).
8142         (Indexer.DefineMethod): same.
8143         (Method.DefineMethod): same.
8144
8145         * ecore.cs: Only set the status used flag if we get back a Field.
8146
8147         * attribute.cs: Temporary hack, so Paolo can keep working.
8148
8149 2002-03-08  Ravi Pratap  <ravi@ximian.com>
8150
8151         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
8152         the unmanaged type in the case we have a MarshalAs attribute.
8153
8154         (Resolve): Handle the case when we are parsing the special MarshalAs
8155         attribute [we need to store the unmanaged type to use later]
8156         
8157         * typemanager.cs (marshal_as_attr_type): Built in type for the 
8158         MarshalAs Attribute.
8159
8160         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
8161         on parameters and accordingly set the marshalling info.
8162         
8163 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
8164
8165         * class.cs: Optimizing slightly by removing redundant code after
8166         we switched to the `NoTypes' return value.
8167         (Property.DefineMethod): use NoTypes here too.
8168
8169         This fixes the bug I introduced in my last batch of changes.
8170
8171 2002-03-05  Ravi Pratap  <ravi@ximian.com>
8172
8173         * tree.cs (RecordEnum): Add. We now keep track of enums too.
8174
8175         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
8176         Enums since those are types too. 
8177
8178         * cs-parser.jay (enum_declaration): Record enums as we parse them.
8179         
8180         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
8181         thanks to a call during the lookup process.
8182
8183 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
8184
8185         * statement.cs (Foreach): Lots of work to accomodate a particular
8186         kind of foreach statement that I had not kept in mind.  It is
8187         possible to have foreachs on classes that provide a GetEnumerator
8188         method that return objects that implement the "pattern" for using
8189         a foreach, there is no need to support GetEnumerator
8190         specifically. 
8191
8192         This is needed to compile nant.
8193
8194         * decl.cs: Only report 114 if the member is not `Finalize' and if
8195         the warning level is at least 2.
8196
8197         * class.cs: Moved the compare function from Method to
8198         MethodSignature. 
8199
8200         (MethodSignature.InheritableMemberSignatureCompare): Add new
8201         filter function that is used to extract inheritable methods from a
8202         class. 
8203
8204         (Method.Define): Use the new `inheritable_method_signature_filter'
8205         delegate
8206
8207         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
8208         command. 
8209
8210 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
8211
8212         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
8213
8214         * cs-parser.jay: Add opt_semicolon to the interface declaration.
8215
8216         * expression.cs: Pass location information to
8217         ConvertImplicitStandard. 
8218
8219         * class.cs: Added debugging code to track return values from
8220         interfaces. 
8221
8222 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
8223
8224         * expression.cs (Is.DoResolve): If either side of the `is' is an
8225         interface, do not flag the warning.
8226
8227         * ecore.cs (ImplicitReferenceConversion): We need a separate test
8228         for interfaces
8229
8230         * report.cs: Allow for --fatal to be used with --probe.
8231         
8232         * typemanager.cs (NoTypes): Move the definition for the empty Type
8233         array here. 
8234
8235         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
8236         properties. 
8237         (TypeContainer.DefineProxy): New function used to proxy to parent
8238         implementations when implementing interfaces.
8239         (TypeContainer.ParentImplements): used to lookup if our parent
8240         implements a public function that is required by an interface.
8241         (TypeContainer.VerifyPendingMethods): Hook this up.
8242
8243         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
8244         `modules' and `assemblies' arraylists into arrays.  We only grow
8245         these are the very early start up of the program, so this improves
8246         the speedof LookupType (nicely measured).
8247
8248         * expression.cs (MakeByteBlob): Replaced unsafe code with
8249         BitConverter, as suggested by Paolo.
8250
8251         * cfold.cs (ConstantFold.Binary): Special case: perform constant
8252         folding of string concatenation, but if either side is a string,
8253         and the other is not, then return null, and let the runtime use
8254         the concatenation on the string plus the object (using
8255         `Object.ToString'). 
8256
8257 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
8258
8259         Constant Folding has been implemented now.
8260         
8261         * expression.cs (Unary.Reduce): Do not throw an exception, catch
8262         the error instead on types that are not supported in one's
8263         complement. 
8264
8265         * constant.cs (Constant and all children): New set of functions to
8266         perform implict and explicit conversions.
8267         
8268         * ecore.cs (EnumConstant): Implement the new functions to perform
8269         conversion by proxying to the child expression.
8270
8271         * codegen.cs: (ConstantCheckState): Constant evaluation has its
8272         own separate setting that can not be turned off from the command
8273         line using --unchecked or --checked and is only controlled using
8274         the checked/unchecked statements and expressions.  This setting is
8275         used by the constant folder to flag errors.
8276
8277         * expression.cs (CheckedExpr, UncheckedExpr): Set the
8278         ConstantCheckState as well.   
8279
8280         During Resolve, they also have to flag the state, because the
8281         constant folder runs completely in the Resolve phase.
8282
8283         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
8284         well.
8285
8286 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
8287
8288         * cfold.cs: New file, this file contains the constant folder.
8289         
8290         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
8291         argument to track whether we are using the resulting address to
8292         load or store a value and provide better error messages. 
8293
8294         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
8295         new AddressOf arguments.
8296
8297         * statement.cs (Foreach.EmitCollectionForeach): Update
8298
8299         * expression.cs (Argument.Emit): Call AddressOf with proper
8300         arguments to track usage.
8301
8302         (New.DoEmit): Call AddressOf with new arguments.
8303
8304         (Unary.Emit): Adjust AddressOf call.
8305
8306 2002-03-01  Ravi Pratap  <ravi@ximian.com>
8307
8308         * cs-parser.jay (member_access): Change the case for pre-defined types
8309         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
8310         this suggestion.
8311
8312         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
8313         a method body.
8314
8315         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
8316         essentially like methods and apply attributes like MethodImplOptions to them too.
8317
8318         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
8319         not being null.
8320
8321         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
8322         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
8323         is the DeclSpace.
8324
8325         * Update code everywhere accordingly.
8326
8327         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
8328
8329         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
8330
8331 2002-02-28  Ravi Pratap  <ravi@ximian.com>
8332
8333         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
8334         try performing lookups against those instead of jumping straight into using
8335         the 'using' clauses.
8336
8337         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
8338
8339         (LookupType): Perform lookups in implicit parents too.
8340
8341         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
8342         sequence as RootContext.LookupType. 
8343
8344         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
8345         the various cases of namespace lookups into this method.
8346
8347 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
8348
8349         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
8350         in positional arguments)
8351
8352         * class.cs (Operator): Update the AllowedModifiers to contain
8353         extern. 
8354
8355         * cs-parser.jay: Update operator declaration to allow for the
8356         operator body to be empty.
8357
8358         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
8359         values. 
8360
8361 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
8362
8363         * class.cs (Method.Emit): Label parameters.
8364
8365         * driver.cs: Return 1 or 0 as the program exit code.
8366
8367 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
8368
8369         * expression.cs: Special case the `null' object when trying to
8370         auto-compute the type, as anything can be explicitly converted to
8371         that. 
8372
8373         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
8374         spotting this Paolo.
8375
8376         (Expression.ImplicitNumericConversion): Perform comparissions of
8377         the type using the underlying type in the case of an enumeration
8378         rather than using the enumeration type for the compare.
8379
8380         Cope with the underlying == type case, which is not possible to
8381         catch before. 
8382
8383         (Expression.ConvertNumericExplicit): Perform comparissions of
8384         the type using the underlying type in the case of an enumeration
8385         rather than using the enumeration type for the compare.
8386
8387         * driver.cs: If the user does not supply an extension, assume .exe
8388
8389         * cs-parser.jay (if_statement): Rewrote so that we can track the
8390         location for the if statement.
8391
8392         * expression.cs (Binary.ConstantFold): Only concat strings when
8393         the operation is "+", not everything ;-)
8394
8395         * statement.cs (Statement.EmitBoolExpression): Take a location
8396         argument. 
8397         (If, While, Do): Track location.
8398
8399         * expression.cs (Binary.ResolveOperator): In the object + string
8400         case, I was missing a call to ConvertImplicit
8401
8402 2002-02-25  Ravi Pratap  <ravi@ximian.com>
8403
8404         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
8405         Location arguments. Ensure we use RootContext.LookupType to do our work
8406         and not try to do a direct Type.GetType and ModuleBuilder.GetType
8407
8408         * interface.cs (PopulateMethod): Handle the type of the parameter being
8409         null gracefully.
8410
8411         * expression.cs (Invocation.BetterFunction): Handle the case when we 
8412         have a params method with no fixed arguments and a call is made with no
8413         arguments.
8414
8415 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
8416
8417         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
8418         the verbatim-string-literal
8419
8420         * support.cs (InternalParameters.ParameterModifier): handle null
8421         fixed parameters.
8422         (InternalParameters.ParameterType): ditto.
8423
8424         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
8425         duplicating the name of the variable parameter.
8426         (GetParameterByName): Fix bug where we were not looking up array
8427         paramters if they were the only present (thanks Paolo!).
8428         (GetParameterInfo): We only have an empty set of types if both
8429         fixed and array are set to null.
8430         (GetParameterInfo-idx): Handle FixedParameter == null
8431
8432         * cs-parser.jay: Handle the case where there is no catch
8433         statements (missing null test).
8434
8435 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
8436
8437         * driver.cs (MainDriver): Be conservative on our command line
8438         handling.
8439
8440         Catch DirectoryNotFoundException when calling GetFiles.
8441         
8442         (SplitPathAndPattern): Used to split the input specification into
8443         a path and a pattern that we can feed to Directory.GetFiles.
8444
8445 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
8446
8447         * statement.cs (Fixed): Implement the last case of the Fixed
8448         statement (string handling).
8449
8450         * expression.cs (StringPtr): New class used to return a char * to
8451         a string;  Used by the Fixed statement.
8452
8453         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
8454
8455         * expression.cs (Binary.ResolveOperator): Remove redundant
8456         MemberLookup pn parent type.
8457         Optimize union call, we do not need a union if the types are the same.
8458         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
8459         type.
8460
8461         Specialize the use of MemberLookup everywhere, instead of using
8462         the default settings. 
8463
8464         (StackAlloc): Implement stackalloc keyword.
8465
8466         * cs-parser.jay: Add rule to parse stackalloc.
8467         
8468         * driver.cs: Handle /h, /help, /?
8469
8470         * expression.cs (MakeByteBlob): Removed the hacks we had in place
8471         before we supported unsafe code.
8472         
8473         * makefile: add --unsafe to the self compilation of mcs.
8474
8475 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
8476
8477         * expression.cs (PointerArithmetic): New class that is used to
8478         perform pointer arithmetic.
8479         (Binary.Resolve): Handle pointer arithmetic
8480         Handle pointer comparission.
8481         (ArrayPtr): Utility expression class that is used to take the
8482         address of an array.
8483
8484         (ElementAccess): Implement array access for pointers
8485         
8486         * statement.cs (Fixed): Implement fixed statement for arrays, we
8487         are missing one more case before we are done.
8488
8489         * expression.cs (Indirection): Implement EmitAssign and set the
8490         ExprClass to Variable.  This allows pointer dereferences to be
8491         treated as variables, and to have values assigned to them.
8492         
8493         * ecore.cs (Expression.StoreFromPtr): New utility function to
8494         store values dereferencing.
8495
8496 2002-02-20  Ravi Pratap  <ravi@ximian.com>
8497
8498         * expression.cs (Binary.ResolveOperator): Ensure that we are
8499         not trying to operate on a void type - this fixes the reported
8500         bug.
8501
8502         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
8503         the parent implementation is sealed.
8504
8505         * ../errors/cs0239.cs : Add.
8506
8507         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
8508
8509         * typemanager.cs (unverifiable_code_type): Corresponds to 
8510         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
8511         which have unsafe code in them.
8512
8513         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
8514         unsafe context.
8515
8516 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
8517
8518         * cs-tokenizer.cs: Add support for @"litreal strings"
8519
8520         Make tokenizer accept pre-processor directives
8521         on any column (remove the old C-like limitation). 
8522
8523         * rootcontext.cs (EmitCode): Emit any global attributes.
8524         (AddGlobalAttributes): Used to keep track of assembly attributes. 
8525
8526         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
8527
8528         * cs-parser.jay: Add support for global attributes.  
8529
8530 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
8531
8532         * expression.cs (Indirection): New helper class.  Unary will
8533         create Indirection classes to be able to implement the
8534         IMemoryLocation interface on it.
8535
8536 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
8537
8538         * cs-parser.jay (fixed_statement): reference the right statement.
8539
8540         * statement.cs (Fixed.Emit): Finish implementing the fixed
8541         statement for the &x case.
8542
8543 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
8544
8545         * class.cs (Property.Define, Method.Define): Remove newslot when
8546         `implementing'.  
8547
8548         * modifiers.cs: My use of NewSlot when `Abstract' was set was
8549         wrong.  NewSlot should only be used if the `new' keyword is present.
8550
8551         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
8552         locating our system dir.  Sorry about this.
8553
8554 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
8555
8556         * driver.cs (GetSystemDir): Compute correctly the location of our
8557         system assemblies.  I was using the compiler directory instead of
8558         the library directory.
8559
8560 2002-02-13  Ravi Pratap  <ravi@ximian.com>
8561
8562         * expression.cs (BetterFunction): Put back in what Miguel commented out
8563         since it is the correct fix. The problem is elsewhere ;-)
8564
8565         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
8566         parameters of the parms method are themselves compatible or not !
8567
8568         (StandardConversionExists): Fix very dangerous bug where we were forgetting
8569         to check that a class implements an interface before saying that an implicit
8570         conversion was allowed. Use ImplementsInterface to do the checking.
8571
8572 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
8573
8574         * class.cs (Method.Define): Track whether we are an explicit
8575         implementation or not.  And only call DefineMethodOverride if we
8576         are an explicit implementation.
8577
8578         (Property.DefineMethod): Ditto.
8579
8580 2002-02-11  Ravi Pratap  <ravi@ximian.com>
8581
8582         * expression.cs (BetterFunction): Catch hideous bug which was
8583          preventing us from detecting ambiguous calls due to implicit casts i.e
8584         cs0121.
8585
8586 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
8587
8588         * support.cs (Pair): Remove un-needed method.  I figured why I was
8589         getting the error in cs-parser.jay, the variable in a foreach loop
8590         is readonly, and the compiler does not really treat this as a variable.
8591
8592         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
8593         instead of EQUALS in grammar.  
8594
8595         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
8596
8597         * expression.cs (Unary.DoResolve): Check whether the argument is
8598         managed or not.
8599
8600 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
8601
8602         * support.cs: Api for Pair to set a value.  Despite the fact that
8603         the variables are public the MS C# compiler refuses to compile
8604         code that accesses the field if the variable is part of a foreach
8605         statement. 
8606
8607         * statement.cs (Fixed): Begin implementation of the fixed
8608         statement.
8609
8610         (Block.AddVariable): Return the VariableInfo on success and null
8611         on failure instead of true/false. 
8612
8613         * cs-parser.jay (foreach): Catch errors on variables already
8614         defined (we were ignoring this value before) and properly unwind
8615         the block hierarchy
8616
8617         (fixed_statement): grammar for the fixed statement.
8618
8619 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
8620
8621         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
8622         pointer types to be incretemented.
8623
8624         (SizeOf): Implement.
8625
8626         * cs-parser.jay (pointer_member_access): Implement
8627         expr->IDENTIFIER production.
8628
8629         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
8630         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
8631         on safe contexts.
8632
8633         (Unary): Implement indirection.
8634
8635         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
8636         use in non-unsafe context).
8637
8638         (SimpleName.DoResolve): Check for pointers in field access on safe
8639         contexts. 
8640
8641         (Expression.LoadFromPtr): Factor the load-indirect code in this
8642         function.  This was duplicated in UnboxCast and ParameterReference
8643
8644 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
8645
8646         * expression.cs (ComposedCast): report an error if a pointer cast
8647         is used in a safe region.
8648
8649         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
8650         pointer type casts in unsafe context.
8651
8652         * codegen.cs (EmitContext): Set up IsUnsafe.
8653
8654         * cs-parser.jay (non_expression_type): Add productions for pointer
8655         casts. 
8656
8657         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
8658         code.  We should not use force into static mode if the method is
8659         not virtual.  Fixes bug in MIS
8660
8661         * statement.cs (Do.Emit, While.Emit, For.Emit,
8662         Statement.EmitBoolExpression): Add support to Do and While to
8663         propagate infinite loop as `I do return' semantics.
8664
8665         Improve the For case to also test for boolean constants.
8666
8667         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
8668         to the list of attributes we can add.
8669
8670         Remove `EmitContext' argument.
8671
8672         * class.cs (Method.Define): Apply parameter attributes.
8673         (Constructor.Define): Apply parameter attributes.
8674         (MethodCore.LabelParameters): Move here the core of labeling
8675         parameters. 
8676
8677         * support.cs (ReflectionParameters.ParameterModifier,
8678         InternalParameters.ParameterModifier): Use IsByRef on the type and
8679         only return the OUT bit for these parameters instead of in/out/ref
8680         flags.
8681
8682         This is because I miss-understood things.  The ParameterInfo.IsIn
8683         and IsOut represent whether the parameter has the [In] and [Out]
8684         attributes set.  
8685
8686 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
8687
8688         * ecore.cs (FieldExpr.Emit): Release temporaries.
8689
8690         * assign.cs (LocalTemporary.Release): new function.
8691
8692         * codegen.cs (EmitContext.GetTemporaryStorage,
8693         EmitContext.FreeTemporaryStorage): Rework the way we deal with
8694         temporary storage.  Now we can "put back" localbuilders when we
8695         are done with them
8696
8697 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
8698
8699         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
8700         need to make a copy of the variable to generate verifiable code.
8701
8702 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
8703
8704         * driver.cs: Compute dynamically the system directory.
8705
8706         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
8707         Slower, but more generally useful.  Used by the abstract
8708         registering implementation. 
8709
8710         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
8711         the rules for the special rule on Type/instances.  First check if
8712         we have the same name, and if so, try that special static path
8713         rather than the instance path.
8714         
8715 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
8716
8717         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
8718         for, while and if.
8719
8720         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
8721         Enum, ValueType, Delegate or Array for non-corlib compiles.
8722
8723         * cs-tokenizer.cs: Catch long identifiers (645)
8724
8725         * typemanager.cs (IndexerPropetyName): Ravi never tested this
8726         piece of code.
8727
8728         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
8729         fix, we were returning too early, so we were not registering
8730         pending methods from abstract classes.
8731
8732         Do not register pending methods if the class is abstract.
8733
8734         * expression.cs (Conditional.DoResolve): Report circular implicit
8735         conversions when we neecd to compute it for conditional
8736         expressions. 
8737
8738         (Is.DoResolve): If the expression is always of the provided type,
8739         flag warning 183.  If the expression can not ever be of the
8740         provided type flag warning 184.
8741
8742         * class.cs: Catch 169 as well.
8743
8744         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
8745         read. 
8746
8747 2002-01-18  Nick Drochak  <ndrochak@gol.com>
8748
8749         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
8750
8751 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
8752
8753         * interface.cs: (PopulateMethod): Check for pointers being defined
8754         only if the unsafe context is active.
8755         (PopulateProperty): ditto.
8756         (PopulateIndexer): ditto.
8757
8758         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
8759         specified.  If pointers are present, make sure that they are
8760         present in an unsafe context.
8761         (Constructor, Constructor.Define): ditto.
8762         (Field, Field.Define): ditto.
8763         (Property, Property.Define): ditto.
8764         (Event, Event.Define): ditto.
8765
8766         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
8767         hashtable if there are classes or structs defined.
8768
8769         * expression.cs (LocalVariableReference.DoResolve): Simplify this
8770         code, as the constant resolution moved.
8771
8772         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
8773         the metadata, so we can flag error 133. 
8774
8775         * decl.cs (MemberCore.UnsafeOK): New function to test that a
8776         pointer is being declared in an unsafe context.
8777
8778 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
8779
8780         * modifiers.cs (Modifiers.Check): Require a Location argument.
8781         Report error 227 for Unsafe use.
8782
8783         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
8784
8785         * statement.cs (For.Emit): If the test is null, then report that
8786         we do `return', as we wont reach anything afterwards.
8787
8788         (Switch.SwitchGoverningType): Track the expression that matched
8789         the conversion.
8790
8791         * driver.cs: Allow negative numbers as an error code to flag.
8792
8793         * cs-parser.jay: Handle 1551.
8794
8795         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
8796
8797 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
8798
8799         * cs-parser.jay: Report 1518 (type declaration can only contain
8800         class, struct, interface, enum or delegate)
8801
8802         (switch_label): Report 1523 (keywords `case' or `default' must
8803         preced code)
8804
8805         (opt_switch_sections): Report 1522 (empty switch)
8806
8807         * driver.cs: Report 1515 (response file specified multiple times)
8808         Report 1516 (Source file specified multiple times).
8809
8810         * expression.cs (Argument.Resolve): Signal 1510
8811
8812         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
8813         access not allowed in static code)
8814
8815 2002-01-11  Ravi Pratap  <ravi@ximian.com>
8816
8817         * typemanager.cs (IsPointerType): Utility method which we are going
8818         to need a lot.
8819
8820         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
8821         the object type, so we take care of that.
8822
8823         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
8824         
8825         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
8826         added to non-params parameters :-)
8827
8828         * typemanager.cs (CSharpName): Include 'void' type too. 
8829
8830         (void_ptr_type): Include in the set of core types.
8831
8832         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
8833         duplicating code.
8834
8835         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
8836         an unsafe context.
8837
8838         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
8839         completely forgotten about it.
8840
8841 2002-01-10  Ravi Pratap  <ravi@ximian.com>
8842
8843         * cs-parser.jay (pointer_type): Add. This begins our implementation
8844         of parsing rules for unsafe code.
8845
8846         (unsafe_statement): Implement.
8847
8848         (embedded_statement): Modify to include the above.
8849
8850         * statement.cs (Unsafe): Implement new class for unsafe blocks.
8851
8852         * codegen.cs (EmitContext.InUnsafe): Add. This determines
8853         if the current context is an unsafe one.
8854
8855         * cs-parser.jay (local_variable_pointer_type): Since local variable types
8856         are handled differently, we need separate rules for them.
8857
8858         (local_variable_declaration): Update to use local_variable_pointer_type
8859         to allow variable declarations of unmanaged pointer types.
8860
8861         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
8862         in unsafe contexts.
8863
8864         * ../errors/cs0214.cs : Add.
8865
8866 2002-01-16  Nick Drochak  <ndrochak@gol.com>
8867
8868         * makefile: remove 'response' file when cleaning.
8869
8870 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
8871
8872         * cs-parser.jay: Report 1524.
8873
8874 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
8875
8876         * typemanager.cs (RegisterMethod): drop checking if we have
8877         registered this from here
8878
8879 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
8880
8881         * class.cs (Method.EmitDestructor): Implement calling our base
8882         destructor. 
8883
8884         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
8885         value of InFinally.
8886
8887         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
8888         this routine and will wrap the call in a try/catch block.  Deal
8889         with the case.
8890
8891 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
8892
8893         * ecore.cs (Expression.MemberLookup): instead of taking a
8894         parameter `same_type' that was used to tell whether we could
8895         access private members we compute our containing type from the
8896         EmitContext.
8897
8898         (FieldExpr): Added partial support for volatile fields.  This does
8899         not work for volatile fields exposed from assemblies, as I can not
8900         figure out how to extract the modreq from it.
8901
8902         Updated all the source files to use this.
8903
8904         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
8905         because it is referenced by MemberLookup very often. 
8906
8907 2002-01-09  Ravi Pratap  <ravi@ximian.com>
8908
8909         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
8910         TypeBuilder.GetCustomAttributes to retrieve what we need.
8911
8912         Get rid of redundant default_member_attr_type as this is the same as
8913         default_member_type which already exists.
8914
8915         * interface.cs, attribute.cs : Update accordingly.
8916         
8917 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
8918
8919         * typemanager.cs: Enable IndexerPropertyName again.  It does not
8920         work for TYpeBuilders though.  Ravi, can you please fix this?
8921
8922         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
8923
8924         * expression.cs (Argument.Emit): Handle the case of ref objects
8925         being passed to ref functions;  
8926
8927         (ParameterReference.EmitLoad): Loads the content of the pointer
8928         without dereferencing.
8929
8930 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8931
8932         * cs-tokenizer.cs: Implemented the pre-processing expressions.
8933
8934 2002-01-08  Ravi Pratap  <ravi@ximian.com>
8935
8936         * class.cs (Indexer.DefineMethod): Incorporate the interface
8937         type in the name of the method if we are doing explicit interface
8938         implementation.
8939
8940         * expression.cs (ConversionExists): Remove as it is completely obsolete.
8941
8942         (BetterConversion): Fix extremely trivial bug where we were referring to
8943         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
8944         again !
8945
8946         * ../errors/bug16.cs : Add although we have fixed it.
8947
8948 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8949
8950         * expression.cs (BaseIndexer): Begin implementation.
8951
8952         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
8953
8954         * cs-parser.jay (indexer_declarator): Use qualified_identifier
8955         production directly to remove a shift/reduce, and implement
8956         explicit interface implementation.
8957
8958         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
8959         after a floating point suffix.
8960
8961         * expression.cs (DoNumericPromotions): Improved the conversion for
8962         uint/uint.  If we have a constant, we avoid doing a typecast to a
8963         larger type.
8964
8965         * class.cs (Indexer): Implement explicit interface implementation
8966         for indexers.
8967         
8968 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
8969
8970         * class.cs: make the default instance constructor public and hidebysig.
8971
8972 2001-01-03  Ravi Pratap  <ravi@ximian.com>
8973
8974         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
8975         so we can call it from elsewhere.
8976
8977         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
8978         we emit it internally if the class has a defined indexer; otherwise the user
8979         emits it by decorating the class definition with the DefaultMemberAttribute.
8980
8981         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
8982         attribute is not used on a type which defines an indexer.
8983
8984         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
8985         character when we skip whitespace.
8986
8987         * ../errors/cs0646.cs : Add.
8988
8989 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
8990
8991         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
8992         again. 
8993
8994         * makefile: Add practical target `mcs3.exe' which builds the third
8995         generation compiler. 
8996
8997         * expression.cs (New): Fix structures constructor calling.
8998
8999         * class.cs (Property, Method, Indexer): Emit Final flag on the
9000         method if we are an interface implementation and we are not
9001         abstract. 
9002
9003         * ecore.cs (PropertyExpr): New public field `IsBase', tells
9004         whether this property is referencing a `base' method.
9005
9006         * expression.cs (Invocation.EmitCall): take an extra argument:
9007         is_base, this is used to determine whether the `call' or
9008         `callvirt' opcode should be used.
9009
9010         
9011         * delegate.cs: update EmitCall.
9012
9013         * class.cs (Method.Define): Set NewSlot for the cases where we are
9014         not implementing an interface method.
9015
9016         (Property.Define): ditto.
9017
9018 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
9019
9020         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
9021         'r'.  Allows mcs to parse itself fully.
9022
9023 2002-01-02  Ravi Pratap  <ravi@ximian.com>
9024
9025         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
9026         of the number of initializers that require the InitializeArray method.
9027
9028         (CheckIndices): Store the Expression in all cases - not the plain value. Also
9029         update the above field where necessary.
9030
9031         (MakeByteBlob): Update accordingly.
9032
9033         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
9034         greater than 2.
9035
9036         (EmitDynamicInitializers): Update in accordance with the new optimization.
9037
9038         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
9039         same OpCode applies.
9040
9041         * cs-parser.jay : Fix some glaring errors I introduced.
9042
9043 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
9044
9045         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
9046         so that we can check for name clashes there too.
9047
9048         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
9049         for interface indexers.
9050
9051         * interfaces.cs (Define): Emit the default member attribute.
9052
9053         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
9054         variable was being referred to while setting the value ;-)
9055
9056 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
9057
9058         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
9059         byte-by-byte information when we know the data is zero.
9060
9061         Make the block always a multiple of 4, because
9062         DefineInitializedData has a bug.
9063
9064         * assign.cs: Fix, we should assign from the temporary, not from
9065         the source. 
9066
9067         * expression.cs (MakeByteBlob): Fix my incorrect code.
9068
9069 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
9070
9071         * typemanager.cs (EnumToUnderlying): This function is used to get
9072         the underlying type from an enumeration, because it does not
9073         always work. 
9074
9075         * constant.cs: Use the I4_S form for values between -128 and 127.
9076
9077         * statement.cs (Block.LookupLabel): Looks up a label.
9078         (Block): Drop support for labeled blocks.
9079
9080         (LabeledStatement): New kind of statement that represents a label
9081         only.
9082
9083         (Goto): Finally implement this bad boy.
9084         
9085         * cs-parser.jay: Update to reflect new mechanism to implement
9086         labels.
9087
9088 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
9089
9090         * codegen.cs (EmitContext.This): a codegen property that keeps the
9091         a single instance of this instead of creating many different this
9092         instances. 
9093
9094         * delegate.cs (Delegate.DoResolve): Update to use the property;
9095
9096         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
9097
9098         * expression.cs (BaseAccess.DoResolve): Ditto.
9099
9100 2001-12-29  Ravi Pratap  <ravi@ximian.com>
9101
9102         * typemanager.cs (methodimpl_attr_type): Add to hold the type
9103         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
9104
9105         (InitCoreTypes): Update accordingly.
9106
9107         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
9108         so we can quickly store the state.
9109
9110         (ApplyAttributes): Set the correct implementation flags
9111         for InternalCall methods.
9112
9113 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
9114
9115         * expression.cs (EmitCall): if a method is not virtual, then do
9116         not use callvirt on it.
9117
9118         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
9119         user defined stuff) requires the use of stobj, which takes an
9120         address on the stack instead of an array and an index.  So emit
9121         the Ldelema operation for it.
9122
9123         (EmitStoreOpcode): Use stobj for valuetypes.
9124
9125         (UnaryMutator.EmitCode): Use the right 1 value depending on
9126         whether we are dealing with int64/uint64, float or doubles.
9127
9128         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
9129         constructors that I implemented last night.
9130
9131         (Constructor.IsDefault): Fix to work properly for static
9132         constructors.
9133
9134         * cs-parser.jay (CheckDef): report method signature errors.
9135         Update error number 103 to be 132.
9136
9137         * decl.cs: New AdditionResult enumeration value: MethodExists.
9138         Although we do this check for methods later on in the semantic
9139         analysis, catching repeated default constructors is so easy that
9140         we catch these here. 
9141         
9142         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
9143         promotions code.
9144
9145         (ParameterReference.EmitAssign, Emit): handle
9146         bools as bytes.
9147
9148         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
9149         (ArrayAccess.EmitStoreOpcode): ditto.
9150
9151         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
9152
9153         * expression.cs (MakeByteBlob): Complete all the missing types
9154         (uint, short, ushort, byte, sbyte)
9155
9156         * class.cs: Only init instance field initializers on instance
9157         constructors. 
9158
9159         Rename `constructors' to instance_constructors. 
9160
9161         (TypeContainer.AddConstructor): Only add constructors to the list
9162         if it is not static.
9163
9164         Make sure that we handle default_static_constructor independently
9165         everywhere where we handle instance_constructors
9166
9167 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
9168
9169         * class.cs: Do not lookup or create a base initializer for a
9170         static constructor.
9171
9172         (ConstructorInitializer.Resolve): use the proper type to lookup
9173         for constructors.
9174
9175         * cs-parser.jay: Report error 1585 (modifiers between type and name).
9176
9177         * enum.cs, interface.cs: Remove CloseType, this is taken care by
9178         in DeclSpace. 
9179
9180         * decl.cs: CloseType is now an virtual method, the default
9181         implementation just closes this type.
9182         
9183 2001-12-28  Ravi Pratap  <ravi@ximian.com>
9184
9185         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
9186         to PreserveSig by default. Also emit HideBySig on such methods.
9187
9188         Basically, set the defaults to standard values.
9189
9190         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
9191         argument, if candidate is better, it can't be worse than the best !
9192
9193         (Invocation): Re-write bits to differentiate between methods being
9194         applicable in their expanded form and their normal form - for params
9195         methods of course.
9196
9197         Get rid of use_standard everywhere as only standard conversions are allowed
9198         in overload resolution. 
9199
9200         More spec conformance.
9201         
9202 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
9203
9204         * driver.cs: Add --timestamp, to see where the compiler spends
9205         most of its time.
9206
9207         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
9208         `this' in static code.
9209
9210         (SimpleName.DoResolve): Implement in terms of a helper function
9211         that allows static-references to be passed upstream to
9212         MemberAccess.
9213
9214         (Expression.ResolveWithSimpleName): Resolve specially simple
9215         names when called by MemberAccess to implement the special
9216         semantics. 
9217
9218         (Expression.ImplicitReferenceConversion): Handle conversions from
9219         Null to reference types before others, as Null's type is
9220         System.Object. 
9221
9222         * expression.cs (Invocation.EmitCall): Handle the special case of
9223         calling methods declared on a reference type from a ValueType
9224         (Base classes System.Object and System.Enum)
9225
9226         (MemberAccess.Resolve): Only perform lookups on Enumerations if
9227         the left hand side is a TypeExpr, not on every enumeration. 
9228
9229         (Binary.Resolve): If types are reference types, then do a cast to
9230         object on operators != and == of both arguments.
9231         
9232         * typemanager.cs (FindMembers): Extract instance and static
9233         members if requested.
9234
9235         * interface.cs (PopulateProperty): Use void_type instead of null
9236         as the return type for the setter method.
9237
9238         (PopulateIndexer): ditto.
9239
9240 2001-12-27  Ravi Pratap  <ravi@ximian.com>
9241
9242         * support.cs (ReflectionParameters): Fix minor bug where we
9243         were examining the wrong parameter for the ParamArray attribute.
9244
9245         Cope with requests for the type of the parameter at position
9246         greater than the params parameter's. We now return the element
9247         type of the params array as that makes more sense.
9248
9249         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
9250         accordingly as we no longer have to extract the element type
9251         ourselves.
9252
9253         (Invocation.OverloadResolve): Update.
9254
9255 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
9256
9257         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
9258         against IEnumerator, test whether the return value is a descendant
9259         of the IEnumerator interface.
9260
9261         * class.cs (Indexer.Define): Use an auxiliary method to implement
9262         the other bits of the method definition.  Begin support for
9263         explicit interface implementation.
9264
9265         (Property.DefineMethod): Use TypeManager.void_type instead of null
9266         for an empty return value.
9267
9268 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
9269
9270         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
9271         dealing with a FieldExpr which is composed of a FieldBuilder, in
9272         the code path we did extract the constant, but we should have
9273         obtained the underlying value to be able to cast it (otherwise we
9274         end up in an infinite loop, this is what Ravi was running into).
9275
9276         (ArrayCreation.UpdateIndices): Arrays might be empty.
9277
9278         (MemberAccess.ResolveMemberAccess): Add support for section
9279         14.5.4.1 that deals with the special case of E.I when E is a type
9280         and something else, that I can be a reference to a static member.
9281
9282         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
9283         handle a particular array type to create byte blobs, it is just
9284         something we dont generate byteblobs for.
9285
9286         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
9287         arguments. 
9288
9289         * location.cs (Push): remove the key from the hashtable that we
9290         are about to add.   This happens for empty files.
9291
9292         * driver.cs: Dispose files after we have parsed them.
9293
9294         (tokenize): new function that only runs the tokenizer on its
9295         input, for speed testing.
9296
9297 2001-12-26  Ravi Pratap  <ravi@ximian.com>
9298
9299         * class.cs (Event.Define): Define the private field only if there
9300         are no accessors defined.
9301
9302         * expression.cs (ResolveMemberAccess): If there is no associated
9303         field with the event, that means we have an event defined with its
9304         own accessors and we should flag error cs0070 since transforming
9305         ourselves into a field is not valid in that case.
9306
9307         * ecore.cs (SimpleName.DoResolve): Same as above.
9308
9309         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
9310         and charset to sane values.
9311
9312 2001-12-25  Ravi Pratap  <ravi@ximian.com>
9313
9314         * assign.cs (DoResolve): Perform check on events only if they 
9315         are being accessed outside the declaring type.
9316
9317         * cs-parser.jay (event_declarations): Update rules to correctly
9318         set the type of the implicit parameter etc.
9319
9320         (add_accessor, remove_accessor): Set current local parameters.
9321
9322         * expression.cs (Binary): For delegate addition and subtraction,
9323         cast the return value from the method into the appropriate delegate
9324         type.
9325
9326 2001-12-24  Ravi Pratap  <ravi@ximian.com>
9327
9328         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
9329         of these as the workaround is unnecessary.
9330
9331         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
9332         delegate data - none of that is needed at all.
9333
9334         Re-write bits to extract the instance expression and the delegate method
9335         correctly.
9336
9337         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
9338         on delegates too.
9339
9340         * attribute.cs (ApplyAttributes): New method to take care of common tasks
9341         of attaching attributes instead of duplicating code everywhere.
9342
9343         * everywhere : Update code to do attribute emission using the above method.
9344
9345 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
9346
9347         * expression.cs (IsParamsMethodApplicable): if there are not
9348         parameters, return immediately.
9349
9350         * ecore.cs: The 0 literal can be implicity converted to an enum
9351         type. 
9352
9353         (SimpleName.DoResolve): First lookup the type, then lookup the
9354         members. 
9355
9356         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
9357         want to get its address.  If the InstanceExpression is not
9358         addressable, store the result in a temporary variable, then get
9359         the address of it.
9360
9361         * codegen.cs: Only display 219 errors on warning level or above. 
9362
9363         * expression.cs (ArrayAccess): Make it implement the
9364         IMemoryLocation interface.
9365
9366         (Binary.DoResolve): handle the operator == (object a, object b)
9367         and operator != (object a, object b) without incurring into a
9368         BoxedCast (because 5 != o should never be performed).
9369
9370         Handle binary enumerator operators.
9371
9372         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
9373         value type, otherwise use Ldelem_ref.
9374
9375         Use precomputed names;
9376
9377         (AddressOf): Implement address of
9378
9379         * cs-parser.jay (labeled_statement): Fix recursive block
9380         addition by reworking the production.
9381
9382         * expression.cs (New.DoEmit): New has a special case:
9383                 
9384                  If we are dealing with a ValueType, we have a few
9385                  situations to deal with:
9386                 
9387                     * The target of New is a ValueType variable, that is
9388                       easy, we just pass this as the variable reference
9389                 
9390                     * The target of New is being passed as an argument,
9391                       to a boxing operation or a function that takes a
9392                       ValueType.
9393                 
9394                       In this case, we need to create a temporary variable
9395                       that is the argument of New.
9396
9397
9398 2001-12-23  Ravi Pratap  <ravi@ximian.com>
9399
9400         * rootcontext.cs (LookupType): Check that current_type is not null before
9401         going about looking at nested types.
9402
9403         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
9404         not implement the IAssignMethod interface any more.
9405
9406         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
9407         where we tranform them into FieldExprs if they are being resolved from within
9408         the declaring type.
9409
9410         * ecore.cs (SimpleName.DoResolve): Do the same here.
9411
9412         * assign.cs (DoResolve, Emit): Clean up code considerably. 
9413
9414         * ../errors/bug10.cs : Add.
9415
9416         * ../errors/cs0070.cs : Add.
9417
9418         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
9419
9420         * assign.cs : Get rid of EventIsLocal everywhere.
9421         
9422 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
9423
9424         * ecore.cs (ConvertIntLiteral): finished the implementation.
9425
9426         * statement.cs (SwitchLabel): Convert the value we are using as a
9427         key before looking up the table.
9428
9429 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
9430
9431         * codegen.cs (EmitTopBlock): Require a Location argument now.
9432
9433         * cs-parser.jay (constructor_declarator): We need to setup
9434         current_local_parameters before we parse the
9435         opt_constructor_initializer, to allow the variables to be bound
9436         to the constructor arguments.
9437
9438         * rootcontext.cs (LookupType): First lookup nested classes in our
9439         class and our parents before we go looking outside our class.
9440
9441         * expression.cs (ConstantFold): Extract/debox the values at the
9442         beginnning. 
9443
9444         * rootcontext.cs (EmitCode): Resolve the constants first before we
9445         resolve the types.  This is not really needed, but it helps debugging.
9446
9447         * statement.cs: report location.
9448         
9449         * cs-parser.jay: pass location to throw statement.
9450
9451         * driver.cs: Small bug fix.
9452
9453         * report.cs: Updated format to be 4-zero filled digits.
9454
9455 2001-12-22  Ravi Pratap  <ravi@ximian.com>
9456
9457         * expression.cs (CheckIndices): Fix minor bug where the wrong
9458         variable was being referred to ;-)
9459
9460         (DoEmit): Do not call EmitStaticInitializers when the 
9461         underlying type is System.Object.
9462
9463 2001-12-21  Ravi Pratap  <ravi@ximian.com>
9464
9465         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
9466         and do the usual workaround for SRE.
9467
9468         * class.cs (MyEventBuilder.EventType): New member to get at the type
9469         of the event, quickly.
9470
9471         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
9472
9473         * assign.cs (Assign.DoResolve): Handle the case when the target
9474         is an EventExpr and perform the necessary checks.
9475
9476         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
9477         interface.
9478
9479         (SimpleName.MemberStaticCheck): Include check for EventExpr.
9480
9481         (EventExpr): Set the type in the constructor itself since we 
9482         are meant to be born fully resolved.
9483
9484         (EventExpr.Define): Revert code I wrote earlier.
9485                 
9486         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
9487         instance expression is null. The instance expression is a This in that case
9488         or a null, depending on whether it is a static method or not.
9489
9490         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
9491         refers to more than one method.
9492
9493         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
9494         and accordingly flag errors.
9495
9496 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
9497
9498         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
9499
9500 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
9501
9502         * location.cs (ToString): Provide useful rutine.
9503
9504 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
9505
9506         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
9507         objects, return the actual integral boxed.
9508
9509         * statement.cs (SwitchLabel): define an ILLabel for each
9510         SwitchLabel. 
9511         
9512         (Switch.CheckSwitch): If the value is a Literal, extract
9513         the underlying literal.
9514         
9515         Also in the unused hashtable we had, add the SwitchLabel so we can
9516         quickly look this value up.
9517
9518         * constant.cs: Implement a bunch of new constants.  Rewrite
9519         Literal based on this.  Made changes everywhere to adapt to this.
9520         
9521         * expression.cs (Expression.MakeByteBlob): Optimize routine by
9522         dereferencing array only once, and also copes with enumrations.
9523
9524         bytes are two bytes wide, not one.
9525
9526         (Cast): Perform constant conversions.
9527         
9528         * ecore.cs (TryImplicitIntConversion): Return literals instead of
9529         wrappers to the literals here.
9530
9531         * expression.cs (DoNumericPromotions): long literals can converted
9532         to ulong implicity (this is taken care of elsewhere, but I was
9533         missing this spot).
9534
9535         * ecore.cs (Expression.Literalize): Make the return type Literal,
9536         to improve type checking.
9537
9538         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
9539
9540 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
9541
9542         * literal.cs: Revert code from ravi that checked the bounds.  The
9543         bounds are sane by the definition of the type itself. 
9544
9545         * typemanager.cs: Fix implementation of ImplementsInterface.  We
9546         need to actually look up in our parent hierarchy for interfaces
9547         implemented. 
9548
9549         * const.cs: Use the underlying type for enumerations
9550
9551         * delegate.cs: Compute the basename for the delegate creation,
9552         that should fix the delegate test case, and restore the correct
9553         Type Lookup semantics in rootcontext
9554
9555         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
9556         referencing a nested type with the Reflection API is using the "+"
9557         sign. 
9558
9559         * cs-parser.jay: Do not require EOF token at the end.
9560
9561 2001-12-20  Ravi Pratap  <ravi@ximian.com>
9562
9563         * rootcontext.cs (LookupType): Concatenate type names with
9564         a '.' instead of a '+' The test suite passes again.
9565
9566         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
9567         field of the enumeration.
9568
9569         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
9570         the case when the member is an EventExpr.
9571
9572         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
9573         static has an associated instance expression.
9574
9575         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
9576
9577         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
9578
9579         * class.cs (Event.Define): Register event and perform appropriate checks
9580         for error #111.
9581
9582         We define the Add and Remove methods even if the use provides none because
9583         in that case, we provide default implementations ourselves.
9584
9585         Define a private field of the type of the event. This is done by the CSC compiler
9586         and we should be doing it too ;-)
9587
9588         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
9589         More methods we use in code we generate.
9590
9591         (multicast_delegate_type, delegate_type): Two separate types since the distinction
9592         is important.
9593
9594         (InitCoreTypes): Update accordingly for the above.
9595
9596         * class.cs (Event.Emit): Generate code for default accessors that we provide
9597
9598         (EmitDefaultMethod): Do the job in the above.
9599
9600         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
9601         appropriate place.
9602
9603 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
9604
9605         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
9606         builders even if we were missing one.
9607
9608         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
9609         pass the Basename as our class name instead of the Name.  The
9610         basename will be correctly composed for us.
9611
9612         * parameter.cs (Paramters): Now takes a Location argument.
9613
9614         * decl.cs (DeclSpace.LookupType): Removed convenience function and
9615         make all the code call directly LookupType in RootContext and take
9616         this chance to pass the Location information everywhere.
9617
9618         * Everywhere: pass Location information.
9619
9620 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
9621
9622         * class.cs (Constructor.Define): Updated way of detecting the
9623         length of the parameters.
9624
9625         (TypeContainer.DefineType): Use basename as the type name for
9626         nested types.
9627
9628         (TypeContainer.Define): Do not recursively define types here, as
9629         definition is taken care in order by the RootContext.
9630
9631         * tree.cs: Keep track of namespaces in a per-file basis.
9632
9633         * parameter.cs (Parameter.ComputeSignature): Update to use
9634         DeclSpace. 
9635
9636         (Parameters.GetSignature): ditto.
9637
9638         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
9639         instead of a TypeContainer.
9640
9641         (Interface.SemanticAnalysis): Use `this' instead of our parent to
9642         resolve names.  Because we need to be resolve in our context, not
9643         our parents.
9644         
9645         * driver.cs: Implement response files.
9646
9647         * class.cs (TypeContainer.DefineType): If we are defined, do not
9648         redefine ourselves.
9649         
9650         (Event.Emit): Emit the code for add/remove handlers.
9651         (Event.Define): Save the MethodBuilders for add/remove.
9652
9653         * typemanager.cs: Use pair here too.
9654
9655         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
9656         DictionaryEntry requires the first argument to be non-null.  
9657         
9658         (enum_declaration): Compute full name for registering the
9659         enumeration.
9660         
9661         (delegate_declaration): Instead of using
9662         formal_parameter_list, use opt_formal_parameter_list as the list
9663         can be empty.
9664
9665         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
9666         (EventParsing): New property that controls whether `add' and
9667         `remove' are returned as tokens or identifiers (for events);
9668
9669 2001-12-19  Ravi Pratap  <ravi@ximian.com>
9670
9671         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
9672         use MyEventBuilder only and let it wrap the real builder for us.
9673
9674         (MyEventBuilder): Revamp constructor etc.
9675
9676         Implement all operations that we perform on EventBuilder in precisely the same
9677         way here too.
9678
9679         (FindMembers): Update to use the EventBuilder member.
9680
9681         (Event.Emit): Update accordingly.
9682
9683 2001-12-18  Ravi Pratap  <ravi@ximian.com>
9684
9685         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
9686         by calling the appropriate methods.
9687
9688         (GetCustomAttributes): Make stubs as they cannot possibly do anything
9689         useful.
9690
9691         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
9692
9693 2001-12-17  Ravi Pratap  <ravi@ximian.com>
9694
9695         * delegate.cs (Delegate.Populate): Check that the return type
9696         and various parameters types are indeed accessible.
9697
9698         * class.cs (Constructor.Define): Same here.
9699
9700         (Field.Define): Ditto.
9701
9702         (Event.Define): Ditto.
9703
9704         (Operator.Define): Check that the underlying Method defined itself
9705         correctly - so it's MethodBuilder should not be null.
9706
9707         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
9708         expression happens to be null.
9709
9710         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
9711         members but as of now we don't seem to be able to do anything really useful with it.
9712
9713         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
9714         not the EventBuilder.
9715
9716 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
9717
9718         * cs-tokenizer.cs: Add support for defines.
9719         Add support for #if, #elif, #else, #endif
9720         
9721         (eval_var): evaluates a variable.
9722         (eval): stubbed for evaluating functions.
9723
9724         * cs-parser.jay: Pass the defines information
9725
9726         * driver.cs: Add --define command line option.
9727
9728         * decl.cs: Move MemberCore here.
9729
9730         Make it the base class for DeclSpace.  This allows us to catch and
9731         report 108 and 109 for everything now.
9732
9733         * class.cs (TypeContainer.Define): Extract all the members
9734         before populating and emit the warning 108 (new keyword required
9735         to override) instead of having each member implement this.
9736
9737         (MemberCore.Define): New abstract method, we will be using this in
9738         the warning reporting engine in Populate.
9739         
9740         (Operator.Define): Adjust to new MemberCore protocol. 
9741
9742         * const.cs (Const): This does not derive from Expression, it is a
9743         temporary object we use to create fields, it is a MemberCore. 
9744
9745         * class.cs (Method.Define): Allow the entry point to be in a
9746         specific class.
9747
9748         * driver.cs: Rewrite the argument handler to clean it up a bit.
9749
9750         * rootcontext.cs: Made it just an auxiliary namespace feature by
9751         making everything static.
9752
9753         * driver.cs: Adapt code to use RootContext type name instead of
9754         instance variable.
9755
9756         * delegate.cs: Remove RootContext argument.
9757
9758         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
9759         argument. 
9760
9761         * class.cs (Event.Define): The lookup can fail.
9762         
9763         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
9764
9765         * expression.cs: Resolve the this instance before invoking the code.
9766
9767 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
9768
9769         * cs-parser.jay: Add a production in element_access that allows
9770         the thing to become a "type" reference.  This way we can parse
9771         things like "(string [])" as a type.
9772
9773         Note that this still does not handle the more complex rules of
9774         casts. 
9775         
9776
9777         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
9778
9779         * ecore.cs: (CopyNewMethods): new utility function used to
9780         assemble the list of methods from running FindMembers.
9781
9782         (MemberLookup): Rework FindMembers so that 
9783
9784 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
9785
9786         * class.cs (TypeContainer): Remove Delegates who fail to be
9787         defined.
9788
9789         * delegate.cs (Populate): Verify that we dont get null return
9790         values.   TODO: Check for AsAccessible.
9791
9792         * cs-parser.jay: Use basename to emit error 574 (destructor should
9793         have the same name as container class), not the full name.
9794
9795         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
9796         possible representation.  
9797
9798         Also implements integer type suffixes U and L.
9799
9800 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
9801
9802         * expression.cs (ArrayCreation.DoResolve): We need to do the
9803         argument resolution *always*.
9804
9805         * decl.cs: Make this hold the namespace.  Hold the root context as
9806         well.
9807         (LookupType): Move here.
9808
9809         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
9810
9811         * location.cs (Row, Name): Fixed the code, it was always returning
9812         references to the first file.
9813
9814         * interface.cs: Register properties defined through interfaces.
9815
9816         * driver.cs: Add support for globbing on the command line
9817
9818         * class.cs (Field): Make it derive from MemberCore as well.
9819         (Event): ditto.
9820
9821 2001-12-15  Ravi Pratap  <ravi@ximian.com>
9822
9823         * class.cs (Event::Define): Check that the type of the event is a delegate
9824         type else flag error #66.
9825
9826         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
9827         same.
9828
9829         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
9830         values of EntryPoint, CharSet etc etc.
9831
9832         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
9833
9834         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
9835         be null and we should ignore this. I am not sure if this is really clean. Apparently,
9836         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
9837         which needs this to do its work.
9838
9839         * ../errors/cs0066.cs : Add.
9840
9841 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
9842
9843         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
9844         helper functions.
9845
9846         * class.cs: (MethodSignature.MethodSignature): Removed hack that
9847         clears out the parameters field.
9848         (MemberSignatureCompare): Cleanup
9849
9850         (MemberCore): New base class used to share code between MethodCore
9851         and Property.
9852
9853         (RegisterRequiredImplementations) BindingFlags.Public requires
9854         either BindingFlags.Instace or Static.  Use instance here.
9855
9856         (Property): Refactored code to cope better with the full spec.
9857
9858         * parameter.cs (GetParameterInfo): Return an empty array instead
9859         of null on error.
9860
9861         * class.cs (Property): Abstract or extern properties have no bodies.
9862
9863         * parameter.cs (GetParameterInfo): return a zero-sized array.
9864
9865         * class.cs (TypeContainer.MethodModifiersValid): Move all the
9866         method modifier validation to the typecontainer so we can reuse
9867         this on properties.
9868
9869         (MethodCore.ParameterTypes): return an empty sized array of types.
9870
9871         (Property.Define): Test property modifier validity.
9872
9873         Add tests for sealed/override too.
9874
9875         (Method.Emit): abstract or extern methods have no bodies.
9876
9877 2001-12-14  Ravi Pratap  <ravi@ximian.com>
9878
9879         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
9880         thing.
9881
9882         (Method::Define, ::Emit): Modify accordingly.
9883
9884         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
9885
9886         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
9887
9888         * makefile: Pass in /unsafe.
9889
9890 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
9891
9892         * class.cs (MakeKey): Kill routine.
9893         
9894         * class.cs (TypeContainer.Define): Correctly define explicit
9895         method implementations (they require the full interface name plus
9896         the method name).
9897
9898         * typemanager.cs: Deply the PtrHashtable here and stop using the
9899         lame keys.  Things work so much better.
9900
9901         This of course broke everyone who depended on `RegisterMethod' to
9902         do the `test for existance' test.  This has to be done elsewhere.
9903
9904         * support.cs (PtrHashtable): A hashtable that avoid comparing with
9905         the object stupid Equals method (because, that like fails all over
9906         the place).  We still do not use it.
9907
9908         * class.cs (TypeContainer.SetRequiredInterface,
9909         TypeContainer.RequireMethods): Killed these two routines and moved
9910         all the functionality to RegisterRequiredImplementations.
9911
9912         (TypeContainer.RegisterRequiredImplementations): This routine now
9913         registers all the implementations required in an array for the
9914         interfaces and abstract methods.  We use an array of structures
9915         which can be computed ahead of time to reduce memory usage and we
9916         also assume that lookups are cheap as most classes will not
9917         implement too many interfaces.
9918
9919         We also avoid creating too many MethodSignatures.
9920
9921         (TypeContainer.IsInterfaceMethod): Update and optionally does not
9922         clear the "pending" bit if we find that there are problems with
9923         the declaration.
9924
9925         (TypeContainer.VerifyPendingMethods): Update to report errors of
9926         methods that look like implementations but are not.
9927
9928         (TypeContainer.Define): Add support for explicit interface method
9929         implementation. 
9930         
9931 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
9932
9933         * typemanager.cs: Keep track of the parameters here instead of
9934         being a feature of the TypeContainer.
9935
9936         * class.cs: Drop the registration of parameters here, as
9937         InterfaceMethods are also interface declarations.
9938
9939         * delegate.cs: Register methods with the TypeManager not only with
9940         the TypeContainer.  This code was buggy.
9941
9942         * interface.cs: Full registation here.
9943
9944 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
9945
9946         * expression.cs: Remove reducer for binary expressions, it can not
9947         be done this way.
9948
9949         * const.cs: Put here the code that used to go into constant.cs
9950
9951         * constant.cs: Put here the code for constants, this is a new base
9952         class for Literals.
9953
9954         * literal.cs: Make Literal derive from Constant.
9955
9956 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
9957
9958         * statement.cs (Return.Emit): Report error 157 if the user
9959         attempts to return from a finally block.
9960
9961         (Return.Emit): Instead of emitting a return, jump to the end of
9962         the function.
9963
9964         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
9965         LocalBuilder to store the result of the function.  ReturnLabel is
9966         the target where we jump.
9967         
9968
9969 2001-12-09  Radek Doulik  <rodo@ximian.com>
9970
9971         * cs-parser.jay: remember alias in current namespace
9972
9973         * ecore.cs (SimpleName::DoResolve): use aliases for types or
9974         namespaces
9975
9976         * class.cs (LookupAlias): lookup alias in my_namespace
9977
9978         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
9979         aliases hashtable
9980         (LookupAlias): lookup alias in this and if needed in parent
9981         namespaces
9982
9983 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
9984
9985         * support.cs: 
9986
9987         * rootcontext.cs: (ModuleBuilder) Made static, first step into
9988         making things static.  I need this to avoid passing the
9989         TypeContainer when calling ParameterType.
9990
9991         * support.cs (InternalParameters.ParameterType): Remove ugly hack
9992         that did string manipulation to compute the type and then call
9993         GetType.  Use Parameter.ParameterType instead.
9994
9995         * cs-tokenizer.cs: Consume the suffix for floating values.
9996
9997         * expression.cs (ParameterReference): figure out whether this is a
9998         reference parameter or not.  Kill an extra variable by computing
9999         the arg_idx during emission.
10000
10001         * parameter.cs (Parameters.GetParameterInfo): New overloaded
10002         function that returns whether a parameter is an out/ref value or not.
10003
10004         (Parameter.ParameterType): The type of the parameter (base,
10005         without ref/out applied).
10006         
10007         (Parameter.Resolve): Perform resolution here.
10008         (Parameter.ExternalType): The full type (with ref/out applied).
10009
10010         * statement.cs (Using.Emit, Using.EmitExpression): Implement
10011         support for expressions on the using statement.
10012
10013 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
10014
10015         * statement.cs (Using.EmitLocalVariableDecls): Split the
10016         localvariable handling of the using statement.
10017
10018         (Block.EmitMeta): Keep track of variable count across blocks.  We
10019         were reusing slots on separate branches of blocks.
10020
10021         (Try.Emit): Emit the general code block, we were not emitting it. 
10022
10023         Check the type of the declaration to be an IDisposable or
10024         something that can be implicity converted to it. 
10025
10026         Emit conversions if required.
10027
10028         * ecore.cs (EmptyExpression): New utility class.
10029         (Expression.ImplicitConversionExists): New utility function.
10030
10031 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
10032
10033         * statement.cs (Using): Implement.
10034
10035         * expression.cs (LocalVariableReference): Support read only variables.
10036
10037         * statement.cs: Remove the explicit emit for the Leave opcode.
10038         (VariableInfo): Add a readonly field.
10039
10040 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
10041
10042         * ecore.cs (ConvCast): new class used to encapsulate the various
10043         explicit integer conversions that works in both checked and
10044         unchecked contexts.
10045
10046         (Expression.ConvertNumericExplicit): Use new ConvCast class to
10047         properly generate the overflow opcodes.
10048
10049 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
10050
10051         * statement.cs: The correct type for the EmptyExpression is the
10052         element_type, not the variable type.  Ravi pointed this out.
10053
10054 2001-12-04  Ravi Pratap  <ravi@ximian.com>
10055
10056         * class.cs (Method::Define): Handle PInvoke methods specially
10057         by using DefinePInvokeMethod instead of the usual one.
10058
10059         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
10060         above to do the task of extracting information and defining the method.
10061         
10062 2001-12-04  Ravi Pratap  <ravi@ximian.com>
10063
10064         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
10065         of the condition for string type.
10066
10067         (Emit): Move that here. 
10068
10069         (ArrayCreation::CheckIndices): Keep string literals in their expression
10070         form.
10071
10072         (EmitDynamicInitializers): Handle strings appropriately.
10073
10074 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
10075
10076         * codegen.cs (EmitContext): Replace multiple variables with a
10077         single pointer to the current Switch statement.
10078
10079         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
10080         EmitContext.
10081
10082 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
10083
10084         * statement.cs 
10085
10086         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
10087         default'.
10088         
10089         (Foreach.Emit): Foreach on arrays was not setting
10090         up the loop variables (for break/continue).
10091
10092         (GotoCase): Semi-implented.
10093         
10094 2001-12-03  Ravi Pratap  <ravi@ximian.com>
10095
10096         * attribute.cs (CheckAttribute): Handle system attributes by using
10097         Attribute.GetAttributes to examine information we need.
10098
10099         (GetValidPlaces): Same here.
10100
10101         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
10102
10103         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
10104
10105         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
10106
10107         (Method::Define): Set appropriate flags if we have a DllImport attribute.
10108
10109         (Method::Emit): Handle the case when we are a PInvoke method.
10110
10111 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
10112
10113         * expression.cs: Use ResolveWithSimpleName on compound names.
10114
10115 2001-12-02  Ravi Pratap  <ravi@ximian.com>
10116
10117         * constant.cs (EmitConstant): Make sure we resolve the associated expression
10118         before trying to reduce it.
10119
10120         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
10121
10122         * constant.cs (LookupConstantValue): Implement.
10123
10124         (EmitConstant): Use the above in emitting the constant.
10125
10126         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
10127         that are user-defined by doing a LookupConstantValue on them.
10128
10129         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
10130         too, like above.
10131
10132 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
10133
10134         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
10135
10136         (BaseAccess.DoResolve): Implement.
10137
10138         (MemberAccess.DoResolve): Split this routine into a
10139         ResolveMemberAccess routine that can be used independently
10140
10141 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
10142
10143         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
10144         As that share bits of the implementation.  Is returns a boolean,
10145         while As returns the Type that is being probed.
10146
10147 2001-12-01  Ravi Pratap  <ravi@ximian.com>
10148
10149         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
10150         instead of a Literal - much easier.
10151
10152         (EnumInTransit): Remove - utterly useless :-)
10153
10154         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
10155
10156         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
10157
10158         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
10159         chain when we have no associated expression.
10160
10161 2001-11-30  Ravi Pratap  <ravi@ximian.com>
10162
10163         * constant.cs (Define): Use Location while reporting the errror.
10164
10165         Also emit a warning when 'new' is used and there is no inherited
10166         member to hide.
10167
10168         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
10169         populated.
10170
10171         (LookupEnumValue): Implement to lookup an enum member's value and define it
10172         if necessary.
10173
10174         (Populate): Re-write accordingly to use the above routine.
10175
10176 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
10177
10178         * expression.cs (This): Fix prototype for DoResolveLValue to
10179         override the base class DoResolveLValue.
10180
10181         * cs-parser.cs: Report errors cs574 and cs575 (destructor
10182         declarations) 
10183
10184         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
10185         (we need to load the address of the field here).  This fixes
10186         test-22. 
10187         
10188         (FieldExpr.DoResolveLValue): Call the DoResolve
10189         function to initialize the Instance expression.
10190         
10191         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
10192         correctly the GetEnumerator operation on a value type.
10193
10194         * cs-parser.jay: Add more simple parsing error catches.
10195
10196         * statement.cs (Switch): Add support for string switches.
10197         Handle null specially.
10198
10199         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
10200
10201 2001-11-28  Ravi Pratap  <ravi@ximian.com>
10202
10203         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
10204
10205         (declare_local_constant): New helper function.
10206
10207         * statement.cs (AddConstant): Keep a separate record of constants
10208
10209         (IsConstant): Implement to determine if a variable is a constant.
10210
10211         (GetConstantExpression): Implement.
10212
10213         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
10214
10215         * statement.cs (IsVariableDefined): Re-write.
10216
10217 2001-11-27  Ravi Pratap  <ravi@ximian.com>
10218
10219         * class.cs (TypeContainer::FindMembers): Look for constants
10220         in the case when we are looking for MemberTypes.Field
10221
10222         * expression.cs (MemberAccess::DoResolve): Check that in the
10223         case we are a FieldExpr and a Literal, we are not being accessed
10224         by an instance reference.
10225
10226         * cs-parser.jay (local_constant_declaration): Implement.
10227
10228         (declaration_statement): Implement for constant declarations.
10229
10230 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
10231
10232         * statement.cs (Switch): Catch double defaults.
10233
10234         (Switch): More work on the switch() statement
10235         implementation.  It works for integral values now, need to finish
10236         string support.
10237
10238
10239 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
10240
10241         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
10242         integer literals into other integer literals.  To be used by
10243         switch. 
10244
10245 2001-11-24  Ravi Pratap  <ravi@ximian.com>
10246
10247         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
10248         some memory.
10249
10250         (EmitDynamicInitializers): Cope with the above since we extract data
10251         directly from ArrayData now.
10252
10253         (ExpectInitializers): Keep track of whether initializers are mandatory
10254         or not.
10255
10256         (Bounds): Make it a hashtable to prevent the same dimension being 
10257         recorded for every element in that dimension.
10258
10259         (EmitDynamicInitializers): Fix bug which prevented the Set array method
10260         from being found.
10261
10262         Also fix bug which was causing the indices to be emitted in the reverse
10263         order.
10264
10265 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
10266
10267         * expression.cs (ArrayCreation): Implement the bits that Ravi left
10268         unfinished.  They do not work, because the underlying code is
10269         sloppy.
10270
10271 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
10272
10273         * cs-parser.jay: Remove bogus fixme.
10274
10275         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
10276         on Switch statement.
10277         
10278 2001-11-23  Ravi Pratap  <ravi@ximian.com>
10279
10280         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
10281         the same. 
10282         
10283         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
10284         parameter. Apparently, any expression is allowed. 
10285
10286         (ValidateInitializers): Update accordingly.
10287
10288         (CheckIndices): Fix some tricky bugs thanks to recursion.
10289
10290         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
10291         I was being completely brain-dead.
10292
10293         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
10294         and re-write acordingly.
10295
10296         (DelegateInvocation): Re-write accordingly.
10297
10298         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
10299
10300         (MakeByteBlob): Handle types more correctly.
10301
10302         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
10303         initialization from expressions but it is incomplete because I am a complete
10304         Dodo :-|
10305
10306 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
10307
10308         * statement.cs (If.Emit): Fix a bug that generated incorrect code
10309         on If.  Basically, we have to return `true' (ie, we do return to
10310         our caller) only if both branches of the if return.
10311
10312         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
10313         short-circuit operators, handle them as short circuit operators. 
10314
10315         (Cast.DoResolve): Resolve type.
10316         (Cast.Cast): Take an expression as the target type.
10317
10318         * cs-parser.jay (cast_expression): Remove old hack that only
10319         allowed a limited set of types to be handled.  Now we take a
10320         unary_expression and we resolve to a type during semantic
10321         analysis.
10322
10323         Use the grammar productions from Rhys to handle casts (this is
10324         not complete like Rhys syntax yet, we fail to handle that corner
10325         case that C# has regarding (-x), but we will get there.
10326         
10327 2001-11-22  Ravi Pratap  <ravi@ximian.com>
10328
10329         * class.cs (EmitFieldInitializer): Take care of the case when we have a
10330         field which is an array type.
10331
10332         * cs-parser.jay (declare_local_variables): Support array initialization too.
10333
10334         * typemanager.cs (MakeKey): Implement.
10335
10336         (everywhere): Use the above appropriately.
10337
10338         * cs-parser.jay (for_statement): Update for array initialization while
10339         declaring variables.
10340
10341         * ecore.cs : The error message was correct, it's the variable's names that
10342         were misleading ;-) Make the code more readable.
10343
10344         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
10345         the correct type etc.
10346
10347         (ConvertExplicit): Handle Enum types by examining the underlying type.
10348
10349 2001-11-21  Ravi Pratap  <ravi@ximian.com>
10350
10351         * parameter.cs (GetCallingConvention): Always return
10352         CallingConventions.Standard for now.
10353
10354 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
10355
10356         * expression.cs (Binary.ResolveOperator): Update the values of `l'
10357         and `r' after calling DoNumericPromotions.
10358
10359         * ecore.cs: Fix error message (the types were in the wrong order).
10360
10361         * statement.cs (Foreach.ProbeCollectionType): Need to pass
10362         BindingFlags.Instance as well 
10363
10364         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
10365         implicit int literal conversion in an empty cast so that we
10366         propagate the right type upstream.
10367
10368         (UnboxCast): new class used to unbox value types.
10369         (Expression.ConvertExplicit): Add explicit type conversions done
10370         by unboxing.
10371
10372         (Expression.ImplicitNumericConversion): Oops, forgot to test for
10373         the target type before applying the implicit LongLiterals to ULong
10374         literal cast.
10375
10376 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
10377
10378         * cs-parser.jay (for_statement): Reworked the way For works: now
10379         we declare manually any variables that are introduced in
10380         for_initializer to solve the problem of having out-of-band code
10381         emition (that is what got for broken).
10382
10383         (declaration_statement): Perform the actual variable declaration
10384         that used to be done in local_variable_declaration here.
10385
10386         (local_variable_declaration): Do not declare anything, just pass
10387         the information on a DictionaryEntry
10388
10389 2001-11-20  Ravi Pratap  <ravi@ximian.com>
10390
10391         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
10392         re-write of the logic to now make it recursive.
10393
10394         (UpdateIndices): Re-write accordingly.
10395
10396         Store element data in a separate ArrayData list in the above methods.
10397
10398         (MakeByteBlob): Implement to dump the array data into a byte array.
10399
10400 2001-11-19  Ravi Pratap  <ravi@ximian.com>
10401
10402         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
10403         into CheckIndices.
10404
10405         * constant.cs (Define): Implement.
10406
10407         (EmitConstant): Re-write fully.
10408
10409         Pass in location info.
10410
10411         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
10412         respectively.
10413
10414         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
10415         DictionaryEntry since we need location info too.
10416
10417         (constant_declaration): Update accordingly.
10418
10419         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
10420         code into another method : UpdateIndices.
10421
10422 2001-11-18  Ravi Pratap  <ravi@ximian.com>
10423
10424         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
10425         some type checking etc.
10426
10427 2001-11-17  Ravi Pratap  <ravi@ximian.com>
10428
10429         * expression.cs (ArrayCreation::ValidateInitializers): Implement
10430         bits to provide dimension info if the user skips doing that.
10431
10432         Update second constructor to store the rank correctly.
10433
10434 2001-11-16  Ravi Pratap  <ravi@ximian.com>
10435
10436         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
10437         and try to implement.
10438
10439         * ../errors/cs0150.cs : Add.
10440
10441         * ../errors/cs0178.cs : Add.
10442
10443 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
10444
10445         * statement.cs: Implement foreach on multi-dimensional arrays. 
10446
10447         * parameter.cs (Parameters.GetParameterByName): Also lookup the
10448         name of the params argument.
10449
10450         * expression.cs: Use EmitStoreOpcode to get the right opcode while
10451         initializing the array.
10452
10453         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
10454         we can use this elsewhere.
10455
10456         * statement.cs: Finish implementation of foreach for single
10457         dimension arrays.
10458
10459         * cs-parser.jay: Use an out-of-band stack to pass information
10460         around, I wonder why I need this.
10461
10462         foreach_block: Make the new foreach_block the current_block.
10463
10464         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
10465         function used to return a static Parameters structure.  Used for
10466         empty parameters, as those are created very frequently.
10467
10468         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
10469
10470 2001-11-15  Ravi Pratap  <ravi@ximian.com>
10471
10472         * interface.cs : Default modifier is private, not public. The
10473         make verify test passes again.
10474
10475 2001-11-15  Ravi Pratap  <ravi@ximian.com>
10476
10477         * support.cs (ReflectionParameters): Fix logic to determine
10478         whether the last parameter is a params one. Test 9 passes again.
10479
10480         * delegate.cs (Populate): Register the builders we define with
10481         RegisterParameterForBuilder. Test 19 passes again.
10482
10483         * cs-parser.jay (property_declaration): Reference $6 instead
10484         of $$ to get at the location.
10485
10486         (indexer_declaration): Similar stuff.
10487
10488         (attribute): Ditto.
10489
10490         * class.cs (Property): Register parameters for the Get and Set methods
10491         if they exist. Test 23 passes again.
10492
10493         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
10494         call to EmitArguments as we are sure there aren't any params arguments. 
10495         Test 32 passes again.
10496
10497         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
10498         IndexOutOfRangeException. 
10499
10500         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
10501         Test 33 now passes again.
10502         
10503 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
10504
10505         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
10506         broke a bunch of things.  Will have to come up with a better way
10507         of tracking locations.
10508
10509         * statement.cs: Implemented foreach for single dimension arrays.
10510
10511 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
10512
10513         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
10514         an error.  This removes the lookup from the critical path.
10515
10516         * cs-parser.jay: Removed use of temporary_loc, which is completely
10517         broken. 
10518
10519 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
10520
10521         * support.cs (ReflectionParameters.ParameterModifier): Report
10522         whether the argument is a PARAMS argument or not.
10523
10524         * class.cs: Set the attribute `ParamArrayAttribute' on the
10525         parameter argument.
10526
10527         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
10528         and cons_param_array_attribute (ConstructorInfo for
10529         ParamArrayAttribute)., 
10530
10531         * codegen.cs: Emit the return using the `Return' statement, that
10532         way we can report the error correctly for missing return values. 
10533
10534         * class.cs (Method.Emit): Clean up.
10535
10536         * expression.cs (Argument.Resolve): Take another argument: the
10537         location where this argument is used.  Notice that this is not
10538         part of the "Argument" class as to reduce the size of the
10539         structure (we know the approximate location anyways).
10540
10541         Test if the argument is a variable-reference, if not, then
10542         complain with a 206.
10543
10544         (Argument.Emit): Emit addresses of variables.
10545
10546         (Argument.FullDesc): Simplify.
10547
10548         (Invocation.DoResolve): Update for Argument.Resolve.
10549
10550         (ElementAccess.DoResolve): ditto.
10551
10552         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
10553         method should be virtual, as this method is always virtual.
10554
10555         (NewDelegate.DoResolve): Update for Argument.Resolve.
10556
10557         * class.cs (ConstructorInitializer.DoResolve): ditto.
10558         
10559         * attribute.cs (Attribute.Resolve): ditto.
10560
10561 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
10562
10563         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
10564
10565         * expression.cs (ParameterReference): Drop IStackStorage and implement
10566         IAssignMethod instead. 
10567
10568         (LocalVariableReference): ditto.
10569         
10570         * ecore.cs (FieldExpr): Drop IStackStorage and implement
10571         IAssignMethod instead. 
10572
10573 2001-11-13  Miguel de Icaza <miguel@ximian.com>
10574
10575         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
10576         enumerations that are used in heavily used structures derive from
10577         byte in a laughable and pathetic attempt to reduce memory usage.
10578         This is the kind of pre-optimzations that you should not do at
10579         home without adult supervision.
10580
10581         * expression.cs (UnaryMutator): New class, used to handle ++ and
10582         -- separatedly from the other unary operators.  Cleans up the
10583         code, and kills the ExpressionStatement dependency in Unary.
10584
10585         (Unary): Removed `method' and `Arguments' from this class, making
10586         it smaller, and moving it all to SimpleCall, so I can reuse this
10587         code in other locations and avoid creating a lot of transient data
10588         strucutres when not required.
10589
10590         * cs-parser.jay: Adjust for new changes.
10591
10592 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
10593
10594         * enum.cs (Enum.Populate): If there is a failure during
10595         definition, return
10596
10597         * cs-parser.jay (opt_enum_base): we used to catch type errors
10598         here, but this is really incorrect.  The type error should be
10599         catched during semantic analysis.
10600
10601 2001-12-11  Ravi Pratap  <ravi@ximian.com>
10602
10603         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
10604         current_local_parameters as expected since I, in my stupidity, had forgotten
10605         to do this :-)
10606
10607         * attribute.cs (GetValidPlaces): Fix stupid bug.
10608
10609         * class.cs (Method::Emit): Perform check on applicability of attributes.
10610
10611         (Constructor::Emit): Ditto.
10612
10613         (Field::Emit): Ditto.
10614
10615         (Field.Location): Store location information.
10616
10617         (Property, Event, Indexer, Operator): Ditto.
10618
10619         * cs-parser.jay (field_declaration): Pass in location for each field.
10620
10621         * ../errors/cs0592.cs : Add.
10622
10623 2001-11-12  Ravi Pratap  <ravi@ximian.com>
10624
10625         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
10626
10627         (InitCoreTypes): Update accordingly.
10628
10629         (RegisterAttrType, LookupAttr): Implement.
10630
10631         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
10632         info about the same.
10633
10634         (Resolve): Update to populate the above as necessary.
10635
10636         (Error592): Helper.
10637
10638         (GetValidPlaces): Helper to the above.
10639
10640         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
10641
10642         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
10643
10644 2001-11-12  Ravi Pratap  <ravi@ximian.com>
10645
10646         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
10647
10648         * ../errors/cs0617.cs : Add.
10649
10650 2001-11-11  Ravi Pratap  <ravi@ximian.com>
10651
10652         * enum.cs (Emit): Rename to Populate to be more consistent with what
10653         we expect it to do and when exactly it is called.
10654
10655         * class.cs, rootcontext.cs : Update accordingly.
10656
10657         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
10658         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
10659
10660         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
10661
10662         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
10663         of a fieldinfo using the above, when dealing with a FieldBuilder.
10664
10665 2001-11-10  Ravi Pratap  <ravi@ximian.com>
10666
10667         * ../errors/cs0031.cs : Add.
10668
10669         * ../errors/cs1008.cs : Add.
10670
10671         * ../errrors/cs0543.cs : Add.
10672
10673         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
10674         enum type.
10675
10676         (FindMembers): Implement.
10677
10678         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
10679         enums and delegates too.
10680
10681         (enum_types): Rename to builder_to_enum.
10682
10683         (delegate_types): Rename to builder_to_delegate.
10684
10685         * delegate.cs (FindMembers): Implement.
10686
10687 2001-11-09  Ravi Pratap  <ravi@ximian.com>
10688
10689         * typemanager.cs (IsEnumType): Implement.
10690
10691         * enum.cs (Emit): Re-write parts to account for the underlying type
10692         better and perform checking etc.
10693
10694         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
10695         of the underlying type.
10696
10697         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
10698         value
10699
10700         * enum.cs (error31): Helper to report error #31.
10701
10702         * cs-parser.jay (enum_declaration): Store location of each member too.
10703
10704         * enum.cs (member_to_location): New hashtable. 
10705
10706         (AddEnumMember): Update location hashtable.
10707
10708         (Emit): Use the location of each member while reporting errors.
10709
10710 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
10711
10712         * cs-parser.jay: A for_initializer if is a
10713         local_variable_declaration really ammount to have an implicit
10714         block with the variable declaration and no initializer for for.
10715
10716         * statement.cs (For.Emit): Cope with null initializers.
10717
10718         This fixes the infinite loop on for initializers.
10719
10720 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
10721
10722         * enum.cs: More cleanup.
10723
10724         * ecore.cs: Remove dead code.
10725
10726         * class.cs (Property.Emit): More simplification.
10727         (Event.Emit): ditto.
10728
10729         Reworked to have less levels of indentation.
10730         
10731 2001-11-08  Ravi Pratap  <ravi@ximian.com>
10732
10733         * class.cs (Property): Emit attributes.
10734
10735         (Field): Ditto.
10736         
10737         (Event): Ditto.
10738
10739         (Indexer): Ditto.
10740
10741         (Operator): Ditto.
10742
10743         * enum.cs (Emit): Ditto.
10744
10745         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
10746         Enums too.
10747
10748         * class.cs (Field, Event, etc.): Move attribute generation into the
10749         Emit method everywhere.
10750
10751         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
10752         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
10753         as we had no way of defining nested enums !
10754
10755         * rootcontext.cs : Adjust code accordingly.
10756
10757         * typemanager.cs (AddEnumType): To keep track of enum types separately.
10758
10759 2001-11-07  Ravi Pratap  <ravi@ximian.com>
10760
10761         * expression.cs (EvalConstantExpression): Move into ecore.cs
10762         
10763         * enum.cs (Enum): Rename some members and make them public and readonly
10764         according to our convention.
10765
10766         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
10767         nothing else.
10768
10769         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
10770
10771         (Enum::Emit): Write a simple version for now which doesn't try to compute
10772         expressions. I shall modify this to be more robust in just a while.
10773
10774         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
10775
10776         (TypeContainer::CloseType): Create the Enum types too.
10777
10778         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
10779
10780         * expression.cs (EvalConstantExpression): Get rid of completely.
10781
10782         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
10783         user-defined values and other cases.
10784
10785         (IsValidEnumLiteral): Helper function.
10786
10787         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
10788         out there in the case we had a literal FieldExpr.
10789
10790         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
10791
10792         (Literalize): Revamp a bit to take two arguments.
10793         
10794         (EnumLiteral): New class which derives from Literal to wrap enum literals.
10795         
10796 2001-11-06  Ravi Pratap  <ravi@ximian.com>
10797
10798         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
10799
10800         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
10801
10802         (Resolve): Use the above to ensure we have proper initializers.
10803
10804 2001-11-05  Ravi Pratap  <ravi@ximian.com>
10805
10806         * expression.cs (Expression::EvalConstantExpression): New method to 
10807         evaluate constant expressions.
10808
10809         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
10810
10811 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
10812
10813         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
10814         in an array.
10815
10816         (Binary.ResolveOperator): Handle operator != (object a, object b)
10817         and operator == (object a, object b);
10818
10819         (Binary.DoNumericPromotions): Indicate whether the numeric
10820         promotion was possible.
10821
10822         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
10823         Implement.  
10824
10825         Made the ArrayAccess implement interface IAssignMethod instead of
10826         IStackStore as the order in which arguments are passed reflects
10827         this.
10828
10829         * assign.cs: Instead of using expr.ExprClass to select the way of
10830         assinging, probe for the IStackStore/IAssignMethod interfaces.
10831
10832         * typemanager.cs: Load InitializeArray definition.
10833
10834         * rootcontext.cs (RootContext.MakeStaticData): Used to define
10835         static data that can be used to initialize arrays. 
10836
10837 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
10838
10839         * expression.cs: Handle operator== and operator!= for booleans.
10840
10841         (Conditioal.Reduce): Implement reducer for the ?: operator.
10842
10843         (Conditional.Resolve): Implement dead code elimination.
10844
10845         (Binary.Resolve): Catch string literals and return a new
10846         concatenated string.
10847
10848         (Unary.Reduce): Implement reduction of unary expressions.
10849
10850         * ecore.cs: Split out the expression core handling here.
10851
10852         (Expression.Reduce): New method used to perform constant folding
10853         and CSE.  This is needed to support constant-expressions. 
10854         
10855         * statement.cs (Statement.EmitBoolExpression): Pass true and false
10856         targets, and optimize for !x.
10857
10858 2001-11-04  Ravi Pratap  <ravi@ximian.com>
10859
10860         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
10861         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
10862         set custom atttributes.
10863
10864         * literal.cs (Literal::GetValue): New abstract method to return the actual
10865         value of the literal, cast as an object.
10866
10867         (*Literal): Implement GetValue method.
10868
10869         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
10870         expressions to the arraylist but objects of type Argument.
10871
10872         * class.cs (TypeContainer::Emit): Emit our attributes too.
10873
10874         (Method::Emit, Constructor::Emit): Ditto.
10875
10876         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
10877         to be ignoring earlier.
10878
10879 2001-11-03  Ravi Pratap  <ravi@ximian.com>
10880
10881         * attribute.cs (AttributeSection::Define): Implement to do the business
10882         of constructing a CustomAttributeBuilder.
10883
10884         (Attribute): New trivial class. Increases readability of code.  
10885
10886         * cs-parser.jay : Update accordingly.
10887
10888         (positional_argument_list, named_argument_list, named_argument): New rules
10889
10890         (attribute_arguments): Use the above so that we are more correct.
10891         
10892 2001-11-02  Ravi Pratap  <ravi@ximian.com>
10893         
10894         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
10895         to perform all checks for a method with a params parameter.
10896
10897         (Invocation::OverloadResolve): Update to use the above method and therefore
10898         cope correctly with params method invocations.
10899
10900         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
10901         params too.
10902
10903         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
10904         constructors in our parent too because we can't afford to miss out on 
10905         protected ones ;-)
10906
10907         * attribute.cs (AttributeSection): New name for the class Attribute
10908
10909         Other trivial changes to improve readability.
10910
10911         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
10912         use the new class names.
10913         
10914 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10915
10916         * class.cs (Method::Define): Complete definition for params types too
10917
10918         (Indexer::Define): Ditto.
10919
10920         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
10921         Cope everywhere with a request for info about the array parameter.
10922
10923 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10924
10925         * tree.cs (RecordNamespace): Fix up to check for the correct key.
10926
10927         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
10928         local_variable_type to extract the string corresponding to the type.
10929
10930         (local_variable_type): Fixup the action to use the new helper method.
10931
10932         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
10933         go.
10934
10935         * expression.cs : Clean out code which uses the above.
10936
10937 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10938         
10939         * typemanager.cs (RegisterMethod): Check if we already have an existing key
10940         and bale out if necessary by returning a false.
10941
10942         (RegisterProperty): Ditto.
10943
10944         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
10945         and print out appropriate error messages.
10946
10947         * interface.cs (everywhere): Ditto.
10948
10949         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
10950         location to constructor.
10951
10952         * class.cs (Property, Event, Indexer): Update accordingly.
10953
10954         * ../errors/cs111.cs : Added.
10955
10956         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
10957         of a method, as laid down by the spec.
10958
10959         (Invocation::OverloadResolve): Use the above method.
10960
10961 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10962
10963         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
10964         now take a TypeContainer and a Parameters object.
10965
10966         (ParameterData): Modify return type of ParameterModifier method to be 
10967         Parameter.Modifier and not a string.
10968
10969         (ReflectionParameters, InternalParameters): Update accordingly.
10970
10971         * expression.cs (Argument::GetParameterModifier): Same here.
10972
10973         * support.cs (InternalParameters::ParameterType): Find a better way of determining
10974         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
10975         symbol in it at all so maybe this is only for now.
10976
10977 2001-10-30  Ravi Pratap  <ravi@ximian.com>
10978
10979         * support.cs (InternalParameters): Constructor now takes an extra argument 
10980         which is the actual Parameters class.
10981
10982         (ParameterDesc): Update to provide info on ref/out modifiers.
10983
10984         * class.cs (everywhere): Update call to InternalParameters to pass in
10985         the second argument too.
10986
10987         * support.cs (ParameterData): Add ParameterModifier, which is a method 
10988         to return the modifier info [ref/out etc]
10989
10990         (InternalParameters, ReflectionParameters): Implement the above.
10991
10992         * expression.cs (Argument::ParameterModifier): Similar function to return
10993         info about the argument's modifiers.
10994
10995         (Invocation::OverloadResolve): Update to take into account matching modifiers 
10996         too.
10997
10998         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
10999         a new SetFormalParameters object which we pass to InternalParameters.
11000
11001 2001-10-30  Ravi Pratap  <ravi@ximian.com>
11002
11003         * expression.cs (NewArray): Merge into the ArrayCreation class.
11004
11005 2001-10-29  Ravi Pratap  <ravi@ximian.com>
11006
11007         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
11008         NewUserdefinedArray into one as there wasn't much of a use in having
11009         two separate ones.
11010
11011         * expression.cs (Argument): Change field's name to ArgType from Type.
11012
11013         (Type): New readonly property which returns the proper type, taking into 
11014         account ref/out modifiers.
11015
11016         (everywhere): Adjust code accordingly for the above.
11017
11018         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
11019         whether we are emitting for a ref or out parameter.
11020
11021         * expression.cs (Argument::Emit): Use the above field to set the state.
11022
11023         (LocalVariableReference::Emit): Update to honour the flag and emit the
11024         right stuff.
11025
11026         * parameter.cs (Attributes): Set the correct flags for ref parameters.
11027
11028         * expression.cs (Argument::FullDesc): New function to provide a full desc.
11029
11030         * support.cs (ParameterData): Add method ParameterDesc to the interface.
11031
11032         (ReflectionParameters, InternalParameters): Implement the above method.
11033
11034         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
11035         reporting errors.
11036
11037         (Invocation::FullMethodDesc): Ditto. 
11038
11039 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
11040
11041         * cs-parser.jay: Add extra production for the second form of array
11042         creation. 
11043
11044         * expression.cs (ArrayCreation): Update to reflect the above
11045         change. 
11046
11047         * Small changes to prepare for Array initialization.
11048
11049 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
11050
11051         * typemanager.cs (ImplementsInterface): interface might be null;
11052         Deal with this problem;
11053
11054         Also, we do store negative hits on the cache (null values), so use
11055         this instead of calling t.GetInterfaces on the type everytime.
11056
11057 2001-10-28  Ravi Pratap  <ravi@ximian.com>
11058
11059         * typemanager.cs (IsBuiltinType): New method to help determine the same.
11060
11061         * expression.cs (New::DoResolve): Get rid of array creation code and instead
11062         split functionality out into different classes.
11063
11064         (New::FormArrayType): Move into NewBuiltinArray.
11065
11066         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
11067         quite useless.
11068
11069         (NewBuiltinArray): New class to handle creation of built-in arrays.
11070
11071         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
11072         account creation of one-dimensional arrays.
11073
11074         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
11075
11076         (NewUserdefinedArray::DoResolve): Implement.
11077
11078         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
11079
11080         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
11081         we maintain inside the TypeManager. This is necessary to perform lookups on the
11082         module builder.
11083
11084         (LookupType): Update to perform GetType on the module builders too.     
11085
11086         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
11087
11088         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
11089
11090 2001-10-23  Ravi Pratap  <ravi@ximian.com>
11091
11092         * expression.cs (New::DoResolve): Implement guts of array creation.
11093
11094         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
11095         
11096 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
11097
11098         * expression.cs: Fix bug I introduced lsat night that broke
11099         Delegates. 
11100
11101         (Expression.Resolve): Report a 246 error (can not resolve name)
11102         if we find a SimpleName in the stream.
11103         
11104         (Expression.ResolveLValue): Ditto.
11105         
11106         (Expression.ResolveWithSimpleName): This function is a variant of
11107         ResolveName, this one allows SimpleNames to be returned without a
11108         warning.  The only consumer of SimpleNames is MemberAccess
11109
11110 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
11111
11112         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
11113         might arrive here.  I have my doubts that this is correct.
11114
11115         * statement.cs (Lock): Implement lock statement.
11116
11117         * cs-parser.jay: Small fixes to support `lock' and `using'
11118
11119         * cs-tokenizer.cs: Remove extra space
11120
11121         * driver.cs: New flag --checked, allows to turn on integer math
11122         checking. 
11123
11124         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
11125         Threading.Monitor.Exit 
11126         
11127 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
11128
11129         * expression.cs (IndexerAccess::DoResolveLValue): Set the
11130         Expression Class to be IndexerAccess.
11131
11132         Notice that Indexer::DoResolve sets the eclass to Value.
11133
11134 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
11135
11136         * class.cs (TypeContainer::Emit): Emit code for indexers.
11137
11138         * assign.cs (IAssignMethod): New interface implemented by Indexers
11139         and Properties for handling assignment.
11140
11141         (Assign::Emit): Simplify and reuse code. 
11142         
11143         * expression.cs (IndexerAccess, PropertyExpr): Implement
11144         IAssignMethod, clean up old code. 
11145
11146 2001-10-22  Ravi Pratap  <ravi@ximian.com>
11147
11148         * typemanager.cs (ImplementsInterface): New method to determine if a type
11149         implements a given interface. Provides a nice cache too.
11150
11151         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
11152         method.
11153
11154         (ConvertReferenceExplicit): Ditto.
11155
11156         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
11157         various methods, with correct names etc.
11158
11159         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
11160         Operator.UnaryNegation.
11161
11162         * cs-parser.jay (operator_declarator): Be a little clever in the case where
11163         we have a unary plus or minus operator.
11164
11165         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
11166         UnaryMinus.
11167
11168         * everywhere : update accordingly.
11169
11170         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
11171         respectively.
11172
11173         * class.cs (Method::Define): For the case where we are implementing a method
11174         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
11175         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
11176         
11177 2001-10-21  Ravi Pratap  <ravi@ximian.com>
11178
11179         * interface.cs (FindMembers): Implement to work around S.R.E
11180         lameness.
11181
11182         * typemanager.cs (IsInterfaceType): Implement.
11183
11184         (FindMembers): Update to handle interface types too.
11185
11186         * expression.cs (ImplicitReferenceConversion): Re-write bits which
11187         use IsAssignableFrom as that is not correct - it doesn't work.
11188
11189         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
11190         and accordingly override EmitStatement.
11191
11192         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
11193         using the correct logic :-)
11194
11195 2001-10-19  Ravi Pratap  <ravi@ximian.com>
11196
11197         * ../errors/cs-11.cs : Add to demonstrate error -11 
11198
11199 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
11200
11201         * assign.cs (Assign::Resolve): Resolve right hand side first, and
11202         then pass this as a hint to ResolveLValue.
11203         
11204         * expression.cs (FieldExpr): Add Location information
11205
11206         (FieldExpr::LValueResolve): Report assignment to readonly
11207         variable. 
11208         
11209         (Expression::ExprClassFromMemberInfo): Pass location information.
11210
11211         (Expression::ResolveLValue): Add new method that resolves an
11212         LValue. 
11213
11214         (Expression::DoResolveLValue): Default invocation calls
11215         DoResolve. 
11216
11217         (Indexers): New class used to keep track of indexers in a given
11218         Type. 
11219
11220         (IStackStore): Renamed from LValue, as it did not really describe
11221         what this did.  Also ResolveLValue is gone from this interface and
11222         now is part of Expression.
11223
11224         (ElementAccess): Depending on the element access type
11225         
11226         * typemanager.cs: Add `indexer_name_type' as a Core type
11227         (System.Runtime.CompilerServices.IndexerNameAttribute)
11228
11229         * statement.cs (Goto): Take a location.
11230         
11231 2001-10-18  Ravi Pratap  <ravi@ximian.com>
11232
11233         * delegate.cs (Delegate::VerifyDelegate): New method to verify
11234         if two delegates are compatible.
11235
11236         (NewDelegate::DoResolve): Update to take care of the case when
11237         we instantiate a delegate from another delegate.
11238
11239         * typemanager.cs (FindMembers): Don't even try to look up members
11240         of Delegate types for now.
11241
11242 2001-10-18  Ravi Pratap  <ravi@ximian.com>
11243
11244         * delegate.cs (NewDelegate): New class to take care of delegate
11245         instantiation.
11246
11247         * expression.cs (New): Split the delegate related code out into 
11248         the NewDelegate class.
11249
11250         * delegate.cs (DelegateInvocation): New class to handle delegate 
11251         invocation.
11252
11253         * expression.cs (Invocation): Split out delegate related code into
11254         the DelegateInvocation class.
11255
11256 2001-10-17  Ravi Pratap  <ravi@ximian.com>
11257
11258         * expression.cs (New::DoResolve): Implement delegate creation fully
11259         and according to the spec.
11260
11261         (New::DoEmit): Update to handle delegates differently.
11262
11263         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
11264         because of which we were printing out arguments in reverse order !
11265
11266         * delegate.cs (VerifyMethod): Implement to check if the given method
11267         matches the delegate.
11268
11269         (FullDelegateDesc): Implement.
11270
11271         (VerifyApplicability): Implement.
11272
11273         * expression.cs (Invocation::DoResolve): Update to accordingly handle
11274         delegate invocations too.
11275
11276         (Invocation::Emit): Ditto.
11277
11278         * ../errors/cs1593.cs : Added.
11279
11280         * ../errors/cs1594.cs : Added.
11281
11282         * delegate.cs (InstanceExpression, TargetMethod): New properties.
11283
11284 2001-10-16  Ravi Pratap  <ravi@ximian.com>
11285
11286         * typemanager.cs (intptr_type): Core type for System.IntPtr
11287
11288         (InitCoreTypes): Update for the same.
11289
11290         (iasyncresult_type, asynccallback_type): Ditto.
11291
11292         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
11293         correct.
11294
11295         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
11296         too.
11297
11298         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
11299         the builders for the 4 members of a delegate type :-)
11300
11301         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
11302         type.
11303
11304         * expression.cs (New::DoResolve): Implement guts for delegate creation.
11305
11306         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
11307
11308 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
11309
11310         * statement.cs (Break::Emit): Implement.   
11311         (Continue::Emit): Implement.
11312
11313         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
11314         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
11315         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
11316         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
11317         end loop
11318         
11319         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
11320         properties that track the label for the current loop (begin of the
11321         loop and end of the loop).
11322
11323 2001-10-15  Ravi Pratap  <ravi@ximian.com>
11324
11325         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
11326         use of emitting anything at all.
11327
11328         * class.cs, rootcontext.cs : Get rid of calls to the same.
11329
11330         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
11331
11332         (Populate): Define the constructor correctly and set the implementation
11333         attributes.
11334
11335         * typemanager.cs (delegate_types): New hashtable to hold delegates that
11336         have been defined.
11337
11338         (AddDelegateType): Implement.
11339
11340         (IsDelegateType): Implement helper method.
11341
11342         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
11343
11344         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
11345         and accordingly handle it.
11346
11347         * delegate.cs (Populate): Take TypeContainer argument.
11348         Implement bits to define the Invoke method. However, I still haven't figured out
11349         how to take care of the native int bit :-(
11350
11351         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
11352         Qualify the name of the delegate, not its return type !
11353
11354         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
11355         conversion.
11356
11357         (StandardConversionExists): Checking for array types turns out to be recursive.
11358
11359         (ConvertReferenceExplicit): Implement array conversion.
11360
11361         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
11362         
11363 2001-10-12  Ravi Pratap  <ravi@ximian.com>
11364
11365         * cs-parser.jay (delegate_declaration): Store the fully qualified
11366         name as it is a type declaration.
11367
11368         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
11369         readonly.
11370
11371         (DefineDelegate): Renamed from Define. Does the same thing essentially,
11372         as TypeContainer::DefineType.
11373
11374         (Populate): Method in which all the definition of the various methods (Invoke)
11375         etc is done.
11376
11377         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
11378         see.
11379         
11380         (CloseDelegate): Finally creates the delegate.
11381
11382         * class.cs (TypeContainer::DefineType): Update to define delegates.
11383         (Populate, Emit and CloseType): Do the same thing here too.
11384
11385         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
11386         delegates in all these operations.
11387
11388 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
11389
11390         * expression.cs: LocalTemporary: a new expression used to
11391         reference a temporary that has been created.
11392
11393         * assign.cs: Handle PropertyAccess back here, so that we can
11394         provide the proper semantic access to properties.
11395
11396         * expression.cs (Expression::ConvertReferenceExplicit): Implement
11397         a few more explicit conversions. 
11398
11399         * modifiers.cs: `NEW' modifier maps to HideBySig.
11400
11401         * expression.cs (PropertyExpr): Make this into an
11402         ExpressionStatement, and support the EmitStatement code path. 
11403
11404         Perform get/set error checking, clean up the interface.
11405
11406         * assign.cs: recognize PropertyExprs as targets, and if so, turn
11407         them into toplevel access objects.
11408
11409 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
11410
11411         * expression.cs: PropertyExpr::PropertyExpr: use work around the
11412         SRE.
11413
11414         * typemanager.cs: Keep track here of our PropertyBuilders again to
11415         work around lameness in SRE.
11416
11417 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
11418
11419         * expression.cs (LValue::LValueResolve): New method in the
11420         interface, used to perform a second resolution pass for LValues. 
11421         
11422         (This::DoResolve): Catch the use of this in static methods.
11423
11424         (This::LValueResolve): Implement.
11425
11426         (This::Store): Remove warning, assigning to `this' in structures
11427         is 
11428
11429         (Invocation::Emit): Deal with invocation of
11430         methods on value types.  We need to pass the address to structure
11431         methods rather than the object itself.  (The equivalent code to
11432         emit "this" for structures leaves the entire structure on the
11433         stack instead of a pointer to it). 
11434
11435         (ParameterReference::DoResolve): Compute the real index for the
11436         argument based on whether the method takes or not a `this' pointer
11437         (ie, the method is static).
11438
11439         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
11440         value types returned from functions when we need to invoke a
11441         method on the sturcture.
11442         
11443
11444 2001-10-11  Ravi Pratap  <ravi@ximian.com>
11445
11446         * class.cs (TypeContainer::DefineType): Method to actually do the business of
11447         defining the type in the Modulebuilder or Typebuilder. This is to take
11448         care of nested types which need to be defined on the TypeBuilder using
11449         DefineNestedMethod.
11450
11451         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
11452         methods in RootContext, only ported to be part of TypeContainer.
11453
11454         (TypeContainer::GetInterfaceOrClass): Ditto.
11455
11456         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
11457
11458         * interface.cs (Interface::DefineInterface): New method. Does exactly
11459         what RootContext.CreateInterface did earlier, only it takes care of nested types 
11460         too.
11461
11462         (Interface::GetInterfaces): Move from RootContext here and port.
11463
11464         (Interface::GetInterfaceByName): Same here.
11465
11466         * rootcontext.cs (ResolveTree): Re-write.
11467
11468         (PopulateTypes): Re-write.
11469
11470         * class.cs (TypeContainer::Populate): Populate nested types too.
11471         (TypeContainer::Emit): Emit nested members too.
11472
11473         * typemanager.cs (AddUserType): Do not make use of the FullName property,
11474         instead just use the name argument passed in as it is already fully
11475         qualified.
11476
11477         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
11478         to TypeContainer mapping to see if a type is user-defined.
11479
11480         * class.cs (TypeContainer::CloseType): Implement. 
11481
11482         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
11483         the default constructor.
11484         
11485         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
11486         twice.
11487
11488         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
11489
11490         * interface.cs (CloseType): Create the type here.
11491         
11492         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
11493         the hierarchy.
11494
11495         Remove all the methods which are now in TypeContainer.
11496
11497 2001-10-10  Ravi Pratap  <ravi@ximian.com>
11498
11499         * delegate.cs (Define): Re-write bits to define the delegate
11500         correctly.
11501
11502 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
11503
11504         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
11505
11506         * expression.cs (ImplicitReferenceConversion): handle null as well
11507         as a source to convert to any reference type.
11508
11509         * statement.cs (Return): Perform any implicit conversions to
11510         expected return type.  
11511
11512         Validate use of return statement.  
11513
11514         * codegen.cs (EmitContext): Pass the expected return type here.
11515
11516         * class.cs (Method, Constructor, Property): Pass expected return
11517         type to EmitContext.
11518
11519 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
11520
11521         * expression.cs: Make DoResolve take an EmitContext instead of a
11522         TypeContainer.
11523
11524         Replaced `l' and `location' for `loc', for consistency.
11525         
11526         (Error, Warning): Remove unneeded Tc argument.
11527
11528         * assign.cs, literal.cs, constant.cs: Update to new calling
11529         convention. 
11530         
11531         * codegen.cs: EmitContext now contains a flag indicating whether
11532         code is being generated in a static method or not.
11533
11534         * cs-parser.jay: DecomposeQI, new function that replaces the old
11535         QualifiedIdentifier.  Now we always decompose the assembled
11536         strings from qualified_identifier productions into a group of
11537         memberaccesses.
11538
11539 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
11540
11541         * rootcontext.cs: Deal with field-less struct types correctly now
11542         by passing the size option to Define Type.
11543
11544         * class.cs: Removed hack that created one static field. 
11545
11546 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
11547
11548         * statement.cs: Moved most of the code generation here. 
11549
11550 2001-10-09  Ravi Pratap  <ravi@ximian.com>
11551
11552         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
11553         seem very right.
11554
11555         (ElementAccess): Remove useless bits for now - keep checks as the spec
11556         says.
11557
11558 2001-10-08  Ravi Pratap  <ravi@ximian.com>
11559
11560         * expression.cs (ElementAccess::DoResolve): Remove my crap code
11561         and start performing checks according to the spec.
11562
11563 2001-10-07  Ravi Pratap  <ravi@ximian.com>
11564
11565         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
11566         rank_specifiers instead.
11567
11568         (rank_specifiers): Change the order in which the rank specifiers are stored
11569
11570         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
11571
11572         * expression.cs (ElementAccess): Implement the LValue interface too.
11573         
11574 2001-10-06  Ravi Pratap  <ravi@ximian.com>
11575         
11576         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
11577         except that user defined conversions are not included.
11578
11579         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
11580         perform the conversion of the return type, if necessary.
11581
11582         (New::DoResolve): Check whether we are creating an array or an object
11583         and accordingly do the needful.
11584
11585         (New::Emit): Same here.
11586
11587         (New::DoResolve): Implement guts of array creation.
11588
11589         (New::FormLookupType): Helper function.
11590
11591 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
11592
11593         * codegen.cs: Removed most of the code generation here, and move the
11594         corresponding code generation bits to the statement classes. 
11595
11596         Added support for try/catch/finalize and throw.
11597         
11598         * cs-parser.jay: Added support for try/catch/finalize.
11599
11600         * class.cs: Catch static methods having the flags override,
11601         virtual or abstract.
11602
11603         * expression.cs (UserCast): This user cast was not really doing
11604         what it was supposed to do.  Which is to be born in fully resolved
11605         state.  Parts of the resolution were being performed at Emit time! 
11606
11607         Fixed this code.
11608
11609 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
11610
11611         * expression.cs: Implicity convert the result from UserCast.
11612
11613 2001-10-05  Ravi Pratap  <ravi@ximian.com>
11614
11615         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
11616         prevented it from working correctly. 
11617
11618         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
11619         merely ConvertImplicit.
11620
11621 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
11622
11623         * typemanager.cs: Make the LookupTypeContainer function static,
11624         and not per-instance.  
11625
11626         * class.cs: Make static FindMembers (the one that takes a Type
11627         argument). 
11628
11629         * codegen.cs: Add EmitForeach here.
11630
11631         * cs-parser.jay: Make foreach a toplevel object instead of the
11632         inline expansion, as we need to perform semantic analysis on it. 
11633
11634 2001-10-05  Ravi Pratap  <ravi@ximian.com>
11635
11636         * expression.cs (Expression::ImplicitUserConversion): Rename to
11637         UserDefinedConversion.
11638
11639         (Expression::UserDefinedConversion): Take an extra argument specifying 
11640         whether we look for explicit user conversions too.
11641
11642         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
11643
11644         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
11645
11646         (ExplicitUserConversion): Make it a call to UserDefinedConversion
11647         with the appropriate arguments.
11648
11649         * cs-parser.jay (cast_expression): Record location too.
11650
11651         * expression.cs (Cast): Record location info.
11652
11653         (Expression::ConvertExplicit): Take location argument.
11654
11655         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
11656         to determine if we are doing explicit conversions.
11657
11658         (UserCast::Emit): Update accordingly.
11659
11660         (Expression::ConvertExplicit): Report an error if everything fails.
11661
11662         * ../errors/cs0030.cs : Add.
11663
11664 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
11665
11666         * modifiers.cs: If the ABSTRACT keyword is present, also set the
11667         virtual and newslot bits. 
11668
11669         * class.cs (TypeContainer::RegisterRequiredImplementations):
11670         Record methods we need.
11671
11672         (TypeContainer::MakeKey): Helper function to make keys for
11673         MethodBases, since the Methodbase key is useless.
11674
11675         (TypeContainer::Populate): Call RegisterRequiredImplementations
11676         before defining the methods.   
11677
11678         Create a mapping for method_builders_to_methods ahead of time
11679         instead of inside a tight loop.
11680
11681         (::RequireMethods):  Accept an object as the data to set into the
11682         hashtable so we can report interface vs abstract method mismatch.
11683
11684 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
11685
11686         * report.cs: Make all of it static.
11687
11688         * rootcontext.cs: Drop object_type and value_type computations, as
11689         we have those in the TypeManager anyways.
11690
11691         Drop report instance variable too, now it is a global.
11692
11693         * driver.cs: Use try/catch on command line handling.
11694
11695         Add --probe option to debug the error reporting system with a test
11696         suite. 
11697
11698         * report.cs: Add support for exiting program when a probe
11699         condition is reached.
11700
11701 2001-10-03  Ravi Pratap  <ravi@ximian.com>
11702
11703         * expression.cs (Binary::DoNumericPromotions): Fix the case when
11704         we do a forcible conversion regardless of type, to check if 
11705         ForceConversion returns a null.
11706
11707         (Binary::error19): Use location to report error.
11708
11709         (Unary::error23): Use location here too.
11710
11711         * ../errors/cs0019.cs : Check in.
11712
11713         * ../errors/cs0023.cs : Check in.
11714
11715         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
11716         case of a non-null MethodInfo object with a length of 0 !
11717
11718         (Binary::ResolveOperator): Flag error if overload resolution fails to find
11719         an applicable member - according to the spec :-)
11720         Also fix logic to find members in base types.
11721
11722         (Unary::ResolveOperator): Same here.
11723
11724         (Unary::report23): Change name to error23 and make first argument a TypeContainer
11725         as I was getting thoroughly confused between this and error19 :-)
11726         
11727         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
11728         (::FindMostEncompassedType): Implement.
11729         (::FindMostEncompassingType): Implement.
11730         (::StandardConversionExists): Implement.
11731
11732         (UserImplicitCast): Re-vamp. We now need info about most specific
11733         source and target types so that we can do the necessary conversions.
11734
11735         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
11736         mathematical union with no duplicates.
11737
11738 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
11739
11740         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
11741         in order from base classes to child classes, so that we can in
11742         child classes look up in our parent for method names and
11743         attributes (required for handling abstract, virtual, new, override
11744         constructs: we need to instrospect our base class, and if we dont
11745         populate the classes in order, the introspection might be
11746         incorrect.  For example, a method could query its parent before
11747         the parent has any methods and would determine that the parent has
11748         no abstract methods (while it could have had them)).
11749
11750         (RootContext::CreateType): Record the order in which we define the
11751         classes.
11752
11753 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
11754
11755         * class.cs (TypeContainer::Populate): Also method definitions can
11756         fail now, keep track of this.
11757
11758         (TypeContainer::FindMembers): Implement support for
11759         DeclaredOnly/noDeclaredOnly flag.
11760
11761         (Constructor::Emit) Return the ConstructorBuilder.
11762
11763         (Method::Emit) Return the MethodBuilder. 
11764         Check for abstract or virtual methods to be public.
11765
11766         * rootcontext.cs (RootContext::CreateType): Register all the
11767         abstract methods required for the class to be complete and the
11768         interface methods that must be implemented. 
11769
11770         * cs-parser.jay: Report error 501 (method requires body if it is
11771         not marked abstract or extern).
11772
11773         * expression.cs (TypeOf::Emit): Implement.
11774
11775         * typemanager.cs: runtime_handle_type, new global type.
11776
11777         * class.cs (Property::Emit): Generate code for properties.
11778
11779 2001-10-02  Ravi Pratap  <ravi@ximian.com>
11780
11781         * expression.cs (Unary::ResolveOperator): Find operators on base type
11782         too - we now conform exactly to the spec.
11783
11784         (Binary::ResolveOperator): Same here.
11785
11786         * class.cs (Operator::Define): Fix minor quirk in the tests.
11787
11788         * ../errors/cs0215.cs : Added.
11789
11790         * ../errors/cs0556.cs : Added.
11791
11792         * ../errors/cs0555.cs : Added.
11793
11794 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
11795
11796         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
11797         single integer which is really efficient
11798
11799 2001-10-01  Ravi Pratap  <ravi@ximian.com>
11800
11801         *  expression.cs (Expression::ImplicitUserConversion): Use location
11802         even in the case when we are examining True operators.
11803  
11804         * class.cs (Operator::Define): Perform extensive checks to conform
11805         with the rules for operator overloading in the spec.
11806
11807         * expression.cs (Expression::ImplicitReferenceConversion): Implement
11808         some of the other conversions mentioned in the spec.
11809
11810         * typemanager.cs (array_type): New static member for the System.Array built-in
11811         type.
11812
11813         (cloneable_interface): For System.ICloneable interface.
11814
11815         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
11816         we start resolving the tree and populating types.
11817
11818         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
11819  
11820 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
11821
11822         * expression.cs (Expression::ExprClassFromMemberInfo,
11823         Expression::Literalize): Create literal expressions from
11824         FieldInfos which are literals.
11825
11826         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
11827         type casts, because they were wrong.  The test suite in tests
11828         caught these ones.
11829
11830         (ImplicitNumericConversion): ushort to ulong requires a widening
11831         cast. 
11832
11833         Int32 constant to long requires widening cast as well.
11834
11835         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
11836         for integers because the type on the stack is not i4.
11837
11838 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
11839
11840         * expression.cs (report118): require location argument. 
11841
11842         * parameter.cs: Do not dereference potential null value.
11843
11844         * class.cs: Catch methods that lack the `new' keyword when
11845         overriding a name.  Report warnings when `new' is used without
11846         anything being there to override.
11847
11848         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
11849
11850         * class.cs: Only add constructor to hashtable if it is non-null
11851         (as now constructors can fail on define).
11852
11853         (TypeManager, Class, Struct): Take location arguments.
11854
11855         Catch field instance initialization in structs as errors.
11856
11857         accepting_filter: a new filter for FindMembers that is static so
11858         that we dont create an instance per invocation.
11859
11860         (Constructor::Define): Catch errors where a struct constructor is
11861         parameterless 
11862
11863         * cs-parser.jay: Pass location information for various new
11864         constructs. 
11865         
11866         * delegate.cs (Delegate): take a location argument.
11867
11868         * driver.cs: Do not call EmitCode if there were problesm in the
11869         Definition of the types, as many Builders wont be there. 
11870
11871         * decl.cs (Decl::Decl): Require a location argument.
11872
11873         * cs-tokenizer.cs: Handle properly hex constants that can not fit
11874         into integers, and find the most appropiate integer for it.
11875
11876         * literal.cs: Implement ULongLiteral.
11877
11878         * rootcontext.cs: Provide better information about the location of
11879         failure when CreateType fails.
11880         
11881 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
11882
11883         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
11884         as well.
11885
11886         * expression.cs (Binary::CheckShiftArguments): Add missing type
11887         computation.
11888         (Binary::ResolveOperator): Add type to the logical and and logical
11889         or, Bitwise And/Or and Exclusive Or code paths, it was missing
11890         before.
11891
11892         (Binary::DoNumericPromotions): In the case where either argument
11893         is ulong (and most signed types combined with ulong cause an
11894         error) perform implicit integer constant conversions as well.
11895
11896 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
11897
11898         * expression.cs (UserImplicitCast): Method should always be
11899         non-null. 
11900         (Invocation::BetterConversion): Simplified test for IntLiteral.
11901
11902         (Expression::ImplicitNumericConversion): Split this routine out.
11903         Put the code that performs implicit constant integer conversions
11904         here. 
11905
11906         (Expression::Resolve): Become a wrapper around DoResolve so we can
11907         check eclass and type being set after resolve.
11908
11909         (Invocation::Badness): Remove this dead function
11910
11911         (Binary::ResolveOperator): Do not compute the expensive argumnets
11912         unless we have a union for it.
11913
11914         (Probe::Emit): Is needs to do an isinst and then
11915         compare against null.
11916
11917         (::CanConvert): Added Location argument.  If the Location argument
11918         is null (Location.Null), then we do not report errors.  This is
11919         used by the `probe' mechanism of the Explicit conversion.  We do
11920         not want to generate an error for something that the user
11921         explicitly requested to be casted.  But the pipeline for an
11922         explicit cast first tests for potential implicit casts.
11923
11924         So for now, if the Location is null, it means `Probe only' to
11925         avoid adding another argument.   Might have to revise this
11926         strategy later.
11927
11928         (ClassCast): New class used to type cast objects into arbitrary
11929         classes (used in Explicit Reference Conversions).
11930
11931         Implement `as' as well.
11932
11933         Reverted all the patches from Ravi below: they were broken:
11934
11935                 * The use of `level' as a mechanism to stop recursive
11936                   invocations is wrong.  That was there just to catch the
11937                   bug with a strack trace but not as a way of addressing
11938                   the problem.
11939
11940                   To fix the problem we have to *understand* what is going
11941                   on and the interactions and come up with a plan, not
11942                   just get things going.
11943
11944                 * The use of the type conversion cache that I proposed
11945                   last night had an open topic: How does this work across
11946                   protection domains.  A user defined conversion might not
11947                   be public in the location where we are applying the
11948                   conversion, a different conversion might be selected
11949                   (ie, private A->B (better) but public B->A (worse),
11950                   inside A, A->B applies, but outside it, B->A will
11951                   apply).
11952
11953                 * On top of that (ie, even if the above is solved),
11954                   conversions in a cache need to be abstract.  Ie, `To
11955                   convert from an Int to a Short use an OpcodeCast', not
11956                   `To convert from an Int to a Short use the OpcodeCast on
11957                   the variable 5' (which is what this patch was doing).
11958         
11959 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11960
11961         * expression.cs (Invocation::ConversionExists): Re-write to use
11962         the conversion cache
11963         
11964         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
11965         cache all conversions done, not just user-defined ones.
11966
11967         (Invocation::BetterConversion): The real culprit. Use ConversionExists
11968         to determine if a conversion exists instead of acutually trying to 
11969         perform the conversion. It's faster too.
11970
11971         (Expression::ConvertExplicit): Modify to use ConversionExists to check
11972         and only then attempt the implicit conversion.
11973
11974 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11975
11976         * expression.cs (ConvertImplicit): Use a cache for conversions
11977         already found. Check level of recursion and bail out if necessary.
11978         
11979 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
11980
11981         * typemanager.cs (string_concat_string_string, string_concat_object_object):
11982         Export standard methods that we expect for string operations.
11983         
11984         * statement.cs (Block::UsageWarning): Track usage of variables and
11985         report the errors for not used variables.
11986
11987         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
11988         operator. 
11989
11990 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
11991
11992         * codegen.cs: remove unnneded code 
11993
11994         * expression.cs: Removed BuiltinTypeAccess class
11995
11996         Fix the order in which implicit conversions are
11997         done.  
11998
11999         The previous fixed dropped support for boxed conversions (adding a
12000         test to the test suite now)
12001
12002         (UserImplicitCast::CanConvert): Remove test for source being null,
12003         that code is broken.  We should not feed a null to begin with, if
12004         we do, then we should track the bug where the problem originates
12005         and not try to cover it up here.
12006
12007         Return a resolved expression of type UserImplicitCast on success
12008         rather than true/false.  Ravi: this is what I was talking about,
12009         the pattern is to use a static method as a "constructor" for
12010         objects. 
12011
12012         Also, do not create arguments until the very last minute,
12013         otherwise we always create the arguments even for lookups that
12014         will never be performed. 
12015
12016         (UserImplicitCast::Resolve): Eliminate, objects of type
12017         UserImplicitCast are born in a fully resolved state. 
12018         
12019         * typemanager.cs (InitCoreTypes): Init also value_type
12020         (System.ValueType). 
12021
12022         * expression.cs (Cast::Resolve): First resolve the child expression.
12023
12024         (LValue): Add new method AddressOf to be used by
12025         the `&' operator.  
12026
12027         Change the argument of Store to take an EmitContext instead of an
12028         ILGenerator, because things like FieldExpr need to be able to call
12029         their children expression to generate the instance code. 
12030
12031         (Expression::Error, Expression::Warning): Sugar functions for
12032         reporting errors.
12033
12034         (Expression::MemberLookup): Accept a TypeContainer instead of a
12035         Report as the first argument.
12036
12037         (Expression::ResolvePrimary): Killed.  I still want to improve
12038         this as currently the code is just not right.
12039
12040         (Expression::ResolveMemberAccess): Simplify, but it is still
12041         wrong. 
12042
12043         (Unary::Resolve): Catch errors in AddressOf operators.
12044
12045         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
12046         index to a byte for the short-version, or the compiler will choose
12047         the wrong Emit call, which generates the wrong data.
12048
12049         (ParameterReference::Emit, ::Store): same.
12050
12051         (FieldExpr::AddressOf): Implement.
12052         
12053         * typemanager.cs: TypeManager: made public variable instead of
12054         property.
12055         
12056         * driver.cs: document --fatal.
12057
12058         * report.cs (ErrorMessage, WarningMessage): new names for the old
12059         Error and Warning classes.
12060
12061         * cs-parser.jay (member_access): Turn built-in access to types
12062         into a normal simplename
12063
12064 2001-09-27  Ravi Pratap  <ravi@ximian.com>
12065
12066         * expression.cs (Invocation::BetterConversion): Fix to cope
12067         with q being null, since this was introducing a bug.
12068
12069         * expression.cs (ConvertImplicit): Do built-in conversions first.
12070
12071 2001-09-27  Ravi Pratap  <ravi@ximian.com>
12072
12073         * expression.cs (UserImplicitCast::Resolve): Fix bug.
12074
12075 2001-09-27  Ravi Pratap  <ravi@ximian.com>
12076
12077         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
12078         I had introduced long ago (what's new ?).
12079
12080         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
12081         the work of all the checking. 
12082         (ConvertImplicit): Call CanConvert and only then create object if necessary.
12083         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
12084
12085         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
12086         that is the right way. 
12087
12088         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
12089         overloading resolution. Use everywhere instead of cutting and pasting code.
12090
12091         (Binary::ResolveOperator): Use MakeUnionSet.
12092
12093         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
12094         we have to convert to bool types. Not complete yet.
12095         
12096 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
12097
12098         * typemanager.cs (TypeManager::CSharpName): support ushort.
12099
12100         * expression.cs (Expression::TryImplicitIntConversion): Attempts
12101         to provide an expression that performsn an implicit constant int
12102         conversion (section 6.1.6).
12103         (Expression::ConvertImplicitRequired): Reworked to include
12104         implicit constant expression conversions.
12105
12106         (Expression::ConvertNumericExplicit): Finished.
12107
12108         (Invocation::Emit): If InstanceExpression is null, then it means
12109         that we perform a call on this.
12110         
12111 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
12112
12113         * expression.cs (Unary::Emit): Remove some dead code.
12114         (Probe): Implement Resolve and Emit for `is'.
12115         (Expression::ConvertImplicitRequired): Attempt to do constant
12116         expression conversions here.  Maybe should be moved to
12117         ConvertImplicit, but I am not sure.
12118         (Expression::ImplicitLongConstantConversionPossible,
12119         Expression::ImplicitIntConstantConversionPossible): New functions
12120         that tell whether is it possible to apply an implicit constant
12121         expression conversion.
12122
12123         (ConvertNumericExplicit): Started work on explicit numeric
12124         conversions.
12125
12126         * cs-parser.jay: Update operator constants.
12127
12128         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
12129         (Parameters::GetSignature): Hook up VerifyArgs here.
12130         (Parameters::VerifyArgs): Verifies that no two arguments have the
12131         same name. 
12132
12133         * class.cs (Operator): Update the operator names to reflect the
12134         ones that the spec expects (as we are just stringizing the
12135         operator names).
12136         
12137         * expression.cs (Unary::ResolveOperator): Fix bug: Use
12138         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
12139         previous usage did only work for our methods.
12140         (Expression::ConvertImplicit): Handle decimal implicit numeric
12141         conversions as well.
12142         (Expression::InternalTypeConstructor): Used to invoke constructors
12143         on internal types for default promotions.
12144
12145         (Unary::Emit): Implement special handling for the pre/post
12146         increment/decrement for overloaded operators, as they need to have
12147         the same semantics as the other operators.
12148
12149         (Binary::ResolveOperator): ditto.
12150         (Invocation::ConversionExists): ditto.
12151         (UserImplicitCast::Resolve): ditto.
12152         
12153 2001-09-26  Ravi Pratap  <ravi@ximian.com>
12154
12155         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
12156         operator, return after emitting body. Regression tests pass again !
12157
12158         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
12159         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
12160         (Invocation::OverloadResolve): Ditto.
12161         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
12162
12163         * everywhere : update calls to the above methods accordingly.
12164
12165 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
12166
12167         * assign.cs (Assign): Make it inherit from ExpressionStatement.
12168
12169         * expression.cs (ExpressionStatement): New base class used for
12170         expressions that can appear in statements, so that we can provide
12171         an alternate path to generate expression that do not leave a value
12172         on the stack.
12173
12174         (Expression::Emit, and all the derivatives): We no longer return
12175         whether a value is left on the stack or not.  Every expression
12176         after being emitted leaves a single value on the stack.
12177
12178         * codegen.cs (EmitContext::EmitStatementExpression): Use the
12179         facilties of ExpressionStatement if possible.
12180
12181         * cs-parser.jay: Update statement_expression.
12182
12183 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
12184
12185         * driver.cs: Change the wording of message
12186
12187 2001-09-25  Ravi Pratap  <ravi@ximian.com>
12188
12189         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
12190         the type of the expression to the return type of the method if
12191         we have an overloaded operator match ! The regression tests pass again !
12192         (Unary::ResolveOperator): Ditto.
12193
12194         * expression.cs (Invocation::ConversionExists): Correct the member lookup
12195         to find "op_Implicit", not "implicit" ;-)
12196         (UserImplicitCast): New class to take care of user-defined implicit conversions.
12197         (ConvertImplicit, ForceConversion): Take TypeContainer argument
12198
12199         * everywhere : Correct calls to the above accordingly.
12200
12201         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
12202         (ConvertImplicit): Do user-defined conversion if it exists.
12203
12204 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
12205
12206         * assign.cs: track location.
12207         (Resolve): Use implicit conversions on assignment.
12208
12209         * literal.cs: Oops.  Not good, Emit of short access values should
12210         pass (Bytes) or the wrong argument will be selected.
12211
12212         * expression.cs (Unary::Emit): Emit code for -expr.
12213         
12214         (Unary::ResolveOperator): Handle `Substract' for non-constants
12215         (substract from zero from the non-constants).
12216         Deal with Doubles as well. 
12217         
12218         (Expression::ConvertImplicitRequired): New routine that reports an
12219         error if no implicit conversion exists. 
12220
12221         (Invocation::OverloadResolve): Store the converted implicit
12222         expressions if we make them
12223         
12224 2001-09-24  Ravi Pratap  <ravi@ximian.com>
12225
12226         * class.cs (ConstructorInitializer): Take a Location argument.
12227         (ConstructorBaseInitializer): Same here.
12228         (ConstructorThisInitializer): Same here.
12229
12230         * cs-parser.jay : Update all calls accordingly.
12231
12232         * expression.cs (Unary, Binary, New): Take location argument.
12233         Update accordingly everywhere.
12234
12235         * cs-parser.jay : Update all calls to the above to take a location
12236         argument.
12237
12238         * class.cs : Ditto.
12239
12240 2001-09-24  Ravi Pratap  <ravi@ximian.com>
12241
12242         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
12243         (Invocation::BetterConversion): Same here
12244         (Invocation::ConversionExists): Ditto.
12245
12246         (Invocation::ConversionExists): Implement.
12247
12248 2001-09-22  Ravi Pratap  <ravi@ximian.com>
12249
12250         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
12251         Also take an additional TypeContainer argument.
12252
12253         * All over : Pass in TypeContainer as argument to OverloadResolve.
12254
12255         * typemanager.cs (CSharpName): Update to check for the string type and return
12256         that too.
12257
12258         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
12259         a given method.
12260         
12261 2001-09-21  Ravi Pratap  <ravi@ximian.com>
12262
12263         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
12264         (Invocation::BetterFunction): Implement.
12265         (Invocation::BetterConversion): Implement.
12266         (Invocation::ConversionExists): Skeleton, no implementation yet.
12267
12268         Okay, things work fine !
12269
12270 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
12271
12272         * typemanager.cs: declare and load enum_type, delegate_type and
12273         void_type. 
12274
12275         * expression.cs (Expression::Emit): Now emit returns a value that
12276         tells whether a value is left on the stack or not.  This strategy
12277         might be reveted tomorrow with a mechanism that would address
12278         multiple assignments.
12279         (Expression::report118): Utility routine to report mismatches on
12280         the ExprClass.
12281
12282         (Unary::Report23): Report impossible type/operator combination
12283         utility function.
12284
12285         (Unary::IsIncrementableNumber): Whether the type can be
12286         incremented or decremented with add.
12287         (Unary::ResolveOperator): Also allow enumerations to be bitwise
12288         complemented. 
12289         (Unary::ResolveOperator): Implement ++, !, ~,
12290
12291         (Invocation::Emit): Deal with new Emit convetion.
12292         
12293         * All Expression derivatives: Updated their Emit method to return
12294         whether they leave values on the stack or not.
12295         
12296         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
12297         stack for expressions that are statements. 
12298
12299 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
12300
12301         * expression.cs (LValue): New interface.  Must be implemented by
12302         LValue objects.
12303         (LocalVariableReference, ParameterReference, FieldExpr): Implement
12304         LValue interface.
12305         
12306         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
12307         interface for generating code, simplifies the code.
12308
12309 2001-09-20  Ravi Pratap  <ravi@ximian.com>
12310
12311         * expression.cs (everywhere): Comment out return statements in ::Resolve
12312         methods to avoid the warnings.
12313
12314 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
12315
12316         * driver.cs (parse): Report error 2001 if we can not open the
12317         source file.
12318
12319         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
12320         not resolve it.
12321
12322         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
12323         object. 
12324
12325         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
12326         otherwise nested blocks end up with the same index.
12327
12328         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
12329
12330         * expression.cs:  Instead of having FIXMEs in the Resolve
12331         functions, throw exceptions so it is obvious that we are facing a
12332         bug. 
12333
12334         * cs-parser.jay (invocation_expression): Pass Location information.
12335
12336         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
12337         Use a basename for those routines because .NET does not like paths
12338         on them. 
12339
12340         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
12341         already defined.
12342
12343 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
12344
12345         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
12346         are loading the correct data types (throws an exception if not).
12347         (TypeManager::InitCoreTypes): Use CoreLookupType
12348
12349         * expression.cs (Unary::ResolveOperator): return the child
12350         expression for expressions which are just +expr.
12351         (Unary::ResolveOperator): Return negative literals for -LITERAL
12352         expressions (otherwise they are Unary {Literal}).
12353         (Invocation::Badness): Take into account `Implicit constant
12354         expression conversions'.
12355
12356         * literal.cs (LongLiteral): Implement long literal class.
12357         (IntLiteral): export the `Value' of the intliteral. 
12358
12359 2001-09-19  Ravi Pratap  <ravi@ximian.com>
12360
12361         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
12362
12363         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
12364         instead of 'Operator'
12365
12366         * expression.cs (Binary::ResolveOperator): Update accordingly.
12367         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
12368         and 'Minus'
12369
12370         * cs-parser.jay (unary_expression): Update to use the new names.
12371
12372         * gen-treedump.cs (GetUnary): Same here.
12373
12374         * expression.cs (Unary::Resolve): Implement.
12375         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
12376         operators are found instead of making noise ;-)
12377         (Unary::ResolveOperator): New method to do precisely the same thing which
12378         Binary::ResolveOperator does for Binary expressions.
12379         (Unary.method, .Arguments): Add.
12380         (Unary::OperName): Implement.   
12381         (Unary::ForceConversion): Copy and Paste !
12382
12383         * class.cs (Operator::Define): Fix a small bug for the case when we have 
12384         a unary operator.
12385
12386         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
12387         for the inbuilt operators. Only overloading works for now ;-)
12388
12389 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
12390
12391         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
12392         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
12393
12394         * expression.cs (This::Emit): Implement. 
12395         (This::Resolve): Implement.
12396         (TypeOf:Resolve): Implement.
12397         (Expression::ResolveSimpleName): Add an implicit this to instance
12398         field references. 
12399         (MemberAccess::Resolve): Deal with Parameters and Fields. 
12400         Bind instance variable to Field expressions.
12401         (FieldExpr::Instance): New field used to track the expression that
12402         represents the object instance.
12403         (FieldExpr::Resolve): Track potential errors from MemberLookup not
12404         binding 
12405         (FieldExpr::Emit): Implement.
12406
12407         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
12408         the last instruction contains a return opcode to avoid generating
12409         the last `ret' instruction (this generates correct code, and it is
12410         nice to pass the peverify output).
12411
12412         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
12413         initializer for static and instance variables.
12414         (Constructor::Emit): Allow initializer to be null in the case of
12415         static constructors.  Only emit initializer for instance
12416         constructors. 
12417
12418         (TypeContainer::FindMembers): Return a null array if there are no
12419         matches.
12420
12421         Also fix the code for the MemberTypes.Method branch, as it was not
12422         scanning that for operators (or tried to access null variables before).
12423
12424         * assign.cs (Assign::Emit): Handle instance and static fields. 
12425
12426         * TODO: Updated.
12427
12428         * driver.cs: Stop compilation if there are parse errors.
12429
12430         * cs-parser.jay (constructor_declaration): Provide default base
12431         initializer for non-static constructors.
12432         (constructor_declarator): Do not provide a default base
12433         initializers if none was specified.
12434         Catch the fact that constructors should not have parameters.
12435
12436         * class.cs: Do not emit parent class initializers for static
12437         constructors, that should be flagged as an error.
12438
12439 2001-09-18  Ravi Pratap  <ravi@ximian.com>
12440
12441         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
12442         Move back code into TypeContainer::Populate.
12443
12444 2001-09-18  Ravi Pratap  <ravi@ximian.com>
12445
12446         * class.cs (TypeContainer::AddConstructor): Fix the check to
12447         compare against Name, not Basename. 
12448         (Operator::OpType): Change Plus and Minus to Add and Subtract.
12449
12450         * cs-parser.jay : Update accordingly.
12451
12452         * class.cs (TypeContainer::FindMembers): For the case where we are searching
12453         for methods, don't forget to look into the operators too.
12454         (RegisterMethodBuilder): Helper method to take care of this for
12455         methods, constructors and operators.
12456         (Operator::Define): Completely revamp.
12457         (Operator.OperatorMethod, MethodName): New fields.
12458         (TypeContainer::Populate): Move the registering of builders into
12459         RegisterMethodBuilder.
12460         (Operator::Emit): Re-write.
12461
12462         * expression.cs (Binary::Emit): Comment out code path to emit method
12463         invocation stuff for the case when we have a user defined operator. I am
12464         just not able to get it right !
12465         
12466 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
12467
12468         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
12469         argument. 
12470
12471         (Expression::MemberLookup): Provide a version that allows to
12472         specify the MemberTypes and BindingFlags. 
12473
12474         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
12475         so it was not fetching variable information from outer blocks.
12476
12477         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
12478         Beforefieldinit as it was buggy.
12479
12480         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
12481         that Ravi put here.  
12482
12483         * class.cs (Constructor::Emit): Only emit if block is not null.
12484         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
12485         deal with this by semantically definining it as if the user had
12486         done it.
12487
12488         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
12489         constructors as we now "emit" them at a higher level.
12490
12491         (TypeContainer::DefineDefaultConstructor): Used to define the
12492         default constructors if none was provided.
12493
12494         (ConstructorInitializer): Add methods Resolve and Emit. 
12495         
12496         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
12497
12498 2001-09-17  Ravi Pratap  <ravi@ximian.com>
12499
12500         * class.cs (TypeContainer::EmitDefaultConstructor): Register
12501         the default constructor builder with our hashtable for methodbuilders
12502         to methodcores.
12503
12504         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
12505         and argument_count is 0 in which case we have a match.
12506         (Binary::ResolveOperator): More null checking and miscellaneous coding
12507         style cleanup.
12508
12509 2001-09-17  Ravi Pratap  <ravi@ximian.com>
12510
12511         * rootcontext.cs (IsNameSpace): Compare against null.
12512
12513         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
12514
12515         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
12516         and Unary::Operator.
12517
12518         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
12519         accordingly.
12520
12521         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
12522         we have overloaded operators.
12523         (Binary::ResolveOperator): Implement the part which does the operator overload
12524         resolution.
12525
12526         * class.cs (Operator::Emit): Implement.
12527         (TypeContainer::Emit): Emit the operators we have too.
12528
12529         * expression.cs (Binary::Emit): Update to emit the appropriate code for
12530         the case when we have a user-defined operator.
12531         
12532 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
12533
12534         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
12535
12536 2001-09-16  Ravi Pratap  <ravi@ximian.com>
12537
12538         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
12539         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
12540         (Constructor::Emit): Implement.
12541         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
12542         if we have no work to do. 
12543         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
12544         Emit method.
12545
12546         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
12547         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
12548
12549         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
12550         of parent.parent.
12551
12552 2001-09-15  Ravi Pratap  <ravi@ximian.com>
12553
12554         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
12555         in the source.
12556         (Tree::RecordNamespace): Method to do what the name says ;-)
12557         (Tree::Namespaces): Property to get at the namespaces hashtable.
12558
12559         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
12560         keep track.
12561
12562         * rootcontext.cs (IsNamespace): Fixed it :-)
12563
12564 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
12565
12566         * class.cs (TypeContainer::FindMembers): Add support for
12567         constructors. 
12568         (MethodCore): New class that encapsulates both the shared aspects
12569         of a Constructor and a Method.  
12570         (Method, Constructor): Factored pieces into MethodCore.
12571
12572         * driver.cs: Added --fatal which makes errors throw exceptions.
12573         Load System assembly as well as part of the standard library.
12574
12575         * report.cs: Allow throwing exceptions on errors for debugging.
12576
12577         * modifiers.cs: Do not use `parent', instead use the real type
12578         container to evaluate permission settings.
12579
12580         * class.cs: Put Ravi's patch back in.  He is right, and we will
12581         have to cope with the
12582
12583 2001-09-14  Ravi Pratap  <ravi@ximian.com>
12584
12585         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
12586         FamORAssem, not FamANDAssem.
12587         
12588 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
12589
12590         * driver.cs: Added --parse option that only parses its input files
12591         and terminates.
12592
12593         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
12594         incorrect.  IsTopLevel is not used to tell whether an object is
12595         root_types or not (that can be achieved by testing this ==
12596         root_types).  But to see if this is a top-level *class* (not
12597         necessarly our "toplevel" container). 
12598
12599 2001-09-14  Ravi Pratap  <ravi@ximian.com>
12600
12601         * enum.cs (Enum::Define): Modify to call the Lookup method on the
12602         parent instead of a direct call to GetType.
12603
12604 2001-09-14  Ravi Pratap  <ravi@ximian.com>
12605
12606         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
12607         Modifiers.TypeAttr. This should just be a call to that method.
12608
12609         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
12610         object so that we can determine if we are top-level or not.
12611
12612         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
12613         TypeContainer too.
12614
12615         * enum.cs (Enum::Define): Ditto.
12616
12617         * modifiers.cs (FieldAttr): Re-write.
12618
12619         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
12620         (TypeContainer::HaveStaticConstructor): New property to provide access
12621         to precisely that info.
12622
12623         * modifiers.cs (MethodAttr): Re-write.
12624         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
12625
12626         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
12627         of top-level types as claimed.
12628         
12629 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
12630
12631         * expression.cs (MemberLookup): Fruitless attempt to lookup
12632         constructors.  Maybe I need to emit default constructors?  That
12633         might be it (currently .NET emits this for me automatically).
12634         (Invocation::OverloadResolve): Cope with Arguments == null.
12635         (Invocation::EmitArguments): new function, shared by the new
12636         constructor and us.
12637         (Invocation::Emit): Handle static and instance methods.  Emit
12638         proper call instruction for virtual or non-virtual invocations.
12639         (New::Emit): Implement.
12640         (New::Resolve): Implement.
12641         (MemberAccess:Resolve): Implement.
12642         (MethodGroupExpr::InstanceExpression): used conforming to the spec
12643         to track instances.
12644         (FieldExpr::Resolve): Set type.
12645
12646         * support.cs: Handle empty arguments.
12647                 
12648         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
12649         SimpleLookup): Auxiliary routines to help parse a qualifier
12650         identifier.  
12651
12652         Update qualifier_identifier rule.
12653
12654         * codegen.cs: Removed debugging messages.
12655
12656         * class.cs: Make this a global thing, this acts just as a "key" to
12657         objects that we might have around.
12658
12659         (Populate): Only initialize method_builders_to_methods once.
12660
12661         * expression.cs (PropertyExpr): Initialize type from the
12662         PropertyType. 
12663
12664         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
12665         Resolve pattern.  Attempt to implicitly convert value to boolean.
12666         Emit code.
12667
12668         * expression.cs: Set the type for the int32/int32 argument case.
12669         (Binary::ResolveOperator): Set the return type to boolean for
12670         comparission operators
12671
12672         * typemanager.cs: Remove debugging print code.
12673
12674         (Invocation::Resolve): resolve type.
12675
12676         * class.cs: Allocate a MemberInfo of the correct size, as the code
12677         elsewhere depends on the test to reflect the correct contents.
12678
12679         (Method::) Keep track of parameters, due to System.Reflection holes
12680
12681         (TypeContainer::Populate): Keep track of MethodBuilders to Method
12682         mapping here.
12683
12684         (TypeContainer::FindMembers): Use ArrayList and then copy an array
12685         of the exact size and return that.
12686
12687         (Class::LookupMethodByBuilder): New function that maps
12688         MethodBuilders to its methods.  Required to locate the information
12689         on methods because System.Reflection bit us again.
12690
12691         * support.cs: New file, contains an interface ParameterData and
12692         two implementations: ReflectionParameters and InternalParameters
12693         used to access Parameter information.  We will need to grow this
12694         as required.
12695
12696         * expression.cs (Invocation::GetParameterData): implement a cache
12697         and a wrapper around the ParameterData creation for methods. 
12698         (Invocation::OverloadResolve): Use new code.
12699
12700 2001-09-13  Ravi Pratap  <ravi@ximian.com>
12701
12702         * class.cs (TypeContainer::EmitField): Remove and move into 
12703         (Field::Define): here and modify accordingly.
12704         (Field.FieldBuilder): New member.
12705         (TypeContainer::Populate): Update accordingly.
12706         (TypeContainer::FindMembers): Implement.
12707
12708 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
12709
12710         * statement.cs: (VariableInfo::VariableType): New field to be
12711         initialized with the full type once it is resolved. 
12712
12713 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
12714
12715         * parameter.cs (GetParameterInfo): Use a type cache to compute
12716         things only once, and to reuse this information
12717
12718         * expression.cs (LocalVariableReference::Emit): Implement.
12719         (OpcodeCast::Emit): fix.
12720
12721         (ParameterReference::Resolve): Implement.
12722         (ParameterReference::Emit): Implement.
12723
12724         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
12725         that are expressions need to stay as Expressions.
12726
12727         * typemanager.cs (CSharpName): Returns the C# name of a type if
12728         possible. 
12729
12730         * expression.cs (Expression::ConvertImplicit): New function that
12731         implements implicit type conversions.
12732
12733         (Expression::ImplicitReferenceConversion): Implements implicit
12734         reference conversions.
12735
12736         (EmptyCast): New type for transparent casts.
12737
12738         (OpcodeCast): New type for casts of types that are performed with
12739         a sequence of bytecodes.
12740         
12741         (BoxedCast): New type used for casting value types into reference
12742         types.  Emits a box opcode.
12743
12744         (Binary::DoNumericPromotions): Implements numeric promotions of
12745         and computation of the Binary::Type.
12746
12747         (Binary::EmitBranchable): Optimization.
12748
12749         (Binary::Emit): Implement code emission for expressions.
12750         
12751         * typemanager.cs (TypeManager): Added two new core types: sbyte
12752         and byte.
12753
12754 2001-09-12  Ravi Pratap  <ravi@ximian.com>
12755
12756         * class.cs (TypeContainer::FindMembers): Method which does exactly
12757         what Type.FindMembers does, only we don't have to use reflection. No
12758         implementation yet.
12759
12760         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
12761         typecontainer objects as we need to get at them.
12762         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
12763
12764         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
12765         typecontainer object.
12766
12767         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
12768         of just a Report object.
12769
12770 2001-09-11  Ravi Pratap  <ravi@ximian.com>
12771
12772         * class.cs (Event::Define): Go back to using the prefixes "add_" and
12773         "remove_"
12774         (TypeContainer::Populate): Now define the delegates of the type too.
12775         (TypeContainer.Delegates): Property to access the list of delegates defined
12776         in the type.
12777
12778         * delegates.cs (Delegate::Define): Implement partially.
12779
12780         * modifiers.cs (TypeAttr): Handle more flags.
12781
12782 2001-09-11  Ravi Pratap  <ravi@ximian.com>
12783
12784         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
12785         and not <=
12786         (Operator::Define): Re-write logic to get types by using the LookupType method
12787         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
12788         (Indexer::Define): Ditto.
12789         (Event::Define): Ditto.
12790         (Property::Define): Ditto.
12791         
12792 2001-09-10  Ravi Pratap  <ravi@ximian.com>
12793
12794         * class.cs (TypeContainer::Populate): Now define operators too. 
12795         (TypeContainer.Operators): New property to access the list of operators
12796         in a type.
12797         (Operator.OperatorMethodBuilder): New member to hold the method builder
12798         for the operator we are defining.
12799         (Operator::Define): Implement.
12800
12801 2001-09-10  Ravi Pratap  <ravi@ximian.com>
12802
12803         * class.cs (Event::Define): Make the prefixes of the accessor methods
12804         addOn_ and removeOn_ 
12805
12806         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
12807         of the location being passed in too. Ideally, this should go later since all
12808         error reporting should be done through the Report object.
12809
12810         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
12811         (Populate): Iterate thru the indexers we have and define them too.
12812         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
12813         for the get and set accessors.
12814         (Indexer::Define): Implement.
12815         
12816 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
12817
12818         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
12819         my previous implementation, did not work.
12820
12821         * typemanager.cs: Add a couple of missing types (the longs).
12822
12823         * literal.cs: Use TypeManager.bool_type instead of getting it.
12824
12825         * expression.cs (EventExpr): New kind of expressions.
12826         (Expressio::ExprClassFromMemberInfo): finish
12827
12828 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
12829
12830         * assign.cs: Emit stores to static fields differently.
12831
12832 2001-09-08  Ravi Pratap  <ravi@ximian.com>
12833
12834         * Merge in changes and adjust code to tackle conflicts. Backed out my
12835         code in Assign::Resolve ;-) 
12836
12837 2001-09-08  Ravi Pratap  <ravi@ximian.com>
12838
12839         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
12840         instead Report.Error and also pass in the location.
12841         (CSharpParser::Lexer): New readonly property to return the reference
12842         to the Tokenizer object.
12843         (declare_local_variables): Use Report.Error with location instead of plain 
12844         old error.
12845         (CheckDef): Ditto.
12846
12847         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
12848         (Operator.CheckBinaryOperator): Ditto.
12849
12850         * cs-parser.jay (operator_declarator): Update accordingly.
12851
12852         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
12853         (CheckBinaryOperator): Same here.
12854
12855         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
12856         on the name without any prefixes of namespace names etc. This is because we
12857         already might have something already fully qualified like 
12858         'System.Console.WriteLine'
12859
12860         * assign.cs (Resolve): Begin implementation. Stuck ;-)
12861
12862 2001-09-07  Ravi Pratap  <ravi@ximian.com>
12863
12864         * cs-tokenizer.cs (location): Return a string which also contains
12865         the file name.
12866
12867         * expression.cs (ElementAccess): New class for expressions of the
12868         type 'element access.'
12869         (BaseAccess): New class for expressions of the type 'base access.'
12870         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
12871         respectively.
12872         
12873         * cs-parser.jay (element_access): Implement action.
12874         (base_access): Implement actions.
12875         (checked_expression, unchecked_expression): Implement.
12876
12877         * cs-parser.jay (local_variable_type): Correct and implement.
12878         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
12879
12880         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
12881
12882         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
12883         name and the specifiers.
12884
12885         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
12886         
12887         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
12888         making them all public ;-)
12889
12890         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
12891         class anyways.
12892         
12893 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
12894
12895         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
12896         PropertyExprs.
12897         (FieldExpr, PropertyExprs): New resolved expressions.
12898         (SimpleName::MemberStaticCheck): Perform static checks for access
12899         to non-static fields on static methods. Maybe this should be
12900         generalized for MemberAccesses. 
12901         (SimpleName::ResolveSimpleName): More work on simple name
12902         resolution. 
12903
12904         * cs-parser.jay (primary_expression/qualified_identifier): track
12905         the parameter index.
12906
12907         * codegen.cs (CodeGen::Save): Catch save exception, report error.
12908         (EmitContext::EmitBoolExpression): Chain to expression generation
12909         instead of temporary hack.
12910         (::EmitStatementExpression): Put generic expression code generation.
12911
12912         * assign.cs (Assign::Emit): Implement variable assignments to
12913         local variables, parameters and fields.
12914
12915 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
12916
12917         * statement.cs (Block::GetVariableInfo): New method, returns the
12918         VariableInfo for a variable name in a block.
12919         (Block::GetVariableType): Implement in terms of GetVariableInfo
12920
12921         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
12922         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
12923
12924 2001-09-06  Ravi Pratap  <ravi@ximian.com>
12925
12926         * cs-parser.jay (operator_declaration): Continue on my quest : update
12927         to take attributes argument.
12928         (event_declaration): Ditto.
12929         (enum_declaration): Ditto.
12930         (indexer_declaration): Ditto.
12931         
12932         * class.cs (Operator::Operator): Update constructor accordingly.
12933         (Event::Event): Ditto.
12934
12935         * delegate.cs (Delegate::Delegate): Same here.
12936
12937         * enum.cs (Enum::Enum): Same here.
12938         
12939 2001-09-05  Ravi Pratap  <ravi@ximian.com>
12940
12941         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
12942
12943         * ../tests/cs0658.cs : New file to demonstrate error 0658.
12944
12945         * attribute.cs (Attributes): New class to encapsulate all attributes which were
12946         being passed around as an arraylist.
12947         (Attributes::AddAttribute): Method to add attribute sections.
12948
12949         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
12950         (struct_declaration): Update accordingly.
12951         (constant_declaration): Update.
12952         (field_declaration): Update.
12953         (method_header): Update.
12954         (fixed_parameter): Update.
12955         (parameter_array): Ditto.
12956         (property_declaration): Ditto.
12957         (destructor_declaration): Ditto.
12958         
12959         * class.cs (Struct::Struct): Update constructors accordingly.
12960         (Class::Class): Ditto.
12961         (Field::Field): Ditto.
12962         (Method::Method): Ditto.
12963         (Property::Property): Ditto.
12964         (TypeContainer::OptAttribute): update property's return type.
12965         
12966         * interface.cs (Interface.opt_attributes): New member.
12967         (Interface::Interface): Update to take the extra Attributes argument.
12968
12969         * parameter.cs (Parameter::Parameter): Ditto.
12970
12971         * constant.cs (Constant::Constant): Ditto.
12972
12973         * interface.cs (InterfaceMemberBase): New OptAttributes field.
12974         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
12975         the attributes as a parameter.
12976         (InterfaceProperty): Update constructor call.
12977         (InterfaceEvent): Ditto.
12978         (InterfaceMethod): Ditto.
12979         (InterfaceIndexer): Ditto.
12980
12981         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
12982         pass the attributes too.
12983         (interface_event_declaration): Ditto.
12984         (interface_property_declaration): Ditto.
12985         (interface_method_declaration): Ditto.
12986         (interface_declaration): Ditto.
12987
12988 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
12989
12990         * class.cs (Method::Define): Track the "static Main" definition to
12991         create an entry point. 
12992
12993         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
12994         EntryPoint if we find it. 
12995
12996         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
12997         (EmitContext::ig): Make this variable public.
12998
12999         * driver.cs: Make the default output file be the first file name
13000         with the .exe extension.  
13001
13002         Detect empty compilations
13003
13004         Handle various kinds of output targets.  Handle --target and
13005         rename -t to --dumper.
13006
13007         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
13008         methods inherited from Expression return now an Expression.  This
13009         will is used during the tree rewriting as we resolve them during
13010         semantic analysis.
13011
13012         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
13013         the spec.  Missing entirely is the information about
13014         accessability of elements of it.
13015
13016         (Expression::ExprClassFromMemberInfo): New constructor for
13017         Expressions that creates a fully initialized Expression based on
13018         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
13019         a Type.
13020
13021         (Invocation::Resolve): Begin implementing resolution of invocations.
13022         
13023         * literal.cs (StringLiteral):  Implement Emit.
13024
13025 2001-09-05  Ravi Pratap  <ravi@ximian.com>
13026
13027         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
13028         member.
13029         
13030 2001-09-04  Ravi Pratap  <ravi@ximian.com>
13031
13032         * cs-parser.jay (attribute_arguments): Implement actions.
13033         (attribute): Fix bug in production. Implement action.
13034         (attribute_list): Implement.
13035         (attribute_target): Implement.
13036         (attribute_target_specifier, opt_target_specifier): Implement
13037         (CheckAttributeTarget): New method to check if the attribute target
13038         is valid.
13039         (attribute_section): Implement.
13040         (opt_attributes): Implement.
13041
13042         * attribute.cs : New file to handle attributes.
13043         (Attribute): Class to hold attribute info.
13044
13045         * cs-parser.jay (opt_attribute_target_specifier): Remove production
13046         (attribute_section): Modify production to use 2 different rules to 
13047         achieve the same thing. 1 s/r conflict down !
13048         Clean out commented, useless, non-reducing dimension_separator rules.
13049         
13050         * class.cs (TypeContainer.attributes): New member to hold list
13051         of attributes for a type.
13052         (Struct::Struct): Modify to take one more argument, the attribute list.
13053         (Class::Class): Ditto.
13054         (Field::Field): Ditto.
13055         (Method::Method): Ditto.
13056         (Property::Property): Ditto.
13057         
13058         * cs-parser.jay (struct_declaration): Update constructor call to
13059         pass in the attributes too.
13060         (class_declaration): Ditto.
13061         (constant_declaration): Ditto.
13062         (field_declaration): Ditto.
13063         (method_header): Ditto.
13064         (fixed_parameter): Ditto.
13065         (parameter_array): Ditto.
13066         (property_declaration): Ditto.
13067
13068         * constant.cs (Constant::Constant): Update constructor similarly.
13069         Use System.Collections.
13070
13071         * parameter.cs (Parameter::Parameter): Update as above.
13072
13073 2001-09-02  Ravi Pratap  <ravi@ximian.com>
13074
13075         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
13076         (TypeContainer.delegates): New member to hold list of delegates.
13077
13078         * cs-parser.jay (delegate_declaration): Implement the action correctly 
13079         this time as I seem to be on crack ;-)
13080
13081 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
13082
13083         * rootcontext.cs (RootContext::IsNamespace): new function, used to
13084         tell whether an identifier represents a namespace.
13085
13086         * expression.cs (NamespaceExpr): A namespace expression, used only
13087         temporarly during expression resolution.
13088         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
13089         utility functions to resolve names on expressions.
13090
13091 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
13092
13093         * codegen.cs: Add hook for StatementExpressions. 
13094
13095         * class.cs: Fix inverted test for static flag in methods.
13096
13097 2001-09-02  Ravi Pratap  <ravi@ximian.com>
13098
13099         * class.cs (Operator::CheckUnaryOperator): Correct error number used
13100         to make it coincide with MS' number.
13101         (Operator::CheckBinaryOperator): Ditto.
13102
13103         * ../errors/errors.txt : Remove error numbers added earlier.
13104
13105         * ../errors/cs1019.cs : Test case for error # 1019
13106
13107         * ../errros/cs1020.cs : Test case for error # 1020
13108
13109         * cs-parser.jay : Clean out commented cruft.
13110         (dimension_separators, dimension_separator): Comment out. Ostensibly not
13111         used anywhere - non-reducing rule.
13112         (namespace_declarations): Non-reducing rule - comment out.
13113
13114         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
13115         with TypeContainer::AddEnum.
13116
13117         * delegate.cs : New file for delegate handling classes.
13118         (Delegate): Class for declaring delegates.
13119
13120         * makefile : Update.
13121
13122         * cs-parser.jay (delegate_declaration): Implement.
13123
13124 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
13125
13126         * class.cs (Event::Define): Implement.
13127         (Event.EventBuilder): New member.
13128
13129         * class.cs (TypeContainer::Populate): Update to define all enums and events
13130         we have.
13131         (Events): New property for the events arraylist we hold. Shouldn't we move to using
13132         readonly fields for all these cases ?
13133
13134 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
13135
13136         * class.cs (Property): Revamp to use the convention of making fields readonly.
13137         Accordingly modify code elsewhere.
13138
13139         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
13140         the Define method of the Property class.
13141
13142         * class.cs : Clean up applied patch and update references to variables etc. Fix 
13143         trivial bug.
13144         (TypeContainer::Populate): Update to define all the properties we have. Also
13145         define all enumerations.
13146
13147         * enum.cs (Define): Implement.
13148         
13149 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
13150
13151         * cs-parser.jay (overloadable_operator): The semantic value is an
13152         enum of the Operator class.
13153         (operator_declarator): Implement actions.
13154         (operator_declaration): Implement.
13155
13156         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
13157         validity of definitions.
13158         (Operator::CheckBinaryOperator): Static method to check for binary operators
13159         (TypeContainer::AddOperator): New method to add an operator to a type.
13160
13161         * cs-parser.jay (indexer_declaration): Added line to actually call the
13162         AddIndexer method so it gets added ;-)
13163
13164         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
13165         already taken care of by the MS compiler ?  
13166
13167 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
13168
13169         * class.cs (Operator): New class for operator declarations.
13170         (Operator::OpType): Enum for the various operators.
13171
13172 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
13173
13174         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
13175         ostensibly handle this in semantic analysis.
13176
13177         * cs-parser.jay (general_catch_clause): Comment out
13178         (specific_catch_clauses, specific_catch_clause): Ditto.
13179         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
13180         (catch_args, opt_catch_args): New productions.
13181         (catch_clause): Rewrite to use the new productions above
13182         (catch_clauses): Modify accordingly.
13183         (opt_catch_clauses): New production to use in try_statement
13184         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
13185         and re-write the code in the actions to extract the specific and
13186         general catch clauses by being a little smart ;-)
13187
13188         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
13189         Hooray, try and catch statements parse fine !
13190         
13191 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
13192
13193         * statement.cs (Block::GetVariableType): Fix logic to extract the type
13194         string from the hashtable of variables.
13195
13196         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
13197         I end up making that mistake ;-)
13198         (catch_clauses): Fixed gross error which made Key and Value of the 
13199         DictionaryEntry the same : $1 !!
13200
13201 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
13202
13203         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
13204
13205         * cs-parser.jay (event_declaration): Correct to remove the semicolon
13206         when the add and remove accessors are specified. 
13207
13208 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
13209
13210         * cs-parser.jay (IndexerDeclaration): New helper class to hold
13211         information about indexer_declarator.
13212         (indexer_declarator): Implement actions.
13213         (parsing_indexer): New local boolean used to keep track of whether
13214         we are parsing indexers or properties. This is necessary because 
13215         implicit_parameters come into picture even for the get accessor in the 
13216         case of an indexer.
13217         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
13218
13219         * class.cs (Indexer): New class for indexer declarations.
13220         (TypeContainer::AddIndexer): New method to add an indexer to a type.
13221         (TypeContainer::indexers): New member to hold list of indexers for the
13222         type.
13223
13224 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
13225
13226         * cs-parser.jay (add_accessor_declaration): Implement action.
13227         (remove_accessor_declaration): Implement action.
13228         (event_accessors_declaration): Implement
13229         (variable_declarators): swap statements for first rule - trivial.
13230
13231         * class.cs (Event): New class to hold information about event
13232         declarations.
13233         (TypeContainer::AddEvent): New method to add an event to a type
13234         (TypeContainer::events): New member to hold list of events.
13235
13236         * cs-parser.jay (event_declaration): Implement actions.
13237
13238 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
13239
13240         * cs-parser.jay (dim_separators): Implement. Make it a string
13241         concatenating all the commas together, just as they appear.
13242         (opt_dim_separators): Modify accordingly
13243         (rank_specifiers): Update accordingly. Basically do the same
13244         thing - instead, collect the brackets here.
13245         (opt_rank_sepcifiers): Modify accordingly.
13246         (array_type): Modify to actually return the complete type string
13247         instead of ignoring the rank_specifiers.
13248         (expression_list): Implement to collect the expressions
13249         (variable_initializer): Implement. We make it a list of expressions
13250         essentially so that we can handle the array_initializer case neatly too.
13251         (variable_initializer_list): Implement.
13252         (array_initializer): Make it a list of variable_initializers
13253         (opt_array_initializer): Modify accordingly.
13254
13255         * expression.cs (New::NType): Add enumeration to help us
13256         keep track of whether we have an object/delegate creation
13257         or an array creation.
13258         (New:NewType, New::Rank, New::Indices, New::Initializers): New
13259         members to hold data about array creation.
13260         (New:New): Modify to update NewType
13261         (New:New): New Overloaded contructor for the array creation
13262         case.
13263
13264         * cs-parser.jay (array_creation_expression): Implement to call
13265         the overloaded New constructor.
13266         
13267 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
13268
13269         * class.cs (TypeContainer::Constructors): Return member
13270         constructors instead of returning null.
13271
13272 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
13273
13274         * typemanager.cs (InitCoreTypes): Initialize the various core
13275         types after we have populated the type manager with the user
13276         defined types (this distinction will be important later while
13277         compiling corlib.dll)
13278
13279         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
13280         on Expression Classification.  Now all expressions have a method
13281         `Resolve' and a method `Emit'.
13282
13283         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
13284         generation from working.     Also add some temporary debugging
13285         code. 
13286         
13287 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
13288
13289         * codegen.cs: Lots of code generation pieces.  This is only the
13290         beginning, will continue tomorrow with more touches of polish.  We
13291         handle the fundamentals of if, while, do, for, return.  Others are
13292         trickier and I need to start working on invocations soon.
13293         
13294         * gen-treedump.cs: Bug fix, use s.Increment here instead of
13295         s.InitStatement. 
13296
13297         * codegen.cs (EmitContext): New struct, used during code
13298         emission to keep a context.   Most of the code generation will be
13299         here. 
13300
13301         * cs-parser.jay: Add embedded blocks to the list of statements of
13302         this block.  So code generation proceeds in a top down fashion.
13303
13304 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
13305
13306         * statement.cs: Add support for multiple child blocks.
13307
13308 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
13309
13310         * codegen.cs (EmitCode): New function, will emit the code for a
13311         Block of code given a TypeContainer and its ILGenerator. 
13312
13313         * statement.cs (Block): Standard public readonly optimization.
13314         (Block::Block constructors): Link children. 
13315         (Block::Child): Child Linker.
13316         (Block::EmitVariables): Emits IL variable declarations.
13317
13318         * class.cs: Drop support for MethodGroups here, delay until
13319         Semantic Analysis.
13320         (Method::): Applied the same simplification that I did before, and
13321         move from Properties to public readonly fields.
13322         (Method::ParameterTypes): Returns the parameter types for the
13323         function, and implements a cache that will be useful later when I
13324         do error checking and the semantic analysis on the methods is
13325         performed.
13326         (Constructor::GetCallingConvention): Renamed from CallingConvetion
13327         and made a method, optional argument tells whether this is a class
13328         or a structure to apply the `has-this' bit.
13329         (Method::GetCallingConvention): Implement, returns the calling
13330         convention. 
13331         (Method::Define): Defines the type, a second pass is performed
13332         later to populate the methods.
13333
13334         (Constructor::ParameterTypes): implement a cache similar to the
13335         one on Method::ParameterTypes, useful later when we do semantic
13336         analysis. 
13337
13338         (TypeContainer::EmitMethod):  New method.  Emits methods.
13339
13340         * expression.cs: Removed MethodGroup class from here.
13341         
13342         * parameter.cs (Parameters::GetCallingConvention): new method.
13343
13344 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
13345
13346         * class.cs (TypeContainer::Populate): Drop RootContext from the
13347         argument. 
13348
13349         (Constructor::CallingConvention): Returns the calling convention.
13350         (Constructor::ParameterTypes): Returns the constructor parameter
13351         types. 
13352         
13353         (TypeContainer::AddConstructor): Keep track of default constructor
13354         and the default static constructor.
13355
13356         (Constructor::) Another class that starts using `public readonly'
13357         instead of properties. 
13358
13359         (Constructor::IsDefault): Whether this is a default constructor. 
13360
13361         (Field::) use readonly public fields instead of properties also.
13362
13363         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
13364         track of static constructors;  If none is used, turn on
13365         BeforeFieldInit in the TypeAttributes. 
13366
13367         * cs-parser.jay (opt_argument_list): now the return can be null
13368         for the cases where there are no arguments. 
13369
13370         (constructor_declarator): If there is no implicit `base' or
13371         `this', then invoke the default parent constructor. 
13372         
13373         * modifiers.cs (MethodAttr): New static function maps a set of
13374         modifiers flags into a MethodAttributes enum
13375         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
13376         MethodAttr, TypeAttr to represent the various mappings where the
13377         modifiers are used.
13378         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
13379
13380 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
13381
13382         * parameter.cs (GetParameterInfo): Fix bug where there would be no
13383         method arguments.
13384
13385         * interface.cs (PopulateIndexer): Implemented the code generator
13386         for interface indexers.
13387
13388 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
13389
13390         * interface.cs (InterfaceMemberBase): Now we track the new status
13391         here.  
13392
13393         (PopulateProperty): Implement property population.  Woohoo!  Got
13394         Methods and Properties going today. 
13395
13396         Removed all the properties for interfaces, and replaced them with
13397         `public readonly' fields. 
13398
13399 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
13400
13401         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
13402         initialize their hashtables/arraylists only when they are needed
13403         instead of doing this always.
13404
13405         * parameter.cs: Handle refs and out parameters.
13406
13407         * cs-parser.jay: Use an ArrayList to construct the arguments
13408         instead of the ParameterCollection, and then cast that to a
13409         Parameter[] array.
13410
13411         * parameter.cs: Drop the use of ParameterCollection and use
13412         instead arrays of Parameters.
13413
13414         (GetParameterInfo): Use the Type, not the Name when resolving
13415         types. 
13416
13417 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
13418
13419         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
13420         and instead use public readonly fields.
13421
13422         * class.cs: Put back walking code for type containers.
13423
13424 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
13425
13426         * class.cs (MakeConstant): Code to define constants.
13427
13428         * rootcontext.cs (LookupType): New function.  Used to locate types 
13429
13430         
13431 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
13432
13433         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
13434         this System.Reflection code is.  Kudos to Microsoft
13435         
13436         * typemanager.cs: Implement a type cache and avoid loading all
13437         types at boot time.  Wrap in LookupType the internals.  This made
13438         the compiler so much faster.  Wow.  I rule!
13439         
13440         * driver.cs: Make sure we always load mscorlib first (for
13441         debugging purposes, nothing really important).
13442
13443         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
13444         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
13445
13446         * rootcontext.cs: Lookup types on their namespace;  Lookup types
13447         on namespaces that have been imported using the `using' keyword.
13448
13449         * class.cs (TypeContainer::TypeAttr): Virtualize.
13450         (Class::TypeAttr): Return attributes suitable for this bad boy.
13451         (Struct::TypeAttr): ditto.
13452         Handle nested classes.
13453         (TypeContainer::) Remove all the type visiting code, it is now
13454         replaced with the rootcontext.cs code
13455
13456         * rootcontext.cs (GetClassBases): Added support for structs. 
13457
13458 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
13459
13460         * interface.cs, statement.cs, class.cs, parameter.cs,
13461         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
13462         Drop use of TypeRefs, and use strings instead.
13463
13464 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
13465
13466         * rootcontext.cs: 
13467
13468         * class.cs (Struct::Struct): set the SEALED flags after
13469         checking the modifiers.
13470         (TypeContainer::TypeAttr): new property, returns the
13471         TypeAttributes for a class.  
13472
13473         * cs-parser.jay (type_list): Oops, list production was creating a
13474         new list of base types.
13475
13476         * rootcontext.cs (StdLib): New property.
13477         (GetInterfaceTypeByName): returns an interface by type name, and
13478         encapsulates error handling here.
13479         (GetInterfaces): simplified.
13480         (ResolveTree): Encapsulated all the tree resolution here.
13481         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
13482         types. 
13483         
13484         * driver.cs: Add support for --nostdlib, to avoid loading the
13485         default assemblies.
13486         (Main): Do not put tree resolution here. 
13487
13488         * rootcontext.cs: Beginning of the class resolution.
13489
13490 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
13491
13492         * rootcontext.cs: Provide better error reporting. 
13493
13494         * cs-parser.jay (interface_base): set our $$ to be interfaces.
13495
13496         * rootcontext.cs (CreateInterface): Handle the case where there
13497         are no parent interfaces.
13498         
13499         (CloseTypes): Routine to flush types at the end.
13500         (CreateInterface): Track types.
13501         (GetInterfaces): Returns an array of Types from the list of
13502         defined interfaces.
13503
13504         * typemanager.c (AddUserType): Mechanism to track user types (puts
13505         the type on the global type hash, and allows us to close it at the
13506         end). 
13507         
13508 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
13509
13510         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
13511         RecordInterface instead.
13512
13513         * cs-parser.jay: Updated to reflect changes above.
13514
13515         * decl.cs (Definition): Keep track of the TypeBuilder type that
13516         represents this type here.  Not sure we will use it in the long
13517         run, but wont hurt for now.
13518
13519         * driver.cs: Smaller changes to accomodate the new code.
13520
13521         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
13522         when done. 
13523
13524         * rootcontext.cs (CreateInterface):  New method, used to create
13525         the System.TypeBuilder type for interfaces.
13526         (ResolveInterfaces): new entry point to resolve the interface
13527         hierarchy. 
13528         (CodeGen): Property, used to keep track of the code generator.
13529
13530 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
13531
13532         * cs-parser.jay: Add a second production for delegate_declaration
13533         with `VOID'.
13534
13535         (enum_body): Put an opt_comma here instead of putting it on
13536         enum_body or enum_member_declarations so we can handle trailing
13537         commas on enumeration members.  Gets rid of a shift/reduce.
13538         
13539         (type_list): Need a COMMA in the middle.
13540
13541         (indexer_declaration): Tell tokenizer to recognize get/set
13542
13543         * Remove old targets.
13544
13545         * Re-add the parser target.
13546
13547 2001-07-13  Simon Cozens <simon@simon-cozens.org>
13548
13549         * cs-parser.jay: Add precendence rules for a number of operators
13550         ot reduce the number of shift/reduce conflicts in the grammar.
13551         
13552 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
13553
13554         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
13555         and put it here.
13556
13557         Get rid of old crufty code.
13558
13559         * rootcontext.cs: Use this to keep track of the parsed
13560         representation and the defined types available to the program. 
13561
13562         * gen-treedump.cs: adjust for new convention.
13563
13564         * type.cs: Split out the type manager, and the assembly builder
13565         from here. 
13566
13567         * typemanager.cs: the type manager will live here now.
13568
13569         * cil-codegen.cs: And the code generator here. 
13570
13571 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
13572
13573         * makefile: Fixed up for easy making.
13574
13575 2001-07-13  Simon Cozens <simon@simon-cozens.org>
13576
13577         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
13578         the 
13579
13580         (unary_expression): Expand pre_increment_expression and
13581         post_decrement_expression to reduce a shift/reduce.
13582
13583 2001-07-11  Simon Cozens
13584
13585         * cs-tokenizer.cs: Hex numbers should begin with a 0.
13586
13587         Improve allow_keyword_as_indent name.
13588
13589 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
13590
13591         * Adjustments for Beta2. 
13592
13593 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
13594
13595         * decl.cs: Added `Define' abstract method.
13596         (InTransit): new property, used to catch recursive definitions. 
13597
13598         * interface.cs: Implement `Define'. 
13599
13600         * modifiers.cs: Map Modifiers.constants to
13601         System.Reflection.TypeAttribute flags.
13602
13603         * class.cs: Keep track of types and user-defined types.
13604         (BuilderInit): New method for creating an assembly
13605         (ResolveType): New function to launch the resolution process, only
13606         used by interfaces for now.
13607
13608         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
13609         that are inserted into the name space. 
13610
13611 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
13612
13613         * ARGH.  I have screwed up my tree so many times due to the use of
13614         rsync rather than using CVS.  Going to fix this at once. 
13615
13616         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
13617         load types.
13618
13619 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
13620
13621         * Experiment successful: Use System.Type rather that our own
13622         version of Type.  
13623
13624 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
13625
13626         * cs-parser.jay: Removed nsAliases from here.
13627
13628         Use new namespaces, handle `using XXX;' 
13629
13630         * namespace.cs: Reimplemented namespace handling, use a recursive
13631         definition of the class.  Now we can keep track of using clauses
13632         and catch invalid using clauses.
13633
13634 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
13635
13636         * gen-treedump.cs: Adapted for all the renaming.
13637
13638         * expression.cs (Expression): this class now has a Type property
13639         which returns an expression Type.
13640
13641         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
13642         `Type', as this has a different meaning now in the base
13643
13644 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
13645
13646         * interface.cs, class.cs: Removed from all the sources the
13647         references to signature computation, as we can not do method
13648         signature computation during the parsing time, as we are not
13649         trying to solve at that point distinguishing:
13650
13651         class X {
13652                 void a (Blah x) {}
13653                 void a (NS.Blah x) {}
13654         }
13655
13656         Which depending on the context might be valid or not, as we do not
13657         know if Blah is the same thing as NS.Blah at that point.
13658
13659         * Redid everything so the code uses TypeRefs now instead of
13660         Types.  TypeRefs are just temporary type placeholders, that need
13661         to be resolved.  They initially have a pointer to a string and the
13662         current scope in which they are used.  This is used later by the
13663         compiler to resolve the reference to an actual Type. 
13664
13665         * DeclSpace is no longer a CIR.Type, and neither are
13666         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
13667         are all DeclSpaces, but no Types. 
13668
13669         * type.cs (TypeRefManager): This implements the TypeRef manager,
13670         which keeps track of all the types that need to be resolved after
13671         the parsing has finished. 
13672
13673 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
13674
13675         * ARGH.  We are going to have to store `foreach' as a class rather
13676         than resolving it, as we need to verify error 1579 after name
13677         resolution.   *OR* we could keep a flag that says `This request to
13678         IEnumerator comes from a foreach statement' which we can then use
13679         to generate the error.
13680
13681 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
13682
13683         * class.cs (TypeContainer.AddMethod): we now add methods to the
13684         MethodGroup instead of the method hashtable.  
13685
13686         * expression.cs: Add MethodGroup abstraction, which gets us one
13687         step closer to the specification in the way we handle method
13688         declarations.  
13689
13690         * cs-parser.jay (primary_expression): qualified_identifier now
13691         tried to match up an identifier to a local variable reference or
13692         to a parameter reference.
13693
13694         current_local_parameters is now a parser global variable that
13695         points to the current parameters for the block, used during name
13696         lookup.
13697
13698         (property_declaration): Now creates an implicit `value' argument to
13699         the set accessor.
13700
13701 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
13702
13703         * parameter.cs: Do not use `param' arguments as part of the
13704         signature, per the spec.
13705
13706 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
13707
13708         * decl.cs: Base class for classes, structs and interfaces.  This
13709         is the "Declaration Space" 
13710
13711         * cs-parser.jay: Use CheckDef for checking declaration errors
13712         instead of having one on each function.
13713
13714         * class.cs: Factor out some code for handling error handling in
13715         accordance to the "Declarations" section in the "Basic Concepts"
13716         chapter in the ECMA C# spec.
13717
13718         * interface.cs: Make all interface member classes derive from
13719         InterfaceMemberBase.
13720
13721 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
13722
13723         * Many things: all interfaces are parsed and generated in
13724         gen-treedump.  Support for member variables, constructors,
13725         destructors, properties, constants is there.
13726
13727         Beginning of the IL backend, but very little done, just there for
13728         testing purposes. 
13729
13730 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
13731
13732         * cs-parser.jay: Fix labeled statement.
13733
13734         * cs-tokenizer.cs (escape): Escape " and ' always.
13735         ref_line, ref_name: keep track of the line/filename as instructed
13736         by #line by the compiler.
13737         Parse #line.
13738
13739 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
13740
13741         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
13742         to match the values in System.CodeDOM.
13743
13744         Divid renamed to Divide.
13745
13746         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
13747         statements. 
13748         (Statements.set): remove.
13749
13750         * System.CodeDOM/CodeCatchClause.cs: always have a valid
13751         statements. 
13752
13753         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
13754         falseStatements always have valid values. 
13755
13756         * cs-parser.jay: Use System.CodeDOM now.
13757