Add setting of The WRAP flag in the Wrap property's set method.
[mono.git] / mcs / mcs / ChangeLog
1 2003-12-09  Martin Baulig  <martin@ximian.com>
2
3         * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
4         call them directly on the UsageVector.
5
6 2003-12-09  Martin Baulig  <martin@ximian.com>
7
8         * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
9         Changed return type from `FlowReturns' to `Reachability'.
10
11 2003-12-09  Martin Baulig  <martin@ximian.com>
12
13         * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
14         (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
15         `Reachable' fields with a single `Reachability' one.
16
17 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
18
19         * class.cs (FindMembers): Remove foreach's.
20
21         Bootstrap times:
22         
23         BEFORE
24                 Run 1:   8.74 seconds
25                 Run 2:   8.71 seconds
26         
27         AFTER
28                 Run 1:   8.64 seconds
29                 Run 2:   8.58 seconds
30         
31
32 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
33
34         * cs-parser.jay:
35         * gen-treedump.cs:
36         * statement.cs:
37         This patch does a few things:
38                 1. EmptyStatement is now a singleton, so it is never reallocated.
39                 2. All blah is EmptyStatement constructs have been changed to
40                    blah == EmptyStatement.Value, which is much faster and valid
41                    now that EmptyStatement is a singleton.
42                 3. When resolving a block, rather than allocating a new array for
43                    the non-empty statements, empty statements are replaced with
44                    EmptyStatement.Value
45                 4. Some recursive functions have been made non-recursive.
46         Mainly the performance impact is from (3), however (1) and (2) are needed for
47         this to work. (4) does not make a big difference in normal situations, however
48         it makes the profile look saner.
49
50         Bootstrap times:
51
52         BEFORE
53         9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
54         9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
55         Total memory allocated: 56397 KB
56         
57         AFTER
58         9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
59         8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
60         Total memory allocated: 55666 KB
61
62 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
63
64         * support.cs: Rewrite DoubleHash to use its own impl. Is faster
65         than the hashtable in a hashtable version
66
67         * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
68         we always end up concating a string. This results in a huge perf
69         loss, because many strings have to be tracked by the GC. In this
70         patch, we first use a hashtable that works with two keys, so that
71         the strings do not need to be concat'ed.
72
73         Bootstrap times:
74         BEFORE
75                 Run 1:   8.74 seconds
76                 Run 2:   8.71 seconds
77         
78         AFTER
79                 Run 1:   8.65 seconds
80                 Run 2:   8.56 seconds
81         
82 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
83
84         * Makefile: Add a new target `do-time' that does a quick and simple
85         profile, leaving easy to parse output.
86
87 2003-12-08  Zoltan Varga  <vargaz@freemail.hu>
88
89         * codegen.cs (Init): Create the dynamic assembly with 
90         AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
91
92 2003-12-02 Ben Maurer  <bmaurer@users.sourceforge.net>
93
94         * support.cs: Make the PtrHashtable use only one
95         instance of its comparer.
96
97 2003-11-30  Zoltan Varga  <vargaz@freemail.hu>
98
99         * typemanager.cs: Fix lookup of GetNamespaces.
100
101 2003-11-29  Miguel de Icaza  <miguel@ximian.com>
102
103         * expression.cs: Removed redundant line.
104
105         * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
106         ArrayLists, use for loops with bounds.  
107
108         * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
109         arraylist.
110
111         * expression.cs (Invocation.OverloadResolve): Avoid foreach on
112         arraylists, use for loop with bounds.
113
114         The above three changes give us a 0.071 second performance
115         improvement out of 3.294 seconds down to 3.223.  On my machine
116         the above changes reduced the memory usage by 1,387 KB during
117         compiler bootstrap.
118
119         * cs-parser.jay (QualifiedIdentifier): New class used to represent
120         QualifiedIdentifiers.  Before we created a new string through
121         concatenation, and mostly later on, the result would be
122         manipulated by DecomposeQI through string manipulation.
123
124         This reduced the compiler memory usage for bootstrapping from
125         59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
126         compile times in 0.05 seconds.
127
128 2003-11-28  Dick Porter  <dick@ximian.com>
129
130         * support.cs: Do string compares with the Invariant culture.
131
132         * rootcontext.cs: 
133         * gen-treedump.cs: 
134         * expression.cs: 
135         * driver.cs: 
136         * decl.cs: 
137         * codegen.cs: 
138         * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
139         the comparison is done with the Invariant culture.
140
141 2003-11-27  Miguel de Icaza  <miguel@ximian.com>
142
143         * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
144         GetEnumerator method.
145
146         (ProbeCollectionType): Iterate starting at the most specific type
147         upwards looking for a GetEnumerator
148
149         * expression.cs: Shift count can be up to 31 for int/uint and 63
150         for long/ulong.
151
152 2003-11-26  Miguel de Icaza  <miguel@ximian.com>
153
154         * statement.cs (Block.LookupLabel): Also look for the label on the
155         children blocks.  Use a hash table to keep track of visited
156         nodes. 
157
158         * cfold.cs (IntConstant to UIntConstant mapping): Only return if
159         we actually did transform the other operand, otherwise fall back
160         to the common codepath that casts to long.
161
162         * cs-tokenizer.cs: Use the same code pattern as the int case.
163         Maybe I should do the parsing myself, and avoid depending on the
164         Parse routines to get this done.
165
166 2003-11-25  Miguel de Icaza  <miguel@ximian.com>
167
168         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
169         which fixes bug 51347.  This time test it.
170         
171         * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
172         attributes for example can not tell the difference between these.
173         The difference was only a syntax feature of the language. 
174
175         * attribute.cs: Apply attributes to delegates.
176
177         * delegate.cs: Call the apply attributes method.
178
179 2003-11-24  Miguel de Icaza  <miguel@ximian.com>
180
181         * convert.cs (TryImplicitIntConversion): One line bug fix: we were
182         comparing 0 vs Byte.MinValue, not the value
183
184         (ImplicitConversionRequired): When reporting a conversion error,
185         use error 31 to print out the constant error instead of the
186         simpler 29.
187
188         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
189         which fixes bug 51347.
190         
191 2003-11-22  Miguel de Icaza  <miguel@ximian.com>
192
193         * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen) 
194         which fixes the -warnaserror command line option.
195         
196 2003-11-21  Miguel de Icaza  <miguel@ximian.com>
197
198         * cfold.cs (DoNumericPromotions): During constant folding of
199         additions on UIntConstant, special case intconstants with
200         IntConstants like we do on the expression binary operator. 
201
202 2003-11-12  Miguel de Icaza  <miguel@ximian.com>
203
204         * convert.cs (ImplicitReferenceConversion): We were missing a case
205         (System.Enum are not value types or class types, so we need to
206         classify them separatedly).
207
208         * driver.cs: We do not support error 2007.
209
210 2003-11-12 Jackson Harper <jackson@ximian.com>
211
212         * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
213         system directory. Also use the full file name so users can
214         libraries names mscorlib-o-tron.dll in a non system dir.
215         
216 2003-11-10  Martin Baulig  <martin@ximian.com>
217
218         * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
219         (TypeManager.InitCoreTypes): Initialize them here, but instead of
220         calling `ResolveType()' on them, directly assign their `Type'.
221
222 2003-11-08  Martin Baulig  <martin@ximian.com>
223
224         * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
225         return value and the `out parent' parameter.
226         (TypeContainer.DefineType): Moved the CS0644 check into
227         GetClassBases().  Don't pass the interface types to the
228         `builder.DefineType()'/`builder.DefineNestedType()', but resolve
229         them later and then call `TypeBuilder.AddInterfaceImplementation()'.
230
231         * ecore.cs (TypeExpr.IsAttribute): New property.
232         (TypeExpr.GetInterfaces): New method.
233
234         * interface.cs (Interface.GetInterfaceTypeByName): Return a
235         TypeExpr instead of a Type.
236         (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
237         (Interface.DefineType): Don't pass the interface types to the
238         `builder.Definetype()'/`builder.DefineNestedType()', but resolve
239         them later and then call `TypeBulider.AddInterfaceImplementation()'.
240
241         * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
242         instead of a `Type[]'.
243         (TypeManager.RegisterBuilder): Likewise.
244         (TypeManager.AddUserInterface): Likewise.
245         (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
246         `Type[]' and also return a `TypeExpr[]'.
247         (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
248
249 2003-11-08  Martin Baulig  <martin@ximian.com>
250
251         * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
252         Expression.     
253
254 2003-11-08  Martin Baulig  <martin@ximian.com>
255
256         * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
257         TypeManager.ResolveExpressionTypes().
258
259         * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
260         instead of an Expression.
261         (TypeExpr): This is now an abstract base class for `TypeExpression'.
262         (TypeExpression): New public class; formerly known as `TypeExpr'.
263
264         * expression.cs (ComposedCast): Derive from TypeExpr.
265
266         * typemanager.cs (TypeManager.system_*_expr): These are now
267         TypExpr's instead of Expression's.
268         (TypeManager.ResolveExpressionTypes): New public static function;
269         called from DeclSpace.GetTypeResolveEmitContext() to resolve all
270         of them.        
271
272 2003-11-06  Miguel de Icaza  <miguel@ximian.com>
273
274         * expression.cs (New.DoResolve): Do not dereference value that
275         might be a null return.
276
277         * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
278         sure that the constant value has the right type.  Fixes an
279         unreported bug, similar to 50425.
280
281         * const.cs (Const.LookupConstantValue): Call
282         ImplicitStandardConversionExists before doing a conversion to
283         avoid havng the TypeManager.ChangeType do conversions.
284
285         Reduced the number of casts used
286
287         (Const.ChangeType): New routine to enable reuse of the constant
288         type changing code from statement.
289
290         * typemanager.cs (ChangeType): Move common initialization to
291         static global variables.
292
293         Fixes #50425.
294
295         * convert.cs (ImplicitReferenceConversion): Somehow we allowed
296         every value type to go through, even if it was void.  Fix that. 
297
298         * cs-tokenizer.cs: Use is_identifier_start_character on the start
299         character of the define, and the is_identifier_part_character for
300         the rest of the string.
301
302 2003-11-05  Miguel de Icaza  <miguel@ximian.com>
303
304         * expression.cs (UnaryMutator.EmitCode): When I updated
305         LocalVariableReference.DoResolve, I overdid it, and dropped an
306         optimization done on local variable references.
307
308 2003-11-04  Miguel de Icaza  <miguel@ximian.com>
309
310         * ecore.cs: Convert the return from Ldlen into an int.
311
312 2003-10-20  Miguel de Icaza  <miguel@ximian.com>
313
314         * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
315         the accessibility, this is a special case for toplevel non-public
316         classes (internal for instance).
317
318 2003-10-20  Nick Drochak <ndrochak@gol.com>
319
320         * ecore.cs: Fix typo and build.  Needed another right paren.
321
322 2003-10-19  Miguel de Icaza  <miguel@ximian.com>
323
324         * ecore.cs: Applied fix from Ben Maurer.   We were handling in the
325         `internal' case regular and protected, but not allowing protected
326         to be evaluated later.  Bug 49840
327
328 2003-10-15  Miguel de Icaza  <miguel@ximian.com>
329
330         * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
331         to kb.Nlast, and not the kb.nFirst to isolate the switch
332         statement.
333
334         Extract the underlying type, so enumerations of long/ulong are
335         treated like long/ulong.
336
337 2003-10-14  Miguel de Icaza  <miguel@ximian.com>
338
339         * expression.cs (New): Overload the meaning of RequestedType to
340         track the possible creation of the NewDelegate type, since
341         DoResolve is invoked more than once for new constructors on field
342         initialization.
343
344         See bugs: #48800 and #37014
345
346         * cs-parser.jay (declare_local_constants): Take an arraylist
347         instead of a single constant.
348
349         (local_constant_declaration): It should take a
350         constant_declarators, not a constant_declarator.  Fixes 49487
351
352         * convert.cs: Fix error report.
353
354 2003-10-13 Jackson Harper <jackson@ximian.com>
355
356         * typemanager.cs (TypeToCoreType): Add float and double this fixes
357         bug #49611
358         
359 2003-10-09  Martin Baulig  <martin@ximian.com>
360
361         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
362         to the .ctor.
363         (MethodCore.DoDefineParameters): Removed the TypeContainer
364         argument; use the DeclSpace which was passed to the .ctor instead.
365         (MethodCore.CheckParameter): Take a DeclSpace instead of a
366         TypeContainer; we only need a DeclSpace here.
367
368 2003-10-09  Martin Baulig  <martin@ximian.com>
369
370         * class.cs (MethodData): Added additional `DeclSpace ds' argument
371         to the .ctor.
372         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
373         EmitContext's .ctor.    
374
375 2003-10-09  Martin Baulig  <martin@ximian.com>
376
377         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
378         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
379         AsAccessible(), moved them as well.
380
381         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
382
383 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
384
385         * cs-parser.jay : Renamed yyName to yyNames related to jay.
386
387 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
388
389         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
390         generation for >=, as spotted by Paolo, bug 48679.  
391         Patch from David Waite.
392
393         * cs-tokenizer.cs: Add handling for #pragma.
394
395         * cs-parser.jay: Allow for both yield and yield return in the
396         syntax.  The anti-cobolization of C# fight will go on!
397
398         * class.cs (TypeBuilder.DefineType): Catch error condition here
399         (Parent.DefineType erroring out and returning null).
400
401         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
402         coping with enumerations variables, we were mistakenly processing
403         them as a regular value type instead of built-in types.  Fixes the
404         bug #48063
405
406         * typemanager.cs (IsBuiltinOrEnum): New method.
407
408 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
409
410         * cs-parser.jay: Upgrade: yield now needs the return clause.
411
412 2003-09-19  Martin Baulig  <martin@ximian.com>
413
414         * decl.cs (MemberCache.SetupCacheForInterface): Take a
415         `MemberCache parent' argument.  Normally, an interface doesn't
416         have a parent type except System.Object, but we use this in gmcs
417         for generic type parameters.
418
419 2003-09-18  Martin Baulig  <martin@ximian.com>
420
421         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
422         on `type.IsInterface'; don't check whether the type has a parent
423         to determine whether it's an interface.
424
425 2003-09-15  Martin Baulig  <martin@ximian.com>
426
427         * class.cs (TypeContainer.DefineType): Added an error flag to
428         avoid reporting duplicate CS0146's ("class definition is
429         circular.").
430
431         * driver.cs (Driver.MainDriver): Abort if
432         RootContext.ResolveTree() reported any errors.
433
434 2003-09-07  Martin Baulig  <martin@ximian.com>
435
436         * report.cs (Error, Warning): Added overloaded versions which take
437         a `params object[] args' and call String.Format().
438
439 2003-09-07  Martin Baulig  <martin@ximian.com>
440
441         * decl.cs (DeclSpace..ctor): Don't call
442         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
443         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
444         (DeclSpace.RecordDecl): New method.
445
446         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
447
448 2003-09-02  Ravi Pratap  <ravi@ximian.com>
449
450         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
451         value attributes to be applied to ParameterBuilders.
452
453         * class.cs (MethodCore.LabelParameters): Make static and more
454         generic so that it can be used from other places - like interface
455         methods, for instance.
456
457         * interface.cs (Interface.Emit): Call LabelParameters before
458         emitting attributes on the InterfaceMethod.
459
460 2003-08-26  Martin Baulig  <martin@ximian.com>
461
462         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
463         resolving aliases; fixes #47927.
464
465 2003-08-26  Martin Baulig  <martin@ximian.com>
466
467         * statement.cs (Using.DoResolve): This is internally emitting a
468         try/finally clause, so we need to set ec.NeedExplicitReturn if we
469         do not always return.  Fixes #47681.
470
471 2003-08-26  Martin Baulig  <martin@ximian.com>
472
473         * decl.cs (MemberCore): Moved WarningNotHiding(),
474         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
475         into MemberBase.
476         (AdditionResult): Make this nested in DeclSpace.
477         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
478         argument; call NamespaceEntry.Define() unless we're nested in a
479         class or struct.
480
481         * namespace.cs (Namespace.DefineName): New public function.  This
482         is called from DeclSpace's .ctor to add 
483         (Namespace.Lookup): Include DeclSpaces in the lookup.
484
485         * class.cs (Operator): Derive from MemberBase, not MemberCore.
486
487         * const.cs (Const): Derive from MemberBase, not MemberCore.     
488
489 2003-08-25  Martin Baulig  <martin@ximian.com>
490
491         * convert.cs (Convert.ExplicitReferenceConversion): When
492         converting from an interface type to a class, unbox if the target
493         type is a struct type.  Fixes #47822.
494
495 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
496
497         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
498         #47854.
499
500 2003-08-22  Martin Baulig  <martin@ximian.com>
501
502         * class.cs (TypeManager.DefineType): When defining a nested type,
503         call DefineType() on our parent; fixes #47801.
504
505 2003-08-22  Martin Baulig  <martin@ximian.com>
506
507         * class.cs (MethodData.Define): While checking if a method is an
508         interface implementation, improve the test a bit more to fix #47654.
509
510 2003-08-22  Martin Baulig  <martin@ximian.com>
511
512         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
513         correctly; fixes #47722.
514
515 2003-08-22  Martin Baulig  <martin@ximian.com>
516
517         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
518         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
519
520         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
521
522 2003-08-22  Martin Baulig  <martin@ximian.com>
523
524         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
525         can only be assigned in static constructors.  Fixes #47161.
526
527 2003-08-22  Martin Baulig  <martin@ximian.com>
528
529         Rewrote and improved the flow analysis code.
530
531         * flowbranching.cs (FlowBranching): Make this class abstract.
532         (FlowBranching.CreateBranching): New static function to create a
533         new flow branching.
534         (FlowBranchingBlock, FlowBranchingException): New classes.
535         (FlowBranching.UsageVector.Type): New public readonly field.
536         (FlowBranching.UsageVector.Breaks): Removed the setter.
537         (FlowBranching.UsageVector.Returns): Removed the setter.
538         (FlowBranching.UsageVector): Added Break(), Return(),
539         NeverReachable() and Throw() methods to modify the reachability.
540         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
541         done by FlowBranching.Merge().
542         (FlowBranching.UsageVector.MergeChild): New method; merges the
543         merge result into the current vector.
544         (FlowBranching.Merge): New abstract method to merge a branching.
545
546 2003-08-12  Martin Baulig  <martin@ximian.com>
547
548         * expression.cs (Indirection.CacheTemporaries): Create the
549         LocalTemporary with the pointer type, not its element type.
550
551 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
552
553         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
554         token was a keyword or not.
555
556         Add `error' options where an IDENTIFIER was expected;  Provide
557         CheckToken and CheckIdentifierToken convenience error reporting
558         functions. 
559
560         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
561
562         * decl.cs: Rename `NamespaceEntry Namespace' public field into
563         NameSpaceEntry NameSpaceEntry.
564
565         (LookupInterfaceOrClass): Avoid creating a full qualified name
566         from namespace and name: avoid doing lookups when we know the
567         namespace is non-existant.   Use new Tree.LookupByNamespace which
568         looks up DeclSpaces based on their namespace, name pair.
569
570         * driver.cs: Provide a new `parser verbose' to display the
571         exception thrown during parsing.  This is turned off by default
572         now, so the output of a failure from mcs is more graceful.
573
574         * namespace.cs: Track all the namespaces defined in a hashtable
575         for quick lookup.
576         
577         (IsNamespace): New method
578
579 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
580
581         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
582         we know that we need to concatenate (full typename can never be
583         null). 
584
585         * class.cs: ditto.
586
587         * statement.cs: Use a bitfield;  Do not initialize to null things
588         which are done by the constructor by default.
589
590         * cs-parser.jay: bug fix, parameter was 4, not 3.
591
592         * expression.cs: Just use the property;
593
594         * statement.cs: No need for GetVariableInfo method.
595
596 2003-08-08  Martin Baulig  <martin@ximian.com>
597
598         * flowanalysis.cs (FlowReturns): This is now nested in the
599         `FlowBranching' class.
600         (MyBitVector): Moved this here from statement.cs.
601         (FlowBranching.SiblingType): New enum type.
602         (FlowBranching.CreateSibling): Added `SiblingType' argument.
603
604 2003-08-07  Martin Baulig  <martin@ximian.com>
605
606         * flowanalysis.cs (FlowBranchingType): This is now nested in the
607         `FlowBranching' class and called `BranchingType'.
608
609 2003-08-07  Martin Baulig  <martin@ximian.com>
610
611         * flowanalysis.cs: Moved all the control flow analysis code into
612         its own file.
613
614 2003-08-07  Martin Baulig  <martin@ximian.com>
615
616         * assign.cs (Assign.DoResolve): `target' must either be an
617         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
618         #37319.
619
620 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
621
622         * expression.cs (BinaryMethod): This kind of expression is created by the
623         Binary class if it determines that the operator has to be handled
624         by a method.
625
626         (BinaryDelegate): This kind of expression is created if we are
627         dealing with a + or - operator on delegates.
628
629         (Binary): remove method, argumetns, and DelegateOperator: when
630         dealing with methods, 
631         
632         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
633
634         * statement.cs (Block): use bitfields for the three extra booleans
635         we had in use.   Remove unused topblock parameter.
636
637         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
638
639         * assign.cs: Drop extra unneeded tests.
640
641 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
642
643         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
644
645         * statement.cs (Foreach): Use VariableStorage instead of
646         LocalBuilders.   
647
648         * codegen.cs (VariableStorage): New class used by clients that
649         require a variable stored: locals or fields for variables that
650         need to live across yield.
651
652         Maybe provide a convenience api for EmitThis+EmitLoad?
653
654         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
655         these bad boys.
656
657 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
658
659         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
660         RemapParameterLValue): New methods that are used to turn a
661         precomputed FieldInfo into an expression like this:
662
663                 instance.FieldInfo
664
665         The idea is to use this instead of making LocalVariableReference
666         have more than one meaning.
667
668         * cs-parser.jay: Add error production to BASE.
669
670         * ecore.cs: Deal with TypeManager.GetField returning null, which
671         is now a valid return value.
672
673         (FieldExprNoAddress): New expression for Fields whose address can
674         not be taken.
675
676         * expression.cs (LocalVariableReference): During the resolve
677         phases, create new expressions if we are in a remapping context.
678         Remove code that dealt with remapping here.
679
680         (ParameterReference): same.
681
682         (ProxyInstance): New expression, like the `This' expression, but
683         it is born fully resolved.  We know what we are doing, so remove
684         the errors that are targeted to user-provided uses of `this'.
685
686         * statement.cs (Foreach): our variable is now stored as an
687         Expression;  During resolution, follow the protocol, dont just
688         assume it will return this.
689         
690 2003-08-06  Martin Baulig  <martin@ximian.com>
691
692         * support.cs (SeekableStreamReader.cs): New public class.
693
694         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
695         SeekableStreamReader instead of the normal StreamReader.
696
697 2003-08-04  Martin Baulig  <martin@ximian.com>
698
699         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
700         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
701         deambiguate casts and delegate invocations.
702         (parenthesized_expression): Use the new tokens to ensure this is
703         not a cast of method invocation.
704
705         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
706         when reading a `)' and Deambiguate_CloseParens () was previously
707         called.
708
709         * expression.cs (ParenthesizedExpression): New class.  This is
710         just used for the CS0075 test.
711         (Binary.DoResolve): Check for CS0075.   
712
713 2003-07-29  Ravi Pratap  <ravi@ximian.com>
714
715         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
716         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
717         reference comparison.
718
719         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
720         examine the ReturnType for equality - this is necessary in the
721         cases of implicit and explicit operators whose signature also
722         includes the return type.
723
724 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
725
726         * namespace.cs: Cache the result of the namespace computation,
727         instead of computing it every time.
728
729 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
730
731         * decl.cs: Use a global arraylist that we reuse over invocations
732         to avoid excesive memory consumption.  Reduces memory usage on an
733         mcs compile by one meg (45 average).
734
735         * typemanager.cs (LookupTypeReflection): In .NET pointers are
736         private, work around that.
737
738 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
739
740         * literal.cs (IntLiteral): Define Zero and One static literals. 
741
742         * cs-parser.jay (integer_literal): use static literals to reduce
743         memory usage for the most used literals (0, 1 and -1).  211kb
744         reduced in memory usage.
745
746         Replace all calls to `new ArrayList' with `new
747         ArrayList(4)' which is a good average number for most allocations,
748         and also requires only 16 bytes of memory for its buffer by
749         default. 
750
751         This reduced MCS memory usage in seven megabytes for the RSS after
752         bootstrapping.
753
754 2003-07-28  Ravi Pratap  <ravi@ximian.com>
755
756         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
757         handle params methods the correct way by forming only one
758         applicable set with params and normal methods in them. Earlier we
759         were looking at params methods only if we found no normal methods
760         which was not the correct thing to do.
761
762         (Invocation.BetterFunction): Take separate arguments indicating
763         when candidate and the best method are params methods in their
764         expanded form.
765
766         This fixes bugs #43367 and #46199.
767
768         * attribute.cs: Documentation updates.
769
770         (CheckAttribute): Rename to CheckAttributeTarget.
771         (GetValidPlaces): Rename to GetValidTargets.
772
773         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
774         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
775
776         Fixes bug #44468.
777
778 2003-07-28  Martin Baulig  <martin@ximian.com>
779
780         * class.cs (TypeContainer.DefineMembers): Use the base type's full
781         name when looking up the base class of a nested class.  Fixes #46977.
782
783 2003-07-26  Martin Baulig  <martin@ximian.com>
784
785         * expression.cs (Indexers.Indexer): New nested struct; contains
786         getter, setter and the indexer's type.
787         (Indexers.Properties): This is now an ArrayList of
788         Indexers.Indexer's.
789         (IndexerAccess.DoResolveLValue): Correctly set the type if the
790         indexer doesn't have any getters.
791
792         * assign.cs (Assign.DoResolve): Also do the implicit conversions
793         for embedded property and indexer assignments.
794
795 2003-07-26  Martin Baulig  <martin@ximian.com>
796
797         * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
798         preprocessor directive is not the first non-whitespace character
799         on a line.
800
801 2003-07-26  Martin Baulig  <martin@ximian.com>
802
803         * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
804         namespace parsing, follow the spec more closely.
805
806         * rootcontext.cs (RootContext.NamespaceLookup): Use the new
807         NamespaceEntry.Lookup().
808
809 2003-07-25  Martin Baulig  <martin@ximian.com>
810
811         * MethodCore.cs (OverridesSomething): New public field; it's set
812         from TypeContainer.DefineMembers if this method overrides
813         something (which doesn't need to be a method).  Fix #39462.
814
815 2003-07-25  Ravi Pratap  <ravi@ximian.com>
816
817         * typemanager.cs (GetMembers): Ensure that the list of members is
818         reversed. This keeps things in sync.
819
820         * attribute.cs (Attribute.CheckAttribute): Break as soon as we
821         find an AttributeUsage attribute.
822
823         * expression.cs (Invocation.OverloadResolve): Perform the check
824         which disallows Invoke to be directly called on a Delegate.
825
826         (Error_InvokeOnDelegate): Report error cs1533.
827         
828 2003-07-25  Martin Baulig  <martin@ximian.com>
829
830         * expression.cs (Indexers.GetIndexersForType): Only look in the
831         interface hierarchy if the requested type is already an
832         interface.  Fixes #46788 while keeping #46502 fixed.
833
834 2003-07-25  Martin Baulig  <martin@ximian.com>
835
836         * class.cs (TypeContainer.DefineMembers): Check whether all
837         readonly fields have been assigned and report warning CS0649 if
838         not.
839
840         * statement.cs (LocalInfo.IsFixed): Always return true if this is
841         a valuetype.
842
843 2003-07-24  Ravi Pratap  <ravi@ximian.com>
844
845         * decl.cs (MemberCache.AddMethods): Reverse the order of the array
846         returned from GetMethods to make things consistent with the
847         assumptions MCS makes about ordering of methods.
848
849         This should comprehensively fix bug #45127 and it does :-)
850
851         * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
852         ordering is actually reverse.
853
854         * Clean up some debug messages I left lying around.
855
856         * interface.cs (Populate*): Get rid of code which emits attributes
857         since the stage in which we emit attributes is the 'Emit' stage,
858         not the define stage.
859
860         (Emit): Move attribute emission for interface members here.
861         
862 2003-07-22  Ravi Pratap  <ravi@ximian.com>
863
864         * expression.cs (Invocation.OverloadResolve): Follow the spec more
865         closely: we eliminate methods in base types when we have an
866         applicable method in a top-level type.
867
868         Please see section 14.5.5.1 for an exact description of what goes
869         on. 
870
871         This fixes bug #45127 and a host of other related to corlib compilation.
872
873         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
874         array is the method corresponding to the top-level type (this is
875         because of the changes made to icall.c) so we change this
876         accordingly.
877
878         (MethodGroupExpr.Name): This too.
879
880         * typemanager.cs (GetElementType): New method which does the right
881         thing when compiling corlib. 
882
883         * everywhere: Make use of the above in the relevant places.
884
885 2003-07-22  Martin Baulig  <martin@ximian.com>
886
887         * cs-parser.jay (invocation_expression): Moved
888         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
889         `cast_expression', but create a InvocationOrCast which later
890         resolves to either an Invocation or a Cast.
891
892         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
893         method; call this before EmitStatement() to make sure that this
894         expression can be used as a statement.
895
896         * expression.cs (InvocationOrCast): New class; resolves to either
897         an Invocation or a Cast.
898
899         * statement.cs (StatementExpression): Call ResolveStatement() on
900         the ExpressionStatement before emitting it.
901
902 2003-07-21  Martin Baulig  <martin@ximian.com>
903
904         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
905         `ref' and `out' attributes match; fixes #46220.
906         (MemberAccess.ResolveMemberAccess): You can't reference a type
907         through an expression; fixes #33180.
908         (Indexers.GetIndexersForType): Don't return the indexers from
909         interfaces the class implements; fixes #46502.
910
911 2003-07-21  Martin Baulig  <martin@ximian.com>
912
913         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
914         CS0661 checks; fixes bug #30442.
915
916 2003-07-21  Martin Baulig  <martin@ximian.com>
917
918         * decl.cs (AdditionResult): Added `Error'.
919
920         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
921
922         * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
923         makes cs0031.cs actually work.
924
925 2003-07-20  Martin Baulig  <martin@ximian.com>
926
927         * namespace.cs: Fixed that bug which caused a crash when compiling
928         the debugger's GUI.
929
930 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
931
932         * typemanager.cs (LookupTypeReflection): Never expose types which
933         are NotPublic, NestedPrivate, NestedAssembly, or
934         NestedFamANDAssem.  We used to return these, and later do a check
935         that would report a meaningful error, but the problem is that we
936         would not get the real match, if there was a name override.
937
938 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
939
940         * namespace.cs (Namespace, Name): Do not compute the namespace
941         name dynamically, compute it in the constructor.  This reduced
942         memory usage by 1697 KB.
943
944         * driver.cs: Use --pause to pause at the end.
945
946 2003-07-17  Peter Williams  <peter@newton.cx>
947
948         * Makefile: Change the name of the test target so that it doesn't
949         conflict with the recursive test target.
950
951 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
952
953         * expression.cs (LocalVariableReference.Emit, EmitAssign,
954         AddressOf): Do not use EmitThis, that was wrong, use the actual
955         this pointer.
956
957 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
958
959         * class.cs (MethodData.Define): While checking if a method is an
960         interface implementation, improve the test: If we are not public
961         (use new test here: use the computed MethodAttributes directly,
962         instead of the parsed modifier flags) check if the `implementing'
963         method comes from an interface or not.
964
965         * pending.cs (VerifyPendingMethods): Slightly better error
966         message.
967
968         * makefile: add test target that does the mcs bootstrap.
969
970 2003-07-16  Ravi Pratap  <ravi@ximian.com>
971
972         * interface.cs (Define): Do nothing here since there are no
973         members to populate etc. Move the attribute emission out of here
974         since this was just totally the wrong place to put it. Attribute
975         application happens during the 'Emit' phase, not in the 'Define'
976         phase.
977
978         (Emit): Add this method and move the attribute emission here
979
980         * rootcontext.cs (EmitCode): Call the Emit method on interface
981         types too.
982
983 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
984
985         * expression.cs (OverloadResolve): Report error only if Location
986         is not 'Null' which means that there was a probe going on.
987
988 2003-07-14  Martin Baulig  <martin@ximian.com>
989
990         * expression.cs (ConditionalLogicalOperator): New public class to
991         implement user defined conditional logical operators.
992         This is section 14.11.2 in the spec and bug #40505.
993
994 2003-07-14  Martin Baulig  <martin@ximian.com>
995
996         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
997
998 2003-07-14  Martin Baulig  <martin@ximian.com>
999
1000         * codegen.cs (EmitContext.InFixedInitializer): New public field.
1001
1002         * ecore.cs (IVariable.VerifyFixed): New interface method.
1003
1004         * expression.cs (Unary.ResolveOperator): When resolving the `&'
1005         operator, check whether the variable is actually fixed.  Fixes bug
1006         #36055.  Set a variable definitely assigned when taking its
1007         address as required by the spec.
1008
1009         * statement.cs (LocalInfo.IsFixed): New field.
1010         (LocalInfo.MakePinned): Set `IsFixed' to true.
1011
1012 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
1013
1014         * attribute.cs (Attribute.Resolve): While doing a Member lookup
1015         for .ctors, ensure that we only ask for members declared in the
1016         attribute type (BindingFlags.DeclaredOnly).
1017
1018         Fixes bug #43632.
1019
1020         * expression.cs (Error_WrongNumArguments): Report error 1501
1021         correctly the way CSC does.
1022
1023 2003-07-13  Martin Baulig  <martin@ximian.com>
1024
1025         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
1026         lookup on the fully qualified name, to make things like "X.X" work
1027         where "X.X" is a fully qualified type name, but we also have a
1028         namespace "X" in the using list.  Fixes #41975.
1029
1030 2003-07-13  Martin Baulig  <martin@ximian.com>
1031
1032         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
1033         function. If we're a CompoundAssign, we need to create an embedded
1034         CompoundAssign, not an embedded Assign.
1035         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
1036         Fixes #45854.
1037
1038 2003-07-13  Martin Baulig  <martin@ximian.com>
1039
1040         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
1041         work to fix bug #46088.
1042
1043 2003-07-13  Ravi Pratap <ravi@ximian.com>
1044
1045         * class.cs (Operator.Emit): Do not emit attributes here - it is
1046         taken care of by the Method class that we delegate too. This takes
1047         care of bug #45876.
1048         
1049 2003-07-10  Martin Baulig  <martin@ximian.com>
1050
1051         * expression.cs (TypeOfVoid): New class.
1052         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
1053
1054 2003-07-10  Martin Baulig  <martin@ximian.com>
1055
1056         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
1057         bug #35957.
1058
1059 2003-07-10  Martin Baulig  <martin@ximian.com>
1060
1061         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
1062         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
1063
1064         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
1065
1066         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
1067
1068 2003-07-10  Martin Baulig  <martin@ximian.com>
1069
1070         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
1071         of decimal.  Fixes #42850.
1072
1073         NOTE: I also fixed the created byte blob, but this doesn't work on
1074         the MS runtime and csc never produces any byte blobs for decimal
1075         arrays.
1076
1077 2003-07-10  Martin Baulig  <martin@ximian.com>
1078
1079         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
1080         structs; fixes #32068.
1081         (Block.AddChildVariableNames): Fixed #44302.
1082
1083 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1084
1085         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
1086         
1087 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1088
1089         * attribute.cs: And this test is onger needed.
1090
1091 2003-07-08  Martin Baulig  <martin@ximian.com>
1092
1093         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
1094         inaccessible types.  Fixes #36313.
1095
1096         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
1097
1098         * namespace.cs (NamespaceEntry): Create implicit entries for all
1099         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
1100         implicit entries for N1.N2 and N1.
1101
1102 2003-07-08  Martin Baulig  <martin@ximian.com>
1103
1104         Rewrote the handling of namespaces to fix a lot of the issues
1105         wrt. `using' aliases etc.
1106
1107         * namespace.cs (Namespace): Splitted this class into a
1108         per-assembly `Namespace' and a per-file `NamespaceEntry'.
1109
1110         * typemanager.cs (TypeManager.IsNamespace): Removed.
1111         (TypeManager.ComputeNamespaces): Only compute namespaces from
1112         loaded assemblies here, not the namespaces from the assembly we're
1113         currently compiling.
1114
1115 2003-07-08  Martin Baulig  <martin@ximian.com>
1116
1117         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
1118
1119 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1120
1121         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
1122         already fixed it.  
1123
1124         I thought about the memory savings here, but LookupTypeReflection
1125         is used under already very constrained scenarios.  Compiling
1126         corlib or mcs only exposes one hit, so it would not really reduce
1127         any memory consumption.
1128
1129 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1130
1131         * typemanager.cs: fixes bug #45889 by only adding public types from
1132         other assemblies to the list of known types.
1133
1134 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
1135
1136         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
1137         on the type we resolved.
1138
1139 2003-07-05  Martin Baulig  <martin@ximian.com>
1140
1141         * pending.cs (PendingImplementation.ParentImplements): Don't
1142         create the proxy if the parent is abstract.
1143
1144         * class.cs (TypeContainer.DefineIndexers): Process explicit
1145         interface implementations first.  Fixes #37714.
1146
1147 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
1148
1149         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
1150         defined recursively;  but since we modify the input parameters
1151         (left is set to `this' temporarily), we reset this value if the
1152         left_is_explicit is false, which gives the original semantics to
1153         the code.  
1154
1155         * literal.cs (NullPointer): new class used to represent a null
1156         literal in a pointer context.
1157
1158         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
1159         type is a pointer, use a NullPointer object instead of a
1160         NullLiteral.   Closes 43687
1161
1162         (ExplicitConversion): Convert pointer values using
1163         the conv opcode to the proper type.
1164
1165         * ecore.cs (New): change ValueTypeVariable property into a method,
1166         that returns whether the valuetype is suitable for being used.
1167
1168         * expression.cs (Binary.DoNumericPromotions): Only return if we
1169         the int constant was a valid uint, and we can return both left and
1170         right as uints.  If not, we continue processing, to trigger the
1171         type conversion.  This fixes 39018.
1172
1173         * statement.cs (Block.EmitMeta): During constant resolution, set
1174         the CurrentBlock property on the emitcontext, so that we resolve
1175         constants propertly.
1176
1177 2003-07-02  Martin Baulig  <martin@ximian.com>
1178
1179         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
1180         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
1181
1182         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
1183         than emitting it here.
1184
1185         * statement.cs: Fixed some more flow analysis bugs.
1186
1187 2003-07-02  Martin Baulig  <martin@ximian.com>
1188
1189         * class.cs (MethodData.Define): When implementing interface
1190         methods, set Final unless we're Virtual.
1191
1192         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
1193         check work for interface methods.
1194
1195 2003-07-01  Martin Baulig  <martin@ximian.com>
1196
1197         * ecore.cs (EmitContext.This): Replaced this property with a
1198         GetThis() method which takes a Location argument.  This ensures
1199         that we get the correct error location for a CS0188.
1200
1201 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
1202
1203         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
1204         ImplicitStandardConversion.
1205
1206         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
1207
1208 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
1209
1210         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
1211         optimization.
1212
1213 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
1214
1215         * class.cs (Constructor.Define): Turn off initlocals for unsafe
1216         constructors.
1217
1218         (MethodData.Define): Turn off initlocals for unsafe methods.
1219
1220 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
1221
1222         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
1223         complete;  Fixes #37521.
1224
1225         * delegate.cs: Use Modifiers.TypeAttr to compute the
1226         TypeAttributes, instead of rolling our own.  This makes the flags
1227         correct for the delegates.
1228
1229 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
1230
1231         * class.cs (Constructor.Define): Set the private flag for static
1232         constructors as well.
1233
1234         * cs-parser.jay (statement_expression): Set the return value to
1235         null, to avoid a crash when we catch an error.
1236
1237 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
1238
1239         * cs-parser.jay: Applied patch from Jackson that adds support for
1240         extern and unsafe modifiers to destructor declarations.
1241
1242         * expression.cs: Report error 21 if the user is trying to index a
1243         System.Array.
1244
1245         * driver.cs: Add an error message, suggested by the bug report.
1246
1247         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
1248         if we do not have a ": this ()" constructor initializer.  Fixes 45149
1249
1250 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
1251
1252         * namespace.cs: Add some information to reduce FAQs.
1253
1254 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
1255
1256         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
1257         underlying enumeration types.  Fixes #43915.
1258
1259         * expression.cs: Treat ushort/short as legal values to be used in
1260         bitwise operations.
1261
1262 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
1263
1264         * delegate.cs: transfer custom attributes for paramenters from
1265         the delegate declaration to Invoke and BeginInvoke.
1266
1267 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
1268
1269         * attribute.cs: handle custom marshalers and emit marshal info
1270         for fields, too.
1271
1272 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
1273
1274         * makefile.gnu: Added anonymous.cs to the compiler sources.
1275
1276 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
1277
1278         * iterators.cs: Change the name of the proxy class to include two
1279         underscores.
1280
1281         * cs-parser.jay: Update grammar to include anonymous methods.
1282         
1283         * anonymous.cs: new file.
1284
1285 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
1286
1287         * class.cs (Field.Define): Add missing test for pointers and
1288         safety. 
1289
1290 2003-05-27  Ravi Pratap  <ravi@ximian.com>
1291
1292         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
1293         we use the stobj opcode.
1294
1295         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
1296         since it wasn't the correct fix. 
1297
1298         It still is puzzling that we are required to use stobj for IntPtr
1299         which seems to be a ValueType.
1300
1301 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
1302
1303         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
1304         during regular simple name resolution.   Now, the trick is that
1305         instead of returning for processing the simplename, we do a
1306         TypeManager.LookupType (ie, a rooted lookup as opposed to a
1307         contextual lookup type).   If a match is found, return that, if
1308         not, return for further composition.
1309
1310         This fixes long-standing 30485.
1311
1312         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1313         using the address to initialize an object, do an Stobj instead of
1314         using the regular Stelem.
1315
1316         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
1317         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
1318         Because if we are a BaseIndexerAccess that value will be true.
1319         Fixes 43643.
1320
1321         * statement.cs (GotoCase.Resolve): Return after reporting an
1322         error, do not attempt to continue. 
1323
1324         * expression.cs (PointerArithmetic.Emit): If our operand is a
1325         long, convert our constants to match the operand before
1326         multiplying.  Convert to I type before adding.   Fixes 43670.
1327         
1328 2003-05-14  Ravi Pratap  <ravi@ximian.com>
1329
1330         * enum.cs (ImplicitConversionExists) : Rename to
1331         ImplicitEnumConversionExists to remove ambiguity. 
1332
1333         * ecore.cs (NullCast): New type of cast expression class which
1334         basically is very similar to EmptyCast with the difference being
1335         it still is a constant since it is used only to cast a null to
1336         something else
1337         (eg. (string) null)
1338
1339         * convert.cs (ImplicitReferenceConversion): When casting a null
1340         literal, we return a NullCast.
1341
1342         * literal.cs (NullLiteralTyped): Remove - I don't see why this
1343         should be around anymore.
1344
1345         The renaming (reported was slightly wrong). Corrections:
1346
1347         ConvertImplicitStandard -> ImplicitConversionStandard
1348         ConvertExplicitStandard -> ExplicitConversionStandard
1349
1350         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
1351         before passing them in !
1352
1353         * convert.cs (ImplicitConversionStandard): When comparing for
1354         equal expr and target types, ensure that expr is not a
1355         NullLiteral.
1356
1357         In general, we must not be checking (expr_type ==
1358         target_type) in the top level conversion methods
1359         (ImplicitConversion, ExplicitConversion etc). This checking is
1360         done in the methods that they delegate to.
1361
1362 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
1363
1364         * convert.cs: Move Error_CannotConvertType,
1365         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
1366         ImplicitNumericConversion, ImplicitConversionExists,
1367         ImplicitUserConversionExists, StandardConversionExists,
1368         FindMostEncompassedType, FindMostSpecificSource,
1369         FindMostSpecificTarget, ImplicitUserConversion,
1370         ExplicitUserConversion, GetConversionOperators,
1371         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
1372         TryImplicitIntConversion, Error_CannotConvertImplicit,
1373         ConvertImplicitRequired, ConvertNumericExplicit,
1374         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
1375         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
1376         its own file.
1377
1378         Perform the following renames:
1379         
1380         StandardConversionExists -> ImplicitStandardConversionExists
1381         ConvertImplicit -> ImplicitConversion
1382         ConvertImplicitStandard -> ImplicitStandardConversion
1383         TryImplicitIntConversion -> ImplicitIntConversion
1384         ConvertImplicitRequired -> ImplicitConversionRequired
1385         ConvertNumericExplicit -> ExplicitNumericConversion
1386         ConvertReferenceExplicit -> ExplicitReferenceConversion
1387         ConvertExplicit -> ExplicitConversion
1388         ConvertExplicitStandard -> ExplicitStandardConversion
1389
1390 2003-05-19  Martin Baulig  <martin@ximian.com>
1391
1392         * statement.cs (TypeInfo.StructInfo): Made this type protected.
1393         (TypeInfo): Added support for structs having structs as fields.
1394
1395         * ecore.cs (FieldExpr): Implement IVariable.
1396         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
1397         VariableInfo for the field.
1398
1399 2003-05-18  Martin Baulig  <martin@ximian.com>
1400
1401         * expression.cs (This.DoResolve): Report a CS0027 if we're
1402         emitting a field initializer.
1403
1404 2003-05-18  Martin Baulig  <martin@ximian.com>
1405
1406         * expression.cs (This.ResolveBase): New public function.
1407         (This.DoResolve): Check for CS0188.
1408
1409         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
1410         This.Resolve().
1411
1412         * ecore.cs (MethodGroupExpr.DoResolve): Set the
1413         `instance_expression' to null if we don't have any non-static
1414         methods.
1415
1416 2003-05-18  Martin Baulig  <martin@ximian.com>
1417
1418         Reworked the way how local variables and parameters are handled by
1419         the flow analysis code.
1420
1421         * statement.cs (TypeInfo, VariableMap): New public classes.
1422         (VariableInfo): New public class.  This is now responsible for
1423         checking whether a variable has been assigned.  It is used for
1424         parameters and local variables.
1425         (Block.EmitMeta): Take the InternalParameters as argument; compute
1426         the layout of the flow vectors here.
1427         (Block.LocalMap, Block.ParameterMap): New public properties.
1428         (FlowBranching): The .ctor doesn't get the InternalParameters
1429         anymore since Block.EmitMeta() now computes the layout of the flow
1430         vector.
1431         (MyStructInfo): This class is now known as `StructInfo' and nested
1432         in `TypeInfo'; we don't access this directly anymore.
1433
1434         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
1435         property and removed IsAssigned(), IsFieldAssigned(),
1436         SetAssigned() and SetFieldAssigned(); we now call them on the
1437         VariableInfo so we don't need to duplicate this code everywhere.
1438
1439         * expression.cs (ParameterReference): Added `Block block' argument
1440         to the .ctor.
1441         (LocalVariableReference, ParameterReference, This): The new
1442         VariableInfo class is now responsible for all the definite
1443         assignment stuff.
1444
1445         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
1446         IsParameterAssigned, SetParameterAssigned): Removed.
1447
1448 2003-05-18  Martin Baulig  <martin@ximian.com>
1449
1450         * typemanager.cs (InitCoreTypes): Try calling
1451         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
1452         the 3-args-version.  Corlib now also needs our `void_type'.
1453         (GetMethod): Added overloaded version which takes an optional
1454         `bool report_errors' to allow lookups of optional methods.
1455
1456 2003-05-12  Martin Baulig  <martin@ximian.com>
1457
1458         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
1459         only used for locals and not for parameters.
1460
1461 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
1462
1463         * support.cs (InternalParameters.ParameterType): Return the
1464         ExternalType of the parameter.
1465
1466         * parameter.cs (Parameter.ExternalType): drop the two arguments,
1467         they were unused.
1468
1469 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
1470
1471         * class.cs (MethodData.Define): Do not set the `newslot' on
1472         interface members, if they are also flagged as "override".
1473
1474         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
1475         better code for ++i and i++.  This only works for static fields
1476         and local variables.
1477
1478         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
1479         want to pull the DeclSpace out of the builder_to_declspace instead
1480         of the TypeBuilder (like in TypeContainer.FindMembers).
1481
1482         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
1483         instead of LookupTypeContainer.  Fixes the crash on .NET for
1484         looking up interface members.
1485
1486         * const.cs: Create our own emit context during the Definition
1487         stage, so that constants are evaluated in the proper context, when
1488         a recursive definition happens.
1489
1490 2003-05-11  Martin Baulig  <martin@ximian.com>
1491
1492         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
1493         new block for a switch section.
1494         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
1495         the adding/lookup in the switch block.  Fixes #39828.
1496
1497 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
1498
1499         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
1500         functionality: I needed to convert the data after I had performed
1501         the add/sub operation into the operands type size.
1502
1503         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
1504         pass the type for the box operation, otherwise the resulting
1505         object would have been of type object.
1506
1507         (BoxedCast): Add constructor to specify the type to box as.
1508
1509 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
1510
1511         * iterators.cs: I was reusing the `count' variable inadvertently,
1512         take steps to not allow this to happen.
1513
1514 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
1515
1516         * attribute.cs (Attribute.Resolve): Params attributes are encoded
1517         by creating an array at the point where the params starts and
1518         putting all those arguments there, then adjusting the size of the
1519         array.
1520
1521 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
1522
1523         * expression.cs (New.AddressOf): Implement interface
1524         IMemoryLocation.  This is used when the `new' operator is used in
1525         the context of an invocation to a method on a value type.
1526
1527         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1528         example. 
1529
1530         * namespace.cs: Also check the using aliases here.
1531
1532         * driver.cs: Move the test for using validity after the types have
1533         been entered, so we do a single pass that also includes the using
1534         aliases. 
1535
1536         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1537         in the regular case.   CreateSiblingForFinally is doing extra
1538         error checking.
1539
1540         * attribute.cs (GetAttributeArgumentExpression): Store the result
1541         on an out value, and use the return value to indicate failure
1542         instead of using null (which is a valid return for Constant.GetValue).
1543
1544         * statement.cs: Perform the analysis flow for the increment
1545         portion after the statement, because this will be the real flow of
1546         execution.  Fixes #42385
1547
1548         * codegen.cs (EmitContext.EmitArgument,
1549         EmitContext.EmitStoreArgument): New helper functions when the
1550         RemapToProxy flag is set.
1551
1552         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1553         function.
1554
1555         Add support for remapping parameters. 
1556
1557         * iterators.cs: Propagate parameter values;  Store parameter
1558         values in the proxy classes.
1559         
1560 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
1561
1562         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
1563         need a proxy reference;  I do not know what I was thinking
1564
1565         * cs-parser.jay (constructor_initializer): catch another error,
1566         and display nice message.
1567         
1568         (field_declaration): catch void field declaration
1569         to flag a better error. 
1570
1571         * class.cs (MemberBase.CheckBase): Report an error instead of a
1572         warning if a new protected member is declared in a struct. 
1573         (Field.Define): catch the error of readonly/volatile.
1574
1575         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1576
1577         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
1578         volatile variable is taken
1579
1580 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
1581
1582         * statement.cs (Fixed.Resolve): Report an error if we are not in
1583         an unsafe context.
1584
1585 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
1586
1587         * typemanager.cs: reuse the code that handles type clashes for
1588         delegates and enumerations.
1589
1590         * class.cs (Report28): Always report.
1591
1592         * expression.cs (EncodeAsAttribute): Allow nulls here.
1593
1594 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
1595
1596         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1597         the functionality for testing whether an expression is valid for
1598         an attribute here.  Also handle the case of arrays of elements
1599         being stored. 
1600
1601         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1602         encoding a linear array into an array of objects that are suitable
1603         to be passed to an CustomAttributeBuilder.
1604
1605         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1606
1607         * ecore.cs: (FieldExpr): Handle field remapping here.
1608
1609         * iteratators.cs: Pass the instance variable (if the method is an
1610         instance method) to the constructors, so we can access the field
1611         variables on the class.
1612
1613         TODO: Test this with structs.  I think the THIS variable on
1614         structs might have to be a pointer, and not a refenrece
1615
1616 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
1617
1618         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1619         local variables to fields in a proxy class.
1620
1621         * iterators.cs (PopulateProxy): Rename our internal fields to
1622         <XXX>.  
1623         Create a <THIS> field if we are an instance method, so we can
1624         reference our parent container variables.
1625         (MapVariable): Called back from the EmitContext code to enter a
1626         new variable to field mapping into the proxy class (we just create
1627         a FieldBuilder).
1628
1629         * expression.cs
1630         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1631         for using the remapped locals to fields.
1632
1633         I placed the code here, because that gives the same semantics to
1634         local variables, and only changes the Emit code.
1635
1636         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1637         statements inside iterators.
1638         (VariableInfo): Add a FieldBuilder for the cases when we are
1639         remapping local variables to fields in a proxy class
1640
1641         * ecore.cs (SimpleNameResolve): Avoid testing two times for
1642         current_block != null.
1643
1644         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1645         not cope with strings, as it has been moved to the
1646         TableSwitchEmit.  Fixed bug in switch generation.
1647
1648         * expression.cs (New.DoResolve): Provide more context for the user
1649         when reporting an error.
1650
1651         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1652         pointers. 
1653
1654         * expression.cs (MemberAccess.DoResolve): When we get a type back,
1655         check the permissions for it.  Note than in a type-resolution
1656         context the check was already present in DeclSpace.ResolveType,
1657         but was missing from the MemberAccess.
1658
1659         (ArrayCreation.CheckIndices): warn if the user has
1660         more nested levels of expressions, but there are no more
1661         dimensions specified.  Avoids crash on bug 41906.
1662
1663 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
1664
1665         * statement.cs (Block): replace Implicit bool, for a generic
1666         flags.   
1667         New flag: `Unchecked'.  This is used during the EmitMeta phase
1668         (which is out-of-line with the regular Resolve/Emit process for a
1669         statement, as this is done ahead of time, but still gets a chance
1670         to call constant resolve).
1671         
1672         (Block.Flags): new enum for adding a new flag.
1673
1674         (Block.EmitMeta): track the state of unchecked.
1675         
1676         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1677         to enable constant resolution to work there as well.
1678
1679 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
1680
1681         * typemanager.cs (ienumerable_type): Also look up
1682         System.Collections.IEnumerable. 
1683
1684 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
1685
1686         TODO: Test more than one conditional per method.
1687         
1688         * class.cs (Indexer.Define): Report the location where the user is
1689         referencing the unsupported feature.
1690
1691         (MethodData): Overload the use of `conditionals' to
1692         minimize the creation of needless ArrayLists.   This saves roughly
1693         212kb on my machine.
1694
1695         (Method): Implement the new IIteratorContainer interface.
1696         (Method.SetYields): Implement the method by setting the ModFlags
1697         to contain METHOD_YIELDS.
1698         
1699         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1700         which just got set to null.
1701
1702         * iterators.cs: New file.
1703
1704         (Yield, YieldBreak): New statements.
1705
1706         * statement.cs (Return.Resolve): Flag an error if we are used in
1707         an iterator method.
1708
1709         * codegen.cs (InIterator): New flag set if the code is being
1710         compiled in an iterator method.
1711
1712         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
1713         internal modifier, and we just use it to avoid adding extra
1714         fields, as this is seldom used.  
1715
1716         * cs-parser.jay: Add yield_statement (yield and yield break).
1717
1718         * driver.cs: New flag -v2 to turn on version 2 features. 
1719
1720         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1721         hashtable when v2 is enabled.
1722
1723 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
1724
1725         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1726         there is already a namespace defined with this name.
1727
1728         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1729         people upgraded their corlibs.
1730
1731         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1732         always use fully qualified types, no need to use the compiler
1733         front end.
1734
1735         (TypeManager.IsNamespace): Use binarysearch.
1736         
1737         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1738         AddDelegate): I did not quite use the new IsValid API properly: I
1739         have to pass the short-name and the fullname.  I was passing only
1740         the basename instead of the fullname sometimes. 
1741
1742         (TypeContainer.DefineType): call NamespaceClash.
1743
1744         * interface.cs (Interface.DefineType): use NamespaceClash before
1745         defining the type.
1746
1747         * delegate.cs (Delegate.DefineType): use NamespaceClash before
1748         defining the type.
1749
1750         * enum.cs: (Enum.DefineType): use NamespaceClash before
1751         defining the type.
1752
1753         * typemanager.cs (: 3-line patch that gives us some tasty 11%
1754         speed increase.  First, use the negative_hits cache when we get a
1755         negative.  Second, add the type with its full original name
1756         instead of the new . and + encoded name (reflection uses + to
1757         separate type from a nested type).  Use LookupTypeReflection
1758         directly which bypasses the type->name hashtable (that we already
1759         know does not contain the type.
1760         
1761         * decl.cs (DeclSpace.ResolveTypeExpr): track the
1762         location/container type. 
1763
1764         * driver.cs: When passing utf8, use directly the UTF8Encoding.
1765
1766 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
1767
1768         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1769
1770         * delegate.cs (NewDelegate.Resolve): Test whether an instance
1771         method is being referenced in the method group from a static
1772         context, and report error 120 if so.
1773
1774         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1775         Error118. 
1776
1777         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1778         is created, we create the A namespace).
1779
1780         * cs-parser.jay: A namespace also introduces a DeclarationFound.
1781         Fixes #41591
1782
1783 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
1784
1785         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1786         invocation to ModuleBuilder.GetType with the same values will
1787         return a new type instance, so we need to cache its return
1788         values. 
1789
1790         * expression.cs (Binary.ResolveOperator): Only allow the compare
1791         operators on enums if they are of the same type.
1792
1793         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1794         types of ValueType on their own case.  Before we were giving them
1795         the same treatment as objects.
1796
1797         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1798         fullname.  Short name is used to compare against container name.
1799         Fullname is used to check against defined namespace names.
1800         
1801         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1802         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1803
1804         (Method.CheckBase): Call parent.
1805         (MemberBase.CheckBase): Check for protected members on sealed
1806         classes.
1807         (PropertyBase.CheckBase): Call parent.
1808         (Field.Define): Call parent.
1809
1810         * report.cs: Negative error codes are now mapped to 8000 - code,
1811         so that the display is render more nicely.
1812
1813         * typemanager.cs: Do not use try/catch, instead report a regular
1814         error. 
1815
1816         (GetPointerType, GetReferenceType): These methods provide
1817         mechanisms to obtain the T* and T& from a T.  We had the code
1818         previously scattered around the code base, and it also used
1819         TypeManager.LookupType that would go through plenty of caches.
1820         This one goes directly to the type source.
1821
1822         In some places we did the Type.GetType followed by
1823         ModuleBuilder.GetType, but not in others, so this unifies the
1824         processing as well.
1825
1826         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1827         statements now that we have namespace information.
1828
1829         * typemanager.cs (IsNamespace): New method, returns whether the
1830         string presented is a namespace or not.
1831
1832         (ComputeNamespaces): New public entry point, computes the list of
1833         available namespaces, using the GetNamespaces API call in Mono, or
1834         the slower version in MS.NET.   
1835
1836         Now before we start the semantic analysis phase, we have a
1837         complete list of namespaces including everything that the user has
1838         provided.
1839
1840         Deleted old code to cache namespaces in .nsc files.
1841
1842 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
1843
1844         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1845         class/struct location definition Location for the implicit
1846         constructor location.
1847
1848         (Operator.Define): Use the location of the operator for the
1849         implicit Method definition.
1850
1851         (Constructor.Emit): use the constructor location for the implicit
1852         base initializer constructor.
1853
1854         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
1855         and the Expression class now contains two new methods:
1856
1857         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
1858         isolate type lookup from the rest of the resolution process.
1859
1860         Since we use Expressions to hold type definitions due to the way
1861         we parse the input we have historically overloaded Resolve to
1862         perform the Type lookups if a special flag is passed.  Now this is
1863         eliminated and two methods take their place. 
1864         
1865         The differences in the two methods between xStep and xTerminal is
1866         that xStep is involved in our current lookup system that uses
1867         SimpleNames to compose a name, while xTerminal is used just to
1868         catch the case where the simplename lookup failed.
1869         
1870 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
1871
1872         * expression.cs (ResolveMemberAccess): Remove redundant code.
1873         TypeExpr expressions are always born fully resolved.
1874
1875         * interface.cs (PopulateMethod): Do not lookup the types twice.
1876         We were doing it once during SemanticAnalysis and once during
1877         PopulateMethod.
1878
1879         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1880         in local variable type definitions, were being returned as a
1881         SimpleName (we decomposed everything into a string), that is
1882         because primary_expression was being used instead of a type in the
1883         grammar (reduce/reduce conflicts).
1884
1885         The part that was wrong is that we converted the expression into a
1886         string (an oversimplification in one hand, compounded with primary
1887         expressions doing string concatenation).
1888
1889         So things like:
1890
1891         A.B.C [] x;
1892
1893         Would return "A.B.C[]" as a SimpleName.  This stopped things like
1894         using clauses from working on this particular context.  And a type
1895         was being matched directly against "A.B.C[]".
1896
1897         We now use the correct approach, and allow for ComposedCast to be
1898         part of the unary expression.  So the "A.B.C []" become a composed
1899         cast of "A.B.C" (as a nested group of MemberAccess with a
1900         SimpleName at the end) plus the rank composition "[]". 
1901
1902         Also fixes 35567
1903         
1904 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
1905
1906         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1907         for the access level checking.
1908
1909         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
1910         `TypeContainer container', because I kept getting confused when I
1911         was debugging this code.
1912
1913         * expression.cs (Indexers): Instead of tracking getters/setters,
1914         we now track them in parallel.  We create one arraylist less, but
1915         most importantly it is possible now for the LValue code to find a
1916         matching get for a set.
1917
1918         (IndexerAccess.DoResolveLValue): Update the code.
1919         GetIndexersForType has been modified already to extract all the
1920         indexers from a type.  The code assumed it did not.
1921
1922         Also make the code set the correct return type for the indexer.
1923         This was fixed a long time ago for properties, but was missing for
1924         indexers.  It used to be void_type.
1925
1926         (Binary.Emit): Test first for doubles instead of
1927         floats, as they are more common.
1928
1929         (Binary.EmitBranchable): Use the .un version of the branch opcodes
1930         when dealing with floats and the <=, >= operators.  This fixes bug
1931         #39314 
1932
1933         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1934         to load the array value by emitting a load on the foreach variable
1935         type.  This was incorrect.  
1936
1937         We now emit the code to load an element using the the array
1938         variable type, and then we emit the conversion operator.
1939
1940         Fixed #40176
1941
1942 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
1943
1944         * attribute.cs: Avoid allocation of ArrayLists in the common case.
1945
1946 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
1947
1948         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1949         test for protection before we test for signatures. 
1950
1951         (MethodSignature.ToString): implement.
1952
1953         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1954         to the case where we reduced into a LongConstant.
1955
1956         * decl.cs (CheckAccessLevel): If the type is an array, we can not
1957         depend on whether the information is acurrate, because the
1958         Microsoft runtime will always claim that the array type is public,
1959         regardless of the real state.
1960
1961         If the type is a pointer, another problem happens: the type is
1962         reported as non-public in Microsoft.  
1963
1964         In both cases we have to call CheckAccessLevel recursively with
1965         the underlying type as the argument to be tested.
1966
1967 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
1968
1969         * assign.cs (Assign.Emit): If we are dealing with a compound
1970         assignment expression, we should use the code path that stores the
1971         intermediate result in a temporary value.  This fixes #40903.
1972
1973         *expression.cs (Indirection.ToString): Provide ToString method for
1974         debugging. 
1975         
1976 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
1977
1978         * class.cs: Null out fields holding references to Block objects so
1979         they can be garbage collected.
1980
1981         * expression.cs (OverloadResolve): Remove unused local.
1982
1983 2003-04-07  Martin Baulig  <martin@ximian.com>
1984
1985         * codegen.cs (EmitContext.CurrentFile): New public field.
1986         (EmitContext.Mark): Use the CurrentFile to check whether the
1987         location is in the correct file.
1988         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
1989
1990 2003-04-07  Martin Baulig  <martin@ximian.com>
1991
1992         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
1993
1994         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
1995         location.  [FIXME: The location argument which gets passed to this
1996         method is sometimes wrong!]
1997
1998 2003-04-07  Nick Drochak <ndrochak@gol.com>
1999
2000         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
2001
2002 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
2003
2004         * expression.cs (Indirection.EmitAssign): We were using the
2005         temporary, but returning immediately instead of continuing the
2006         EmitAssing flow.
2007
2008 2003-04-06  Martin Baulig  <martin@ximian.com>
2009
2010         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
2011         if it's a nested child, but also deriving from the outer class.
2012         See test 190.cs.
2013
2014         * typemanager.cs (IsNestedChildOf): Make this work if it's a
2015         nested child, but also deriving from the outer class.  See
2016         test-190.cs.
2017         (FilterWithClosure): We may access private members of the outer
2018         class if we're a nested child and deriving from the outer class.
2019         (RealMemberLookup): Only set `closure_private_ok' if the
2020         `original_bf' contained BindingFlags.NonPublic.
2021
2022 2003-04-05  Martin Baulig  <martin@ximian.com>
2023
2024         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
2025
2026 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
2027
2028         * class.cs (Event.Define): Do not allow abstract events to have
2029         initializers. 
2030
2031 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
2032
2033         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
2034         block in event declarations.
2035
2036         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
2037         value type, get its address.
2038
2039         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
2040         leaving a class on the stack instead of a boolean value (int
2041         0/1).  Change the code so we compare against null, and then the
2042         result against zero.
2043
2044         * class.cs (TypeContainer.GetClassBases): We were checking for the
2045         parent class being sealed too late.
2046
2047         * expression.cs (Binary.Emit): For <= and >= when dealing with
2048         floating point values, use cgt.un and clt.un instead of cgt and
2049         clt alone.
2050
2051 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
2052
2053         * statement.cs: Apply the same optimization as MS: skip the 
2054         GetEnumerator returning an IEnumerator, and use the one returning a 
2055         CharEnumerator instead. This allows us to avoid the try-finally block 
2056         and the boxing.
2057
2058 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
2059
2060         * cs-parser.jay: Attributes cannot be applied to
2061                          namespaces. Fixes #40473
2062
2063 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2064
2065         * class.cs:
2066         (Add*): check if the name is valid using the full name for constants,
2067         fields, properties and events.
2068
2069 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
2070
2071         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
2072         char constants to be part of the enumeration.
2073
2074         * expression.cs (Conditional.DoResolve): Add support for operator
2075         true. Implements the missing functionality from 14.12
2076
2077         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
2078         operator true/false as required by the spec.
2079
2080         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
2081         implicit conversion to boolean.
2082
2083         * statement.cs (Statement.ResolveBoolean): A boolean expression is
2084         also one where the type implements `operator true'. 
2085
2086         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
2087         get an expression that will invoke operator true based on an
2088         expression.  
2089
2090         (GetConversionOperators): Removed the hack that called op_True
2091         here.  
2092
2093         (Expression.ResolveBoolean): Move this from Statement.
2094
2095 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
2096
2097         * ecore.cs (FieldExpr): do not allow initialization of initonly
2098         fields on derived classes
2099
2100 2003-03-13  Martin Baulig  <martin@ximian.com>
2101
2102         * statement.cs (Block.Emit): Call ig.BeginScope() and
2103         ig.EndScope() when compiling with debugging info; call
2104         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
2105
2106 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
2107
2108         * expression.cs (Indexers): Do not construct immediately, allow
2109         for new members to be appended as we go.  Fixes 38143
2110
2111 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2112
2113         * expression.cs: save/restore context when resolving an unchecked
2114         expression.
2115
2116 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
2117
2118         * cfold.cs: Catch division by zero in modulus operator during
2119         constant folding.
2120
2121 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
2122
2123         * interface.cs (Interface.DefineMembers): Avoid defining members
2124         twice. 
2125
2126 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
2127
2128         * driver.cs: handle the +/- options for -noconfig
2129
2130         * statement.cs (Unckeched.Resolve): Also track the state of
2131         unchecked in the Resolve phase.
2132
2133 2003-02-27  Martin Baulig  <martin@ximian.com>
2134
2135         * ecore.cs (Expression.MemberLookup): Don't create a
2136         MethodGroupExpr for something which is not a method.  Fixes #38291.
2137
2138 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
2139
2140         * class.cs (MemberBase.CheckParameters): Also check that the type
2141         is unmanaged if it is a pointer.
2142
2143         * expression.cs (SizeOf.Resolve): Add location information.
2144
2145         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
2146         a managed type is declared.
2147
2148         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
2149         parameter modifiers as well.  Fixes bug 38606
2150
2151         * class.cs: Very sad.  Am backing out the speed up changes
2152         introduced by the ArrayList -> Array in the TypeContainer, as they
2153         were not actually that much faster, and introduced a bug (no error
2154         reports on duplicated methods).
2155
2156         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
2157         source first, this will guarantee that we have a valid expression
2158         before calling in lower levels functions that will require a
2159         resolved object.  Then use this original_source in the
2160         target.ResolveLValue instead of the original source that was
2161         passed to us.
2162
2163         Another change.  Use target.Resolve instead of LValueResolve.
2164         Although we are resolving for LValues, we will let the Assign code
2165         take care of that (it will be called again from Resolve).  This
2166         basically allows code like this:
2167
2168         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
2169         class Y { void A (X x) { x [0] += o; }
2170
2171         The problem was that the indexer was trying to resolve for
2172         set_Item (idx, object o) and never finding one.  The real set_Item
2173         was set_Item (idx, X).  By delaying the process we get the right
2174         semantics. 
2175
2176         Fixes bug 36505
2177         
2178 2003-02-23  Martin Baulig  <martin@ximian.com>
2179
2180         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
2181         while calling DoEmit ().
2182
2183         * codegen.cs (EmitContext.Mark): Don't mark locations in other
2184         source files; if you use the #line directive inside a method, the
2185         compiler stops emitting line numbers for the debugger until it
2186         reaches the end of the method or another #line directive which
2187         restores the original file.
2188
2189 2003-02-23  Martin Baulig  <martin@ximian.com>
2190
2191         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
2192
2193 2003-02-23  Martin Baulig  <martin@ximian.com>
2194
2195         * statement.cs (Block.AddChildVariableNames): We need to call this
2196         recursively, not just for our immediate children.
2197
2198 2003-02-23  Martin Baulig  <martin@ximian.com>
2199
2200         * class.cs (Event.Define): Always make the field private, like csc does.
2201
2202         * typemanager.cs (TypeManager.RealMemberLookup): Make events
2203         actually work, fixes bug #37521.
2204
2205 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
2206
2207         * delegate.cs: When creating the various temporary "Parameters"
2208         classes, make sure that we call the ComputeAndDefineParameterTypes
2209         on those new parameters (just like we do with the formal ones), to
2210         allow them to be resolved in the context of the DeclSpace.
2211
2212         This fixes the bug that Dick observed in Bugzilla #38530.
2213
2214 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
2215
2216         * expression.cs (ResolveMemberAccess): When resolving a constant,
2217         do not attempt to pull a constant if the value was not able to
2218         generate a valid constant.
2219
2220         * const.cs (LookupConstantValue): Do not report more errors than required.
2221
2222 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2223
2224         * expression.cs: fixes bug #38328.
2225
2226 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2227
2228         * class.cs: Changed all the various members that can be part of a
2229         class from being an ArrayList to be an Array of the right type.
2230         During the DefineType type_list, interface_list, delegate_list and
2231         enum_list are turned into types, interfaces, delegates and enums
2232         arrays.  
2233
2234         And during the member population, indexer_list, event_list,
2235         constant_list, field_list, instance_constructor_list, method_list,
2236         operator_list and property_list are turned into their real arrays.
2237
2238         Although we could probably perform this operation earlier, for
2239         good error reporting we need to keep the lists and remove the
2240         lists for longer than required.
2241
2242         This optimization was triggered by Paolo profiling the compiler
2243         speed on the output of `gen-sample-program.pl' perl script. 
2244
2245         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
2246         not crash in methods like MemberLookupFailed that use this field.  
2247
2248         This problem arises when the compiler fails to resolve a type
2249         during interface type definition for example.
2250
2251 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
2252
2253         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
2254         inherit from System.Object, so we have to stop at null, not only
2255         when reaching System.Object.
2256
2257 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
2258
2259         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
2260         DeclaredOnly because the parent indexer might have had a different
2261         name, but did not loop until the top of the hierarchy was reached.
2262
2263         The problem this one fixes is 35492: when a class implemented an
2264         indexer from an interface, we were getting the interface method
2265         (which was abstract) and we were flagging an error (can not invoke
2266         abstract method).
2267
2268         This also keeps bug 33089 functioning, and test-148 functioning.
2269
2270         * typemanager.cs (IsSpecialMethod): The correct way of figuring
2271         out if a method is special is to see if it is declared in a
2272         property or event, or whether it is one of the predefined operator
2273         names.   This should fix correctly #36804.
2274
2275 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
2276
2277         The goal here is to remove the dependency on EmptyCast.Peel ().
2278         Killing it completely.
2279         
2280         The problem is that currently in a number of places where
2281         constants are expected, we have to "probe" for an EmptyCast, and
2282         Peel, which is not the correct thing to do, as this will be
2283         repetitive and will likely lead to errors. 
2284
2285         The idea is to remove any EmptyCasts that are used in casts that
2286         can be reduced to constants, so we only have to cope with
2287         constants. 
2288
2289         This bug hunt was triggered by Bug 37363 and the desire to remove
2290         the duplicate pattern where we were "peeling" emptycasts to check
2291         whether they were constants.  Now constants will always be
2292         constants.
2293         
2294         * ecore.cs: Use an enumconstant here instead of wrapping with
2295         EmptyCast.  
2296
2297         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
2298         throwing me off.  By handling this we can get rid of a few hacks.
2299         
2300         * statement.cs (Switch): Removed Peel() code.
2301
2302 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
2303
2304         * class.cs: Location information for error 508
2305
2306         * expression.cs (New.DoResolve): Add a guard against double
2307         resolution of an expression.  
2308
2309         The New DoResolve might be called twice when initializing field
2310         expressions (see EmitFieldInitializers, the call to
2311         GetInitializerExpression will perform a resolve on the expression,
2312         and later the assign will trigger another resolution
2313
2314         This leads to bugs (#37014)
2315
2316         * delegate.cs: The signature for EndInvoke should contain any ref
2317         or out parameters as well.  We were not doing this in the past. 
2318
2319         * class.cs (Field.Define): Do not overwrite the type definition
2320         inside the `volatile' group.  Turns out that volatile enumerations
2321         were changing the type here to perform a validity test, which
2322         broke conversions. 
2323
2324 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
2325
2326         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
2327         and structs, we do not want to load the instance variable
2328
2329         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
2330         enum_type has to be handled like an object reference (implicit
2331         conversions exists from this to object), but the regular IsClass
2332         and IsValueType tests will never return true for this one.
2333
2334         Also we use TypeManager.IsValueType instead of type.IsValueType,
2335         just for consistency with the rest of the code (this is only
2336         needed if we ever use the construct exposed by test-180.cs inside
2337         corlib, which we dont today).
2338
2339 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
2340
2341         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
2342         just InternalCall.
2343
2344 2003-02-09  Martin Baulig  <martin@ximian.com>
2345
2346         * namespace.cs (Namespace..ctor): Added SourceFile argument.
2347         (Namespace.DefineNamespaces): New static public method; this is
2348         called when we're compiling with debugging to add all namespaces
2349         to the symbol file.
2350
2351         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
2352         pass it to the Namespace's .ctor.
2353
2354         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
2355         and MethodBase arguments; pass the namespace ID to the symwriter;
2356         pass the MethodBase instead of the token to the symwriter.
2357         (SymbolWriter.DefineNamespace): New method to add a namespace to
2358         the symbol file.
2359
2360 2003-02-09  Martin Baulig  <martin@ximian.com>
2361
2362         * symbolwriter.cs: New file.  This is a wrapper around
2363         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
2364         methods here in near future.
2365
2366 2003-02-09  Martin Baulig  <martin@ximian.com>
2367
2368         * codegen.cs (EmitContext.Mark): Just pass the arguments to
2369         ILGenerator.MarkSequencePoint() which are actually used by the
2370         symbol writer.
2371
2372 2003-02-09  Martin Baulig  <martin@ximian.com>
2373
2374         * location.cs (SourceFile): New public sealed class.  This
2375         contains the name and an index which is used in the location's token.
2376         (Location): Reserve an appropriate number of bits in the token for
2377         the source file instead of walking over that list, this gives us a
2378         really huge performance improvement when compiling with debugging.
2379
2380         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
2381         `SourceFile' argument instead of a string.
2382         (Driver.ProcessFile): Add all the files via Location.AddFile(),
2383         but don't parse/tokenize here, we need to generate the list of all
2384         source files before we do that.
2385         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
2386         the files.
2387
2388         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
2389         instead of a string.
2390
2391         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
2392         of a string.
2393
2394 2003-02-09  Martin Baulig  <martin@ximian.com>
2395
2396         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
2397         filename on `#line default'.
2398
2399 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
2400
2401         * statement.cs: don't clear the pinned var when the fixed statement
2402         returns from the method (fixes bug#37752).
2403
2404 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
2405
2406         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
2407         to IsValueType.
2408
2409 2003-02-07  Martin Baulig  <martin@ximian.com>
2410
2411         * driver.cs: Removed the `--debug-args' command line argument.
2412
2413         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
2414         automatically by the AsssemblyBuilder.
2415         (CodeGen.InitializeSymbolWriter): We don't need to call any
2416         initialization function on the symbol writer anymore.  This method
2417         doesn't take any arguments.
2418
2419 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
2420
2421         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
2422         from referenced assemblies as well.
2423
2424 2003-02-02  Martin Baulig  <martin@ximian.com>
2425
2426         * class.cs (MethodData.Emit): Generate debugging info for external methods.
2427
2428 2003-02-02  Martin Baulig  <martin@ximian.com>
2429
2430         * class.cs (Constructor.Emit): Open the symbol writer before
2431         emitting the constructor initializer.
2432         (ConstructorInitializer.Emit): Call ec.Mark() to allow
2433         single-stepping through constructor initializers.
2434
2435 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
2436
2437         * class.cs: Handle error 549: do not allow virtual methods in
2438         sealed classes. 
2439
2440 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
2441
2442         * decl.cs: Check access levels when resolving types
2443         
2444 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
2445
2446         * statement.cs: Add parameters and locals set in catch blocks that might 
2447         return to set vector
2448
2449 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
2450
2451         * class.cs (Operator): Set the SpecialName flags for operators.
2452         
2453         * expression.cs (Invocation.DoResolve): Only block calls to
2454         accessors and operators on SpecialName methods.
2455
2456         (Cast.TryReduce): Handle conversions from char constants.
2457
2458
2459 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
2460
2461         * statement.cs: small memory and time optimization in FlowBranching.
2462         
2463 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
2464
2465         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
2466         problem that the last fix but in the other sid (Set).
2467
2468         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
2469         access when there is no indexer in the hierarchy.
2470         
2471 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
2472
2473         * class.cs: Combine some if statements.
2474
2475 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2476
2477         * driver.cs: fixed bug #37187.
2478
2479 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
2480
2481         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
2482         any indexer, it's needed to build a list with all the indexers in the
2483         hierarchy (AllGetters), else we have problems. Fixes #35653.
2484
2485 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
2486
2487         * class.cs (MethodData.Define): It is wrong for an interface
2488         implementation to be static in both cases: explicit and implicit.
2489         We were only handling this in one case.
2490
2491         Improve the if situation there to not have negations.
2492         
2493         * class.cs (Field.Define): Turns out that we do not need to check
2494         the unsafe bit on field definition, only on usage.  Remove the test.
2495
2496 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2497
2498         * driver.cs: use assembly.Location instead of Codebase (the latest
2499         patch made mcs fail when using MS assemblies).
2500
2501 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
2502
2503         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
2504         get the path to *corlib.dll.
2505
2506 2003-01-21  Nick Drochak <ndrochak@gol.com>
2507
2508         * cs-tokenizer.cs:
2509         * pending.cs:
2510         * typemanager.cs: Remove compiler warnings
2511
2512 2003-01-20  Duncan Mak  <duncan@ximian.com>
2513
2514         * AssemblyInfo.cs: Bump the version number to 0.19.
2515         
2516 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2517
2518         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2519
2520 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
2521
2522         * class.cs (Constructor::Emit): Emit debugging info for constructors.
2523
2524 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
2525
2526         * cs-parser.jay: Small fix: we were not comparing the constructor
2527         name correctly.   Thanks to Zoltan for the initial pointer.
2528
2529 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2530
2531         * cs-tokenizer.cs: Set file name when specified with #line
2532
2533 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
2534
2535         * cs-parser.jay: Only perform the constructor checks here if we
2536         are named like the class;  This will help provider a better
2537         error.  The constructor path is taken when a type definition is
2538         not found, but most likely the user forgot to add the type, so
2539         report that rather than the constructor error.
2540
2541 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2542
2543         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2544         allocations.
2545
2546 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2547
2548         * cs-parser.jay: Add cleanup call.
2549
2550 2003-01-13  Duncan Mak  <duncan@ximian.com>
2551
2552         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2553         consistent with other methods.
2554
2555 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2556
2557         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2558         
2559 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2560
2561         * attribute.cs: only set GuidAttr to true when we have a
2562         GuidAttribute.
2563
2564 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2565
2566         * ecore.cs:
2567         * expression.cs:
2568         * typemanager.cs: fixes to allow mcs compile corlib with the new
2569         Type.IsSubclassOf fix.
2570
2571 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
2572
2573         * expression.cs (LocalVariableReference.DoResolve): Classify a
2574         constant as a value, not as a variable.   Also, set the type for
2575         the variable.
2576
2577         * cs-parser.jay (fixed_statement): take a type instead of a
2578         pointer_type, so we can produce a better error message later.
2579         
2580         * statement.cs (Fixed.Resolve): Flag types that are not pointers
2581         as an error.  
2582         
2583         (For.DoEmit): Make inifinite loops have a
2584         non-conditional branch back.
2585
2586         (Fixed.DoEmit): First populate the pinned variables, then emit the
2587         statement, then clear the variables.  Before I was emitting the
2588         code once for each fixed piece.
2589
2590
2591 2003-01-08  Martin Baulig  <martin@ximian.com>
2592
2593         * statement.cs (FlowBranching.MergeChild): A break in a
2594         SWITCH_SECTION does not leave a loop.  Fixes #36155.
2595
2596 2003-01-08  Martin Baulig  <martin@ximian.com>
2597
2598         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2599         lives in the same number space than `param_map'.  Fixes #36154.
2600
2601 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
2602
2603         * cs-parser.jay (constructor_declaration): Set the
2604         Constructor.ModFlags before probing for it.  This makes the
2605         compiler report 514, 515 and 132 (the code was there, but got
2606         broken). 
2607
2608         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2609         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2610         (GotoCase.Resolve): Set `Returns' to ALWAYS.
2611
2612 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2613
2614         * enum.cs: create the enum static fields using the enum type.
2615
2616 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2617
2618         * class.cs: don't try to create the ParamBuilder for the return
2619         type if it's not needed (and handle it breaking for the ms runtime
2620         anyway).
2621
2622 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2623
2624         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2625
2626 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
2627
2628         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2629         the command.   This showed up while compiling the JANET source
2630         code, which used \r as its only newline separator.
2631
2632 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
2633
2634         * class.cs (Method.Define): If we are an operator (because it
2635         reuses our code), then set the SpecialName and HideBySig.  #36128
2636
2637 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
2638
2639         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2640         exception, report error 120 `object reference required'.
2641
2642         * driver.cs: Add --pause option, used during to measure the size
2643         of the process as it goes with --timestamp.
2644
2645         * expression.cs (Invocation.DoResolve): Do not allow methods with
2646         SpecialName to be invoked.
2647
2648 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
2649
2650         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2651         number before adding it.
2652
2653 2002-12-21  Ravi Pratap  <ravi@ximian.com>
2654
2655         * ecore.cs (StandardImplicitConversion): When in an unsafe
2656         context, we allow conversion between void * to any other pointer
2657         type. This fixes bug #35973.
2658
2659 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2660
2661         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2662         is not thrown when extensionless outputs are used 
2663
2664 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2665
2666         * rootcontext.cs: fixed compilation of corlib.
2667
2668 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
2669
2670         * attribute.cs (Attributes.Contains): Add new method.
2671
2672         * class.cs (MethodCore.LabelParameters): if the parameter is an
2673         `out' parameter, check that no attribute `[In]' has been passed.
2674
2675         * enum.cs: Handle the `value__' name in an enumeration.
2676
2677 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
2678
2679         * decl.cs: Added special case to allow overrides on "protected
2680         internal" methods
2681         
2682 2002-12-18  Ravi Pratap  <ravi@ximian.com>
2683
2684         * attribute.cs (Attributes.AddAttributeSection): Rename to this
2685         since it makes much more sense.
2686
2687         (Attributes.ctor): Don't require a Location parameter.
2688         
2689         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2690
2691         * attribute.cs (ApplyAttributes): Remove extra Location parameters
2692         since we already have that information per attribute.
2693
2694         * everywhere : make appropriate changes.
2695
2696         * class.cs (LabelParameters): Write the code which actually
2697         applies attributes to the return type. We can't do this on the MS
2698         .NET runtime so we flag a warning in the case an exception is
2699         thrown.
2700
2701 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
2702
2703         * const.cs: Handle implicit null conversions here too.
2704
2705 2002-12-17  Ravi Pratap  <ravi@ximian.com>
2706
2707         * class.cs (MethodCore.LabelParameters): Remove the extra
2708         Type [] parameter since it is completely unnecessary. Instead
2709         pass in the method's attributes so that we can extract
2710         the "return" attribute.
2711
2712 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
2713
2714         * cs-parser.jay (parse): Use Report.Error to flag errors instead
2715         of ignoring it and letting the compile continue.
2716
2717         * typemanager.cs (ChangeType): use an extra argument to return an
2718         error condition instead of throwing an exception.
2719
2720 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
2721
2722         * expression.cs (Unary.TryReduce): mimic the code for the regular
2723         code path.  Perform an implicit cast in the cases where we can
2724         implicitly convert to one of the integral types, and then reduce
2725         based on that constant.   This fixes bug #35483.
2726
2727 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2728
2729         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2730
2731 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2732
2733         * namespace.cs: fixed bug #35489.
2734
2735 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
2736
2737         * class.cs: Remove some dead code.
2738
2739         * cs-parser.jay: Estimate the number of methods needed
2740         (RootContext.MethodCount);
2741
2742         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2743         numbers instead of StringBuilders.
2744
2745         * support.cs (PtrHashtable): Add constructor with initial size;
2746         We can now reduce reallocations of the method table.
2747
2748 2002-12-10  Ravi Pratap  <ravi@ximian.com>
2749
2750         * attribute.cs (ApplyAttributes): Keep track of the emitted
2751         attributes on a per-target basis. This fixes bug #35413.
2752
2753 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
2754
2755         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2756         default to the Windows 1252 encoding.
2757
2758         (UnixParseOption): Support version, thanks to Alp for the missing
2759         pointer. 
2760
2761         * AssemblyInfo.cs: Add nice assembly information.
2762
2763         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2764         (bug 35169).
2765
2766         * cs-parser.jay: Allow a trailing comma before the close bracked
2767         in the attribute_section production.
2768
2769         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2770         address of the instance was being taken, I will take this out,
2771         because we take the address of the object immediately here.
2772
2773 2002-12-09  Ravi Pratap  <ravi@ximian.com>
2774
2775         * typemanager.cs (AreMultipleAllowed): Take care of the most
2776         obvious case where attribute type is not in the current assembly -
2777         stupid me ;-)
2778
2779 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
2780
2781         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2782         definitions, instead of doing that afterwards.  
2783
2784         Also we use a nice little hack, depending on the constructor, we
2785         know if we are a "composed" name or a simple name.  Hence, we
2786         avoid the IndexOf test, and we avoid 
2787
2788         * codegen.cs: Add code to assist in a bug reporter to track down
2789         the source of a compiler crash. 
2790
2791 2002-12-07  Ravi Pratap  <ravi@ximian.com>
2792
2793         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2794         types have been emitted for a given element and flag an error
2795         if something which does not have AllowMultiple set is used more
2796         than once.
2797
2798         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2799         attribute types and their corresponding AllowMultiple properties
2800
2801         (AreMultipleAllowed): Check the property for a given type.
2802
2803         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2804         property in the case we have a TypeContainer.
2805
2806         (Attributes.AddAttribute): Detect duplicates and just skip on
2807         adding them. This trivial fix catches a pretty gross error in our
2808         attribute emission - global attributes were being emitted twice!
2809
2810         Bugzilla bug #33187 is now fixed.
2811
2812 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
2813
2814         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2815         instead of pp_and).
2816
2817         * expression.cs (Binary.ResolveOperator): I can only use the
2818         Concat (string, string, string) and Concat (string, string,
2819         string, string) if the child is actually a concatenation of
2820         strings. 
2821
2822 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
2823
2824         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2825         context where we need a 2-character lookahead.
2826
2827         * pending.cs (PendingImplementation): Rework so we can keep track
2828         of interface types all the time, and flag those which were
2829         implemented by parents as optional.
2830
2831 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
2832
2833         * expression.cs (Binary.ResolveOperator): Use
2834         String.Concat(string,string,string) or
2835         String.Concat(string,string,string,string) when possible. 
2836
2837         * typemanager: More helper methods.
2838
2839
2840 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2841
2842         * pending.cs: remove the bogus return from GetMissingInterfaces()
2843         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2844
2845 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2846
2847         * namespace.cs: avoid duplicated 'using xxx' being added to
2848         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2849         when we get more than one 'using' statement for the same namespace.
2850         Report a CS0105 warning for it.
2851
2852 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
2853
2854         * cs-tokenizer.cs (consume_identifier): use read directly, instead
2855         of calling getChar/putback, uses internal knowledge of it.    
2856
2857         (xtoken): Reorder tokenizer so most common patterns are checked
2858         first.  This reduces the compilation time in another 5% (from 8.11s
2859         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2860
2861         The parsing time is 22% of the compilation in mcs, and from that
2862         64% is spent on the tokenization process.  
2863
2864         I tried using a binary search for keywords, but this is slower
2865         than the hashtable.  Another option would be to do a couple of
2866         things:
2867
2868                 * Not use a StringBuilder, instead use an array of chars,
2869                   with a set value.  Notice that this way we could catch
2870                   the 645 error without having to do it *afterwards*.
2871
2872                 * We could write a hand-parser to avoid the hashtable
2873                   compares altogether.
2874
2875         The identifier consumption process takes 37% of the tokenization
2876         time.  Another 15% is spent on is_number.  56% of the time spent
2877         on is_number is spent on Int64.Parse:
2878
2879                 * We could probably choose based on the string length to
2880                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
2881                   computations. 
2882
2883         Another 3% is spend on wrapping `xtoken' in the `token' function.
2884
2885         Handle 0xa0 as whitespace (#34752)
2886         
2887 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
2888
2889         * typemanager.cs (IsCLRType): New routine to tell whether a type
2890         is one of the builtin types.  
2891
2892         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
2893         typecode in more places instead of doing pointer comparissions.
2894         We could leverage some knowledge about the way the typecodes are
2895         laid out.
2896
2897         New code to cache namespaces in assemblies, it is currently not
2898         invoked, to be used soon.
2899
2900         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2901
2902         * expression.cs (Binary.ResolveOperator): specially handle
2903         strings, and do not perform user-defined operator overloading for
2904         built-in types.
2905
2906 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
2907
2908         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2909         internalcall as it is a pretty simple operation;  Avoid whenever
2910         possible to call Char.IsLetter.
2911
2912         (consume_identifier): Cut by half the number of
2913         hashtable calls by merging the is_keyword and GetKeyword behavior.
2914
2915         Do not short-circuit, because if we do, we
2916         report errors (ie, #if false && true would produce an invalid
2917         directive error);
2918         
2919
2920 2002-11-24  Martin Baulig  <martin@ximian.com>
2921
2922         * expression.cs (Cast.TryReduce): If we're in checked syntax,
2923         check constant ranges and report a CS0221.  Fixes #33186.
2924
2925 2002-11-24  Martin Baulig  <martin@ximian.com>
2926
2927         * cs-parser.jay: Make this work for uninitialized variable
2928         declarations in the `for' initializer.  Fixes #32416.
2929
2930 2002-11-24  Martin Baulig  <martin@ximian.com>
2931
2932         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2933         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
2934
2935 2002-11-24  Martin Baulig  <martin@ximian.com>
2936
2937         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2938         argument; if true, we also check for user-defined conversions.
2939         This is only needed if both arguments are of a user-defined type.
2940         Fixes #30443, added test-175.cs.
2941         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2942
2943         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2944
2945 2002-11-24  Martin Baulig  <martin@ximian.com>
2946
2947         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2948         function to get the store opcode.
2949         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2950         only emit the Ldelema if the store opcode is Stobj.  You must run
2951         both test-34 and test-167 to test this.  Fixes #34529.
2952
2953 2002-11-23  Martin Baulig  <martin@ximian.com>
2954
2955         * ecore.cs (Expression.MemberLookup): Added additional
2956         `qualifier_type' argument which is used when we're being called
2957         from MemberAccess.DoResolve() and null if we're called from a
2958         SimpleName lookup.
2959         (Expression.MemberLookupFailed): New method to report errors; this
2960         does the CS1540 check and reports the correct error message.
2961
2962         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2963         argument for the CS1540 check and redone the way how we're dealing
2964         with private members.  See the comment in the source code for details.
2965         (FilterWithClosure): Reverted this back to revision 1.197; renamed
2966         `closure_start_type' to `closure_qualifier_type' and check whether
2967         it's not null.  It was not this filter being broken, it was just
2968         being called with the wrong arguments.
2969
2970         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2971         and pass it the correct `qualifier_type'; this also does the error
2972         handling for us.
2973
2974 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
2975
2976         * expression.cs (Invocation.EmitParams): If the we are dealing
2977         with a non-built-in value type, load its address as well.
2978
2979         (ArrayCreation): Use a a pretty constant instead
2980         of the hardcoded value 2.   Use 6 instead of 2 for the number of
2981         static initializers.  
2982
2983         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
2984         because they are not really value types, just glorified integers. 
2985
2986         * driver.cs: Do not append .exe, the CSC compiler does not do it.
2987
2988         * ecore.cs: Remove redundant code for enumerations, make them use
2989         the same code path as everything else, fixes the casting issue
2990         with enumerations in Windows.Forms.
2991
2992         * attribute.cs: Do only cast to string if it is a string, the
2993         validation happens later.
2994
2995         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
2996         people upgrade their corlibs.
2997
2998         * ecore.cs: Oops, enumerations were not following the entire code path
2999
3000 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
3001
3002         * typemanager.cs (FilterWithClosure): Commented out the test for
3003         1540 in typemanager.cs, as it has problems when accessing
3004         protected methods from a parent class (see test-174.cs). 
3005
3006         * attribute.cs (Attribute.ValidateGuid): new method.
3007         (Attribute.Resolve): Use above.
3008
3009 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
3010
3011         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
3012
3013         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
3014         handling for enumerations, as we only needed the TypeContainer
3015         functionality to begin with (this is required for the fix below to
3016         work for enums that reference constants in a container class for
3017         example). 
3018
3019         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
3020
3021         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
3022         a valid TypeBuilder to perform lookups on.o
3023
3024         * class.cs (InheritableMemberSignatureCompare): Use true in the
3025         call to GetGetMethod and GetSetMethod, because we are comparing
3026         the signature, and we need to get the methods *even* if they are
3027         private. 
3028
3029         (PropertyBase.CheckBase): ditto.
3030
3031         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
3032         GotoCase.Resolve): Use Peel on EmpytCasts.
3033
3034         * ecore.cs (EmptyCast): drop child, add Peel method.
3035
3036 2002-11-17  Martin Baulig  <martin@ximian.com>
3037
3038         * ecore.cs (EmptyCast.Child): New public property.
3039
3040         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
3041         label resolved to an EmptyCast.  Fixes #34162.
3042         (GotoCase.Resolve): Likewise.
3043         (Block.EmitMeta): Likewise.
3044
3045 2002-11-17  Martin Baulig  <martin@ximian.com>
3046
3047         * expression.cs (Invocation.BetterConversion): Prefer int over
3048         uint; short over ushort; long over ulong for integer literals.
3049         Use ImplicitConversionExists instead of StandardConversionExists
3050         since we also need to check for user-defined implicit conversions.
3051         Fixes #34165.  Added test-173.cs.
3052
3053 2002-11-16  Martin Baulig  <martin@ximian.com>
3054
3055         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
3056         with the `true' and `false' literals.  Fixes #33151.
3057
3058 2002-11-16  Martin Baulig  <martin@ximian.com>
3059
3060         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
3061         October 22nd; don't do the cs1540 check for static members.
3062
3063         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
3064         now using our own filter here and doing the cs1540 check again.
3065
3066 2002-11-16  Martin Baulig  <martin@ximian.com>
3067
3068         * support.cs (InternalParameters): Don't crash if we don't have
3069         any fixed parameters.  Fixes #33532.
3070
3071 2002-11-16  Martin Baulig  <martin@ximian.com>
3072
3073         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
3074         when looking up static methods to make this work on Windows.
3075         Fixes #33773.
3076
3077 2002-11-16  Martin Baulig  <martin@ximian.com>
3078
3079         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
3080         a setter rather than using PropertyInfo.CanWrite.
3081
3082 2002-11-15  Nick Drochak  <ndrochak@gol.com>
3083
3084         * class.cs: Allow acces to block member by subclasses. Fixes build
3085         breaker.
3086
3087 2002-11-14  Martin Baulig  <martin@ximian.com>
3088
3089         * class.cs (Constructor.Emit): Added the extern/block check.
3090         Fixes bug #33678.
3091
3092 2002-11-14  Martin Baulig  <martin@ximian.com>
3093
3094         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
3095         iteration while looking for indexers, this is needed because the
3096         indexer may have a different name in our base classes.  Fixed the
3097         error reporting (no indexers at all, not get accessor, no
3098         overloaded match).  Fixes bug #33089.
3099         (IndexerAccess.DoResolveLValue): Likewise.
3100
3101 2002-11-14  Martin Baulig  <martin@ximian.com>
3102
3103         * class.cs (PropertyBase.CheckBase): Make this work for multiple
3104         indexers.  Fixes the first part of bug #33089.
3105         (MethodSignature.InheritableMemberSignatureCompare): Added support
3106         for properties.
3107
3108 2002-11-13  Ravi Pratap  <ravi@ximian.com>
3109
3110         * attribute.cs (Attribute.Resolve): Catch the
3111         NullReferenceException and report it since it isn't supposed to
3112         happen. 
3113         
3114 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
3115
3116         * expression.cs (Binary.EmitBranchable): Also handle the cases for
3117         LogicalOr and LogicalAnd that can benefit from recursively
3118         handling EmitBranchable.  The code now should be nice for Paolo.
3119
3120 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
3121
3122         * typemanager.cs (LookupType): Added a negative-hit hashtable for
3123         the Type lookups, as we perform quite a number of lookups on
3124         non-Types.  This can be removed once we can deterministically tell
3125         whether we have a type or a namespace in advance.
3126
3127         But this might require special hacks from our corlib.
3128
3129         * TODO: updated.
3130
3131         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
3132         and double which avoids a conversion from an integer to a double.
3133
3134         * expression.cs: tiny optimization, avoid calling IsConstant,
3135         because it effectively performs the lookup twice.
3136
3137 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
3138
3139         But a bogus return here to keep the semantics of the old code
3140         until the Mono runtime is fixed.
3141         
3142         * pending.cs (GetMissingInterfaces): New method used to remove all
3143         the interfaces that are already implemented by our parent
3144         classes from the list of pending methods. 
3145
3146         * interface.cs: Add checks for calls after ResolveTypeExpr.
3147
3148 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
3149
3150         * class.cs (Class.Emit): Report warning 67: event not used if the
3151         warning level is beyond 3.
3152
3153         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
3154         being a NullLiteral.
3155
3156         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
3157         specifiers. 
3158
3159         * class.cs (TypeContainer.GetClassBases): Cover a missing code
3160         path that might fail if a type can not be resolved.
3161
3162         * expression.cs (Binary.Emit): Emit unsigned versions of the
3163         operators. 
3164
3165         * driver.cs: use error 5.
3166         
3167 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
3168
3169         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
3170
3171 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
3172
3173         * cs-parser.jay (switch_section): A beautiful patch from Martin
3174         Baulig that fixed 33094.
3175
3176 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
3177
3178         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
3179         Check whether the base is abstract and report an error if so.
3180
3181         * expression.cs (IndexerAccess.DoResolveLValue,
3182         IndexerAccess.DoResolve): ditto. 
3183
3184         (Invocation.DoResolve): ditto.
3185         
3186         (Invocation.FullMethodDesc): Improve the report string.
3187
3188         * statement.cs (Block): Eliminate IsVariableDefined as it is
3189         basically just a wrapper for GetVariableInfo.
3190
3191         * ecore.cs (SimpleName): Use new 
3192
3193         * support.cs (ReflectionParamter.ParameterType): We unwrap the
3194         type, as we return the actual parameter ref/unref state on a
3195         different call.
3196
3197 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
3198
3199         * support.cs: Return proper flags REF/OUT fixing the previous
3200         commit.  
3201
3202         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
3203         not used to mean `ref' but `ref or out' in ParameterReference
3204         
3205         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
3206         full type signature instead of calling TypeManger.CSharpName
3207         ourselves. 
3208
3209         * support.cs (InternalParameters.ParameterDesc): Do not compare
3210         directly to the modflags, because REF/OUT will actually be bitsets
3211         if set. 
3212
3213         * delegate.cs (VerifyMethod): Check also the modifiers.
3214
3215         * cs-tokenizer.cs: Fix bug where floating point values with an
3216         exponent where a sign was missing was ignored.
3217
3218         * driver.cs: Allow multiple assemblies to be specified in a single
3219         /r: argument
3220
3221 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
3222
3223         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
3224         because identifiers after a parenthesis would end up in this kind
3225         of production, and we needed to desamiguate it for having casts
3226         like:
3227
3228                 (UserDefinedType *) xxx
3229
3230 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
3231
3232         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
3233         we should set on the Bindingflags.NonPublic, but not turn on
3234         private_ok.  private_ok controls whether a Private member is
3235         returned (this is chekced on the filter routine), while the
3236         BindingFlags.NonPublic just controls whether private/protected
3237         will be allowed.   This fixes the problem part of the problem of
3238         private properties being allowed to be used in derived classes.
3239
3240         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
3241         so we can call the children DoResolveLValue method (this will
3242         properly signal errors on lvalue assignments to base properties)
3243         
3244         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
3245         getter are null, and we have a property info, we know that this
3246         happened because the lookup failed, so we report an error 122 for
3247         protection level violation.
3248
3249         We also silently return if setter and getter are null in the
3250         resolve functions, this condition only happens if we have flagged
3251         the error before.  This is the other half of the problem. 
3252
3253         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
3254         not have accessibility information, that is why we were returning
3255         true in the filter function in typemanager.cs.
3256
3257         To properly report 122 (property is inaccessible because of its
3258         protection level) correctly, we report this error in ResolveAccess
3259         by failing if both the setter and the getter are lacking (ie, the
3260         lookup failed). 
3261
3262         DoResolve and DoLResolve have been modified to check for both
3263         setter/getter being null and returning silently, the reason being
3264         that I did not want to put the knowledge about this error in upper
3265         layers, like:
3266
3267         int old = Report.Errors;
3268         x = new PropertyExpr (...);
3269         if (old != Report.Errors)
3270                 return null;
3271         else
3272                 return x;
3273
3274         So the property expr is returned, but it is invalid, so the error
3275         will be flagged during the resolve process. 
3276
3277         * class.cs: Remove InheritablePropertySignatureCompare from the
3278         class, as we no longer depend on the property signature to compute
3279         whether it is possible to implement a method or not.
3280
3281         The reason is that calling PropertyInfo.GetGetMethod will return
3282         null (in .NET, in Mono it works, and we should change this), in
3283         cases where the Get Method does not exist in that particular
3284         class.
3285
3286         So this code:
3287
3288         class X { public virtual int A { get { return 1; } } }
3289         class Y : X { }
3290         class Z : Y { public override int A { get { return 2; } } }
3291
3292         Would fail in Z because the parent (Y) would not have the property
3293         defined.  So we avoid this completely now (because the alternative
3294         fix was ugly and slow), and we now depend exclusively on the
3295         method names.
3296
3297         (PropertyBase.CheckBase): Use a method-base mechanism to find our
3298         reference method, instead of using the property.
3299
3300         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
3301         routines are gone now.
3302
3303         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
3304         names, they were incorrectly named.
3305
3306         * cs-tokenizer.cs: Return are more gentle token on failure. 
3307
3308         * pending.cs (PendingImplementation.InterfaceMethod): This routine
3309         had an out-of-sync index variable, which caused it to remove from
3310         the list of pending methods the wrong method sometimes.
3311
3312 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
3313
3314         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
3315         CanWrite, because those refer to this particular instance of the
3316         property, and do not take into account the fact that we can
3317         override single members of a property.
3318
3319         Constructor requires an EmitContext.  The resolution process does
3320         not happen here, but we need to compute the accessors before,
3321         because the resolution does not always happen for properties.
3322         
3323         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
3324         subclass, before we did not update this flag, but we did update
3325         bindingflags. 
3326
3327         (GetAccessors): Drop this routine, as it did not work in the
3328         presence of partially overwritten set/get methods. 
3329
3330         Notice that this broke the cs1540 detection, but that will require
3331         more thinking. 
3332         
3333 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3334
3335         * class.cs:
3336         * codegen.cs:
3337         * driver.cs: issue a warning instead of an error if we don't support
3338         debugging for the platform. Also ignore a couple of errors that may
3339         arise when trying to write the symbols. Undo my previous patch.
3340
3341 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3342
3343         * driver.cs: ignore /debug switch except for Unix platforms.
3344
3345 2002-10-23  Nick Drochak  <ndrochak@gol.com>
3346
3347         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
3348
3349 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
3350
3351         * driver.cs: Do not make mcs-debug conditional, so we do not break
3352         builds that use it.
3353
3354         * statement.cs (UsageVector.MergeChildren): I would like Martin to
3355         review this patch.  But basically after all the children variables
3356         have been merged, the value of "Breaks" was not being set to
3357         new_breaks for Switch blocks.  I think that it should be set after
3358         it has executed.  Currently I set this to the value of new_breaks,
3359         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
3360         conservative, but I do not understand this code very well.
3361
3362         I did not break anything in the build, so that is good ;-)
3363
3364         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
3365
3366 2002-10-20  Mark Crichton  <crichton@gimp.org>
3367
3368         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
3369
3370 2002-10-20  Nick Drochak  <ndrochak@gol.com>
3371
3372         * cfold.cs: Fixed compile blocker.
3373
3374 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
3375
3376         * driver.cs: I was chekcing the key, not the file.
3377
3378 2002-10-19  Ravi Pratap  <ravi@ximian.com>
3379
3380         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
3381         message that we were generating - we just need to silently return
3382         a null.
3383
3384 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
3385
3386         * class.cs (Event.Define): Change my previous commit, as this
3387         breaks the debugger.  This is a temporary hack, as it seems like
3388         the compiler is generating events incorrectly to begin with.
3389
3390         * expression.cs (Binary.ResolveOperator): Added support for 
3391         "U operator - (E x, E y)"
3392
3393         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
3394         y)".
3395
3396         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
3397         init-only variables, but this path did not take into account that
3398         there might be also instance readonly variables.  Correct this
3399         problem. 
3400
3401         This fixes bug 32253
3402
3403         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
3404         delegates as well.
3405
3406         * driver.cs: Change the extension for modules to `netmodule'
3407
3408         * cs-parser.jay: Improved slightly the location tracking for
3409         the debugger symbols.
3410
3411         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
3412         modifiers that were specified instead of the hardcoded value
3413         (FamAndAssem).  This was basically ignoring the static modifier,
3414         and others.  Fixes 32429.
3415
3416         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
3417         fixed a bug in the process (32476)
3418
3419         * expression.cs (ArrayAccess.EmitAssign): Patch from
3420         hwang_rob@yahoo.ca that fixes bug 31834.3
3421
3422 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
3423
3424         * driver.cs: Make the module extension .netmodule.
3425
3426 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
3427
3428         * driver.cs: Report an error if the resource file is not found
3429         instead of crashing.
3430
3431         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
3432         false, like Emit does.
3433
3434 2002-10-16  Nick Drochak  <ndrochak@gol.com>
3435
3436         * typemanager.cs: Remove unused private member.  Also reported mcs
3437         bug to report this as a warning like csc.
3438
3439 2002-10-15  Martin Baulig  <martin@gnome.org>
3440
3441         * statement.cs (Statement.Emit): Made this a virtual method; emits
3442         the line number info and calls DoEmit().
3443         (Statement.DoEmit): New protected abstract method, formerly knows
3444         as Statement.Emit().
3445
3446         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
3447
3448 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
3449
3450         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
3451         have fixed a remaining problem: not every AddXXXX was adding a
3452         fully qualified name.  
3453
3454         Now everyone registers a fully qualified name in the DeclSpace as
3455         being defined instead of the partial name.  
3456
3457         Downsides: we are slower than we need to be due to the excess
3458         copies and the names being registered this way.  
3459
3460         The reason for this is that we currently depend (on the corlib
3461         bootstrap for instance) that types are fully qualified, because
3462         we dump all the types in the namespace, and we should really have
3463         types inserted into the proper namespace, so we can only store the
3464         basenames in the defined_names array.
3465
3466 2002-10-10  Martin Baulig  <martin@gnome.org>
3467
3468         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
3469         from bug #31834, see the bug report for a testcase which is
3470         miscompiled.
3471
3472 2002-10-10  Martin Baulig  <martin@gnome.org>
3473
3474         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
3475         flow analysis code for this.
3476
3477         * statement.cs (Do, While, For): Tell the flow analysis code about
3478         infinite loops.
3479         (FlowBranching.UsageVector): Added support for infinite loops.
3480         (Block.Resolve): Moved the dead code elimination here and use flow
3481         analysis to do it.
3482
3483 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
3484
3485         * class.cs (Field.Define): Catch cycles on struct type
3486         definitions. 
3487
3488         * typemanager.cs (IsUnmanagedtype): Do not recursively check
3489         fields if the fields are static.  We only need to check instance
3490         fields. 
3491
3492         * expression.cs (As.DoResolve): Test for reference type.
3493
3494         * statement.cs (Using.ResolveExpression): Use
3495         ConvertImplicitRequired, not ConvertImplicit which reports an
3496         error on failture
3497         (Using.ResolveLocalVariableDecls): ditto.
3498
3499         * expression.cs (Binary.ResolveOperator): Report errors in a few
3500         places where we had to.
3501
3502         * typemanager.cs (IsUnmanagedtype): Finish implementation.
3503
3504 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
3505
3506         * expression.cs: Use StoreFromPtr instead of extracting the type
3507         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
3508
3509         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3510         an enumeration value to a System.Enum, but System.Enum is not a
3511         value type, but an class type, so we need to box.
3512
3513         (Expression.ConvertExplicit): One codepath could return
3514         errors but not flag them.  Fix this.  Fixes #31853
3515
3516         * parameter.cs (Resolve): Do not allow void as a parameter type.
3517
3518 2002-10-06  Martin Baulig  <martin@gnome.org>
3519
3520         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3521         if it's a class type and not a struct.  Fixes #31815.
3522
3523 2002-10-06  Martin Baulig  <martin@gnome.org>
3524
3525         * statement.cs: Reworked the flow analysis code a bit to make it
3526         usable for dead code elimination.
3527
3528 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3529
3530         * cs-parser.jay: allow empty source files. Fixes bug #31781.
3531
3532 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3533
3534         * expression.cs (ComposedCast.DoResolveType): A quick workaround
3535         to fix the test 165, will investigate deeper.
3536
3537 2002-10-04  Martin Baulig  <martin@gnome.org>
3538
3539         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3540         finally blocks actually work.
3541         (Try.Resolve): We don't need to create a sibling for `finally' if
3542         there is no finally block.
3543
3544 2002-10-04  Martin Baulig  <martin@gnome.org>
3545
3546         * class.cs (Constructor.Define): The default accessibility for a
3547         non-default constructor is private, not public.
3548
3549 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
3550
3551         * class.cs (Constructor): Make AllowedModifiers public, add
3552         EXTERN.
3553
3554         * cs-parser.jay: Perform the modifiers test here, as the
3555         constructor for the Constructor class usually receives a zero
3556         because of the way we create it (first we create, later we
3557         customize, and we were never checking the modifiers).
3558
3559         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3560         is a version of LookupTypeReflection that includes the type-name
3561         cache.  This can be used as a fast path for functions that know
3562         the fully qualified name and are only calling into *.GetType() to
3563         obtain a composed type.
3564
3565         This is also used by TypeManager.LookupType during its type
3566         composition.
3567
3568         (LookupType): We now also track the real type name, as sometimes
3569         we can get a quey for the real type name from things like
3570         ComposedCast.  This fixes bug 31422.
3571         
3572         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3573         complete type fullname, it does not have to go through the type
3574         resolution system to obtain the composed version of the type (for
3575         obtaining arrays or pointers).
3576         
3577         (Conditional.Emit): Use the EmitBoolExpression to
3578         generate nicer code, as requested by Paolo.
3579
3580         (ArrayCreation.CheckIndices): Use the patch from
3581         hwang_rob@yahoo.ca to validate the array initializers. 
3582
3583 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
3584
3585         * class.cs (ConstructorInitializer.Emit): simplify code by using
3586         Invocation.EmitCall, and at the same time, fix the bugs in calling
3587         parent constructors that took variable arguments. 
3588
3589         * ecore.cs (Expression.ConvertNumericExplicit,
3590         Expression.ImplicitNumericConversion): Remove the code that
3591         manually wrapped decimal (InternalTypeConstructor call is now gone
3592         as well).
3593
3594         * expression.cs (Cast.TryReduce): Also handle decimal types when
3595         trying to perform a constant fold on the type.
3596
3597         * typemanager.cs (IsUnmanagedtype): Partially implemented.
3598
3599         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3600         that only turned off an error report, and did nothing else. 
3601
3602 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
3603
3604         * driver.cs: Handle and ignore /fullpaths
3605
3606 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
3607
3608         * expression.cs (Binary.ResolveOperator): Catch the case where
3609         DoNumericPromotions returns true, 
3610
3611         (Binary.DoNumericPromotions): Simplify the code, and the tests.
3612
3613 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
3614
3615         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3616         report error 70.
3617
3618 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
3619
3620         * ecore.cs (ConvertNumericExplicit): It is not enough that the
3621         conversion exists, but it is also required that the conversion be
3622         performed.  This manifested in "(Type64Enum) 2".  
3623
3624         * class.cs (TypeManager.AddMethod): The fix is not to change
3625         AddEnum, because that one was using a fully qualified name (every
3626         DeclSpace derivative does), but to change the AddMethod routine
3627         that was using an un-namespaced name.  This now correctly reports
3628         the duplicated name.
3629
3630         Revert patch until I can properly fix it.  The issue
3631         is that we have a shared Type space across all namespaces
3632         currently, which is wrong.
3633
3634         Options include making the Namespace a DeclSpace, and merge
3635         current_namespace/current_container in the parser.
3636
3637 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
3638
3639         * cs-parser.jay: Improve error reporting when we get a different
3640         kind of expression in local_variable_type and
3641         local_variable_pointer_type. 
3642
3643         Propagate this to avoid missleading errors being reported.
3644
3645         * ecore.cs (ImplicitReferenceConversion): treat
3646         TypeManager.value_type as a target just like object_type.   As
3647         code like this:
3648
3649         ValueType v = 1;
3650
3651         Is valid, and needs to result in the int 1 being boxed before it
3652         is assigned to the value type v.
3653
3654         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3655         to validate the enumeration name.
3656
3657         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3658         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
3659         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3660
3661         * ecore.cs (TryImplicitIntConversion): When doing an
3662         implicit-enumeration-conversion, check if the type is 64-bits and
3663         perform a conversion before passing to EnumConstant.
3664
3665 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
3666
3667         * decl.cs (Error_AmbiguousTypeReference); New routine used to
3668         report ambiguous type references.  Unlike the MS version, we
3669         report what the ambiguity is.   Innovation at work ;-)
3670
3671         (DeclSpace.FindType): Require a location argument to
3672         display when we display an ambiguous error.
3673
3674         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3675
3676         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3677
3678         * expression.cs (EmitDynamicInitializers): Apply patch from
3679         hwang_rob@yahoo.ca that fixes the order in which we emit our
3680         initializers. 
3681
3682 2002-09-21  Martin Baulig  <martin@gnome.org>
3683
3684         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3685         delegate takes no arguments.
3686
3687 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
3688
3689         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3690         from integers.
3691
3692         * expression.cs: Extract the underlying type.
3693
3694         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3695
3696         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3697
3698 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
3699
3700         * class.cs (TypeContainer.DefineType): We can not use the nice
3701         PackingSize with the size set to 1 DefineType method, because it
3702         will not allow us to define the interfaces that the struct
3703         implements.
3704
3705         This completes the fixing of bug 27287
3706
3707         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3708         means also structs.  This fixes part of the problem. 
3709         (Expresion.ImplicitReferenceConversionExists): ditto.
3710
3711         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3712         error if there were no errors reported during the type lookup
3713         process, to avoid duplicates or redundant errors.  Without this
3714         you would get an ambiguous errors plus a type not found.  We have
3715         beaten the user enough with the first error.  
3716
3717         (DeclSparce.FindType): Emit a warning if we have an ambiguous
3718         reference. 
3719
3720         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3721         during the resolution process, stop the lookup, this avoids
3722         repeated error reports (same error twice).
3723
3724         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3725
3726         * typemanager.cs (LookupType): Redo the type lookup code to match
3727         the needs of System.Reflection.  
3728
3729         The issue is that System.Reflection requires references to nested
3730         types to begin with a "+" sign instead of a dot.  So toplevel
3731         types look like: "NameSpace.TopLevelClass", and nested ones look
3732         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3733         levels. 
3734
3735 2002-09-19  Martin Baulig  <martin@gnome.org>
3736
3737         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3738         says that a method always returns or always throws an exception,
3739         don't report the CS0161.
3740
3741         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3742         set `Returns = new_returns'.
3743
3744 2002-09-19  Martin Baulig  <martin@gnome.org>
3745
3746         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3747         to an enum constant, check for a CS0176.
3748
3749 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
3750
3751         * class.cs (TypeContainer.CheckPairedOperators): Now we check
3752         for operators that must be in pairs and report errors.
3753
3754         * ecore.cs (SimpleName.DoResolveType): During the initial type
3755         resolution process, when we define types recursively, we must
3756         check first for types in our current scope before we perform
3757         lookups in the enclosing scopes.
3758
3759         * expression.cs (MakeByteBlob): Handle Decimal blobs.
3760
3761         (Invocation.VerifyArgumentsCompat): Call
3762         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3763         I thought we were supposed to always call this, but there are a
3764         few places in the code where we dont do it.
3765
3766 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
3767
3768         * driver.cs: Add support in -linkres and -resource to specify the
3769         name of the identifier.
3770
3771 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3772
3773         * ecore.cs (StandardConversionExists): Sync with the conversion
3774         code: allow anything-* to void* conversions.
3775
3776         (FindMostSpecificSource): Use an Expression argument
3777         instead of a Type, because we might be handed over a Literal which
3778         gets a few more implicit conversions that plain types do not.  So
3779         this information was being lost.
3780
3781         Also, we drop the temporary type-holder expression when not
3782         required.
3783
3784 2002-09-17  Martin Baulig  <martin@gnome.org>
3785
3786         * class.cs (PropertyBase.CheckBase): Don't check the base class if
3787         this is an explicit interface implementation.
3788
3789 2002-09-17  Martin Baulig  <martin@gnome.org>
3790
3791         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3792         different `IndexerName' attributes.
3793
3794         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3795         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3796         virtual CommonResolve().
3797
3798 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
3799
3800         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3801         and convert that to the UnderlyingType.
3802
3803         * statement.cs (Foreach.Resolve): Indexers are just like variables
3804         or PropertyAccesses.
3805
3806         * cs-tokenizer.cs (consume_string): Track line numbers and columns
3807         inside quoted strings, we were not doing this before.
3808
3809 2002-09-16  Martin Baulig  <martin@gnome.org>
3810
3811         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3812         resolve it.  This is needed for the definite assignment check of the
3813         instance expression, fixes bug #29846.
3814         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3815
3816 2002-09-16  Nick Drochak  <ndrochak@gol.com>
3817
3818         * parameter.cs: Fix compile error.  Cannot reference static member
3819         from an instance object.  Is this an mcs bug?
3820
3821 2002-09-14  Martin Baulig  <martin@gnome.org>
3822
3823         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3824         multiple times.  Fixes bug #30295, added test-166.cs.
3825
3826 2002-09-14  Martin Baulig  <martin@gnome.org>
3827
3828         * statement.cs (Block.Emit): Don't emit unreachable code.
3829         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3830         `break' statements.
3831         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3832
3833 2002-09-14  Martin Baulig  <martin@gnome.org>
3834
3835         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3836         is set.
3837
3838 2002-09-14  Martin Baulig  <martin@gnome.org>
3839
3840         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3841         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3842         be false on the ms runtime.
3843
3844 2002-09-13  Martin Baulig  <martin@gnome.org>
3845
3846         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3847         the CS0038 error message.
3848
3849 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
3850
3851         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3852         constant inside, return it.
3853
3854 2002-09-12  Martin Baulig  <martin@gnome.org>
3855
3856         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3857         implicit conversion can be done between enum types.
3858
3859         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3860         check whether an implicit conversion to the current enum's UnderlyingType
3861         exists and report an error if not.
3862
3863         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3864         without debugging support.
3865
3866         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3867         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
3868
3869 2002-09-12  Martin Baulig  <martin@gnome.org>
3870
3871         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3872
3873         * ecore.cs (IMemberExpr.DeclaringType): New property.
3874         (SimpleName.SimpleNameResolve): Check whether we're accessing a
3875         nonstatic member of an outer type (CS0038).
3876
3877 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
3878
3879         * driver.cs: Activate the using-error detector at warning level
3880         4 (at least for MS-compatible APIs).
3881
3882         * namespace.cs (VerifyUsing): Small buglett fix.
3883
3884         * pending.cs (PendingImplementation): pass the container pointer. 
3885
3886         * interface.cs (GetMethods): Allow for recursive definition.  Long
3887         term, I would like to move every type to support recursive
3888         definitions, not the current ordering mechanism that we have right
3889         now.
3890
3891         The situation is this: Attributes are handled before interfaces,
3892         so we can apply attributes to interfaces.  But some attributes
3893         implement interfaces, we will now handle the simple cases
3894         (recursive definitions will just get an error).  
3895
3896         * parameter.cs: Only invalidate types at the end if we fail to
3897         lookup all types.  
3898
3899 2002-09-09  Martin Baulig  <martin@gnome.org>
3900
3901         * ecore.cs (PropertyExpr.Emit): Also check for
3902         TypeManager.system_int_array_get_length so this'll also work when
3903         compiling corlib.  Fixes #30003.
3904
3905 2002-09-09  Martin Baulig  <martin@gnome.org>
3906
3907         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3908         and throw an exception if we can't get the type's size.  Fixed #30040,
3909         added test-165.cs.
3910
3911 2002-09-09  Martin Baulig  <martin@gnome.org>
3912
3913         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3914
3915         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3916         context.  Fixes bug #30027.
3917
3918         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3919         virtual functions.  Fixes bug #30043, added test-164.cs.
3920
3921 2002-09-08  Ravi Pratap  <ravi@ximian.com>
3922
3923         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3924
3925 2002-09-08  Nick Drochak  <ndrochak@gol.com>
3926
3927         * driver.cs: Use an object to get the windows codepage since it's not a
3928         static property.
3929
3930 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
3931
3932         * statement.cs (For.Emit): for infinite loops (test == null)
3933         return whether there is a break inside, not always "true".
3934
3935         * namespace.cs (UsingEntry): New struct to hold the name of the
3936         using definition, the location where it is defined, and whether it
3937         has been used in a successful type lookup.
3938         
3939         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3940         strings.
3941
3942         * decl.cs: ditto.
3943
3944 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3945
3946         * attribute.cs : Fix incorrect code which relied on catching
3947         a NullReferenceException to detect a null being passed in
3948         where an object was expected.
3949
3950 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
3951
3952         * statement.cs (Try): flag the catch variable as assigned
3953
3954         * expression.cs (Cast): Simplified by using ResolveType instead of
3955         manually resolving.
3956
3957         * statement.cs (Catch): Fix bug by using ResolveType.
3958
3959 2002-09-06  Ravi Pratap  <ravi@ximian.com>
3960
3961         * expression.cs (BetterConversion): Special case for when we have
3962         a NullLiteral as the argument and we have to choose between string
3963         and object types - we choose string the way csc does.
3964
3965         * attribute.cs (Attribute.Resolve): Catch the
3966         NullReferenceException and report error #182 since the Mono
3967         runtime no more has the bug and having this exception raised means
3968         we tried to select a constructor which takes an object and is
3969         passed a null.
3970
3971 2002-09-05  Ravi Pratap  <ravi@ximian.com>
3972
3973         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3974         message (1502, 1503) when we can't locate a method after overload
3975         resolution. This is much more informative and closes the bug
3976         Miguel reported.
3977
3978         * interface.cs (PopulateMethod): Return if there are no argument
3979         types. Fixes a NullReferenceException bug.
3980
3981         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
3982         expressions too. Previously we were checking only in one place for
3983         positional arguments leaving out named arguments.
3984
3985         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
3986         type to the enum type is not allowed. Remove code corresponding to
3987         that.
3988
3989         (ConvertNumericExplicit): Allow explicit conversions from
3990         the underlying type to enum type. This precisely follows the spec
3991         and closes a bug filed by Gonzalo.
3992         
3993 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3994
3995         * compiler.csproj:
3996         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
3997
3998 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
3999
4000         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
4001         it was important that we stored the right value after the
4002         reduction in `converted'.
4003
4004 2002-09-04  Martin Baulig  <martin@gnome.org>
4005
4006         * location.cs (Location.SymbolDocument): Use full pathnames for the
4007         source files.
4008
4009 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
4010
4011         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
4012         of the expression resolve mechanism, because that will catch the
4013         SimpleName error failures.
4014
4015         (Conditional): If we can not resolve the
4016         expression, return, do not crash.
4017
4018 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4019
4020         * cs-tokenizer.cs:
4021         (location): display token name instead of its number.
4022
4023 2002-08-28  Martin Baulig  <martin@gnome.org>
4024
4025         * expression.cs (Binary.ResolveOperator): Don't silently return
4026         but return an error if an operator cannot be applied between two
4027         enum types.
4028
4029 2002-08-28  Martin Baulig  <martin@gnome.org>
4030
4031         * class.cs (Constructor.Define): Set the permission attributes
4032         correctly instead of making all constructors public.
4033
4034 2002-08-28  Martin Baulig  <martin@gnome.org>
4035
4036         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
4037         for private members before reporting a CS0103; if we find anything,
4038         it's a CS0122.
4039
4040 2002-08-28  Martin Baulig  <martin@gnome.org>
4041
4042         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
4043         to check whether `closure_start_type == closure_invocation_type',
4044         we also need to check whether `m.DeclaringType == closure_invocation_type'
4045         before bypassing the permission checks.  We might be accessing
4046         protected/private members from the base class.
4047         (TypeManager.RealMemberLookup): Only set private_ok if private
4048         members were requested via BindingFlags.NonPublic.
4049
4050         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
4051
4052         * expression.cs (MemberAccess.ResolveMemberAccess): Set
4053         MethodGroupExpr.IsExplicitImpl if appropriate.
4054         (Invocation.DoResolve): Don't report the CS0120 for explicit
4055         interface implementations.
4056
4057 2002-08-27  Martin Baulig  <martin@gnome.org>
4058
4059         * expression.cs (Invocation.DoResolve): If this is a static
4060         method and we don't have an InstanceExpression, we must report
4061         a CS0120.
4062
4063 2002-08-25  Martin Baulig  <martin@gnome.org>
4064
4065         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
4066         `==' between a valuetype and an object.
4067
4068 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
4069
4070         * ecore.cs (TypeExpr): Provide a ToString method.
4071
4072 2002-08-24  Martin Baulig  <martin@gnome.org>
4073
4074         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
4075         now called proggie.dbg and it's a binary file.
4076
4077 2002-08-23  Martin Baulig  <martin@gnome.org>
4078
4079         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
4080
4081 2002-08-23  Martin Baulig  <martin@gnome.org>
4082
4083         * struct.cs (MyStructInfo.ctor): Make this work with empty
4084         structs; it's not allowed to use foreach() on null.
4085
4086 2002-08-23  Martin Baulig  <martin@gnome.org>
4087
4088         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
4089         writer the full pathname of the generated assembly.
4090
4091 2002-08-23  Martin Baulig  <martin@gnome.org>
4092
4093         * statements.cs (FlowBranching.UsageVector.MergeChildren):
4094         A `finally' block never returns or breaks; improved handling of
4095         unreachable code.
4096
4097 2002-08-23  Martin Baulig  <martin@gnome.org>
4098
4099         * statement.cs (Throw.Resolve): Allow `throw null'.
4100
4101 2002-08-23  Martin Baulig  <martin@gnome.org>
4102
4103         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
4104         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
4105         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
4106         MemberLookup would return a wrong event if this is an explicit
4107         interface implementation and the class has an event with the same
4108         name.
4109
4110 2002-08-23  Martin Baulig  <martin@gnome.org>
4111
4112         * statement.cs (Block.AddChildVariableNames): New public method.
4113         (Block.AddChildVariableName): Likewise.
4114         (Block.IsVariableNameUsedInChildBlock): Likewise.
4115         (Block.AddVariable): Check whether a variable name has already
4116         been used in a child block.
4117
4118         * cs-parser.jay (declare_local_variables): Mark all variable names
4119         from the current block as being used in a child block in the
4120         implicit block.
4121
4122 2002-08-23  Martin Baulig  <martin@gnome.org>
4123
4124         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
4125         find the symbol writer.
4126
4127         * driver.cs: csc also allows the arguments to /define being
4128         separated by commas, not only by semicolons.
4129
4130 2002-08-23  Martin Baulig  <martin@gnome.org>
4131
4132         * interface.cs (Interface.GetMembers): Added static check for events.
4133
4134 2002-08-15  Martin Baulig  <martin@gnome.org>
4135
4136         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
4137         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
4138
4139         * ecore.cs (Expression.MemberLookup): Added documentation and explained
4140         why the MethodData.EmitDestructor() change was necessary.
4141
4142 2002-08-20  Martin Baulig  <martin@gnome.org>
4143
4144         * class.cs (TypeContainer.FindMembers): Added static check for events.
4145
4146         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
4147
4148         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
4149         use Type.GetEvents(), not Type.FindMembers().
4150
4151 2002-08-20  Martin Baulig  <martin@gnome.org>
4152
4153         * decl.cs (MemberCache): Added a special method cache which will
4154         be used for method-only searched.  This ensures that a method
4155         search will return a MethodInfo with the correct ReflectedType for
4156         inherited methods.      
4157
4158 2002-08-20  Martin Baulig  <martin@gnome.org>
4159
4160         * decl.cs (DeclSpace.FindMembers): Made this public.
4161
4162 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4163
4164         * delegate.cs: fixed build on windows.
4165         [FIXME:  Filed as bug #29150: MCS must report these errors.]
4166
4167 2002-08-19  Ravi Pratap  <ravi@ximian.com>
4168
4169         * ecore.cs (StandardConversionExists): Return a false
4170         if we are trying to convert the void type to anything else
4171         since that is not allowed.
4172
4173         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
4174         we flag error 70 in the event an event is trying to be accessed
4175         directly from outside the declaring type.
4176
4177 2002-08-20  Martin Baulig  <martin@gnome.org>
4178
4179         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
4180         MemberCache from typemanager.cs to decl.cs.
4181
4182 2002-08-19  Martin Baulig  <martin@gnome.org>
4183
4184         * class.cs (TypeContainer): Implement IMemberContainer.
4185         (TypeContainer.DefineMembers): Create the MemberCache.
4186         (TypeContainer.FindMembers): Do better BindingFlags checking; only
4187         return public members if BindingFlags.Public was given, check
4188         whether members are static.
4189
4190 2002-08-16  Martin Baulig  <martin@gnome.org>
4191
4192         * decl.cs (DeclSpace.Define): Splitted this in Define and
4193         DefineMembers.  DefineMembers is called first and initializes the
4194         MemberCache.
4195
4196         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
4197         DefineMembers() on all our DeclSpaces.
4198
4199         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
4200         but call DefineMembers() on all nested interfaces.  We call their
4201         Define() in our new Define() function.
4202
4203         * interface.cs (Interface): Implement IMemberContainer.
4204         (Interface.Define): Moved all code except the attribute stuf to
4205         DefineMembers().
4206         (Interface.DefineMembers): Initialize the member cache.
4207
4208         * typemanager.cs (IMemberFinder): Removed this interface, we don't
4209         need this anymore since we can use MemberCache.FindMembers directly.
4210
4211 2002-08-19  Martin Baulig  <martin@gnome.org>
4212
4213         * typemanager.cs (MemberCache): When creating the cache for an
4214         interface type, add all inherited members.
4215         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
4216         to `out bool used_cache' and documented it.
4217         (TypeManager.MemberLookup): If we already used the cache in the first
4218         iteration, we don't need to do the interfaces check.
4219
4220 2002-08-19  Martin Baulig  <martin@gnome.org>
4221
4222         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
4223         here from IMemberFinder and don't implement this interface anymore.
4224         (DeclSpace.MemberCache): Moved here from IMemberFinder.
4225
4226         * typemanager.cs (IMemberFinder): This interface is now only used by
4227         classes which actually support the member cache.
4228         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
4229         since we only put DeclSpaces into this Hashtable.
4230         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
4231         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
4232
4233 2002-08-16  Martin Baulig  <martin@gnome.org>
4234
4235         * typemanager.cs (ICachingMemberFinder): Removed.
4236         (IMemberFinder.MemberCache): New property.
4237         (TypeManager.FindMembers): Merged this with RealFindMembers().
4238         This function will never be called from TypeManager.MemberLookup()
4239         so we can't use the cache here, just the IMemberFinder.
4240         (TypeManager.MemberLookup_FindMembers): Check whether the
4241         IMemberFinder has a MemberCache and call the cache's FindMembers
4242         function.
4243         (MemberCache): Rewrote larger parts of this yet another time and
4244         cleaned it up a bit.
4245
4246 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
4247
4248         * driver.cs (LoadArgs): Support quoting.
4249
4250         (Usage): Show the CSC-like command line arguments.
4251
4252         Improved a few error messages.
4253
4254 2002-08-15  Martin Baulig  <martin@gnome.org>
4255
4256         * typemanager.cs (IMemberContainer.Type): New property.
4257         (IMemberContainer.IsInterface): New property.
4258
4259         The following changes are conditional to BROKEN_RUNTIME, which is
4260         defined at the top of the file.
4261
4262         * typemanager.cs (MemberCache.MemberCache): Don't add the base
4263         class'es members, but add all members from TypeHandle.ObjectType
4264         if we're an interface.
4265         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
4266         is the current type.
4267         (MemberCache.CacheEntry.Container): Removed this field.
4268         (TypeHandle.GetMembers): Include inherited members.
4269
4270 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4271
4272         * typemanager.cs: fixed compilation and added a comment on a field that
4273         is never used.
4274
4275 2002-08-15  Martin Baulig  <martin@gnome.org>
4276
4277         * class.cs (ConstructorInitializer.Resolve): In the
4278         Expression.MemberLookup call, use the queried_type as
4279         invocation_type.
4280
4281         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
4282         declared' attribute, it's always true.
4283         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
4284         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
4285         temporary wrapper for FindMembers which tells MemberLookup whether
4286         members from the base classes are included in the return value.
4287         This will go away soon.
4288         (TypeManager.MemberLookup): Use this temporary hack here; once the
4289         new MemberCache is completed, we don't need to do the DeclaredOnly
4290         looping here anymore since the MemberCache will take care of this.
4291         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
4292         (MemberCache): When creating the MemberCache for a class, get
4293         members from the current class and all its base classes.
4294         (MemberCache.CacheEntry.Container): New field.  This is a
4295         temporary hack until the Mono runtime is fixed to distinguish
4296         between ReflectedType and DeclaringType.  It allows us to use MCS
4297         with both the MS runtime and the unfixed Mono runtime without
4298         problems and without accecting performance.
4299         (MemberCache.SearchMembers): The DeclaredOnly looping from
4300         TypeManager.MemberLookup is now done here.      
4301
4302 2002-08-14  Martin Baulig  <martin@gnome.org>
4303
4304         * statement.cs (MyStructInfo.MyStructInfo): Don't call
4305         Type.GetFields on dynamic types but get the fields from the
4306         corresponding TypeContainer.
4307         (MyStructInfo.GetStructInfo): Added check for enum types.
4308
4309         * typemanager.cs (MemberList.IsSynchronized): Implemented.
4310         (MemberList.SyncRoot): Implemented.
4311         (TypeManager.FilterWithClosure): No need to check permissions if
4312         closure_start_type == closure_invocation_type, don't crash if
4313         closure_invocation_type is null.
4314
4315 2002-08-13  Martin Baulig  <martin@gnome.org>
4316
4317         Rewrote TypeContainer.FindMembers to use a member cache.  This
4318         gives us a speed increase of about 35% for the self-hosting MCS
4319         build and of about 15-20% for the class libs (both on GNU/Linux).
4320
4321         * report.cs (Timer): New class to get enhanced profiling.  This
4322         whole class is "TIMER" conditional since it remarkably slows down
4323         compilation speed.
4324
4325         * class.cs (MemberList): New class.  This is an IList wrapper
4326         which we're now using instead of passing MemberInfo[]'s around to
4327         avoid copying this array unnecessarily.
4328         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
4329         (ICachingMemberFinder, IMemberContainer): New interface.
4330         (TypeManager.FilterWithClosure): If `criteria' is null, the name
4331         has already been checked, otherwise use it for the name comparision.
4332         (TypeManager.FindMembers): Renamed to RealMemberFinder and
4333         provided wrapper which tries to use ICachingMemberFinder.FindMembers
4334         if possible.  Returns a MemberList, not a MemberInfo [].
4335         (TypeHandle): New class, implements IMemberContainer.  We create
4336         one instance of this class per type, it contains a MemberCache
4337         which is used to do the member lookups.
4338         (MemberCache): New class.  Each instance of this class contains
4339         all members of a type and a name-based hash table.
4340         (MemberCache.FindMembers): This is our new member lookup
4341         function.  First, it looks up all members of the requested name in
4342         the hash table.  Then, it walks this list and sorts out all
4343         applicable members and returns them.
4344
4345 2002-08-13  Martin Baulig  <martin@gnome.org>
4346
4347         In addition to a nice code cleanup, this gives us a performance
4348         increase of about 1.4% on GNU/Linux - not much, but it's already
4349         half a second for the self-hosting MCS compilation.
4350
4351         * typemanager.cs (IMemberFinder): New interface.  It is used by
4352         TypeManager.FindMembers to call FindMembers on a TypeContainer,
4353         Enum, Delegate or Interface.
4354         (TypeManager.finder_to_member_finder): New PtrHashtable.
4355         (TypeManager.finder_to_container): Removed.
4356         (TypeManager.finder_to_delegate): Removed.
4357         (TypeManager.finder_to_interface): Removed.
4358         (TypeManager.finder_to_enum): Removed.
4359
4360         * interface.cs (Interface): Implement IMemberFinder.
4361
4362         * delegate.cs (Delegate): Implement IMemberFinder.
4363
4364         * enum.cs (Enum): Implement IMemberFinder.
4365
4366         * class.cs (TypeContainer): Implement IMemberFinder.
4367
4368 2002-08-12  Martin Baulig  <martin@gnome.org>
4369
4370         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
4371
4372 2002-08-12  Martin Baulig  <martin@gnome.org>
4373
4374         * ecore.cs (ITypeExpression): New interface for expressions which
4375         resolve to a type.
4376         (TypeExpression): Renamed to TypeLookupExpression.
4377         (Expression.DoResolve): If we're doing a types-only lookup, the
4378         expression must implement the ITypeExpression interface and we
4379         call DoResolveType() on it.
4380         (SimpleName): Implement the new ITypeExpression interface.
4381         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
4382         hack, the situation that we're only looking up types can't happen
4383         anymore when this method is called.  Moved the type lookup code to
4384         DoResolveType() and call it.
4385         (SimpleName.DoResolveType): This ITypeExpression interface method
4386         is now doing the types-only lookup.
4387         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
4388         (ResolveFlags): Added MaskExprClass.
4389
4390         * expression.cs (MemberAccess): Implement the ITypeExpression
4391         interface.
4392         (MemberAccess.DoResolve): Added support for a types-only lookup
4393         when we're called via ITypeExpression.DoResolveType().
4394         (ComposedCast): Implement the ITypeExpression interface.
4395
4396         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
4397         Expression.Resolve() with ResolveFlags.Type instead.
4398
4399 2002-08-12  Martin Baulig  <martin@gnome.org>
4400
4401         * interface.cs (Interface.Define): Apply attributes.
4402
4403         * attribute.cs (Attribute.ApplyAttributes): Added support for
4404         interface attributes.
4405
4406 2002-08-11  Martin Baulig  <martin@gnome.org>
4407
4408         * statement.cs (Block.Emit): Only check the "this" variable if we
4409         do not always throw an exception.
4410
4411         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
4412         whether the property has a set accessor.
4413
4414 2002-08-11  Martin Baulig  <martin@gnome.org>
4415
4416         Added control flow analysis support for structs.
4417
4418         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
4419         with control flow analysis turned off.
4420         (IVariable): New interface.
4421         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
4422         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
4423         (FieldExpr.DoResolve): Resolve the instance expression with flow
4424         analysis turned off and do the definite assignment check after the
4425         resolving when we know what the expression will resolve to.
4426
4427         * expression.cs (LocalVariableReference, ParameterReference):
4428         Implement the new IVariable interface, only call the flow analysis
4429         code if ec.DoFlowAnalysis is true.
4430         (This): Added constructor which takes a Block argument.  Implement
4431         the new IVariable interface.
4432         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
4433         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
4434         This does the definite assignment checks for struct members.
4435
4436         * class.cs (Constructor.Emit): If this is a non-static `struct'
4437         constructor which doesn't have any initializer, call
4438         Block.AddThisVariable() to tell the flow analysis code that all
4439         struct elements must be initialized before control returns from
4440         the constructor.
4441
4442         * statement.cs (MyStructInfo): New public class.
4443         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
4444         argument to this indexer.  If non-zero, check an individual struct
4445         member, not the whole struct.
4446         (FlowBranching.CheckOutParameters): Check struct members.
4447         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
4448         overloaded versions of these methods which take an additional
4449         `int field_idx' argument to check struct members.
4450         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
4451         overloaded versions of these methods which take an additional
4452         `string field_name' argument to check struct member.s
4453         (VariableInfo): Implement the IVariable interface.
4454         (VariableInfo.StructInfo): New public property.  Returns the
4455         MyStructInfo instance of the variable if it's a struct or null.
4456         (Block.AddThisVariable): New public method.  This is called from
4457         Constructor.Emit() for non-static `struct' constructor which do
4458         not have any initializer.  It creates a special variable for the
4459         "this" instance variable which will be checked by the flow
4460         analysis code to ensure that all of the struct's fields are
4461         initialized before control returns from the constructor.
4462         (UsageVector): Added support for struct members.  If a
4463         variable/parameter is a struct with N members, we reserve a slot
4464         in the usage vector for each member.  A struct is considered fully
4465         initialized if either the struct itself (slot 0) or all its
4466         members are initialized.
4467
4468 2002-08-08  Martin Baulig  <martin@gnome.org>
4469
4470         * driver.cs (Driver.MainDriver): Only report an error CS5001
4471         if there were no compilation errors.
4472
4473         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
4474         `UnsafeContext' property to determine whether the parent is in
4475         unsafe context rather than checking the parent's ModFlags:
4476         classes nested in an unsafe class are unsafe as well.
4477
4478 2002-08-08  Martin Baulig  <martin@gnome.org>
4479
4480         * statement.cs (UsageVector.MergeChildren): Distinguish between
4481         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
4482         we return.  Added test17() and test18() to test-154.cs.
4483
4484 2002-08-08  Martin Baulig  <martin@gnome.org>
4485
4486         * typemanager.cs (TypeManager.FilterWithClosure): If we have
4487         Family access, make sure the invoking type isn't a subclass of the
4488         queried type (that'd be a CS1540).
4489
4490         * ecore.cs (Expression.MemberLookup): Added overloaded version of
4491         this method which takes an additional `Type invocation_type'.
4492
4493         * expression.cs (BaseAccess.DoResolve): Use the base type as
4494         invocation and query type.
4495         (MemberAccess.DoResolve): If the lookup failed and we're about to
4496         report a CS0122, try a lookup with the ec.ContainerType - if this
4497         succeeds, we must report a CS1540.
4498
4499 2002-08-08  Martin Baulig  <martin@gnome.org>
4500
4501         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
4502         (MethodGroupExpr): Implement the IMemberExpr interface.
4503
4504         * expression (MemberAccess.ResolveMemberAccess): No need to have
4505         any special code for MethodGroupExprs anymore, they're now
4506         IMemberExprs.   
4507
4508 2002-08-08  Martin Baulig  <martin@gnome.org>
4509
4510         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4511         Family, FamANDAssem and FamORAssem permissions.
4512         (TypeManager.IsSubclassOrNestedChildOf): New public method.
4513
4514 2002-08-08  Martin Baulig  <martin@gnome.org>
4515
4516         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4517         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4518         or loop block.
4519
4520 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4521
4522         * driver.cs: implemented /resource option to embed managed resources.
4523
4524 2002-08-07  Martin Baulig  <martin@gnome.org>
4525
4526         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4527         (FieldBase.HasFieldInitializer): New public property.
4528         (FieldBase.GetInitializerExpression): New public method.  Resolves and
4529         returns the field initializer and makes sure it is only resolved once.
4530         (TypeContainer.EmitFieldInitializers): Call
4531         FieldBase.GetInitializerExpression to get the initializer, this ensures
4532         that it isn't resolved multiple times.
4533
4534         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
4535         the resolving process (SimpleName/MemberLookup) that we're currently
4536         emitting a field initializer (which must not access any instance members,
4537         this is an error CS0236).
4538
4539         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4540         argument, if the `IsFieldInitializer' flag is set, we must report and
4541         error CS0236 and not an error CS0120.   
4542
4543 2002-08-07  Martin Baulig  <martin@gnome.org>
4544
4545         * ecore.cs (IMemberExpr): New public interface.
4546         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4547         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4548         if the expression is an IMemberExpr.
4549
4550         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4551         to be null, implicitly default to `this' if we're non-static in
4552         this case.  Simplified the code a lot by using the new IMemberExpr
4553         interface.  Also fixed bug #28176 here.
4554
4555 2002-08-06  Martin Baulig  <martin@gnome.org>
4556
4557         * cs-parser.jay (SimpleLookup): Removed.  We need to create
4558         ParameterReferences during semantic analysis so that we can do a
4559         type-only search when resolving Cast, TypeOf and SizeOf.
4560         (block): Pass the `current_local_parameters' to the Block's
4561         constructor.
4562
4563         * class.cs (ConstructorInitializer): Added `Parameters parameters'
4564         argument to the constructor.
4565         (ConstructorInitializer.Resolve): Create a temporary implicit
4566         block with the parameters.
4567
4568         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4569         references here if we aren't doing a type-only search.
4570
4571         * statement.cs (Block): Added constructor which takes a
4572         `Parameters parameters' argument.
4573         (Block.Parameters): New public property.
4574
4575         * support.cs (InternalParameters.Parameters): Renamed `parameters'
4576         to `Parameters' and made it public readonly.
4577
4578 2002-08-06  Martin Baulig  <martin@gnome.org>
4579
4580         * ecore.cs (Expression.Warning): Made this public as well.
4581
4582         * report.cs (Report.Debug): Print the contents of collections.
4583
4584 2002-08-06  Martin Baulig  <martin@gnome.org>
4585
4586         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
4587         used to tell Resolve() which kinds of expressions it may return.
4588         (Expression.Resolve): Added overloaded version of this method which
4589         takes a `ResolveFlags flags' argument.  This can be used to tell
4590         Resolve() which kinds of expressions it may return.  Reports a
4591         CS0118 on error.
4592         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4593         ResolveFlags.SimpleName.
4594         (Expression.Error118): Added overloaded version of this method which
4595         takes a `ResolveFlags flags' argument.  It uses the flags to determine
4596         which kinds of expressions are allowed.
4597
4598         * expression.cs (Argument.ResolveMethodGroup): New public method.
4599         Resolves an argument, but allows a MethodGroup to be returned.
4600         This is used when invoking a delegate.
4601
4602         * TODO: Updated a bit.
4603
4604 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4605
4606         Fixed compilation with csc.
4607
4608         * ecore.cs: Expression.Error made public. Is this correct? Should
4609         Warning be made public too?
4610
4611         * expression.cs: use ea.Location instead of ea.loc.
4612         [FIXME:  Filed as bug #28607: MCS must report these errors.]
4613
4614 2002-08-06  Martin Baulig  <martin@gnome.org>
4615
4616         * ecore.cs (Expression.loc): Moved the location here instead of
4617         duplicating it in all derived classes.
4618         (Expression.Location): New public property.
4619         (Expression.Error, Expression.Warning): Made them non-static and
4620         removed the location argument.
4621         (Expression.Warning): Added overloaded version which takes an
4622         `int level' argument.
4623         (Expression.Error118): Make this non-static and removed the
4624         expression and location arguments.
4625         (TypeExpr): Added location argument to the constructor.
4626
4627         * expression.cs (StaticCallExpr): Added location argument to
4628         the constructor.
4629         (Indirection, PointerArithmetic): Likewise.
4630         (CheckedExpr, UnCheckedExpr): Likewise.
4631         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4632         (StringPtr): Likewise.
4633
4634
4635 2002-08-05  Martin Baulig  <martin@gnome.org>
4636
4637         * expression.cs (BaseAccess.DoResolve): Actually report errors.
4638
4639         * assign.cs (Assign.DoResolve): Check whether the source
4640         expression is a value or variable.
4641
4642         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4643         while resolving the corresponding blocks.
4644
4645         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4646         an error, don't silently return null.
4647
4648         * statement.cs (Block.AddVariable): Do the error reporting here
4649         and distinguish between CS0128 and CS0136.
4650         (Block.DoResolve): Report all unused labels (warning CS0164).
4651         (LabeledStatement): Pass the location to the constructor.
4652         (LabeledStatement.HasBeenReferenced): New property.
4653         (LabeledStatement.Resolve): Set it to true here.
4654
4655         * statement.cs (Return.Emit): Return success even after reporting
4656         a type mismatch error (CS0126 or CS0127), this is what csc does and
4657         it avoids confusing the users with any consecutive errors.
4658
4659 2002-08-05  Martin Baulig  <martin@gnome.org>
4660
4661         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4662
4663         * const.cs (Const.LookupConstantValue): Catch circular definitions.
4664
4665         * expression.cs (MemberAccess.DoResolve): Silently return if an
4666         error has already been reported.
4667
4668         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4669         error has already been reported.
4670
4671 2002-08-05  Martin Baulig  <martin@gnome.org>
4672
4673         * statement.cs (UsageVector): Only initialize the `parameters'
4674         vector if we actually have any "out" parameters.
4675
4676 2002-08-05  Martin Baulig  <martin@gnome.org>
4677
4678         * expression.cs (Binary.ResolveOperator): When combining delegates,
4679         they must have the same type.
4680
4681 2002-08-05  Martin Baulig  <martin@gnome.org>
4682
4683         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4684         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4685         work with the ms runtime and we also don't need it: if we're a
4686         PropertyBuilder and not in the `indexer_arguments' hash, then we
4687         are a property and not an indexer.
4688
4689         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4690         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4691         since the latter one doesn't work with the ms runtime.
4692
4693 2002-08-03  Martin Baulig  <martin@gnome.org>
4694
4695         Fixed bugs #27998 and #22735.
4696
4697         * class.cs (Method.IsOperator): New public field.
4698         (Method.CheckBase): Report CS0111 if there's already a method
4699         with the same parameters in the current class.  Report CS0508 when
4700         attempting to change the return type of an inherited method.
4701         (MethodData.Emit): Report CS0179 if a method doesn't have a body
4702         and it's not marked abstract or extern.
4703         (PropertyBase): New abstract base class for Property and Indexer.
4704         (PropertyBase.CheckBase): Moved here from Property and made it work
4705         for indexers.
4706         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4707         the same so we can reuse it there.
4708         (Property, Indexer): Derive from PropertyBase.
4709         (MethodSignature.inheritable_property_signature_filter): New delegate
4710         to find properties and indexers.
4711
4712         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4713         argument and improved error reporting.
4714
4715         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4716         EmptyReadOnlyParameters and made it a property.
4717
4718         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4719         version of this method which takes a `PropertyInfo indexer'.
4720         (TypeManager.RegisterIndexer): New method.
4721
4722         * class.cs: Added myself as author of this file :-)
4723
4724 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4725
4726         * class.cs: fixed compilation on windoze.
4727
4728 2002-08-03  Martin Baulig  <martin@gnome.org>
4729
4730         * interface.cs (Interface.GetInterfaceBases): Check whether all
4731         base interfaces are at least as accessible than the current one.
4732
4733         * class.cs (TypeContainer.GetClassBases): Check whether base types
4734         are at least as accessible than the current type.
4735         (TypeContainer.AsAccessible): Implemented and made non-static.
4736         (MemberBase.CheckParameters): Report errors if the accessibility
4737         checks fail.
4738
4739         * delegate.cs (Delegate.Delegate): The default visibility is
4740         internal for top-level types and private for nested types.
4741         (Delegate.Define): Report errors if the accessibility checks fail.
4742
4743         * enum.cs (Enum.Enum): The default visibility is internal for
4744         top-level types and private for nested types.
4745         (Enum.DefineType): Compute the correct visibility.
4746
4747         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4748         function which takes a `bool is_toplevel' instead of a TypeContainer.
4749
4750         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4751         builtin type.
4752
4753 2002-08-02  Martin Baulig  <martin@gnome.org>
4754
4755         * expression.cs (LocalVariableReferenc): Added constructor which
4756         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4757         (LocalVariableReference.IsReadOnly): New property.
4758         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4759         variable is readonly, use our own readonly flag to do this; you can
4760         use the new constructor to get a writable reference to a read-only
4761         variable.
4762
4763         * cs-parser.jay (foreach_statement, using_statement): Get a writable
4764         reference to the local variable.
4765
4766 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
4767
4768         * rootcontext.cs (ResolveCore): Also include System.Exception
4769
4770         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4771         we reach an EmptyStatement.
4772
4773         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4774         is also fine.
4775
4776         * expression.cs (Binary.ResolveOperator): Check error result in
4777         two places.
4778
4779         use brtrue/brfalse directly and avoid compares to null.
4780
4781 2002-08-02  Martin Baulig  <martin@gnome.org>
4782
4783         * class.cs (TypeContainer.Define): Define all nested interfaces here.
4784         Fixes bug #28407, added test-155.cs.
4785
4786 2002-08-01  Martin Baulig  <martin@gnome.org>
4787
4788         * class.cs (Event.EmitDefaultMethod): Make this work with static
4789         events.  Fixes #28311, added verify-3.cs.
4790
4791 2002-08-01  Martin Baulig  <martin@gnome.org>
4792
4793         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4794         `is_disposable' fields.
4795         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4796         `hm.is_disposable' if we're using the collection pattern.
4797         (Foreach.EmitCollectionForeach): Use the correct type for the
4798         enumerator's local variable, only emit the try/finally block if
4799         necessary (fixes #27713).
4800
4801 2002-08-01  Martin Baulig  <martin@gnome.org>
4802
4803         * ecore.cs (Expression.report118): Renamed to Error118 and made
4804         it public static.
4805
4806         * statement.cs (Throw.Resolve): Check whether the expression is of
4807         the correct type (CS0118) and whether the type derives from
4808         System.Exception (CS0155).
4809         (Catch.Resolve): New method.  Do the type lookup here and check
4810         whether it derives from System.Exception (CS0155).
4811         (Catch.CatchType, Catch.IsGeneral): New public properties.
4812
4813         * typemanager.cs (TypeManager.exception_type): Added.
4814
4815 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
4816
4817         * driver.cs: Updated About function.
4818
4819 2002-07-31  Martin Baulig  <martin@gnome.org>
4820
4821         Implemented Control Flow Analysis.
4822
4823         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4824         (EmitContext.CurrentBranching): Added.
4825         (EmitContext.StartFlowBranching): Added.
4826         (EmitContext.EndFlowBranching): Added.
4827         (EmitContext.KillFlowBranching): Added.
4828         (EmitContext.IsVariableAssigned): Added.
4829         (EmitContext.SetVariableAssigned): Added.
4830         (EmitContext.IsParameterAssigned): Added.
4831         (EmitContext.SetParameterAssigned): Added.
4832         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4833         Added control flow analysis stuff here.
4834
4835         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4836         resolve the expression as lvalue.
4837         (LocalVariableReference.DoResolve): Check whether the variable has
4838         already been assigned.
4839         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4840         the parameter as assigned here.
4841         (ParameterReference.DoResolve): Check whether the parameter has already
4842         been assigned.
4843         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4844         expression as lvalue.
4845
4846         * statement.cs (FlowBranching): New class for the flow analysis code.
4847         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4848         (LabeledStatement.IsDefined): New public property.
4849         (LabeledStatement.AddUsageVector): New public method to tell flow
4850         analyis that the label may be reached via a forward jump.
4851         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4852         flow analysis.
4853         (VariableInfo.Number): New public field.  This is used by flow analysis
4854         to number all locals of a block.
4855         (Block.CountVariables): New public property.  This is the number of
4856         local variables in this block (including the locals from all parent
4857         blocks).
4858         (Block.EmitMeta): Number all the variables.
4859
4860         * statement.cs: Added flow analysis support to all classes.
4861
4862 2002-07-31  Martin Baulig  <martin@gnome.org>
4863
4864         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4865         To get debugging messages, compile mcs with /define:MCS_DEBUG and
4866         then use this argument.
4867
4868         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4869
4870         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4871         use this to specify /define options.
4872
4873 2002-07-29  Martin Baulig  <martin@gnome.org>
4874
4875         * statement.cs (Fixed): Moved all code that does variable lookups
4876         and resolvings from Emit to Resolve.
4877
4878         * statement.cs (For): Moved all code that does variable lookups
4879         and resolvings from Emit to Resolve.
4880
4881         * statement.cs (Using): Moved all code that does variable lookups
4882         and resolvings from Emit to Resolve.
4883
4884 2002-07-29  Martin Baulig  <martin@gnome.org>
4885
4886         * attribute.cs (Attribute.Resolve): Explicitly catch a
4887         System.NullReferenceException when creating the
4888         CustromAttributeBuilder and report a different warning message.
4889
4890 2002-07-29  Martin Baulig  <martin@gnome.org>
4891
4892         * support.cs (ParameterData.ParameterName): Added method to
4893         get the name of a parameter.
4894
4895         * typemanager.cs (TypeManager.IsValueType): New public method.
4896
4897 2002-07-29  Martin Baulig  <martin@gnome.org>
4898
4899         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
4900         is a flag which specifies that it's either ref or out.
4901         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4902         the out parameter to `out Parameter.Modifier mod', also set the
4903         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4904
4905         * support.cs (InternalParameters.ParameterModifier): Distinguish
4906         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4907         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4908
4909         * expression.cs (Argument.GetParameterModifier): Distinguish
4910         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4911         Parameter.Modifier.ISBYREF flag if it's either ref or out.
4912
4913 2002-07-29  Martin Baulig  <martin@gnome.org>
4914
4915         * expression.cs (ParameterReference.ParameterReference): Added
4916         `Location loc' argument to the constructor.
4917
4918         * cs-parser.jay: Pass location to ParameterReference.
4919
4920 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
4921
4922         * statement.cs (Try): Initialize the location.
4923
4924         * cs-parser.jay: pass location to Try.
4925
4926         * expression.cs (Unary.Reduce): Change the prototype to return
4927         whether a constant fold could be performed or not.  The result is
4928         returned in an out parameters.  In the case of Indirection and
4929         AddressOf, we want to perform the full tests.
4930
4931 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
4932
4933         * statement.cs (Statement.Emit): Flag dead code.
4934
4935 2002-07-27  Andrew Birkett  <andy@nobugs.org>
4936
4937         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4938
4939 2002-07-27  Martin Baulig  <martin@gnome.org>
4940
4941         * class.cs (MethodData.Define): Put back call to
4942         TypeManager.AddMethod(), accidentally commented this out.
4943
4944         * report.cs (Debug): New public method to print debugging information,
4945         this is `[Conditional ("DEBUG")]'.
4946
4947 2002-07-26  Martin Baulig  <martin@gnome.org>
4948
4949         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4950         (switch_statement): Push the current_block to the switch_stack and
4951         pop it again when we're done with the switch.
4952         (switch_section): The new block is a child of the current_block.
4953         Fixes bug #24007, added test-152.cs.
4954
4955 2002-07-27  Martin Baulig  <martin@gnome.org>
4956
4957         * expression.cs (Invocation.EmitArguments): When calling a varargs
4958         function with only its fixed arguments, we need to pass an empty
4959         array.
4960
4961 2002-07-27  Martin Baulig  <martin@gnome.org>
4962
4963         Mono 0.13 has been released.
4964
4965 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
4966
4967         * driver.cs: Rename --resource to --linkres, because that is what
4968         we do currently, we dont support --resource yet.
4969
4970         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4971
4972 2002-07-25  Martin Baulig  <martin@gnome.org>
4973
4974         * class.cs (MethodData): New public class.  This is a `method builder'
4975         class for a method or one accessor of a Property/Indexer/Event.
4976         (MethodData.GetMethodFlags): Moved here from MemberBase.
4977         (MethodData.ApplyAttributes): Likewise.
4978         (MethodData.ApplyObsoleteAttribute): Likewise.
4979         (MethodData.ApplyConditionalAttribute): Likewise.
4980         (MethodData.ApplyDllImportAttribute): Likewise.
4981         (MethodData.CheckAbstractAndExternal): Likewise.
4982         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
4983         (MethodData.Emit): Formerly known as Method.Emit().
4984         (MemberBase): Moved everything which was specific to a single
4985         accessor/method to MethodData.
4986         (Method): Create a new MethodData and call Define() and Emit() on it.
4987         (Property, Indexer, Event): Create a new MethodData objects for each
4988         accessor and call Define() and Emit() on them.
4989
4990 2002-07-25  Martin Baulig  <martin@gnome.org>
4991
4992         Made MethodCore derive from MemberBase to reuse the code from there.
4993         MemberBase now also checks for attributes.
4994
4995         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
4996         (MemberBase.GetMethodFlags): Moved here from class Method and marked
4997         as virtual.
4998         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
4999         `CallingConventions cc' and `Attributes opt_attrs' arguments.
5000         (MemberBase.ApplyAttributes): New virtual method; applies the
5001         attributes to a method or accessor.
5002         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
5003         (MemberBase.ApplyConditionalAttribute): Likewise.
5004         (MemberBase.ApplyDllImportAttribute): Likewise.
5005         (MemberBase.CheckAbstractAndExternal): Likewise.
5006         (MethodCore.ParameterTypes): This is now a property instead of a
5007         method, it's initialized from DoDefineParameters().
5008         (MethodCore.ParameterInfo): Removed the set accessor.
5009         (MethodCore.DoDefineParameters): New protected virtual method to
5010         initialize ParameterTypes and ParameterInfo.
5011         (Method.GetReturnType): We can now simply return the MemberType.
5012         (Method.GetMethodFlags): Override the MemberBase version and add
5013         the conditional flags.
5014         (Method.CheckBase): Moved some code from Define() here, call
5015         DoDefineParameters() here.
5016         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
5017         here to avoid some larger code duplication.
5018         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
5019         ensure that abstract and external accessors don't declare a body.
5020
5021         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
5022         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
5023         lookup in the attribute's parent classes, so we need to abort as soon
5024         as we found the first match.
5025         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
5026         the attribute has no arguments.
5027
5028         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
5029         of a Method.
5030
5031 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5032
5033         * cs-parser.jay: reverted previous patch.
5034
5035 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5036
5037         * cs-parser.jay: fixed bug #22119.
5038
5039 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5040
5041         * attribute.cs: fixed compilation. The error was:
5042         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
5043         be assigned to before control leaves the current method."
5044         [FIXME:  Filed as bug #28186: MCS must report this error.]
5045
5046 2002-07-25  Martin Baulig  <martin@gnome.org>
5047
5048         * attribute.cs (Attribute.Conditional_GetConditionName): New static
5049         method to pull the condition name ouf of a Conditional attribute.
5050         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
5051         the obsolete message and error flag out of an Obsolete attribute.
5052
5053         * class.cs (Method.GetMethodFlags): New public method to get the
5054         TypeManager.MethodFlags for this method.
5055         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
5056         private methods.
5057         (Method.Define): Get and apply the Obsolete and Conditional attributes;
5058         if we're overriding a virtual function, set the new private variable
5059         `parent_method'; call the new TypeManager.AddMethod().
5060
5061         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
5062         the MethodBuilder and the Method in a PtrHashtable.
5063         (TypeManager.builder_to_method): Added for this purpose.
5064         (TypeManager.MethodFlags): Added IsObsoleteError.
5065         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
5066         Obsolete and Conditional arguments in MethodBuilders.  If we discover
5067         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
5068         the message from the attribute.
5069
5070 2002-07-24  Martin Baulig  <martin@gnome.org>
5071
5072         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
5073         preprocessor directives, ensure that the argument to #define/#undef is
5074         exactly one identifier and that it's actually an identifier.
5075
5076         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
5077         did not work ....
5078
5079 2002-07-24  Martin Baulig  <martin@gnome.org>
5080
5081         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
5082         initialize it to TypeManager.object_type in the constructor.
5083         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
5084         of the `hm.get_current' method if we're using the collection pattern.
5085         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
5086         for the explicit conversion to make it work when we're using the collection
5087         pattern and the `Current' property has a different return type than `object'.
5088         Fixes #27713.
5089
5090 2002-07-24  Martin Baulig  <martin@gnome.org>
5091
5092         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
5093         does not match, but don't report any errors.  This method is called in
5094         order for all methods in a MethodGroupExpr until a matching method is
5095         found, so we don't want to bail out if the first method doesn't match.
5096         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
5097         matches, report the 123.  Fixes #28070.
5098
5099 2002-07-24  Martin Baulig  <martin@gnome.org>
5100
5101         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
5102         TypeManager.TypeToCoreType() to the top of the method so the
5103         following equality checks will work.  Fixes #28107.
5104
5105 2002-07-24  Martin Baulig  <martin@gnome.org>
5106
5107         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
5108         operand is of type uint, and the other operand is of type sbyte,
5109         short or int, the operands are converted to type long." -
5110         Actually do what this comment already told us.  Fixes bug #28106,
5111         added test-150.cs.
5112
5113 2002-07-24  Martin Baulig  <martin@gnome.org>
5114
5115         * class.cs (MethodBase): New abstract class.  This is now a base
5116         class for Property, Indexer and Event to avoid some code duplication
5117         in their Define() and DefineMethods() methods.
5118         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
5119         generic methods for Define() and DefineMethods().
5120         (FieldBase): Derive from MemberBase, not MemberCore.
5121         (Property): Derive from MemberBase, not MemberCore.
5122         (Property.DefineMethod): Moved all the code from this method to the
5123         new MethodBase.DefineAccessor(), just call it with appropriate
5124         argumetnts.
5125         (Property.Define): Call the new Property.DoDefine(), this does some
5126         sanity checks and we don't need to duplicate the code everywhere.
5127         (Event): Derive from MemberBase, not MemberCore.
5128         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
5129         accessors, this will also make them work with interface events.
5130         (Indexer): Derive from MemberBase, not MemberCore.
5131         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
5132         (Indexer.Define): Use the new MethodBase functions.
5133
5134         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
5135         argument to the constructor.
5136         (Interface.FindMembers): Added support for interface events.
5137         (Interface.PopluateEvent): Implemented.
5138
5139         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
5140
5141 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
5142
5143         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
5144         but this is required to check for a method name being the same as
5145         the containing class.  
5146
5147         Handle this now.
5148
5149 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5150
5151         * interface.cs: initialize variable.
5152
5153 2002-07-23  Martin Baulig  <martin@gnome.org>
5154
5155         Implemented the IndexerName attribute in interfaces.
5156
5157         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
5158         name if this is an explicit interface implementation.
5159         (Indexer.InterfaceIndexerName): New public variable.  If we're
5160         implementing an interface indexer, this is the IndexerName in that
5161         interface.  Otherwise, it's the IndexerName.
5162         (Indexer.DefineMethod): If we're implementing interface indexer,
5163         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
5164         and Pending.ImplementIndexer methods.
5165         (Indexer.Define): Also define the PropertyBuilder if we're
5166         implementing an interface indexer and this is neither an explicit
5167         interface implementation nor do the IndexerName match the one in
5168         the interface.
5169
5170         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
5171         If a method is defined here, then we always need to create a proxy
5172         for it.  This is used when implementing interface indexers.
5173         (Pending.IsInterfaceIndexer): New public method.
5174         (Pending.ImplementIndexer): New public method.
5175         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
5176         This is used when implementing interface indexers to define a proxy
5177         if necessary.
5178         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
5179         define a proxy if necessary.
5180
5181         * interface.cs (Interface.IndexerName): New public variable.
5182         (Interface.PopulateIndexer): Set the IndexerName.
5183         (Interface.DefineIndexers): New private method.  Populate all the
5184         indexers and make sure their IndexerNames match.
5185
5186         * typemanager.cs (IndexerPropertyName): Added support for interface
5187         indexers.
5188
5189 2002-07-22  Martin Baulig  <martin@gnome.org>
5190
5191         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
5192         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
5193         ret if HasReturnLabel.
5194         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
5195         variables.
5196
5197         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
5198         and set the ec.LoopBeginTryCatchLevel.
5199         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
5200         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
5201         the current ec.TryCatchLevel, the branch goes out of an exception
5202         block.  In this case, we need to use Leave and not Br.
5203
5204 2002-07-22  Martin Baulig  <martin@gnome.org>
5205
5206         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
5207         block unless the block does not always return or it is contained in
5208         another try { ... } catch { ... } block.  Fixes bug #26506.
5209         Added verify-1.cs to the test suite.
5210
5211 2002-07-22  Martin Baulig  <martin@gnome.org>
5212
5213         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
5214         then we do not always return.  Fixes bug #24985.
5215
5216 2002-07-22  Martin Baulig  <martin@gnome.org>
5217
5218         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
5219         lookup on a per-class level; ie. walk up the class hierarchy until we
5220         found at least one applicable method, then choose the best among them.
5221         Fixes bug #24463 and test-29.cs.
5222
5223 2002-07-22  Martin Baulig  <martin@gnome.org>
5224
5225         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
5226         return types of the methods.  The return type is not part of the
5227         signature and we must not check it to make the `new' modifier work.
5228         Fixes bug #27999, also added test-147.cs.
5229         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
5230
5231         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
5232         on the method's return type.
5233
5234 2002-07-21  Martin Baulig  <martin@gnome.org>
5235
5236         * assign.cs: Make this work if the rightmost source is a constant and
5237         we need to do an implicit type conversion.  Also adding a few more tests
5238         to test-38.cs which should have caught this.
5239
5240         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
5241         target in the makefile for this.  The makefile.gnu is primarily intended
5242         for end-users who don't want to debug the compiler.
5243
5244 2002-07-21  Martin Baulig  <martin@gnome.org>
5245
5246         * assign.cs: Improved the Assign class so it can now handle embedded
5247         assignments (X = Y = Z = something).  As a side-effect this'll now also
5248         consume less local variables.  test-38.cs now passes with MCS, added
5249         a few new test cases to that test.
5250
5251 2002-07-20  Martin Baulig  <martin@gnome.org>
5252
5253         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
5254         instructions.  Fixes bug #27977, also added test-146.cs.
5255
5256 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5257
5258         * cs-tokenizer.cs: fixed getHex ().
5259
5260 2002-07-19  Martin Baulig  <martin@gnome.org>
5261
5262         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
5263         not Type.GetType() to lookup the array type.  This is needed when
5264         we're constructing an array of a user-defined type.
5265         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
5266         single-dimensional arrays, but also for single-dimensial arrays of
5267         type decimal.
5268
5269 2002-07-19  Martin Baulig  <martin@gnome.org>
5270
5271         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
5272         this function is called, it's not allowed to share LocalBuilders
5273         among ILGenerators.
5274
5275 2002-07-19  Martin Baulig  <martin@gnome.org>
5276
5277         * expression.cs (Argument.Resolve): Report an error 118 when trying
5278         to pass a type as argument.
5279
5280 2002-07-18  Martin Baulig  <martin@gnome.org>
5281
5282         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
5283         Conv_R_Un for the signed `long' type.
5284
5285 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
5286
5287         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
5288         `expr' for the temporary result, as that will fail if we do
5289         multiple resolves on the same expression.
5290
5291 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
5292
5293         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
5294         ec.TypeContainer for looking up aliases. 
5295
5296         * class.cs (TypeContainer): Remove LookupAlias from here.
5297
5298         * decl.cs (DeclSpace); Move here.
5299
5300 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
5301
5302         * class.cs (FindMembers): Only call filter if the constructor
5303         bulider is not null.
5304
5305         Also handle delegates in `NestedTypes' now.  Now we will perform
5306         type lookups using the standard resolution process.  This also
5307         fixes a bug.
5308
5309         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
5310         This uses Expressions (the limited kind that can be parsed by the
5311         tree) instead of strings.
5312
5313         * expression.cs (ComposedCast.ToString): Implement, used to flag
5314         errors since now we have to render expressions.
5315
5316         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
5317         FormArrayType. 
5318
5319         * ecore.cs (SimpleName.ToString): ditto.
5320
5321         * cs-parser.jay: Instead of using strings to assemble types, use
5322         Expressions to assemble the type (using SimpleName, ComposedCast,
5323         MemberAccess).  This should fix the type lookups in declarations,
5324         because we were using a different code path for this.
5325
5326         * statement.cs (Block.Resolve): Continue processing statements
5327         even when there is an error.
5328
5329 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
5330
5331         * class.cs (Event.Define): Also remove the `remove' method from
5332         the list of pending items.
5333
5334         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
5335         generate more compact code. 
5336
5337 2002-07-17  Martin Baulig  <martin@gnome.org>
5338
5339         * const.cs (Const.LookupConstantValue): Add support for constant
5340         `unchecked' and `checked' expressions.
5341         Also adding test case test-140.cs for this.
5342
5343 2002-07-17  Martin Baulig  <martin@gnome.org>
5344
5345         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
5346         check whether mi.ReturnType implements the IEnumerator interface; the
5347         `==' and the IsAssignableFrom() will fail in this situation.
5348
5349 2002-07-16  Ravi Pratap  <ravi@ximian.com>
5350
5351         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
5352         here too.
5353
5354 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5355
5356         * expression.cs: fixed bug #27811.
5357
5358 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
5359
5360         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
5361         Molaro: when we are a ref, the value already contains a pointer
5362         value, do not take the address of it.
5363
5364 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5365         * removed mb-parser.jay and mb-tokenizer.cs
5366
5367 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5368
5369         * expression.cs: check against the building corlib void type.
5370
5371 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
5372
5373         * ecore.cs: fix for valuetype static readonly fields: when 
5374         initializing them, we need their address, not the address of a copy.
5375
5376 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
5377
5378         * typemanager.cs: register also enum_type in corlib.
5379
5380 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5381
5382         * class.cs: allow calling this (but not base) initializers in structs.
5383
5384 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
5385
5386         * ecore.cs: make sure we compare against the building base types
5387         in GetTypeSize ().
5388
5389 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
5390
5391         * typemanager.cs: fix TypeToCoreType() to handle void and object
5392         (corlib gets no more typerefs after this change).
5393
5394 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
5395
5396         * expression.cs (ArrayCreation.EmitArrayArguments): use
5397         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
5398
5399         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
5400         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
5401         array indexes, the runtime actually forbids them.
5402
5403         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
5404         for array arguments here.
5405
5406         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
5407         instead of the default for ValueTypes.
5408
5409         (New.DoEmit): Use IsValueType instead of
5410         IsSubclassOf (value_type)
5411         (New.DoResolve): ditto.
5412         (Invocation.EmitCall): ditto.
5413
5414         * assign.cs (Assign): ditto.
5415
5416         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
5417         Statements *are* currently doing part of their resolution during
5418         Emit.  
5419
5420         Expressions do always resolve during resolve, but statements are
5421         only required to propagate resolution to their children.
5422
5423 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
5424
5425         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
5426
5427         (LoadAssembly): Do not add the dll if it is already specified
5428         
5429         (MainDriver): Add the System directory to the link path at the end,
5430         after all the other -L arguments. 
5431
5432         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
5433         wrong opcode for loading bytes and bools (ldelem.i1 instead of
5434         ldelem.u1) and using the opposite for sbytes.
5435
5436         This fixes Digger, and we can finally run it.
5437
5438         * driver.cs (UnixParseOption): Move the option parsing here.  
5439         (CSCParseOption): Implement CSC-like parsing of options.
5440
5441         We now support both modes of operation, the old Unix way, and the
5442         new CSC-like way.  This should help those who wanted to make cross
5443         platform makefiles.
5444
5445         The only thing broken is that /r:, /reference: and /lib: are not
5446         implemented, because I want to make those have the same semantics
5447         as the CSC compiler has, and kill once and for all the confussion
5448         around this.   Will be doing this tomorrow.
5449
5450         * statement.cs (Unsafe.Resolve): The state is checked during
5451         resolve, not emit, so we have to set the flags for IsUnsfe here.
5452
5453 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
5454
5455         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
5456         not catch the Error_ObjectRefRequired in SimpleName (as it is
5457         possible to have a class/instance variable name that later gets
5458         deambiguated), we have to check this here.      
5459
5460 2002-07-10  Ravi Pratap  <ravi@ximian.com>
5461
5462         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
5463         make static and put into Expression.
5464
5465         (Event.Define): Register the private field of the event with the 
5466         TypeManager so that GetFieldFromEvent can get at it.
5467
5468         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
5469         keep track of the private field associated with an event which
5470         has no accessors.
5471
5472         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
5473         private field.
5474
5475         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
5476         
5477 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
5478
5479         * expression.cs (Binary.EmitBranchable): this routine emits the
5480         Binary expression in a branchable context.  This basically means:
5481         we need to branch somewhere, not just get the value on the stack.
5482
5483         This works together with Statement.EmitBoolExpression.
5484
5485         * statement.cs (Statement.EmitBoolExpression): Use
5486         EmitBranchable. 
5487
5488 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
5489
5490         * statement.cs (For): Reduce the number of jumps in loops.
5491
5492         (For): Implement loop inversion for the For statement.
5493
5494         (Break): We can be breaking out of a Try/Catch controlled section
5495         (foreach might have an implicit try/catch clause), so we need to
5496         use Leave instead of Br.
5497
5498         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
5499         now).  If the instace expression supports IMemoryLocation, we use
5500         the AddressOf method from the IMemoryLocation to extract the
5501         address instead of emitting the instance.
5502
5503         This showed up with `This', as we were emitting the instance
5504         always (Emit) instead of the Address of This.  Particularly
5505         interesting when This is a value type, as we dont want the Emit
5506         effect (which was to load the object).
5507         
5508 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
5509
5510         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5511
5512         * statement.cs (Checked): Set the CheckedState during the resolve
5513         process too, as the ConvCast operations track the checked state on
5514         the resolve process, and not emit.
5515
5516         * cs-parser.jay (namespace_member_declaration): Flag that we have
5517         found a declaration when we do.  This is used to flag error 1529
5518
5519         * driver.cs: Report ok when we display the help only.
5520
5521 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
5522
5523         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5524
5525 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
5526
5527         * cs-tokenizer.cs (define): We also have to track locally the
5528         defines.  AllDefines is just used for the Conditional Attribute,
5529         but we also need the local defines for the current source code. 
5530
5531 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
5532
5533         * statement.cs (While, For, Do): These loops can exit through a
5534         Break statement, use this information to tell whether the
5535         statement is the last piece of code.
5536
5537         (Break): Flag that we break.
5538
5539         * codegen.cs (EmitContexts): New `Breaks' state variable.
5540
5541 2002-07-03  Martin Baulig  <martin@gnome.org>
5542
5543         * class.cs (TypeContainer.MethodModifiersValid): Allow override
5544         modifiers in method declarations in structs.  Otherwise, you won't
5545         be able to override things like Object.Equals().
5546
5547 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5548
5549         * class.cs (Method, Property, Indexer): Do not allow the public
5550         modifier to be used in explicit interface implementations.
5551
5552         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5553         override modifiers in method declarations in structs
5554
5555 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
5556
5557         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5558         integer or real overflow, report an error
5559
5560 2002-07-02  Martin Baulig  <martin@gnome.org>
5561
5562         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5563         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5564         to tell the runtime about our newly created System.Object and
5565         System.ValueType types.
5566
5567 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
5568
5569         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5570         struct instead of Ldarg/Starg.
5571
5572 2002-07-02  Martin Baulig  <martin@gnome.org>
5573
5574         * expression.cs (Indirection.Indirection): Call
5575         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5576
5577 2002-07-02  Martin Baulig  <martin@gnome.org>
5578
5579         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5580         ValueType, call TypeManager.TypeToCoreType() on it.
5581         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5582         the OpCodes.Newarr argument.
5583
5584 2002-07-02  Martin Baulig  <martin@gnome.org>
5585
5586         * expression.cs (Invocation.EmitCall): When compiling corlib,
5587         replace all calls to the system's System.Array type to calls to
5588         the newly created one.
5589
5590         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5591         System.Array methods.
5592         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5593         from the system's System.Array type which must be replaced.
5594
5595 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5596
5597         * typemanager.cs: load unverifiable_code_ctor so we can build
5598         corlib using the correct type. Avoid using GetTypeCode() with
5599         TypeBuilders.
5600         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5601         TypeManager.object_type to allow building corlib.
5602
5603 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5604
5605         * ecore.cs: handle System.Enum separately in LoadFromPtr().
5606
5607 2002-07-01  Martin Baulig  <martin@gnome.org>
5608
5609         * class.cs: Make the last change actually work, we need to check
5610         whether `ifaces != null' to avoid a crash.
5611
5612 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5613
5614         * class.cs: when we build structs without fields that implement
5615         interfaces, we need to add the interfaces separately, since there is
5616         no API to both set the size and add the interfaces at type creation
5617         time.
5618
5619 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5620
5621         * expression.cs: the dimension arguments to the array constructors
5622         need to be converted if they are a long.
5623
5624 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5625
5626         * class.cs: don't emit ldarg.0 if there is no parent constructor
5627         (fixes showstopper for corlib).
5628
5629 2002-06-29  Martin Baulig  <martin@gnome.org>
5630
5631         MCS now compiles corlib on GNU/Linux :-)
5632
5633         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5634         ie. check for MethodImplOptions.InternalCall.
5635
5636         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5637         and TypeManager.attribute_type are null, so we must explicitly check
5638         whether parent is not null to find out whether it's an attribute type.
5639         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5640         and SetBuilder, not only if the property is neither abstract nor external.
5641         This is necessary to set the MethodImplOptions on the accessor methods.
5642         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5643         SetBuilder, see Property.Emit().
5644
5645         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5646         populate "System.Object", "System.ValueType" and "System.Attribute" since
5647         they've already been populated from BootCorlib_PopulateCoreTypes().
5648
5649 2002-06-29  Martin Baulig  <martin@gnome.org>
5650
5651         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5652         is the NullLiteral, we also need to make sure that target_type is not
5653         an enum type.   
5654
5655 2002-06-29  Martin Baulig  <martin@gnome.org>
5656
5657         * rootcontext.cs (RootContext.ResolveCore): We must initialize
5658         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5659         before calling BootstrapCorlib_ResolveDelegate ().
5660
5661 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5662
5663         * statement.cs: fixed build-breaker. All tests passed ok.
5664
5665 2002-06-27  Martin Baulig  <martin@gnome.org>
5666
5667         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5668         for System.Decimal when compiling corlib.
5669
5670 2002-06-27  Martin Baulig  <martin@gnome.org>
5671
5672         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5673         switch blocks which contain nothing but a default clause.
5674
5675 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
5676
5677        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5678
5679 2002-06-27  Martin Baulig  <martin@gnome.org>
5680
5681         * ecore.cs (PropertyExpr.PropertyExpr): Call
5682         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5683
5684         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5685         is already a TypeBuilder.
5686
5687 2002-06-27  Martin Baulig  <martin@gnome.org>
5688
5689         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5690         `target_type == TypeManager.array_type', not IsAssignableFrom() in
5691         the "from an array-type to System.Array" case.  This makes it work
5692         when compiling corlib.
5693
5694 2002-06-27  Martin Baulig  <martin@gnome.org>
5695
5696         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5697         non-static PropertyExpr, set its InstanceExpression.  This makes
5698         the `ICollection.Count' property work in System/Array.cs.
5699
5700 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
5701
5702         * driver.cs: Made error handling more consistent.  Errors now
5703         tracked by Report class, so many methods which used to return int
5704         now return void.  Main() now prints success/failure and 
5705         errors/warnings message.
5706
5707         Renamed '--probe' compiler argument to '--expect-error'.  Removed
5708         the magic number return values (123 and 124).  Now, if the
5709         expected error occurs, the compiler exits with success (exit value
5710         0).  If the compilation completes without seeing that particular
5711         error, the compiler exits with failure (exit value 1).  The
5712         makefile in mcs/errors has been changed to handle the new behaviour.
5713
5714         * report.cs: Made 'expected error' number a property and renamed
5715         it from 'Probe' to 'ExpectedError'.
5716
5717         * genericparser.cs: Removed error handling support, since it is
5718         now all done by Report class.
5719
5720         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5721         class, so parse() no longer returns an int.
5722
5723         * namespace.cs: Use Report.Error instead of GenericParser.error
5724
5725 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
5726
5727         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5728         TypeContainer.AddOperator): At the front of the list put the
5729         explicit implementations, so they get resolved/defined first. 
5730
5731 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
5732
5733         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5734         interface type is implemented by this TypeContainer.  Used during
5735         explicit interface implementation.
5736
5737         (Property.Define, Indexer.Define, Method.Define): Validate that
5738         the given interface in the explicit implementation is one of the
5739         base classes for the containing type.
5740
5741         Also if we are explicitly implementing an interface, but there is
5742         no match in the pending implementation table, report an error.
5743
5744         (Property.Define): Only define the property if we are
5745         not explicitly implementing a property from an interface.  Use the
5746         correct name also for those properties (the same CSC uses,
5747         although that is really not needed).
5748         
5749         (Property.Emit): Do not emit attributes for explicitly implemented
5750         properties, as there is no TypeBuilder.
5751
5752         (Indexer.Emit): ditto.
5753
5754         Hiding then means that we do not really *implement* a pending
5755         implementation, which makes code fail.
5756
5757 2002-06-22  Martin Baulig  <martin@gnome.org>
5758
5759         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5760         the return value of Object.GetType().  [FIXME: we need to do this whenever
5761         we get a type back from the reflection library].
5762
5763 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5764
5765         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5766
5767 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
5768
5769         * attribute.cs: Return null if we can not look up the type.
5770
5771         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5772         the interface types found.
5773
5774         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5775         interface types found.
5776
5777         * typemanager.cs (GetInterfaces): Make this routine returns alll
5778         the interfaces and work around the lame differences between
5779         System.Type and System.Reflection.Emit.TypeBuilder in the results
5780         result for GetInterfaces.
5781         
5782         (ExpandInterfaces): Given an array of interface types, expand and
5783         eliminate repeated ocurrences of an interface.  This expands in
5784         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5785         be IA, IB, IC.
5786         
5787 2002-06-21  Martin Baulig  <martin@gnome.org>
5788
5789         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5790         on System.Enum.
5791
5792 2002-06-21  Martin Baulig  <martin@gnome.org>
5793
5794         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
5795         and called with one of the core types, return the corresponding typebuilder for
5796         that type.
5797
5798         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5799         element type.
5800
5801 2002-06-21  Martin Baulig  <martin@gnome.org>
5802
5803         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5804         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5805         (Expression.ConvertReferenceExplicit): Likewise.
5806
5807         * expression.cs (ElementAccess.DoResolve): Likewise.
5808         (ElementAccess.DoResolveLValue): Likewise.
5809
5810 2002-06-10  Martin Baulig  <martin@gnome.org>
5811
5812         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5813         add the "value" parameter to the parameter list.
5814
5815         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5816         to our caller.
5817
5818 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
5819
5820         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5821         the argument to an int, uint, long or ulong, per the spec.  Also
5822         catch negative constants in array creation.
5823
5824 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5825
5826         * class.cs: do not allow the same interface to appear twice in
5827         the definition list.
5828
5829 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5830
5831         * ecore.cs: don't use ldlen with System.Array.
5832
5833 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5834
5835         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5836
5837 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5838
5839         * modifiers.cs: produce correct field attributes for protected
5840         internal. Easy fix so miguel can work on ther harder stuff:-)
5841
5842 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
5843
5844         * pending.cs: New file.  Move the code from class.cs here.
5845         Support clearning the pending flag for all methods (when not doing
5846         explicit interface implementation).
5847
5848 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5849
5850         * rootcontext.cs: added a couple more types needed to bootstrap.
5851
5852 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
5853
5854         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5855         constructor in the type, instead of any constructor in the type
5856         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
5857         a bug in the Mono runtime when applying the params attribute). 
5858
5859 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
5860         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5861
5862 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
5863
5864         * expression.cs (Unary.ResolveOperator): Use TypeManager
5865         to resolve the type.
5866         
5867 2002-06-13  Ravi Pratap  <ravi@ximian.com>
5868
5869         * cs-parser.jay (enum_member_declaration): Pass in the attributes
5870         attached.
5871
5872         * enum.cs (AddEnumMember): Add support to store the attributes associated 
5873         with each member too.
5874
5875         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5876         field builders too - this takes care of the enum member case.
5877
5878 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
5879
5880         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5881         address-of operator on both value types and pointers.
5882         
5883 2002-06-10  Martin Baulig  <martin@gnome.org>
5884
5885         * interface.cs (Interface.PopulateIndexer): Add the indexer's
5886         PropertyBuilder to the `property_builders' list.
5887
5888         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5889         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5890         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
5891         find any indexers which are inherited from an interface.
5892
5893 2002-06-09  Martin Baulig  <martin@gnome.org>
5894
5895         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5896         the same type as the constant if necessary.  There's also a test-130.cs
5897         for this.
5898
5899         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5900
5901         * typemanager.cs (TypeManager.ChangeType): Previously known as
5902         Enum.ChangeEnumType().
5903
5904 2002-06-09  Martin Baulig  <martin@gnome.org>
5905
5906         * expression.cs (Cast.TryReduce): Added support for consts.
5907
5908 2002-06-08  Ravi Pratap  <ravi@ximian.com>
5909
5910         * class.cs (Accessor): Hold attributes information so we can pass
5911         it along.
5912
5913         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5914         Modify to pass in attributes attached to the methods.
5915
5916         (add_accessor_declaration, remove_accessor_declaration): Ditto.
5917
5918         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5919         to handle the Accessor kind :-)
5920
5921         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5922         
5923 2002-06-08  Martin Baulig  <martin@gnome.org>
5924
5925         * expression.cs (Unary.TryReduceNegative): Added support for
5926         ULongConstants.
5927
5928 2002-06-08  Martin Baulig  <martin@gnome.org>
5929
5930         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5931         name can't be found in the `defined_names' - the caller will do a
5932         MemberLookup in this case and thus find methods in System.Enum
5933         such as Enum.IsDefined().
5934
5935 2002-06-08  Martin Baulig  <martin@gnome.org>
5936
5937         * enum.cs (Enum.ChangeEnumType): This is a custom version of
5938         Convert.ChangeType() which works with TypeBuilder created types.
5939         (Enum.LookupEnumValue, Enum.Define): Use it here.
5940
5941         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5942         `TypeBuilder.BaseType != null' check.
5943         (TypeContainer.FindMembers): Only lookup parent members if we
5944         actually have a parent.
5945         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5946         (ConstructorInitializer.Resolve): Likewise.
5947
5948         * interface.cs (Interface.FindMembers): Added
5949         `TypeBuilder.BaseType != null' check.
5950
5951         * rootcontext.cs (RootContext.ResolveCore): Added
5952         "System.Runtime.CompilerServices.IndexerNameAttribute" to
5953         classes_second_stage.
5954
5955         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5956         debug_type and trace_type when compiling with --nostdlib.       
5957
5958 2002-06-07  Martin Baulig  <martin@gnome.org>
5959
5960         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5961         (AddField): Set it to true when adding a non-static field.
5962         (DefineType): Use `have_nonstatic_fields' to find out whether we
5963         have non-static fields, not `Fields != null'.
5964
5965 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
5966
5967         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5968         dereferencing a null on the static-field code path)
5969
5970 2002-05-30  Martin Baulig  <martin@gnome.org>
5971
5972         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5973         to take command line arguments.  Use reflection to call the new
5974         custom `Initialize' function on the symbol writer and pass it the
5975         command line arguments.
5976
5977         * driver.cs (--debug-args): New command line argument to pass command
5978         line arguments to the symbol writer.
5979
5980 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
5981
5982         * assign.cs (DoResolve): Forgot to do the implicit conversion to
5983         the target type for indexers and properties.  Thanks to Joe for
5984         catching this.
5985
5986 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
5987
5988         * typemanager.cs (MethodFlags): returns the method flags
5989         (Obsolete/ShouldIgnore) that control warning emission and whether
5990         the invocation should be made, or ignored. 
5991
5992         * expression.cs (Invocation.Emit): Remove previous hack, we should
5993         not do this on matching a base type, we should do this based on an attribute
5994
5995         Only emit calls to System.Diagnostics.Debug and
5996         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
5997         on the command line.
5998
5999         * rootcontext.cs: Global settings for tracing and debugging.
6000
6001         * cs-tokenizer.cs (define): New utility function to track
6002         defines.   Set the global settings for TRACE and DEBUG if found.
6003
6004 2002-05-25  Ravi Pratap  <ravi@ximian.com>
6005
6006         * interface.cs (Populate*): Pass in the TypeContainer as well as
6007         the DeclSpace as parameters so that we can create EmitContexts and
6008         then use that to apply attributes etc.
6009
6010         (PopulateMethod, PopulateEvent, PopulateProperty)
6011         (PopulateIndexer): Apply attributes everywhere.
6012
6013         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
6014         etc.
6015
6016         (ApplyAttributes): Update accordingly.
6017
6018         We now apply interface attributes for all members too.
6019
6020 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
6021
6022         * class.cs (Indexer.Define); Correctly check if we are explicit
6023         implementation (instead of checking the Name for a ".", we
6024         directly look up if the InterfaceType was specified).
6025
6026         Delay the creation of the PropertyBuilder.
6027
6028         Only create the PropertyBuilder if we are not an explicit
6029         interface implementation.   This means that explicit interface
6030         implementation members do not participate in regular function
6031         lookups, and hence fixes another major ambiguity problem in
6032         overload resolution (that was the visible effect).
6033
6034         (DefineMethod): Return whether we are doing an interface
6035         implementation. 
6036         
6037         * typemanager.cs: Temporary hack until we get attributes in
6038         interfaces (Ravi is working on that) and we get IndexerName
6039         support in interfaces.
6040
6041         * interface.cs: Register the indexers as properties.
6042
6043         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
6044         warning, I have verified that this is a bug in the .NET runtime
6045         (JavaScript suffers of the same problem).
6046
6047         * typemanager.cs (MemberLookup): When looking up members for
6048         interfaces, the parent of an interface is the implicit
6049         System.Object (so we succeed in searches of Object methods in an
6050         interface method invocation.  Example:  IEnumerable x;  x.ToString
6051         ()) 
6052
6053 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
6054
6055         * class.cs (Event): Events should also register if they do
6056         implement the methods that an interface requires.
6057
6058         * typemanager.cs (MemberLookup); use the new GetInterfaces
6059         method. 
6060
6061         (GetInterfaces): The code used to lookup interfaces for a type is
6062         used in more than one place, factor it here. 
6063
6064         * driver.cs: Track the errors at the bottom of the file, we kept
6065         on going.
6066
6067         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
6068         instance if the method we are calling is static!
6069
6070 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
6071
6072         * attribute.cs (ApplyAttributes): Make this function filter out
6073         the IndexerName attribute (as that attribute in reality is never
6074         applied) and return the string constant for the IndexerName
6075         attribute. 
6076
6077         * class.cs (TypeContainer.Emit): Validate that all the indexers
6078         have the same IndexerName attribute, and if so, set the
6079         DefaultName attribute on the class. 
6080
6081         * typemanager.cs: The return value might contain other stuff (not
6082         only methods).  For instance, consider a method with an "Item"
6083         property and an Item method.
6084
6085         * class.cs: If there is a problem with the parameter types,
6086         return. 
6087
6088 2002-05-24  Ravi Pratap  <ravi@ximian.com>
6089
6090         * ecore.cs (ImplicitConversionExists): Wrapper function which also
6091         looks at user defined conversion after making a call to 
6092         StandardConversionExists - we need this for overload resolution.
6093
6094         * expression.cs : Update accordingly the various method calls.
6095
6096         This fixes 2 bugs filed against implicit user defined conversions 
6097
6098 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
6099
6100         * statement.cs: Track the result of the assignment.
6101
6102 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
6103
6104         * expression.cs (MemberAccess): Improved error reporting for
6105         inaccessible members.
6106
6107 2002-05-22  Martin Baulig  <martin@gnome.org>
6108
6109         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
6110         itself with debugging support.
6111
6112 2002-05-22  Martin Baulig  <martin@gnome.org>
6113
6114         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
6115         Removed, this isn't needed anymore.
6116
6117 2002-05-20  Martin Baulig  <martin@gnome.org>
6118
6119         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
6120         be underlying type for an enum.
6121
6122 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
6123
6124         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
6125         that splits out the loading of just the core types.
6126
6127         * rootcontext.cs (ResolveCore): Split the struct resolution in
6128         two, so we can load the enumeration underlying types before any
6129         enums are used.
6130
6131         * expression.cs (Is): Bandaid until we fix properly Switch (see
6132         bug #24985 for details).
6133
6134         * typemanager.cs (ImplementsInterface): The hashtable will contain
6135         a null if there are no interfaces implemented.
6136
6137 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
6138
6139         * cs-parser.jay (indexer_declarator): It is fine to have array
6140         parameters
6141
6142 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
6143
6144         * typemanager.cs: (RegisterBuilder): New function used to register
6145         TypeBuilders that implement interfaces.  Since
6146         TypeBuilder.GetInterfaces (as usual) does not work with lame
6147         Reflection.Emit. 
6148         (AddUserType): register interfaces.
6149
6150         (ImplementsInterface): Use the builder_to_ifaces hash if we are
6151         dealing with TypeBuilder.  Also, arrays are showing up as
6152         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
6153         methods can not be invoked on them!
6154
6155         * ecore.cs (ExplicitReferenceConversionExists): Made public.
6156         (ImplicitReferenceConversionExists): Split out from
6157         StandardConversionExists. 
6158
6159         * expression.cs (As): We were only implementing one of the three
6160         cases for the as operator.  We now implement them all.
6161         (Is): Implement the various other cases for Is as well.
6162
6163         * typemanager.cs (CACHE): New define used to control if we want or
6164         not the FindMembers cache.  Seems to have a negative impact on
6165         performance currently
6166
6167         (MemberLookup): Nested types have full acess to
6168         enclosing type members
6169
6170         Remove code that coped with instance/static returns for events, we
6171         now catch this in RealFindMembers.
6172
6173         (RealFindMembers): only perform static lookup if the instance
6174         lookup did not return a type or an event.  
6175
6176 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
6177
6178         * assign.cs (CompoundAssign): We pass more semantic information
6179         now to Compound Assignments than we did before: now we have all
6180         the information at hand, and now we resolve the target *before* we
6181         do the expression expansion, which allows the "CacheValue" method
6182         to have the effect we intended (before, a [x] += 1 would generate
6183         two differen ArrayAccess expressions from the ElementAccess,
6184         during the resolution process).
6185
6186         (CompoundAssign.DoResolve): Resolve target and original_source here.
6187
6188 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
6189
6190         * expression.cs (ArrayAccess): dropped debugging information. 
6191
6192         * typemanager.cs: Small bug fix: I was always returning i_members,
6193         instead of one of i_members or s_members (depending on which had
6194         the content).
6195
6196         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
6197         method is invoked before any code generation takes place, and it
6198         is a mechanism to inform that the expression will be invoked more
6199         than once, and that the method should use temporary values to
6200         avoid having side effects
6201
6202         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
6203         
6204         * ecore.cs (Expression.CacheTemporaries): Provide empty default
6205         implementation.
6206
6207         * expression.cs (Indirection, ArrayAccess): Add support for
6208         CacheTemporaries in these two bad boys. 
6209
6210         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
6211         ldobj or ldind_ref.  
6212         (StoreFromPtr): Handle stobj as well.
6213
6214         * expression.cs (UnaryMutator): Share more code.
6215         
6216         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
6217         down: I was not tracking the Filter function as well, which
6218         was affecting the results of the cache.
6219
6220 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
6221
6222         * attribute.cs: Remove the hack to handle the CharSet property on
6223         StructLayouts. 
6224
6225 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
6226
6227         * attribute.cs (DoResolve): More uglyness, we now only try to
6228         resolve the attribute partially, to extract the CharSet
6229         information (only if we are a StructLayout attribute).  Otherwise 
6230
6231         (GetExtraTypeInfo): Add some code to conditionally kill in the
6232         future this.   I am more and more convinced that the .NET
6233         framework has special code to handle the attribute setting on
6234         certain elements.
6235
6236         * expression.cs (IsParamsMethodApplicable): Revert my previous
6237         foreach change here, it was wrong.
6238
6239 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
6240
6241         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
6242         (pp_expr): do not abort on unknown input, just return.
6243         (eval): abort if there are pending chars.
6244
6245         * attribute.cs (Attribute.Resolve): Positional parameters are
6246         optional.  Deal with that case.
6247
6248         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
6249         the Ansi/Unicode/Auto information for the type.
6250
6251         (TypeContainer.DefineType): instantiate the EmitContext here, as
6252         we will be using it during the type definition (to resolve
6253         attributes) and during the emit phase.
6254
6255         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
6256         to pull type information out of the attributes
6257
6258         (Attribute.Resolve): track the constructor builder, and allow for
6259         multiple invocations (structs and classes will use this).
6260
6261         * ecore.cs (MemberLookupFinal): new version with all the
6262         parameters customizable.
6263
6264         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
6265         constructors.  Return if the result value is null (as the error
6266         would have been flagged already by MemberLookupFinal)
6267
6268         Do not allow instances of abstract classes or interfaces to be
6269         created.
6270         
6271         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
6272         We have to compare the assembly property here when dealing with
6273         FamANDAssem and Assembly access modifiers, because we might be
6274         creating an assembly from *modules* (that means that we are not
6275         getting TypeBuilders for types defined in other modules that are
6276         part of this assembly).
6277
6278         (Method.Emit): If the method is marked abstract and has a body,
6279         emit an error. 
6280
6281         (TypeContainer.DefineMembers): If both the defined member and the
6282         parent name match are methods, then do not emit any warnings: let
6283         the Method.Define routine take care of flagging warnings.  But if
6284         there is a mismatch (method overrides something else, or method is
6285         overriwritten by something, then emit warning).
6286
6287         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
6288         set to null, this means `do not check for the return type on the
6289         signature'. 
6290
6291         (Method.Define): set the return type for the method signature to
6292         null, so that we get methods with the same name and parameters and
6293         different return types.  This is used to flag warning 114 (you are
6294         hiding a method, and you probably want to use the new/override
6295         keywords instead).
6296
6297         * typemanager.cs (MemberLookup): Implemented proper access
6298         control, closing a long standing set of bug reports.  The problem
6299         was that the Framework only has two bits: Public and NonPublic,
6300         and NonPublic includes private and protected methods, but we need
6301         to enforce the FamANDAssem, FamOrAssem and Family. 
6302
6303 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
6304
6305         * statement.cs (GotoCase): Return true: Ammounts to giving up
6306         knowledge on whether we return or not, and letting the other case
6307         be responsible for it.
6308
6309 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
6310
6311         * driver.cs: Do not load directories for each file processed, only
6312         do it if there is a pattern.
6313
6314         * ecore.cs: Report readonly assigns here as well, as we might have
6315         been resolved only by MemberAccess.
6316
6317         (SimpleName.SimpleNameResolve): Also be useful for LValue
6318         resolution.   We need this to propagate assign to local readonly variables
6319
6320         * typemanager.cs: Use a ptrhashtable for the criteria, because we
6321         do not want to reuse potential criteria memory.
6322
6323         * class.cs (MyEventBuilder): Set reflected_type;
6324
6325         * ecore.cs (Constantify): Added support for constifying bools.
6326
6327         (RootContext.LookupType): Added a cache for values looked up in
6328         the declaration space.
6329
6330         * typemanager.cs (FindMembers): Now is a front-end to
6331         RealFindMembers, and provides a two-level hashtable-based cache to
6332         the request.  
6333
6334         15% performance improvement: from 22.5 to 19.2 seconds.
6335
6336         * expression.cs (IsParamsMethodApplicable): use foreach.
6337         (Invocation.DoResolve): ditto.
6338         (New.DoResolve): ditto.
6339         (ArrayCreation.DoResolve): ditto.
6340
6341         * ecore.cs (FindMostEncompassingType): use foreach.
6342
6343         * delegate.cs (NewDelegate.DoResolve): Use foreach
6344
6345         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
6346         (RemoveMethods): use foreach.
6347
6348         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
6349         nested foreach statements instead of for, and also break out of
6350         the inner loop once a match is found.
6351         
6352         (Invocation.OverloadResolve): Use foreach, simplify the code. 
6353
6354 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
6355
6356         * cfold.cs (BinaryFold): During an enumeration evaluation context,
6357         we actually unwrap the expression to allow for extra information
6358         to be extracted. 
6359
6360         * expression.cs: Use Shr_Un on unsigned operations. 
6361
6362 2002-05-08  Ravi Pratap  <ravi@ximian.com>
6363
6364         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
6365         applicable operators was not being considered correctly. This closes
6366         the bug Miguel reported.
6367
6368 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
6369
6370         * attribute.cs: check that the type derives from System.Attribute
6371         and report the correct error in that case (moved the duplicate code to
6372         its own method, too).
6373
6374 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
6375
6376         * attribute.cs: lookup attribute type name as the spec says: first the
6377         bare attribute name and then name + "Attribute" (nant compiles with
6378         mcs after this fix).
6379
6380 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
6381
6382         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
6383         Because of the way we parse things, we should try to see if a
6384         UIntConstant can fit in an integer.
6385
6386 2002-05-07  Ravi Pratap  <ravi@ximian.com>
6387
6388         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
6389         when we are in an explicit context.
6390
6391         (ConvertReferenceExplicit): When converting from Iface type S to Class
6392         T make sure the rules are implemented as an OR.
6393
6394         * parameter.cs (ParameterType): Make it a property for now although the
6395         purpose really isn't anything immediate.
6396         
6397         * expression.cs (Is*Applicable): Do better checking on the parameter type
6398         of a ref/out parameter. The ones from the system assemblies are already 
6399         marked with the correct type so we don't need to do any correction.
6400
6401         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
6402         the object type is standard too so include that.
6403
6404 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6405
6406         * ecore.cs (StandardConversionExists): Augment with missing code:
6407         deal with IntConstant, LongConstants and Enumerations.
6408
6409         * assign.cs: Report the error, instead of failing silently
6410
6411         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
6412         typecontainer that they are declared, because the
6413         typecontainer/namespace will have the list of using clauses that
6414         need to be applied.
6415
6416         Assembly Attributes were escaping the normal registration
6417         mechanism. 
6418
6419         (EmitCode): Apply attributes within an EmitContext that represents
6420         the container they were declared on.
6421         
6422         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
6423
6424 2002-05-06  Ravi Pratap  <ravi@ximian.com>
6425
6426         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
6427         Revamp completely - make much cleaner as we now operate only
6428         on a set of Types.
6429
6430         (FindMostSpecificSource, FindMostSpecificTarget): New methods
6431         to implement the logic detailed in the spec more correctly.
6432
6433         (UserDefinedConversion): Update accordingly.
6434
6435 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6436
6437         * statement.cs: Return flow analysis information up.
6438
6439         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
6440         and the default.
6441
6442         (token): Do not consume an extra character before calling
6443         decimal_digits.
6444
6445 2002-05-06  Piers Haken <piersh@friskit.com>
6446
6447         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
6448
6449 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
6450
6451         * class.cs (Constructor.Emit): Set the IsStatic flag in the
6452         EmitContext during the instance constructor initializer
6453         resolution, to stop access to instance variables.
6454
6455         This is mandated by the spec, last paragraph of the `constructor
6456         initializers' section. 
6457
6458 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
6459
6460         * cs-parser.jay, class.cs (Accessor): new class used to represent
6461         an accessor (get or set).  In the past we used `null' to represent
6462         a missing accessor.  But this is ambiguous because there was no
6463         way to tell in abstract indexers/properties if one of them was
6464         specified.
6465
6466         Now there is a way of addressing that.
6467
6468         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
6469         instead of FindMembers.
6470
6471         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
6472         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
6473
6474         * attribute.cs: Treat indexers and properties as the same in terms
6475         of applying attributes
6476
6477         * ecore.cs (FindMostEncompassedType): Use statically initialized
6478         EmptyExpressions()s like we do elsewhere to avoid creating useless
6479         objects (and we take this out of the tight loop).
6480
6481         (GetConversionOperators): Move the code to extract the actual
6482         operators to a separate routine to clean things up.
6483
6484 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
6485
6486         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
6487         events are always registered FieldBuilders.
6488         
6489         * class.cs (FieldBase): New class shared by Fields 
6490
6491         * delegate.cs: If we are a toplevel delegate, use our full name.
6492         If we are a nested delegate, then only use our tail name.
6493
6494 2002-05-02  Ravi Pratap  <ravi@ximian.com>
6495
6496         * expression.cs (IsApplicable): Ensure that we add the "&" to
6497         ref/out types before comparing it with the type of the argument.
6498
6499         (IsParamsMethodApplicable): Ditto.
6500
6501         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
6502         silly me ;-)
6503
6504         * delegate.cs : Handle the case when we have more than one applicable
6505         method. Flag an error only when we finish checking all.
6506
6507 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
6508
6509         * expression.cs: Add support for boolean static initializers.
6510
6511 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
6512
6513         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6514
6515         * parameter.cs (ComputeParameterTypes,
6516         ComputeAndDefineParameterTypes): Better error handling: now we
6517         clear the `types' cache if we fail during any of the type lookups.
6518         We also return the status code correctly to our caller
6519
6520         * delegate.cs: If we fail to define a delegate, abort the extra
6521         steps. 
6522
6523         * expression.cs (Binary.ResolveOperator): for
6524         operator==(object,object) and operator !=(object, object) we also
6525         have to verify that there is an implicit conversion from one to
6526         the other.
6527
6528         (ArrayAccess.DoResolve): Array Access can operate on
6529         non-variables. 
6530
6531 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
6532
6533         * assign.cs (CompoundAssign): A new class used as a "flag" that
6534         the assignment actually is happening as part of a compound
6535         assignment operator.
6536
6537         During compound assignment, a few new rules exist to enable things
6538         like:
6539
6540         byte b |= 1 + 2
6541
6542         From the spec:
6543         
6544         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6545         to the type of x) if y is implicitly convertible to the type of x,
6546         and the operator is a builtin operator and the return type of the
6547         operator is explicitly convertible to the type of x. 
6548
6549         * rootcontext.cs: Reset warning level to 2.  4 catches various
6550         "interesting" features in mcs, we must clean this up at some
6551         point, but currently am trying to kill other bugs ;-)
6552
6553         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6554         in container classes as well.  
6555
6556         * expression.cs (Binary.ResolveOperator): Handle string case
6557         before anything else (as operator overloading does emit an error
6558         before doing anything else).
6559
6560         This code could go away when we move to a table driven model, but
6561         i could not come up with a good plan last night.
6562         
6563 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
6564
6565         * typemanager.cs (CSharpName): reimplementation using regex.
6566         * class.cs: added null check for fields in Emit
6567         * rootcontext.cs: set warninglevel to 4
6568
6569 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
6570
6571         * typemanager.cs (CSharpName): reimplemented with Lupus
6572         suggestion.
6573
6574 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
6575
6576         * statement.cs (If): correclty implement Resolve, because we were
6577         not catching sem errors in there.  The same process is needed
6578         everywhere else. 
6579         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6580         
6581
6582         (Statement.Warning_DeadCodeFound): Factorize code.
6583         (While): Report dead code here too.
6584
6585         (Statement): Added Resolve virtual method to allow
6586         for resolution split from the emit code.
6587
6588 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6589
6590         * statement.cs (EmitBoolExpression): No longer try to resolve the
6591         expression here.    
6592         (MakeBoolean): New utility function that resolve, implicitly
6593         converts to boolean and tags the expression. 
6594         
6595
6596         (If, Do): Implement dead code elimination.
6597         (While): Implement loop inversion
6598
6599         (Do, While, For, If): Resolve the expression prior to calling our
6600         code generation.
6601
6602 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
6603
6604         * class.cs:
6605           - added method Report28 (warning: program has more than one entry point)
6606           - added method IsEntryPoint, implements paragraph 10.1 of the spec
6607           - modified method Method.Define, the part at the end of the method
6608
6609         * rootcontext.cs: added static public Location EntryPointLocation;
6610           
6611         * ../errors/cs0028.cs : Add test case for the above warning.              
6612
6613         * typemanager.cs:
6614           - modified method CSharpName to allow arrays of primitive type to
6615             be printed nicely (e.g. instead of System.Int32[][] it now prints
6616             int[][])
6617           - added method CSharpSignature: returns the signature of a method
6618             in string format to be used in reporting errors, warnings, etc.
6619
6620         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6621         with String.Empty.
6622         
6623 2002-04-26  Ravi Pratap  <ravi@ximian.com>
6624
6625         * delegate.cs (Define): Fix extremely silly bug where I was
6626         setting the type of the 'object' parameter of the BeginInvoke
6627         method to System.IAsyncResult instead of System.Object ;-)
6628
6629 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
6630
6631         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6632         here. 
6633
6634         (Constructor.Emit): return if we fail to initialize the
6635         constructor.  Another door closed!  
6636
6637         * expression.cs (New.DoResolve): Improve error message (from -6 to
6638         1501).  Use DeclaredOnly lookup to find the exact constructor.
6639
6640         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6641         loop.  This is useful.
6642
6643         * cs-parser.jay: Adjust the default parameters so that destructors
6644         have the proper signature.
6645
6646 2002-04-26  Martin Baulig  <martin@gnome.org>
6647
6648         * driver.cs (LoadAssembly): If `assembly' contains any characters
6649         which are only valid in path names and not in assembly names
6650         (currently slash, backslash and point), use Assembly.LoadFrom ()
6651         instead of Assembly.Load () on the `assembly' (before iteration
6652         over the link_paths).
6653
6654 2002-04-26  Martin Baulig  <martin@gnome.org>
6655
6656         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6657
6658 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
6659
6660         * class.cs (Property): use the new typemanager.MemberLookup
6661
6662         (TypeContainer.MemberLookup): Implement using the
6663         TypeManager.MemberLookup now. 
6664         
6665         * typemanager.cs: Make MemberLookup a function of the TypeManager,
6666         and return MemberInfos, so that these can be used without an
6667         EmitContext (what we had before).
6668
6669 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
6670
6671         * expression.cs: Fix the case where the argument to params if the
6672         type of the params.  I omitted handling this before.   Fixed
6673
6674 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6675
6676         * driver.cs: Call BootCorlib_PopulateCoreType
6677
6678         * class.cs (Property.CheckBase): Check for properties only, not
6679         for all members. 
6680
6681         * interface.cs: Temporary hack: try/catch around the
6682         CustomAttributeBuilder, because I am getting an exception that I
6683         do not understand.
6684
6685         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6686         types whose definitions are required to be there (attributes are
6687         defined before standard types).
6688
6689         Compute definitions as we boot the various types, as they are used
6690         immediately (value_type class will need object_type, but if we do
6691         not initialize object_type, we will pass a null, which will let
6692         the runtime pick the System.Object from the existing corlib, which
6693         is not what we want).
6694
6695 2002-04-22  Patrik Torstensson <totte@labs2.com>
6696
6697         * cs-tokenizer.cs: fixed a number of trim() issues.
6698
6699 2002-04-22  Ravi Pratap  <ravi@ximian.com>
6700
6701         * expression.cs (Argument.Type): Ensure that we return the correct
6702         type when we have out or ref parameters [in which case we 
6703         append a "&"].
6704         
6705 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
6706
6707         * class.cs (Property, Indexer): Allow extern modifier in there. 
6708
6709         * typemanager.cs (InitBaseTypes): Initializes object_type and
6710         value_type, since those will be used early on during the bootstrap
6711         process to compile corlib.
6712
6713         (InitCoreTypes): Move code from here to InitBaseTypes.
6714
6715 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
6716
6717         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6718         single-dimension arrays as using the ldlen opcode.  
6719
6720         Daniel Lewis discovered this optimization.  
6721
6722         * typemanager.cs: Add signature for System.Array::get_Length
6723
6724 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6725
6726         * statement.cs: report the error when the foreach does not apply to an
6727         array nor a collection.
6728
6729 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
6730
6731         * expression.cs: Add implicit conversions to the operator ~.
6732
6733         * constant.cs (DecimalConstant.Emit): Emit decimal value.
6734
6735         * typemanager.cs: Locate the decimal constructor.
6736
6737 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6738
6739         * attribute.cs: use the new property of TypeOf.
6740         * expression.cs: added 'get' property around typearg.
6741
6742         These changes fix a build breaker reported by NickD. Is this the
6743         correct way to fix?  If not, please, revert my changes and make it
6744         work :-).
6745
6746 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
6747
6748         * attribute.cs: Add support for typeof in attribute invocations.
6749         I am not sure that this is right though.
6750
6751 2002-04-14  Duncan Mak  <duncan@ximian.com>
6752
6753         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6754         Binary.Operator.Division case.
6755
6756 2002-04-13  Ravi Pratap  <ravi@ximian.com>
6757
6758         * class.cs (DefineType): Ensure that we do a proper check on
6759         attribute types and also register it with the TypeManager.
6760
6761         (TypeContainer.Targets): The default for attribute types is
6762         AttributeTargets.All.
6763         
6764         * attribute.cs (ApplyAttributes): Registering the attribute type
6765         is done elsewhere, not when we discover we have a Usage attribute.
6766
6767 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6768
6769         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6770         and get rid of is_delegate parameter.
6771
6772         * everywhere : update.
6773         
6774 2002-04-12  Ravi Pratap  <ravi@ximian.com>
6775
6776         * cs-parser.jay (compilation_unit): Revamp completely to use
6777         some new ideas that I got from Rhys' grammar to solve the problems
6778         with assembly level attributes.
6779
6780         (outer_declaration): New grammar production.
6781
6782         (attribute_sections): Add.
6783
6784         (opt_attributes): Base on attribute_sections
6785
6786         (namespace_declaration): Allow opt_attributes to tackle the case
6787         when we have assembly level attributes - we are clever in this
6788         regard now ;-)
6789
6790         * attribute.cs (ApplyAttributes): Do not worry about assembly 
6791         attributes in the non-global context.
6792
6793         * rootcontext.cs (AddGlobalAttributes): Go back to using this
6794         instead of SetGlobalAttributes.
6795
6796         * class.cs, rootcontext.cs : Ensure we define and generate 
6797         attribute types before anything else.
6798
6799         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6800         and flag the new error -20 for the case when the attribute type
6801         does not have valid targets specified. csc does not catch this.
6802
6803         * ../errors/errors.txt : update for error # -20
6804
6805 2002-04-11  Ravi Pratap  <ravi@ximian.com>
6806
6807         * support.cs (InternalParameters.ParameterModifier): Do some null
6808         checking and return sane values.
6809
6810         * class.cs (Method.Define): If we are a PInvoke method, ensure
6811         that we are static and extern. Report error # 601
6812
6813         * ../errors/cs0601.cs : Add test case for the above error.
6814
6815 2002-04-07  Ravi Pratap  <ravi@ximian.com>
6816
6817         * rootcontext.cs (attribute_types): We need to keep type of
6818         all attribute types separately and emit code for them first.
6819
6820         (RegisterAttribute) : Implement.
6821
6822         * class.cs (DefineType): Check if the current Type is a custom
6823         attribute type and register it accordingly.
6824
6825         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6826         adding the first attribute twice and rename to
6827
6828         (SetGlobalAttributes): this.
6829
6830         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6831         lookups.
6832
6833         * attribute.cs (ApplyAttributes): Take an additional argument telling us
6834         if we are processing global arguments. Hmm, I am unsure of this.
6835
6836 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6837
6838         * expression.cs: added static array of strings to avoid calling
6839         Enum.ToString () for Operator in Binary. Significant recover of
6840         performance.
6841
6842 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
6843
6844         * class.cs (FindMembers): Allow the Builders of the various
6845         members to be null.  If they are skip them.  This only happens
6846         during the PInvoke declaration.
6847
6848 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
6849
6850         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6851         failure, so we do not keep going afterwards.
6852
6853         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6854         wanted to pass `false' as the `is_delegate' argument.  If this is
6855         the case, why not use delegate_type == null to mean `is_delegate =
6856         false' and anything else as is_delegate = true.
6857
6858 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
6859
6860         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6861         code for the section, not the beginning of the tests.
6862
6863 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
6864
6865         * cfold.cs: Handle operator + (Enum x, Underlying x) 
6866
6867         * expression.cs (Binary): same.  Warn about errors where we have
6868         Enum/Enum in operator + as well.
6869
6870 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
6871
6872         * statement.cs:
6873                 - added support for switch(bool)
6874                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6875                 - add TableSwitchEmit() to handle table-based switch statements
6876
6877 2002-04-05  Ravi Pratap  <ravi@ximian.com>
6878
6879         * expression.cs (Invocation.OverloadResolve): Factor out code which
6880         does parameter compatibility checking with arguments so that we can 
6881         re-use the code even from Delegate.VerifyApplicability
6882
6883         (VerifyArgumentsCompat): Move above code here.
6884
6885         * delegate.cs (VerifyApplicability): Get rid of duplicate code
6886         and instead make a call to the above method.
6887
6888 2002-03-31  Ravi Pratap  <ravi@ximian.com>
6889
6890         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6891         We use it to keep track of classes which are attribute types.
6892
6893 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
6894
6895         * delegate.cs (Delegate.Define): Correctly define the types in the
6896         presence of fixed and array parameters.
6897
6898         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6899         doing FindMembers.
6900
6901         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6902         include NonPublic after the first iteration.
6903
6904         * class.cs (Indexer.CheckBase): Only check if both parents are
6905         non-null. 
6906         
6907         * cs-parser.jay (accessor_body): If empty, set to null.
6908
6909         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6910         same code path here to resolve constants names that we did have in
6911         MemberAccess.DoResolve.  There is too much code duplicated here.
6912
6913 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
6914
6915         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6916
6917         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6918         to MakeUnionSet.
6919
6920         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6921         tokens, numbers and strings.
6922
6923         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6924         parenthesis.
6925
6926         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6927         asyncronous parameters and the regular parameters.  
6928
6929         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6930         specify the target directory.
6931
6932         * expression.cs: (This.DoResolve): Simplify
6933         (As.Emit): Optimize, do not generate IsInst if the expression is
6934         always of the given type.
6935
6936         (Is.DoResolve): Bug fix, we were reporting both always/never for
6937         the is expression.
6938
6939         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6940         creating too many unnecessary arrays.
6941
6942 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
6943
6944         * class.cs (EmitFieldInitializer): Use Assign expression to assign
6945         fields instead of rolling our own initializer.   Takes care of all
6946         implicit conversions, and drops unnecessary static checks/argument.
6947
6948 2002-03-31  Dick Porter  <dick@ximian.com>
6949
6950         * driver.cs: use the GetDirectories() return values properly, and
6951         use "/" as path separator.
6952
6953 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
6954
6955         * expression.cs (Unary): Optimize - - expr into expr.
6956         (Binary): Optimize a + (-b) into a -b.
6957
6958         * codegen.cs (CodeGen): Made all methods static.
6959
6960 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
6961
6962         * rootcontext.cs: 
6963
6964         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6965         TypeBuilder property.
6966
6967         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6968         instead. 
6969
6970         * tree.cs: Removed the various RecordXXXX, and replaced with a
6971         single RecordDecl.  Removed all the accessor methods, and just
6972         left a single access point Type 
6973
6974         * enum.cs: Rename DefineEnum to DefineType.
6975
6976         * decl.cs: New abstract method `DefineType' used to unify the
6977         Defines for Enumerations, Interfaces, TypeContainers and
6978         Delegates.
6979
6980         (FindType): Moved LookupInterfaceOrClass here.  Moved the
6981         LookupBaseClasses method that used to live in class.cs and
6982         interface.cs here, and renamed to FindType.
6983         
6984         * delegate.cs: Implement DefineType.  Take advantage of the
6985         refactored pattern for locating the parent builder without taking
6986         the parent_builder argument (which we know does not work if we are
6987         nested, and triggering a toplevel definition).
6988
6989 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
6990
6991         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
6992         accessibility of a member has changed during override and report
6993         an error if so.
6994
6995         * class.cs (Method.Define, Property.Define): Only complain on
6996         overrides if the method is private, any other accessibility is
6997         fine (and since we just checked the permission is the same, we are
6998         good to go).
6999
7000         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
7001         and elif are processed always.  The other pre-processing
7002         directives are only processed if we are "taking" the path
7003
7004 2002-03-29  Martin Baulig  <martin@gnome.org>
7005
7006         * class.cs (Method.Emit): Only emit symbolic debugging info if the
7007         current location is not Null.
7008
7009         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
7010         a separate method so we can profile it.
7011
7012         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
7013         `span.Seconds' are just seconds, but no minutes or hours.
7014         (MainDriver): Profile the CodeGen.SaveSymbols calls.
7015
7016 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
7017
7018         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
7019         Remove the gratuitous set of Final:
7020
7021                                 // If an interface implementation, then we can set Final.
7022                                 if (((flags & MethodAttributes.Abstract) == 0) &&
7023                                     implementing.DeclaringType.IsInterface)
7024                                         flags |= MethodAttributes.Final;
7025
7026         I do not know what I was smoking when I used that.
7027         
7028
7029         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
7030         step into fixing the name resolution issues for delegates and
7031         unifying the toplevel name resolution.
7032
7033 2002-03-28  Martin Baulig  <martin@gnome.org>
7034
7035         * class.cs (Method.Emit): If we have a symbol writer, call its
7036         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
7037         tell it about the current method.
7038
7039         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
7040         writer that we're going to emit the first byte of IL code for a new
7041         statement (a new source line).
7042         (EmitContext.EmitTopBlock): If we have a symbol writer, call
7043         EmitContext.Mark() before emitting any code.
7044
7045         * location.cs (SymbolDocument): Return null when we're Null.
7046
7047         * statement.cs (Statement): Moved the `Location loc' variable here.
7048         (Statement.EmitBoolExpression): If we have a symbol writer, call
7049         ec.Mark() before emitting any code to tell it that we're at the
7050         beginning of a new statement.
7051         (StatementExpression): Added `Location' argument to the constructor.
7052         (Block): Added public readonly variable `StartLocation' and public
7053         variable `EndLocation'.  The latter is to be set using SetEndLocation().
7054         (Block): Added constructor which takes a start and end location.
7055         (Block.SetEndLocation): New method. This sets the end location.
7056         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
7057         local variables we create.
7058         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
7059         each statement and do also mark the begin and end of the block.
7060
7061         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
7062         tell it the current lexer.Location, use Location.Null for the end of the
7063         block.
7064         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
7065         current block, set its end location using SetEndLocation().
7066         (statement_expression): StatementExpression constructor now takes the
7067         lexer.Location as additional argument.
7068         (for_statement, declare_local_variables): Likewise.
7069         (declare_local_variables): When creating a new implicit block, use the
7070         new Block constructor and pass it the lexer.Location.
7071
7072 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
7073
7074         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
7075         members also on the parent interfaces recursively.
7076
7077 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
7078
7079         * report.cs: Use new formats, since Gonzalo finished the missing
7080         bits. 
7081
7082         * expression.cs (Binary.ResolveOperator): added missing operator|
7083         operator& and operator^ for bool/bool.
7084
7085         * cs-parser.jay: CheckDef now takes a Location argument that is
7086         used to report errors more precisly (instead of reporting the end
7087         of a definition, we try to track something which is a lot closer
7088         to the source of the problem).
7089
7090         * cs-tokenizer.cs: Track global token use, so we can properly flag
7091         the use of #define/#undef after the first token has been seen.
7092
7093         Also, rename the reportXXXX to Error_DescriptiveName
7094
7095         * decl.cs (DeclSpace.IsTopLevel): Move property here from
7096         TypeContainer, so that Enum and Interface can use this too.
7097
7098         * class.cs (TypeContainer.LookupInterfaceOrClass,
7099         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
7100         `builder' argument.  Typically this was used to pass the parent
7101         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
7102         the definition).  
7103
7104         The problem is that a nested class could trigger the definition of
7105         a toplevel class, and the builder would be obviously wrong in that
7106         case. 
7107
7108         So we drop this argument, and we compute dynamically the
7109         TypeBuilder/ModuleBuilder (the correct information was available
7110         to us anyways from DeclSpace.Parent)
7111
7112         * interface.cs (Interface.DefineInterface): Drop builder
7113         parameter cleanup like class.cs
7114
7115         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
7116         like class.cs
7117
7118         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
7119         values. 
7120
7121         (Try.Emit): Propagate the returns value from the statement.
7122
7123         (Return.Emit): Even if we are leavning 
7124
7125         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
7126
7127         * modifiers.cs: Fix the computation of MethodAttributes flags.
7128
7129 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
7130
7131         * driver.cs: allow compilation of files that start with '/'.
7132         Add a default case when checking the argument of --target.
7133
7134 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
7135
7136         * interface.cs: Implement the same search algorithm for types in
7137         the interface code.
7138
7139         * delegate.cs: Do not allow multiple definition.
7140
7141         * Recovered ChangeLog that got accidentally amputated
7142
7143         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
7144
7145         * rootcontext.cs: Load manually enum to allow core classes to
7146         contain enumerations.
7147
7148         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
7149         Update to new static methods in TypeManager.
7150
7151         * typemanager.cs (GetMethod, GetConstructor): Use our
7152         implementation of FindMembers to find the members, since during
7153         corlib compilation, the types are TypeBuilders and GetMethod and
7154         GetConstructor do not work.
7155
7156         Make all methods in TypeManager static.
7157
7158         (InitCodeHelpers): Split the functionality from
7159         the InitCodeTypes function.
7160
7161         * driver.cs: Call InitCodeHelpers after we have populated the
7162         types. 
7163
7164         * cs-parser.jay (delegate_declaration): we did not used to compute
7165         the delegate name correctly for void delegates.
7166
7167 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
7168
7169         * rootcontext.cs (RootContext): Init the interface_resolve_order
7170         and type_container_resolve_order always.
7171
7172         (ResolveCore, BootstrapCorlib_ResolveClass,
7173         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
7174         compiler when compiling with --nostdlib
7175
7176         * class.cs (TypeContainer.DefineType): Check that our parent is
7177         not null.  This test is most important when we are bootstraping
7178         the core types.
7179
7180         * codegen.cs: Split out the symbol writing code.
7181
7182 2002-03-25  Martin Baulig  <martin@gnome.org>
7183
7184         * driver.cs (-g): Made -g an alias for --debug.
7185
7186 2002-03-24  Martin Baulig  <martin@gnome.org>
7187
7188         * codegen.cs (SymbolWriter): New public variable. Returns the
7189         current symbol writer.
7190         (CodeGen): Added `bool want_debugging_support' argument to the
7191          constructor. If true, tell the ModuleBuild that we want debugging
7192         support and ask it for the ISymbolWriter.
7193         (Save): If we have a symbol writer, call it's Close() method after
7194         saving the assembly.
7195
7196         * driver.c (--debug): New command line argument to create a
7197         debugger information file.
7198
7199         * location.cs (SymbolDocument): New public property. Returns an
7200         ISymbolDocumentWriter object for the current source file or null
7201         if we don't have a symbol writer.
7202
7203 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
7204
7205         * driver.cs (LoadAssembly): Correctly return when all the paths
7206         have been tried and not before.
7207
7208         * statement.cs (Switch.Emit): return the actual coverage for this
7209         statement (returns/not-returns)
7210
7211         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
7212         switch of the statement if we are the last switch section.  That
7213         kills two problems: try/catch problems (we used to emit an empty
7214         nop at the end) and switch statements where all branches would
7215         return. 
7216
7217 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
7218
7219         * driver.cs: Add default assemblies (the equivalent to the
7220         Microsoft CSC.RSP file)
7221
7222         * cs-tokenizer.cs: When updating `cols and setting it to zero,
7223         also update tokens_seen and set it to false.
7224
7225         * driver.cs: Implement --recurse for Mike.
7226
7227         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
7228         correctly splitting out the paths.
7229
7230 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
7231
7232         * interface.cs (Interface.PopulateProperty): Instead of using
7233         `parent' as the declaration space for the set parameters, use
7234         `this' 
7235
7236         * support.cs (InternalParameters): InternalParameters constructor
7237         takes a DeclSpace instead of a TypeContainer.
7238
7239         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
7240         types are being initialized, load the address of it before calling
7241         the function.  
7242
7243         (New): Provide a mechanism to disable the generation of local
7244         value type temporaries when the caller will be providing us with
7245         an address to store it.
7246
7247         (ArrayCreation.EmitDynamicInitializers): Use it.
7248
7249 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
7250
7251         * expression.cs (Invocation.EmitArguments): Only probe for array
7252         property if there is more than one argument.  Sorry about that.
7253
7254         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
7255         empty param arrays.
7256         
7257         * class.cs (Method.LabelParameters): Fix incorrect code path that
7258         prevented the `ParamArrayAttribute' from being applied to the
7259         params attribute.
7260
7261 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
7262
7263         * support.cs (ReflectionParameters): Correctly compute whether the
7264         last argument is a params array.  Fixes the problem with
7265         string.Split ('a')
7266
7267         * typemanager.cs: Make the assemblies array always be non-null
7268         (empty, but non-null)
7269
7270         * tree.cs (RecordDecl): New function that abstracts the recording
7271         of names.  This reports error 101, and provides a pointer to the
7272         previous declaration.  Fixes a crash in the compiler.
7273
7274         * cs-parser.jay (constructor_declaration): Update to new grammar,
7275         and provide a constructor_body that can be empty.
7276
7277 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
7278
7279         * driver.cs: Add support for --resources.
7280
7281         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
7282         Make all types for the various array helper methods be integer.
7283
7284         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
7285         CheckState to ConvCast.
7286
7287         (ConvCast): Now it takes a `checked' state argument, to avoid
7288         depending on the emit context for the conversion, and just using
7289         the resolve time setting.
7290
7291         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
7292         instead of Invocation.EmitArguments.  We do not emit the original
7293         arguments, instead we emit those which have been converted to
7294         unsigned int expressions.
7295
7296         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
7297
7298         * codegen.cs: ditto.
7299
7300         * expression.cs (LocalVariableReference): Drop the use of the
7301         Store function that depended on the variable index.
7302
7303         * statement.cs (VariableInfo): Drop the `Idx' property from this
7304         class, as this is not taking into account the indexes for
7305         temporaries tat we generate during the execution, getting the
7306         indexes wrong.
7307
7308         * class.cs: First emit class initializers, then call the parent
7309         constructor. 
7310
7311         * expression.cs (Binary): Fix opcode emision.
7312         (UnaryMutator.EmitCode): Support checked code generation
7313
7314         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
7315         matches for events for both the Static and Instance scans,
7316         pointing to the same element.   Fix that.
7317
7318 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
7319
7320         * rootcontext.cs (ResolveTree): Always set the
7321         interface_resolve_order, because nested interfaces will be calling
7322         into us.
7323
7324         * class.cs (GetInterfaceOrClass): Track the same resolution
7325         process used by TypeManager.LookupType.  This fixes the nested
7326         type lookups in class declarations (separate path from
7327         LookupType). 
7328
7329         (TypeContainer.DefineType): Also define nested interfaces.
7330         (TypeContainer.RegisterOrder): New public function used to
7331         register the order in which child interfaces need to be closed.
7332
7333         Nested interfaces need to be closed after their parents have been
7334         created. 
7335         
7336         * interface.cs (InterfaceAttr): Put all the logic for computing
7337         the interface attribute here. 
7338
7339         (DefineInterface): Register our interface order with the
7340         RootContext or with the TypeContainer depending on the case.
7341
7342 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
7343
7344         * cs-parser.jay: rework foreach statement to work with the new
7345         changes to the policy on SimpleNames.
7346         
7347         * report.cs: support Stacktrace on warnings as well.
7348
7349         * makefile: drop --unsafe and /unsafe from the compile.
7350
7351 2002-03-13  Ravi Pratap  <ravi@ximian.com>
7352
7353         * ecore.cs (StandardConversionExists): Modify to take an Expression
7354         as the first parameter. Ensure we do null -> reference type conversion
7355         checking.
7356
7357         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
7358         temporary Expression objects.
7359
7360 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
7361
7362         * interface.cs: workaround bug in method overloading resolution
7363         (there is already a bugzilla bug for it).
7364
7365 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
7366
7367         We could also solve this problem by having a separate path for
7368         performing type lookups, instead of DoResolve, we could have a
7369         ResolveType entry point, and only participating pieces of the
7370         production (simplename, deref, array) would implement this. 
7371         
7372         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
7373         signal SimpleName to only resolve type names and not attempt to
7374         resolve anything else.
7375
7376         * expression.cs (Cast): Set the flag.
7377
7378         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
7379
7380         * class.cs: Only report 108 if there is no `new' modifier.
7381
7382         * cs-parser.jay: rework foreach statement to work with the new
7383         changes to the policy on SimpleNames.
7384         
7385         * report.cs: support Stacktrace on warnings as well.
7386
7387         * makefile: drop --unsafe and /unsafe from the compile.
7388
7389 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
7390
7391         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7392         lookups here, instead of doing that at parse time.  This means
7393         that our grammar will not introduce `LocalVariableReferences' as
7394         expressions at this point.  That solves the problem of code like
7395         this:
7396
7397         class X {
7398            static void Main ()
7399            { int X = 1;
7400             { X x = null }}}
7401
7402         This is only half the fix.  The full fix requires parameters to
7403         also be handled in this way.
7404
7405         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
7406         makes the use more obvious of the DeclSpace.  The
7407         ec.TypeContainer.TypeBuilder is now only used to pull the
7408         TypeBuilder for it.
7409
7410         My theory is that I can get rid of the TypeBuilder completely from
7411         the EmitContext, and have typecasts where it is used (from
7412         DeclSpace to where it matters).  
7413
7414         The only pending problem is that the code that implements Aliases
7415         is on TypeContainer, and probably should go in DeclSpace.
7416
7417         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7418         lookups here, instead of doing that at parse time.  This means
7419         that our grammar will not introduce `LocalVariableReferences' as
7420         expressions at this point.  That solves the problem of code like
7421         this:
7422
7423         class X {
7424            static void Main ()
7425            { int X = 1;
7426             { X x = null }}}
7427
7428         This is only half the fix.  The full fix requires parameters to
7429         also be handled in this way.
7430
7431         * class.cs (Property.DefineMethod): When implementing an interface
7432         method, set newslot, when implementing an abstract method, do not
7433         set the flag (before we tried never setting it, or always setting
7434         it, which is the difference).
7435         (Indexer.DefineMethod): same.
7436         (Method.DefineMethod): same.
7437
7438         * ecore.cs: Only set the status used flag if we get back a Field.
7439
7440         * attribute.cs: Temporary hack, so Paolo can keep working.
7441
7442 2002-03-08  Ravi Pratap  <ravi@ximian.com>
7443
7444         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
7445         the unmanaged type in the case we have a MarshalAs attribute.
7446
7447         (Resolve): Handle the case when we are parsing the special MarshalAs
7448         attribute [we need to store the unmanaged type to use later]
7449         
7450         * typemanager.cs (marshal_as_attr_type): Built in type for the 
7451         MarshalAs Attribute.
7452
7453         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
7454         on parameters and accordingly set the marshalling info.
7455         
7456 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
7457
7458         * class.cs: Optimizing slightly by removing redundant code after
7459         we switched to the `NoTypes' return value.
7460         (Property.DefineMethod): use NoTypes here too.
7461
7462         This fixes the bug I introduced in my last batch of changes.
7463
7464 2002-03-05  Ravi Pratap  <ravi@ximian.com>
7465
7466         * tree.cs (RecordEnum): Add. We now keep track of enums too.
7467
7468         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
7469         Enums since those are types too. 
7470
7471         * cs-parser.jay (enum_declaration): Record enums as we parse them.
7472         
7473         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
7474         thanks to a call during the lookup process.
7475
7476 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
7477
7478         * statement.cs (Foreach): Lots of work to accomodate a particular
7479         kind of foreach statement that I had not kept in mind.  It is
7480         possible to have foreachs on classes that provide a GetEnumerator
7481         method that return objects that implement the "pattern" for using
7482         a foreach, there is no need to support GetEnumerator
7483         specifically. 
7484
7485         This is needed to compile nant.
7486
7487         * decl.cs: Only report 114 if the member is not `Finalize' and if
7488         the warning level is at least 2.
7489
7490         * class.cs: Moved the compare function from Method to
7491         MethodSignature. 
7492
7493         (MethodSignature.InheritableMemberSignatureCompare): Add new
7494         filter function that is used to extract inheritable methods from a
7495         class. 
7496
7497         (Method.Define): Use the new `inheritable_method_signature_filter'
7498         delegate
7499
7500         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
7501         command. 
7502
7503 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
7504
7505         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
7506
7507         * cs-parser.jay: Add opt_semicolon to the interface declaration.
7508
7509         * expression.cs: Pass location information to
7510         ConvertImplicitStandard. 
7511
7512         * class.cs: Added debugging code to track return values from
7513         interfaces. 
7514
7515 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
7516
7517         * expression.cs (Is.DoResolve): If either side of the `is' is an
7518         interface, do not flag the warning.
7519
7520         * ecore.cs (ImplicitReferenceConversion): We need a separate test
7521         for interfaces
7522
7523         * report.cs: Allow for --fatal to be used with --probe.
7524         
7525         * typemanager.cs (NoTypes): Move the definition for the empty Type
7526         array here. 
7527
7528         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7529         properties. 
7530         (TypeContainer.DefineProxy): New function used to proxy to parent
7531         implementations when implementing interfaces.
7532         (TypeContainer.ParentImplements): used to lookup if our parent
7533         implements a public function that is required by an interface.
7534         (TypeContainer.VerifyPendingMethods): Hook this up.
7535
7536         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7537         `modules' and `assemblies' arraylists into arrays.  We only grow
7538         these are the very early start up of the program, so this improves
7539         the speedof LookupType (nicely measured).
7540
7541         * expression.cs (MakeByteBlob): Replaced unsafe code with
7542         BitConverter, as suggested by Paolo.
7543
7544         * cfold.cs (ConstantFold.Binary): Special case: perform constant
7545         folding of string concatenation, but if either side is a string,
7546         and the other is not, then return null, and let the runtime use
7547         the concatenation on the string plus the object (using
7548         `Object.ToString'). 
7549
7550 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
7551
7552         Constant Folding has been implemented now.
7553         
7554         * expression.cs (Unary.Reduce): Do not throw an exception, catch
7555         the error instead on types that are not supported in one's
7556         complement. 
7557
7558         * constant.cs (Constant and all children): New set of functions to
7559         perform implict and explicit conversions.
7560         
7561         * ecore.cs (EnumConstant): Implement the new functions to perform
7562         conversion by proxying to the child expression.
7563
7564         * codegen.cs: (ConstantCheckState): Constant evaluation has its
7565         own separate setting that can not be turned off from the command
7566         line using --unchecked or --checked and is only controlled using
7567         the checked/unchecked statements and expressions.  This setting is
7568         used by the constant folder to flag errors.
7569
7570         * expression.cs (CheckedExpr, UncheckedExpr): Set the
7571         ConstantCheckState as well.   
7572
7573         During Resolve, they also have to flag the state, because the
7574         constant folder runs completely in the Resolve phase.
7575
7576         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7577         well.
7578
7579 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7580
7581         * cfold.cs: New file, this file contains the constant folder.
7582         
7583         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7584         argument to track whether we are using the resulting address to
7585         load or store a value and provide better error messages. 
7586
7587         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7588         new AddressOf arguments.
7589
7590         * statement.cs (Foreach.EmitCollectionForeach): Update
7591
7592         * expression.cs (Argument.Emit): Call AddressOf with proper
7593         arguments to track usage.
7594
7595         (New.DoEmit): Call AddressOf with new arguments.
7596
7597         (Unary.Emit): Adjust AddressOf call.
7598
7599 2002-03-01  Ravi Pratap  <ravi@ximian.com>
7600
7601         * cs-parser.jay (member_access): Change the case for pre-defined types
7602         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
7603         this suggestion.
7604
7605         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7606         a method body.
7607
7608         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7609         essentially like methods and apply attributes like MethodImplOptions to them too.
7610
7611         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7612         not being null.
7613
7614         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7615         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7616         is the DeclSpace.
7617
7618         * Update code everywhere accordingly.
7619
7620         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7621
7622         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7623
7624 2002-02-28  Ravi Pratap  <ravi@ximian.com>
7625
7626         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7627         try performing lookups against those instead of jumping straight into using
7628         the 'using' clauses.
7629
7630         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7631
7632         (LookupType): Perform lookups in implicit parents too.
7633
7634         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7635         sequence as RootContext.LookupType. 
7636
7637         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
7638         the various cases of namespace lookups into this method.
7639
7640 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
7641
7642         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7643         in positional arguments)
7644
7645         * class.cs (Operator): Update the AllowedModifiers to contain
7646         extern. 
7647
7648         * cs-parser.jay: Update operator declaration to allow for the
7649         operator body to be empty.
7650
7651         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7652         values. 
7653
7654 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
7655
7656         * class.cs (Method.Emit): Label parameters.
7657
7658         * driver.cs: Return 1 or 0 as the program exit code.
7659
7660 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
7661
7662         * expression.cs: Special case the `null' object when trying to
7663         auto-compute the type, as anything can be explicitly converted to
7664         that. 
7665
7666         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7667         spotting this Paolo.
7668
7669         (Expression.ImplicitNumericConversion): Perform comparissions of
7670         the type using the underlying type in the case of an enumeration
7671         rather than using the enumeration type for the compare.
7672
7673         Cope with the underlying == type case, which is not possible to
7674         catch before. 
7675
7676         (Expression.ConvertNumericExplicit): Perform comparissions of
7677         the type using the underlying type in the case of an enumeration
7678         rather than using the enumeration type for the compare.
7679
7680         * driver.cs: If the user does not supply an extension, assume .exe
7681
7682         * cs-parser.jay (if_statement): Rewrote so that we can track the
7683         location for the if statement.
7684
7685         * expression.cs (Binary.ConstantFold): Only concat strings when
7686         the operation is "+", not everything ;-)
7687
7688         * statement.cs (Statement.EmitBoolExpression): Take a location
7689         argument. 
7690         (If, While, Do): Track location.
7691
7692         * expression.cs (Binary.ResolveOperator): In the object + string
7693         case, I was missing a call to ConvertImplicit
7694
7695 2002-02-25  Ravi Pratap  <ravi@ximian.com>
7696
7697         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7698         Location arguments. Ensure we use RootContext.LookupType to do our work
7699         and not try to do a direct Type.GetType and ModuleBuilder.GetType
7700
7701         * interface.cs (PopulateMethod): Handle the type of the parameter being
7702         null gracefully.
7703
7704         * expression.cs (Invocation.BetterFunction): Handle the case when we 
7705         have a params method with no fixed arguments and a call is made with no
7706         arguments.
7707
7708 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
7709
7710         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7711         the verbatim-string-literal
7712
7713         * support.cs (InternalParameters.ParameterModifier): handle null
7714         fixed parameters.
7715         (InternalParameters.ParameterType): ditto.
7716
7717         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7718         duplicating the name of the variable parameter.
7719         (GetParameterByName): Fix bug where we were not looking up array
7720         paramters if they were the only present (thanks Paolo!).
7721         (GetParameterInfo): We only have an empty set of types if both
7722         fixed and array are set to null.
7723         (GetParameterInfo-idx): Handle FixedParameter == null
7724
7725         * cs-parser.jay: Handle the case where there is no catch
7726         statements (missing null test).
7727
7728 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
7729
7730         * driver.cs (MainDriver): Be conservative on our command line
7731         handling.
7732
7733         Catch DirectoryNotFoundException when calling GetFiles.
7734         
7735         (SplitPathAndPattern): Used to split the input specification into
7736         a path and a pattern that we can feed to Directory.GetFiles.
7737
7738 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
7739
7740         * statement.cs (Fixed): Implement the last case of the Fixed
7741         statement (string handling).
7742
7743         * expression.cs (StringPtr): New class used to return a char * to
7744         a string;  Used by the Fixed statement.
7745
7746         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
7747
7748         * expression.cs (Binary.ResolveOperator): Remove redundant
7749         MemberLookup pn parent type.
7750         Optimize union call, we do not need a union if the types are the same.
7751         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7752         type.
7753
7754         Specialize the use of MemberLookup everywhere, instead of using
7755         the default settings. 
7756
7757         (StackAlloc): Implement stackalloc keyword.
7758
7759         * cs-parser.jay: Add rule to parse stackalloc.
7760         
7761         * driver.cs: Handle /h, /help, /?
7762
7763         * expression.cs (MakeByteBlob): Removed the hacks we had in place
7764         before we supported unsafe code.
7765         
7766         * makefile: add --unsafe to the self compilation of mcs.
7767
7768 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
7769
7770         * expression.cs (PointerArithmetic): New class that is used to
7771         perform pointer arithmetic.
7772         (Binary.Resolve): Handle pointer arithmetic
7773         Handle pointer comparission.
7774         (ArrayPtr): Utility expression class that is used to take the
7775         address of an array.
7776
7777         (ElementAccess): Implement array access for pointers
7778         
7779         * statement.cs (Fixed): Implement fixed statement for arrays, we
7780         are missing one more case before we are done.
7781
7782         * expression.cs (Indirection): Implement EmitAssign and set the
7783         ExprClass to Variable.  This allows pointer dereferences to be
7784         treated as variables, and to have values assigned to them.
7785         
7786         * ecore.cs (Expression.StoreFromPtr): New utility function to
7787         store values dereferencing.
7788
7789 2002-02-20  Ravi Pratap  <ravi@ximian.com>
7790
7791         * expression.cs (Binary.ResolveOperator): Ensure that we are
7792         not trying to operate on a void type - this fixes the reported
7793         bug.
7794
7795         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7796         the parent implementation is sealed.
7797
7798         * ../errors/cs0239.cs : Add.
7799
7800         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7801
7802         * typemanager.cs (unverifiable_code_type): Corresponds to 
7803         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7804         which have unsafe code in them.
7805
7806         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
7807         unsafe context.
7808
7809 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
7810
7811         * cs-tokenizer.cs: Add support for @"litreal strings"
7812
7813         Make tokenizer accept pre-processor directives
7814         on any column (remove the old C-like limitation). 
7815
7816         * rootcontext.cs (EmitCode): Emit any global attributes.
7817         (AddGlobalAttributes): Used to keep track of assembly attributes. 
7818
7819         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7820
7821         * cs-parser.jay: Add support for global attributes.  
7822
7823 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
7824
7825         * expression.cs (Indirection): New helper class.  Unary will
7826         create Indirection classes to be able to implement the
7827         IMemoryLocation interface on it.
7828
7829 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
7830
7831         * cs-parser.jay (fixed_statement): reference the right statement.
7832
7833         * statement.cs (Fixed.Emit): Finish implementing the fixed
7834         statement for the &x case.
7835
7836 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
7837
7838         * class.cs (Property.Define, Method.Define): Remove newslot when
7839         `implementing'.  
7840
7841         * modifiers.cs: My use of NewSlot when `Abstract' was set was
7842         wrong.  NewSlot should only be used if the `new' keyword is present.
7843
7844         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7845         locating our system dir.  Sorry about this.
7846
7847 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7848
7849         * driver.cs (GetSystemDir): Compute correctly the location of our
7850         system assemblies.  I was using the compiler directory instead of
7851         the library directory.
7852
7853 2002-02-13  Ravi Pratap  <ravi@ximian.com>
7854
7855         * expression.cs (BetterFunction): Put back in what Miguel commented out
7856         since it is the correct fix. The problem is elsewhere ;-)
7857
7858         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7859         parameters of the parms method are themselves compatible or not !
7860
7861         (StandardConversionExists): Fix very dangerous bug where we were forgetting
7862         to check that a class implements an interface before saying that an implicit
7863         conversion was allowed. Use ImplementsInterface to do the checking.
7864
7865 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
7866
7867         * class.cs (Method.Define): Track whether we are an explicit
7868         implementation or not.  And only call DefineMethodOverride if we
7869         are an explicit implementation.
7870
7871         (Property.DefineMethod): Ditto.
7872
7873 2002-02-11  Ravi Pratap  <ravi@ximian.com>
7874
7875         * expression.cs (BetterFunction): Catch hideous bug which was
7876          preventing us from detecting ambiguous calls due to implicit casts i.e
7877         cs0121.
7878
7879 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
7880
7881         * support.cs (Pair): Remove un-needed method.  I figured why I was
7882         getting the error in cs-parser.jay, the variable in a foreach loop
7883         is readonly, and the compiler does not really treat this as a variable.
7884
7885         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
7886         instead of EQUALS in grammar.  
7887
7888         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7889
7890         * expression.cs (Unary.DoResolve): Check whether the argument is
7891         managed or not.
7892
7893 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
7894
7895         * support.cs: Api for Pair to set a value.  Despite the fact that
7896         the variables are public the MS C# compiler refuses to compile
7897         code that accesses the field if the variable is part of a foreach
7898         statement. 
7899
7900         * statement.cs (Fixed): Begin implementation of the fixed
7901         statement.
7902
7903         (Block.AddVariable): Return the VariableInfo on success and null
7904         on failure instead of true/false. 
7905
7906         * cs-parser.jay (foreach): Catch errors on variables already
7907         defined (we were ignoring this value before) and properly unwind
7908         the block hierarchy
7909
7910         (fixed_statement): grammar for the fixed statement.
7911
7912 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
7913
7914         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7915         pointer types to be incretemented.
7916
7917         (SizeOf): Implement.
7918
7919         * cs-parser.jay (pointer_member_access): Implement
7920         expr->IDENTIFIER production.
7921
7922         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7923         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7924         on safe contexts.
7925
7926         (Unary): Implement indirection.
7927
7928         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7929         use in non-unsafe context).
7930
7931         (SimpleName.DoResolve): Check for pointers in field access on safe
7932         contexts. 
7933
7934         (Expression.LoadFromPtr): Factor the load-indirect code in this
7935         function.  This was duplicated in UnboxCast and ParameterReference
7936
7937 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
7938
7939         * expression.cs (ComposedCast): report an error if a pointer cast
7940         is used in a safe region.
7941
7942         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7943         pointer type casts in unsafe context.
7944
7945         * codegen.cs (EmitContext): Set up IsUnsafe.
7946
7947         * cs-parser.jay (non_expression_type): Add productions for pointer
7948         casts. 
7949
7950         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7951         code.  We should not use force into static mode if the method is
7952         not virtual.  Fixes bug in MIS
7953
7954         * statement.cs (Do.Emit, While.Emit, For.Emit,
7955         Statement.EmitBoolExpression): Add support to Do and While to
7956         propagate infinite loop as `I do return' semantics.
7957
7958         Improve the For case to also test for boolean constants.
7959
7960         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7961         to the list of attributes we can add.
7962
7963         Remove `EmitContext' argument.
7964
7965         * class.cs (Method.Define): Apply parameter attributes.
7966         (Constructor.Define): Apply parameter attributes.
7967         (MethodCore.LabelParameters): Move here the core of labeling
7968         parameters. 
7969
7970         * support.cs (ReflectionParameters.ParameterModifier,
7971         InternalParameters.ParameterModifier): Use IsByRef on the type and
7972         only return the OUT bit for these parameters instead of in/out/ref
7973         flags.
7974
7975         This is because I miss-understood things.  The ParameterInfo.IsIn
7976         and IsOut represent whether the parameter has the [In] and [Out]
7977         attributes set.  
7978
7979 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
7980
7981         * ecore.cs (FieldExpr.Emit): Release temporaries.
7982
7983         * assign.cs (LocalTemporary.Release): new function.
7984
7985         * codegen.cs (EmitContext.GetTemporaryStorage,
7986         EmitContext.FreeTemporaryStorage): Rework the way we deal with
7987         temporary storage.  Now we can "put back" localbuilders when we
7988         are done with them
7989
7990 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
7991
7992         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
7993         need to make a copy of the variable to generate verifiable code.
7994
7995 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
7996
7997         * driver.cs: Compute dynamically the system directory.
7998
7999         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
8000         Slower, but more generally useful.  Used by the abstract
8001         registering implementation. 
8002
8003         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
8004         the rules for the special rule on Type/instances.  First check if
8005         we have the same name, and if so, try that special static path
8006         rather than the instance path.
8007         
8008 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
8009
8010         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
8011         for, while and if.
8012
8013         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
8014         Enum, ValueType, Delegate or Array for non-corlib compiles.
8015
8016         * cs-tokenizer.cs: Catch long identifiers (645)
8017
8018         * typemanager.cs (IndexerPropetyName): Ravi never tested this
8019         piece of code.
8020
8021         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
8022         fix, we were returning too early, so we were not registering
8023         pending methods from abstract classes.
8024
8025         Do not register pending methods if the class is abstract.
8026
8027         * expression.cs (Conditional.DoResolve): Report circular implicit
8028         conversions when we neecd to compute it for conditional
8029         expressions. 
8030
8031         (Is.DoResolve): If the expression is always of the provided type,
8032         flag warning 183.  If the expression can not ever be of the
8033         provided type flag warning 184.
8034
8035         * class.cs: Catch 169 as well.
8036
8037         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
8038         read. 
8039
8040 2002-01-18  Nick Drochak  <ndrochak@gol.com>
8041
8042         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
8043
8044 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
8045
8046         * interface.cs: (PopulateMethod): Check for pointers being defined
8047         only if the unsafe context is active.
8048         (PopulateProperty): ditto.
8049         (PopulateIndexer): ditto.
8050
8051         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
8052         specified.  If pointers are present, make sure that they are
8053         present in an unsafe context.
8054         (Constructor, Constructor.Define): ditto.
8055         (Field, Field.Define): ditto.
8056         (Property, Property.Define): ditto.
8057         (Event, Event.Define): ditto.
8058
8059         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
8060         hashtable if there are classes or structs defined.
8061
8062         * expression.cs (LocalVariableReference.DoResolve): Simplify this
8063         code, as the constant resolution moved.
8064
8065         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
8066         the metadata, so we can flag error 133. 
8067
8068         * decl.cs (MemberCore.UnsafeOK): New function to test that a
8069         pointer is being declared in an unsafe context.
8070
8071 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
8072
8073         * modifiers.cs (Modifiers.Check): Require a Location argument.
8074         Report error 227 for Unsafe use.
8075
8076         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
8077
8078         * statement.cs (For.Emit): If the test is null, then report that
8079         we do `return', as we wont reach anything afterwards.
8080
8081         (Switch.SwitchGoverningType): Track the expression that matched
8082         the conversion.
8083
8084         * driver.cs: Allow negative numbers as an error code to flag.
8085
8086         * cs-parser.jay: Handle 1551.
8087
8088         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
8089
8090 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
8091
8092         * cs-parser.jay: Report 1518 (type declaration can only contain
8093         class, struct, interface, enum or delegate)
8094
8095         (switch_label): Report 1523 (keywords `case' or `default' must
8096         preced code)
8097
8098         (opt_switch_sections): Report 1522 (empty switch)
8099
8100         * driver.cs: Report 1515 (response file specified multiple times)
8101         Report 1516 (Source file specified multiple times).
8102
8103         * expression.cs (Argument.Resolve): Signal 1510
8104
8105         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
8106         access not allowed in static code)
8107
8108 2002-01-11  Ravi Pratap  <ravi@ximian.com>
8109
8110         * typemanager.cs (IsPointerType): Utility method which we are going
8111         to need a lot.
8112
8113         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
8114         the object type, so we take care of that.
8115
8116         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
8117         
8118         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
8119         added to non-params parameters :-)
8120
8121         * typemanager.cs (CSharpName): Include 'void' type too. 
8122
8123         (void_ptr_type): Include in the set of core types.
8124
8125         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
8126         duplicating code.
8127
8128         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
8129         an unsafe context.
8130
8131         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
8132         completely forgotten about it.
8133
8134 2002-01-10  Ravi Pratap  <ravi@ximian.com>
8135
8136         * cs-parser.jay (pointer_type): Add. This begins our implementation
8137         of parsing rules for unsafe code.
8138
8139         (unsafe_statement): Implement.
8140
8141         (embedded_statement): Modify to include the above.
8142
8143         * statement.cs (Unsafe): Implement new class for unsafe blocks.
8144
8145         * codegen.cs (EmitContext.InUnsafe): Add. This determines
8146         if the current context is an unsafe one.
8147
8148         * cs-parser.jay (local_variable_pointer_type): Since local variable types
8149         are handled differently, we need separate rules for them.
8150
8151         (local_variable_declaration): Update to use local_variable_pointer_type
8152         to allow variable declarations of unmanaged pointer types.
8153
8154         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
8155         in unsafe contexts.
8156
8157         * ../errors/cs0214.cs : Add.
8158
8159 2002-01-16  Nick Drochak  <ndrochak@gol.com>
8160
8161         * makefile: remove 'response' file when cleaning.
8162
8163 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
8164
8165         * cs-parser.jay: Report 1524.
8166
8167 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
8168
8169         * typemanager.cs (RegisterMethod): drop checking if we have
8170         registered this from here
8171
8172 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
8173
8174         * class.cs (Method.EmitDestructor): Implement calling our base
8175         destructor. 
8176
8177         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
8178         value of InFinally.
8179
8180         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
8181         this routine and will wrap the call in a try/catch block.  Deal
8182         with the case.
8183
8184 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
8185
8186         * ecore.cs (Expression.MemberLookup): instead of taking a
8187         parameter `same_type' that was used to tell whether we could
8188         access private members we compute our containing type from the
8189         EmitContext.
8190
8191         (FieldExpr): Added partial support for volatile fields.  This does
8192         not work for volatile fields exposed from assemblies, as I can not
8193         figure out how to extract the modreq from it.
8194
8195         Updated all the source files to use this.
8196
8197         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
8198         because it is referenced by MemberLookup very often. 
8199
8200 2002-01-09  Ravi Pratap  <ravi@ximian.com>
8201
8202         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
8203         TypeBuilder.GetCustomAttributes to retrieve what we need.
8204
8205         Get rid of redundant default_member_attr_type as this is the same as
8206         default_member_type which already exists.
8207
8208         * interface.cs, attribute.cs : Update accordingly.
8209         
8210 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
8211
8212         * typemanager.cs: Enable IndexerPropertyName again.  It does not
8213         work for TYpeBuilders though.  Ravi, can you please fix this?
8214
8215         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
8216
8217         * expression.cs (Argument.Emit): Handle the case of ref objects
8218         being passed to ref functions;  
8219
8220         (ParameterReference.EmitLoad): Loads the content of the pointer
8221         without dereferencing.
8222
8223 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8224
8225         * cs-tokenizer.cs: Implemented the pre-processing expressions.
8226
8227 2002-01-08  Ravi Pratap  <ravi@ximian.com>
8228
8229         * class.cs (Indexer.DefineMethod): Incorporate the interface
8230         type in the name of the method if we are doing explicit interface
8231         implementation.
8232
8233         * expression.cs (ConversionExists): Remove as it is completely obsolete.
8234
8235         (BetterConversion): Fix extremely trivial bug where we were referring to
8236         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
8237         again !
8238
8239         * ../errors/bug16.cs : Add although we have fixed it.
8240
8241 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
8242
8243         * expression.cs (BaseIndexer): Begin implementation.
8244
8245         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
8246
8247         * cs-parser.jay (indexer_declarator): Use qualified_identifier
8248         production directly to remove a shift/reduce, and implement
8249         explicit interface implementation.
8250
8251         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
8252         after a floating point suffix.
8253
8254         * expression.cs (DoNumericPromotions): Improved the conversion for
8255         uint/uint.  If we have a constant, we avoid doing a typecast to a
8256         larger type.
8257
8258         * class.cs (Indexer): Implement explicit interface implementation
8259         for indexers.
8260         
8261 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
8262
8263         * class.cs: make the default instance constructor public and hidebysig.
8264
8265 2001-01-03  Ravi Pratap  <ravi@ximian.com>
8266
8267         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
8268         so we can call it from elsewhere.
8269
8270         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
8271         we emit it internally if the class has a defined indexer; otherwise the user
8272         emits it by decorating the class definition with the DefaultMemberAttribute.
8273
8274         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
8275         attribute is not used on a type which defines an indexer.
8276
8277         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
8278         character when we skip whitespace.
8279
8280         * ../errors/cs0646.cs : Add.
8281
8282 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
8283
8284         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
8285         again. 
8286
8287         * makefile: Add practical target `mcs3.exe' which builds the third
8288         generation compiler. 
8289
8290         * expression.cs (New): Fix structures constructor calling.
8291
8292         * class.cs (Property, Method, Indexer): Emit Final flag on the
8293         method if we are an interface implementation and we are not
8294         abstract. 
8295
8296         * ecore.cs (PropertyExpr): New public field `IsBase', tells
8297         whether this property is referencing a `base' method.
8298
8299         * expression.cs (Invocation.EmitCall): take an extra argument:
8300         is_base, this is used to determine whether the `call' or
8301         `callvirt' opcode should be used.
8302
8303         
8304         * delegate.cs: update EmitCall.
8305
8306         * class.cs (Method.Define): Set NewSlot for the cases where we are
8307         not implementing an interface method.
8308
8309         (Property.Define): ditto.
8310
8311 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
8312
8313         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
8314         'r'.  Allows mcs to parse itself fully.
8315
8316 2002-01-02  Ravi Pratap  <ravi@ximian.com>
8317
8318         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
8319         of the number of initializers that require the InitializeArray method.
8320
8321         (CheckIndices): Store the Expression in all cases - not the plain value. Also
8322         update the above field where necessary.
8323
8324         (MakeByteBlob): Update accordingly.
8325
8326         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
8327         greater than 2.
8328
8329         (EmitDynamicInitializers): Update in accordance with the new optimization.
8330
8331         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
8332         same OpCode applies.
8333
8334         * cs-parser.jay : Fix some glaring errors I introduced.
8335
8336 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
8337
8338         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
8339         so that we can check for name clashes there too.
8340
8341         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
8342         for interface indexers.
8343
8344         * interfaces.cs (Define): Emit the default member attribute.
8345
8346         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
8347         variable was being referred to while setting the value ;-)
8348
8349 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
8350
8351         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
8352         byte-by-byte information when we know the data is zero.
8353
8354         Make the block always a multiple of 4, because
8355         DefineInitializedData has a bug.
8356
8357         * assign.cs: Fix, we should assign from the temporary, not from
8358         the source. 
8359
8360         * expression.cs (MakeByteBlob): Fix my incorrect code.
8361
8362 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
8363
8364         * typemanager.cs (EnumToUnderlying): This function is used to get
8365         the underlying type from an enumeration, because it does not
8366         always work. 
8367
8368         * constant.cs: Use the I4_S form for values between -128 and 127.
8369
8370         * statement.cs (Block.LookupLabel): Looks up a label.
8371         (Block): Drop support for labeled blocks.
8372
8373         (LabeledStatement): New kind of statement that represents a label
8374         only.
8375
8376         (Goto): Finally implement this bad boy.
8377         
8378         * cs-parser.jay: Update to reflect new mechanism to implement
8379         labels.
8380
8381 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
8382
8383         * codegen.cs (EmitContext.This): a codegen property that keeps the
8384         a single instance of this instead of creating many different this
8385         instances. 
8386
8387         * delegate.cs (Delegate.DoResolve): Update to use the property;
8388
8389         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
8390
8391         * expression.cs (BaseAccess.DoResolve): Ditto.
8392
8393 2001-12-29  Ravi Pratap  <ravi@ximian.com>
8394
8395         * typemanager.cs (methodimpl_attr_type): Add to hold the type
8396         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
8397
8398         (InitCoreTypes): Update accordingly.
8399
8400         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
8401         so we can quickly store the state.
8402
8403         (ApplyAttributes): Set the correct implementation flags
8404         for InternalCall methods.
8405
8406 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
8407
8408         * expression.cs (EmitCall): if a method is not virtual, then do
8409         not use callvirt on it.
8410
8411         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
8412         user defined stuff) requires the use of stobj, which takes an
8413         address on the stack instead of an array and an index.  So emit
8414         the Ldelema operation for it.
8415
8416         (EmitStoreOpcode): Use stobj for valuetypes.
8417
8418         (UnaryMutator.EmitCode): Use the right 1 value depending on
8419         whether we are dealing with int64/uint64, float or doubles.
8420
8421         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
8422         constructors that I implemented last night.
8423
8424         (Constructor.IsDefault): Fix to work properly for static
8425         constructors.
8426
8427         * cs-parser.jay (CheckDef): report method signature errors.
8428         Update error number 103 to be 132.
8429
8430         * decl.cs: New AdditionResult enumeration value: MethodExists.
8431         Although we do this check for methods later on in the semantic
8432         analysis, catching repeated default constructors is so easy that
8433         we catch these here. 
8434         
8435         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
8436         promotions code.
8437
8438         (ParameterReference.EmitAssign, Emit): handle
8439         bools as bytes.
8440
8441         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
8442         (ArrayAccess.EmitStoreOpcode): ditto.
8443
8444         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
8445
8446         * expression.cs (MakeByteBlob): Complete all the missing types
8447         (uint, short, ushort, byte, sbyte)
8448
8449         * class.cs: Only init instance field initializers on instance
8450         constructors. 
8451
8452         Rename `constructors' to instance_constructors. 
8453
8454         (TypeContainer.AddConstructor): Only add constructors to the list
8455         if it is not static.
8456
8457         Make sure that we handle default_static_constructor independently
8458         everywhere where we handle instance_constructors
8459
8460 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
8461
8462         * class.cs: Do not lookup or create a base initializer for a
8463         static constructor.
8464
8465         (ConstructorInitializer.Resolve): use the proper type to lookup
8466         for constructors.
8467
8468         * cs-parser.jay: Report error 1585 (modifiers between type and name).
8469
8470         * enum.cs, interface.cs: Remove CloseType, this is taken care by
8471         in DeclSpace. 
8472
8473         * decl.cs: CloseType is now an virtual method, the default
8474         implementation just closes this type.
8475         
8476 2001-12-28  Ravi Pratap  <ravi@ximian.com>
8477
8478         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
8479         to PreserveSig by default. Also emit HideBySig on such methods.
8480
8481         Basically, set the defaults to standard values.
8482
8483         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
8484         argument, if candidate is better, it can't be worse than the best !
8485
8486         (Invocation): Re-write bits to differentiate between methods being
8487         applicable in their expanded form and their normal form - for params
8488         methods of course.
8489
8490         Get rid of use_standard everywhere as only standard conversions are allowed
8491         in overload resolution. 
8492
8493         More spec conformance.
8494         
8495 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
8496
8497         * driver.cs: Add --timestamp, to see where the compiler spends
8498         most of its time.
8499
8500         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
8501         `this' in static code.
8502
8503         (SimpleName.DoResolve): Implement in terms of a helper function
8504         that allows static-references to be passed upstream to
8505         MemberAccess.
8506
8507         (Expression.ResolveWithSimpleName): Resolve specially simple
8508         names when called by MemberAccess to implement the special
8509         semantics. 
8510
8511         (Expression.ImplicitReferenceConversion): Handle conversions from
8512         Null to reference types before others, as Null's type is
8513         System.Object. 
8514
8515         * expression.cs (Invocation.EmitCall): Handle the special case of
8516         calling methods declared on a reference type from a ValueType
8517         (Base classes System.Object and System.Enum)
8518
8519         (MemberAccess.Resolve): Only perform lookups on Enumerations if
8520         the left hand side is a TypeExpr, not on every enumeration. 
8521
8522         (Binary.Resolve): If types are reference types, then do a cast to
8523         object on operators != and == of both arguments.
8524         
8525         * typemanager.cs (FindMembers): Extract instance and static
8526         members if requested.
8527
8528         * interface.cs (PopulateProperty): Use void_type instead of null
8529         as the return type for the setter method.
8530
8531         (PopulateIndexer): ditto.
8532
8533 2001-12-27  Ravi Pratap  <ravi@ximian.com>
8534
8535         * support.cs (ReflectionParameters): Fix minor bug where we
8536         were examining the wrong parameter for the ParamArray attribute.
8537
8538         Cope with requests for the type of the parameter at position
8539         greater than the params parameter's. We now return the element
8540         type of the params array as that makes more sense.
8541
8542         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
8543         accordingly as we no longer have to extract the element type
8544         ourselves.
8545
8546         (Invocation.OverloadResolve): Update.
8547
8548 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
8549
8550         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8551         against IEnumerator, test whether the return value is a descendant
8552         of the IEnumerator interface.
8553
8554         * class.cs (Indexer.Define): Use an auxiliary method to implement
8555         the other bits of the method definition.  Begin support for
8556         explicit interface implementation.
8557
8558         (Property.DefineMethod): Use TypeManager.void_type instead of null
8559         for an empty return value.
8560
8561 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
8562
8563         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8564         dealing with a FieldExpr which is composed of a FieldBuilder, in
8565         the code path we did extract the constant, but we should have
8566         obtained the underlying value to be able to cast it (otherwise we
8567         end up in an infinite loop, this is what Ravi was running into).
8568
8569         (ArrayCreation.UpdateIndices): Arrays might be empty.
8570
8571         (MemberAccess.ResolveMemberAccess): Add support for section
8572         14.5.4.1 that deals with the special case of E.I when E is a type
8573         and something else, that I can be a reference to a static member.
8574
8575         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8576         handle a particular array type to create byte blobs, it is just
8577         something we dont generate byteblobs for.
8578
8579         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8580         arguments. 
8581
8582         * location.cs (Push): remove the key from the hashtable that we
8583         are about to add.   This happens for empty files.
8584
8585         * driver.cs: Dispose files after we have parsed them.
8586
8587         (tokenize): new function that only runs the tokenizer on its
8588         input, for speed testing.
8589
8590 2001-12-26  Ravi Pratap  <ravi@ximian.com>
8591
8592         * class.cs (Event.Define): Define the private field only if there
8593         are no accessors defined.
8594
8595         * expression.cs (ResolveMemberAccess): If there is no associated
8596         field with the event, that means we have an event defined with its
8597         own accessors and we should flag error cs0070 since transforming
8598         ourselves into a field is not valid in that case.
8599
8600         * ecore.cs (SimpleName.DoResolve): Same as above.
8601
8602         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8603         and charset to sane values.
8604
8605 2001-12-25  Ravi Pratap  <ravi@ximian.com>
8606
8607         * assign.cs (DoResolve): Perform check on events only if they 
8608         are being accessed outside the declaring type.
8609
8610         * cs-parser.jay (event_declarations): Update rules to correctly
8611         set the type of the implicit parameter etc.
8612
8613         (add_accessor, remove_accessor): Set current local parameters.
8614
8615         * expression.cs (Binary): For delegate addition and subtraction,
8616         cast the return value from the method into the appropriate delegate
8617         type.
8618
8619 2001-12-24  Ravi Pratap  <ravi@ximian.com>
8620
8621         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8622         of these as the workaround is unnecessary.
8623
8624         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8625         delegate data - none of that is needed at all.
8626
8627         Re-write bits to extract the instance expression and the delegate method
8628         correctly.
8629
8630         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
8631         on delegates too.
8632
8633         * attribute.cs (ApplyAttributes): New method to take care of common tasks
8634         of attaching attributes instead of duplicating code everywhere.
8635
8636         * everywhere : Update code to do attribute emission using the above method.
8637
8638 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8639
8640         * expression.cs (IsParamsMethodApplicable): if there are not
8641         parameters, return immediately.
8642
8643         * ecore.cs: The 0 literal can be implicity converted to an enum
8644         type. 
8645
8646         (SimpleName.DoResolve): First lookup the type, then lookup the
8647         members. 
8648
8649         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8650         want to get its address.  If the InstanceExpression is not
8651         addressable, store the result in a temporary variable, then get
8652         the address of it.
8653
8654         * codegen.cs: Only display 219 errors on warning level or above. 
8655
8656         * expression.cs (ArrayAccess): Make it implement the
8657         IMemoryLocation interface.
8658
8659         (Binary.DoResolve): handle the operator == (object a, object b)
8660         and operator != (object a, object b) without incurring into a
8661         BoxedCast (because 5 != o should never be performed).
8662
8663         Handle binary enumerator operators.
8664
8665         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8666         value type, otherwise use Ldelem_ref.
8667
8668         Use precomputed names;
8669
8670         (AddressOf): Implement address of
8671
8672         * cs-parser.jay (labeled_statement): Fix recursive block
8673         addition by reworking the production.
8674
8675         * expression.cs (New.DoEmit): New has a special case:
8676                 
8677                  If we are dealing with a ValueType, we have a few
8678                  situations to deal with:
8679                 
8680                     * The target of New is a ValueType variable, that is
8681                       easy, we just pass this as the variable reference
8682                 
8683                     * The target of New is being passed as an argument,
8684                       to a boxing operation or a function that takes a
8685                       ValueType.
8686                 
8687                       In this case, we need to create a temporary variable
8688                       that is the argument of New.
8689
8690
8691 2001-12-23  Ravi Pratap  <ravi@ximian.com>
8692
8693         * rootcontext.cs (LookupType): Check that current_type is not null before
8694         going about looking at nested types.
8695
8696         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8697         not implement the IAssignMethod interface any more.
8698
8699         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8700         where we tranform them into FieldExprs if they are being resolved from within
8701         the declaring type.
8702
8703         * ecore.cs (SimpleName.DoResolve): Do the same here.
8704
8705         * assign.cs (DoResolve, Emit): Clean up code considerably. 
8706
8707         * ../errors/bug10.cs : Add.
8708
8709         * ../errors/cs0070.cs : Add.
8710
8711         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8712
8713         * assign.cs : Get rid of EventIsLocal everywhere.
8714         
8715 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
8716
8717         * ecore.cs (ConvertIntLiteral): finished the implementation.
8718
8719         * statement.cs (SwitchLabel): Convert the value we are using as a
8720         key before looking up the table.
8721
8722 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8723
8724         * codegen.cs (EmitTopBlock): Require a Location argument now.
8725
8726         * cs-parser.jay (constructor_declarator): We need to setup
8727         current_local_parameters before we parse the
8728         opt_constructor_initializer, to allow the variables to be bound
8729         to the constructor arguments.
8730
8731         * rootcontext.cs (LookupType): First lookup nested classes in our
8732         class and our parents before we go looking outside our class.
8733
8734         * expression.cs (ConstantFold): Extract/debox the values at the
8735         beginnning. 
8736
8737         * rootcontext.cs (EmitCode): Resolve the constants first before we
8738         resolve the types.  This is not really needed, but it helps debugging.
8739
8740         * statement.cs: report location.
8741         
8742         * cs-parser.jay: pass location to throw statement.
8743
8744         * driver.cs: Small bug fix.
8745
8746         * report.cs: Updated format to be 4-zero filled digits.
8747
8748 2001-12-22  Ravi Pratap  <ravi@ximian.com>
8749
8750         * expression.cs (CheckIndices): Fix minor bug where the wrong
8751         variable was being referred to ;-)
8752
8753         (DoEmit): Do not call EmitStaticInitializers when the 
8754         underlying type is System.Object.
8755
8756 2001-12-21  Ravi Pratap  <ravi@ximian.com>
8757
8758         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8759         and do the usual workaround for SRE.
8760
8761         * class.cs (MyEventBuilder.EventType): New member to get at the type
8762         of the event, quickly.
8763
8764         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8765
8766         * assign.cs (Assign.DoResolve): Handle the case when the target
8767         is an EventExpr and perform the necessary checks.
8768
8769         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8770         interface.
8771
8772         (SimpleName.MemberStaticCheck): Include check for EventExpr.
8773
8774         (EventExpr): Set the type in the constructor itself since we 
8775         are meant to be born fully resolved.
8776
8777         (EventExpr.Define): Revert code I wrote earlier.
8778                 
8779         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8780         instance expression is null. The instance expression is a This in that case
8781         or a null, depending on whether it is a static method or not.
8782
8783         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8784         refers to more than one method.
8785
8786         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8787         and accordingly flag errors.
8788
8789 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8790
8791         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8792
8793 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
8794
8795         * location.cs (ToString): Provide useful rutine.
8796
8797 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
8798
8799         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8800         objects, return the actual integral boxed.
8801
8802         * statement.cs (SwitchLabel): define an ILLabel for each
8803         SwitchLabel. 
8804         
8805         (Switch.CheckSwitch): If the value is a Literal, extract
8806         the underlying literal.
8807         
8808         Also in the unused hashtable we had, add the SwitchLabel so we can
8809         quickly look this value up.
8810
8811         * constant.cs: Implement a bunch of new constants.  Rewrite
8812         Literal based on this.  Made changes everywhere to adapt to this.
8813         
8814         * expression.cs (Expression.MakeByteBlob): Optimize routine by
8815         dereferencing array only once, and also copes with enumrations.
8816
8817         bytes are two bytes wide, not one.
8818
8819         (Cast): Perform constant conversions.
8820         
8821         * ecore.cs (TryImplicitIntConversion): Return literals instead of
8822         wrappers to the literals here.
8823
8824         * expression.cs (DoNumericPromotions): long literals can converted
8825         to ulong implicity (this is taken care of elsewhere, but I was
8826         missing this spot).
8827
8828         * ecore.cs (Expression.Literalize): Make the return type Literal,
8829         to improve type checking.
8830
8831         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8832
8833 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8834
8835         * literal.cs: Revert code from ravi that checked the bounds.  The
8836         bounds are sane by the definition of the type itself. 
8837
8838         * typemanager.cs: Fix implementation of ImplementsInterface.  We
8839         need to actually look up in our parent hierarchy for interfaces
8840         implemented. 
8841
8842         * const.cs: Use the underlying type for enumerations
8843
8844         * delegate.cs: Compute the basename for the delegate creation,
8845         that should fix the delegate test case, and restore the correct
8846         Type Lookup semantics in rootcontext
8847
8848         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
8849         referencing a nested type with the Reflection API is using the "+"
8850         sign. 
8851
8852         * cs-parser.jay: Do not require EOF token at the end.
8853
8854 2001-12-20  Ravi Pratap  <ravi@ximian.com>
8855
8856         * rootcontext.cs (LookupType): Concatenate type names with
8857         a '.' instead of a '+' The test suite passes again.
8858
8859         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8860         field of the enumeration.
8861
8862         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8863         the case when the member is an EventExpr.
8864
8865         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8866         static has an associated instance expression.
8867
8868         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8869
8870         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8871
8872         * class.cs (Event.Define): Register event and perform appropriate checks
8873         for error #111.
8874
8875         We define the Add and Remove methods even if the use provides none because
8876         in that case, we provide default implementations ourselves.
8877
8878         Define a private field of the type of the event. This is done by the CSC compiler
8879         and we should be doing it too ;-)
8880
8881         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8882         More methods we use in code we generate.
8883
8884         (multicast_delegate_type, delegate_type): Two separate types since the distinction
8885         is important.
8886
8887         (InitCoreTypes): Update accordingly for the above.
8888
8889         * class.cs (Event.Emit): Generate code for default accessors that we provide
8890
8891         (EmitDefaultMethod): Do the job in the above.
8892
8893         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
8894         appropriate place.
8895
8896 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
8897
8898         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8899         builders even if we were missing one.
8900
8901         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8902         pass the Basename as our class name instead of the Name.  The
8903         basename will be correctly composed for us.
8904
8905         * parameter.cs (Paramters): Now takes a Location argument.
8906
8907         * decl.cs (DeclSpace.LookupType): Removed convenience function and
8908         make all the code call directly LookupType in RootContext and take
8909         this chance to pass the Location information everywhere.
8910
8911         * Everywhere: pass Location information.
8912
8913 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
8914
8915         * class.cs (Constructor.Define): Updated way of detecting the
8916         length of the parameters.
8917
8918         (TypeContainer.DefineType): Use basename as the type name for
8919         nested types.
8920
8921         (TypeContainer.Define): Do not recursively define types here, as
8922         definition is taken care in order by the RootContext.
8923
8924         * tree.cs: Keep track of namespaces in a per-file basis.
8925
8926         * parameter.cs (Parameter.ComputeSignature): Update to use
8927         DeclSpace. 
8928
8929         (Parameters.GetSignature): ditto.
8930
8931         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8932         instead of a TypeContainer.
8933
8934         (Interface.SemanticAnalysis): Use `this' instead of our parent to
8935         resolve names.  Because we need to be resolve in our context, not
8936         our parents.
8937         
8938         * driver.cs: Implement response files.
8939
8940         * class.cs (TypeContainer.DefineType): If we are defined, do not
8941         redefine ourselves.
8942         
8943         (Event.Emit): Emit the code for add/remove handlers.
8944         (Event.Define): Save the MethodBuilders for add/remove.
8945
8946         * typemanager.cs: Use pair here too.
8947
8948         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8949         DictionaryEntry requires the first argument to be non-null.  
8950         
8951         (enum_declaration): Compute full name for registering the
8952         enumeration.
8953         
8954         (delegate_declaration): Instead of using
8955         formal_parameter_list, use opt_formal_parameter_list as the list
8956         can be empty.
8957
8958         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8959         (EventParsing): New property that controls whether `add' and
8960         `remove' are returned as tokens or identifiers (for events);
8961
8962 2001-12-19  Ravi Pratap  <ravi@ximian.com>
8963
8964         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8965         use MyEventBuilder only and let it wrap the real builder for us.
8966
8967         (MyEventBuilder): Revamp constructor etc.
8968
8969         Implement all operations that we perform on EventBuilder in precisely the same
8970         way here too.
8971
8972         (FindMembers): Update to use the EventBuilder member.
8973
8974         (Event.Emit): Update accordingly.
8975
8976 2001-12-18  Ravi Pratap  <ravi@ximian.com>
8977
8978         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
8979         by calling the appropriate methods.
8980
8981         (GetCustomAttributes): Make stubs as they cannot possibly do anything
8982         useful.
8983
8984         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
8985
8986 2001-12-17  Ravi Pratap  <ravi@ximian.com>
8987
8988         * delegate.cs (Delegate.Populate): Check that the return type
8989         and various parameters types are indeed accessible.
8990
8991         * class.cs (Constructor.Define): Same here.
8992
8993         (Field.Define): Ditto.
8994
8995         (Event.Define): Ditto.
8996
8997         (Operator.Define): Check that the underlying Method defined itself
8998         correctly - so it's MethodBuilder should not be null.
8999
9000         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
9001         expression happens to be null.
9002
9003         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
9004         members but as of now we don't seem to be able to do anything really useful with it.
9005
9006         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
9007         not the EventBuilder.
9008
9009 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
9010
9011         * cs-tokenizer.cs: Add support for defines.
9012         Add support for #if, #elif, #else, #endif
9013         
9014         (eval_var): evaluates a variable.
9015         (eval): stubbed for evaluating functions.
9016
9017         * cs-parser.jay: Pass the defines information
9018
9019         * driver.cs: Add --define command line option.
9020
9021         * decl.cs: Move MemberCore here.
9022
9023         Make it the base class for DeclSpace.  This allows us to catch and
9024         report 108 and 109 for everything now.
9025
9026         * class.cs (TypeContainer.Define): Extract all the members
9027         before populating and emit the warning 108 (new keyword required
9028         to override) instead of having each member implement this.
9029
9030         (MemberCore.Define): New abstract method, we will be using this in
9031         the warning reporting engine in Populate.
9032         
9033         (Operator.Define): Adjust to new MemberCore protocol. 
9034
9035         * const.cs (Const): This does not derive from Expression, it is a
9036         temporary object we use to create fields, it is a MemberCore. 
9037
9038         * class.cs (Method.Define): Allow the entry point to be in a
9039         specific class.
9040
9041         * driver.cs: Rewrite the argument handler to clean it up a bit.
9042
9043         * rootcontext.cs: Made it just an auxiliary namespace feature by
9044         making everything static.
9045
9046         * driver.cs: Adapt code to use RootContext type name instead of
9047         instance variable.
9048
9049         * delegate.cs: Remove RootContext argument.
9050
9051         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
9052         argument. 
9053
9054         * class.cs (Event.Define): The lookup can fail.
9055         
9056         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
9057
9058         * expression.cs: Resolve the this instance before invoking the code.
9059
9060 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
9061
9062         * cs-parser.jay: Add a production in element_access that allows
9063         the thing to become a "type" reference.  This way we can parse
9064         things like "(string [])" as a type.
9065
9066         Note that this still does not handle the more complex rules of
9067         casts. 
9068         
9069
9070         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
9071
9072         * ecore.cs: (CopyNewMethods): new utility function used to
9073         assemble the list of methods from running FindMembers.
9074
9075         (MemberLookup): Rework FindMembers so that 
9076
9077 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
9078
9079         * class.cs (TypeContainer): Remove Delegates who fail to be
9080         defined.
9081
9082         * delegate.cs (Populate): Verify that we dont get null return
9083         values.   TODO: Check for AsAccessible.
9084
9085         * cs-parser.jay: Use basename to emit error 574 (destructor should
9086         have the same name as container class), not the full name.
9087
9088         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
9089         possible representation.  
9090
9091         Also implements integer type suffixes U and L.
9092
9093 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
9094
9095         * expression.cs (ArrayCreation.DoResolve): We need to do the
9096         argument resolution *always*.
9097
9098         * decl.cs: Make this hold the namespace.  Hold the root context as
9099         well.
9100         (LookupType): Move here.
9101
9102         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
9103
9104         * location.cs (Row, Name): Fixed the code, it was always returning
9105         references to the first file.
9106
9107         * interface.cs: Register properties defined through interfaces.
9108
9109         * driver.cs: Add support for globbing on the command line
9110
9111         * class.cs (Field): Make it derive from MemberCore as well.
9112         (Event): ditto.
9113
9114 2001-12-15  Ravi Pratap  <ravi@ximian.com>
9115
9116         * class.cs (Event::Define): Check that the type of the event is a delegate
9117         type else flag error #66.
9118
9119         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
9120         same.
9121
9122         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
9123         values of EntryPoint, CharSet etc etc.
9124
9125         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
9126
9127         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
9128         be null and we should ignore this. I am not sure if this is really clean. Apparently,
9129         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
9130         which needs this to do its work.
9131
9132         * ../errors/cs0066.cs : Add.
9133
9134 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
9135
9136         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
9137         helper functions.
9138
9139         * class.cs: (MethodSignature.MethodSignature): Removed hack that
9140         clears out the parameters field.
9141         (MemberSignatureCompare): Cleanup
9142
9143         (MemberCore): New base class used to share code between MethodCore
9144         and Property.
9145
9146         (RegisterRequiredImplementations) BindingFlags.Public requires
9147         either BindingFlags.Instace or Static.  Use instance here.
9148
9149         (Property): Refactored code to cope better with the full spec.
9150
9151         * parameter.cs (GetParameterInfo): Return an empty array instead
9152         of null on error.
9153
9154         * class.cs (Property): Abstract or extern properties have no bodies.
9155
9156         * parameter.cs (GetParameterInfo): return a zero-sized array.
9157
9158         * class.cs (TypeContainer.MethodModifiersValid): Move all the
9159         method modifier validation to the typecontainer so we can reuse
9160         this on properties.
9161
9162         (MethodCore.ParameterTypes): return an empty sized array of types.
9163
9164         (Property.Define): Test property modifier validity.
9165
9166         Add tests for sealed/override too.
9167
9168         (Method.Emit): abstract or extern methods have no bodies.
9169
9170 2001-12-14  Ravi Pratap  <ravi@ximian.com>
9171
9172         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
9173         thing.
9174
9175         (Method::Define, ::Emit): Modify accordingly.
9176
9177         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
9178
9179         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
9180
9181         * makefile: Pass in /unsafe.
9182
9183 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
9184
9185         * class.cs (MakeKey): Kill routine.
9186         
9187         * class.cs (TypeContainer.Define): Correctly define explicit
9188         method implementations (they require the full interface name plus
9189         the method name).
9190
9191         * typemanager.cs: Deply the PtrHashtable here and stop using the
9192         lame keys.  Things work so much better.
9193
9194         This of course broke everyone who depended on `RegisterMethod' to
9195         do the `test for existance' test.  This has to be done elsewhere.
9196
9197         * support.cs (PtrHashtable): A hashtable that avoid comparing with
9198         the object stupid Equals method (because, that like fails all over
9199         the place).  We still do not use it.
9200
9201         * class.cs (TypeContainer.SetRequiredInterface,
9202         TypeContainer.RequireMethods): Killed these two routines and moved
9203         all the functionality to RegisterRequiredImplementations.
9204
9205         (TypeContainer.RegisterRequiredImplementations): This routine now
9206         registers all the implementations required in an array for the
9207         interfaces and abstract methods.  We use an array of structures
9208         which can be computed ahead of time to reduce memory usage and we
9209         also assume that lookups are cheap as most classes will not
9210         implement too many interfaces.
9211
9212         We also avoid creating too many MethodSignatures.
9213
9214         (TypeContainer.IsInterfaceMethod): Update and optionally does not
9215         clear the "pending" bit if we find that there are problems with
9216         the declaration.
9217
9218         (TypeContainer.VerifyPendingMethods): Update to report errors of
9219         methods that look like implementations but are not.
9220
9221         (TypeContainer.Define): Add support for explicit interface method
9222         implementation. 
9223         
9224 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
9225
9226         * typemanager.cs: Keep track of the parameters here instead of
9227         being a feature of the TypeContainer.
9228
9229         * class.cs: Drop the registration of parameters here, as
9230         InterfaceMethods are also interface declarations.
9231
9232         * delegate.cs: Register methods with the TypeManager not only with
9233         the TypeContainer.  This code was buggy.
9234
9235         * interface.cs: Full registation here.
9236
9237 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
9238
9239         * expression.cs: Remove reducer for binary expressions, it can not
9240         be done this way.
9241
9242         * const.cs: Put here the code that used to go into constant.cs
9243
9244         * constant.cs: Put here the code for constants, this is a new base
9245         class for Literals.
9246
9247         * literal.cs: Make Literal derive from Constant.
9248
9249 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
9250
9251         * statement.cs (Return.Emit): Report error 157 if the user
9252         attempts to return from a finally block.
9253
9254         (Return.Emit): Instead of emitting a return, jump to the end of
9255         the function.
9256
9257         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
9258         LocalBuilder to store the result of the function.  ReturnLabel is
9259         the target where we jump.
9260         
9261
9262 2001-12-09  Radek Doulik  <rodo@ximian.com>
9263
9264         * cs-parser.jay: remember alias in current namespace
9265
9266         * ecore.cs (SimpleName::DoResolve): use aliases for types or
9267         namespaces
9268
9269         * class.cs (LookupAlias): lookup alias in my_namespace
9270
9271         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
9272         aliases hashtable
9273         (LookupAlias): lookup alias in this and if needed in parent
9274         namespaces
9275
9276 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
9277
9278         * support.cs: 
9279
9280         * rootcontext.cs: (ModuleBuilder) Made static, first step into
9281         making things static.  I need this to avoid passing the
9282         TypeContainer when calling ParameterType.
9283
9284         * support.cs (InternalParameters.ParameterType): Remove ugly hack
9285         that did string manipulation to compute the type and then call
9286         GetType.  Use Parameter.ParameterType instead.
9287
9288         * cs-tokenizer.cs: Consume the suffix for floating values.
9289
9290         * expression.cs (ParameterReference): figure out whether this is a
9291         reference parameter or not.  Kill an extra variable by computing
9292         the arg_idx during emission.
9293
9294         * parameter.cs (Parameters.GetParameterInfo): New overloaded
9295         function that returns whether a parameter is an out/ref value or not.
9296
9297         (Parameter.ParameterType): The type of the parameter (base,
9298         without ref/out applied).
9299         
9300         (Parameter.Resolve): Perform resolution here.
9301         (Parameter.ExternalType): The full type (with ref/out applied).
9302
9303         * statement.cs (Using.Emit, Using.EmitExpression): Implement
9304         support for expressions on the using statement.
9305
9306 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
9307
9308         * statement.cs (Using.EmitLocalVariableDecls): Split the
9309         localvariable handling of the using statement.
9310
9311         (Block.EmitMeta): Keep track of variable count across blocks.  We
9312         were reusing slots on separate branches of blocks.
9313
9314         (Try.Emit): Emit the general code block, we were not emitting it. 
9315
9316         Check the type of the declaration to be an IDisposable or
9317         something that can be implicity converted to it. 
9318
9319         Emit conversions if required.
9320
9321         * ecore.cs (EmptyExpression): New utility class.
9322         (Expression.ImplicitConversionExists): New utility function.
9323
9324 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
9325
9326         * statement.cs (Using): Implement.
9327
9328         * expression.cs (LocalVariableReference): Support read only variables.
9329
9330         * statement.cs: Remove the explicit emit for the Leave opcode.
9331         (VariableInfo): Add a readonly field.
9332
9333 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
9334
9335         * ecore.cs (ConvCast): new class used to encapsulate the various
9336         explicit integer conversions that works in both checked and
9337         unchecked contexts.
9338
9339         (Expression.ConvertNumericExplicit): Use new ConvCast class to
9340         properly generate the overflow opcodes.
9341
9342 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
9343
9344         * statement.cs: The correct type for the EmptyExpression is the
9345         element_type, not the variable type.  Ravi pointed this out.
9346
9347 2001-12-04  Ravi Pratap  <ravi@ximian.com>
9348
9349         * class.cs (Method::Define): Handle PInvoke methods specially
9350         by using DefinePInvokeMethod instead of the usual one.
9351
9352         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
9353         above to do the task of extracting information and defining the method.
9354         
9355 2001-12-04  Ravi Pratap  <ravi@ximian.com>
9356
9357         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
9358         of the condition for string type.
9359
9360         (Emit): Move that here. 
9361
9362         (ArrayCreation::CheckIndices): Keep string literals in their expression
9363         form.
9364
9365         (EmitDynamicInitializers): Handle strings appropriately.
9366
9367 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
9368
9369         * codegen.cs (EmitContext): Replace multiple variables with a
9370         single pointer to the current Switch statement.
9371
9372         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
9373         EmitContext.
9374
9375 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
9376
9377         * statement.cs 
9378
9379         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
9380         default'.
9381         
9382         (Foreach.Emit): Foreach on arrays was not setting
9383         up the loop variables (for break/continue).
9384
9385         (GotoCase): Semi-implented.
9386         
9387 2001-12-03  Ravi Pratap  <ravi@ximian.com>
9388
9389         * attribute.cs (CheckAttribute): Handle system attributes by using
9390         Attribute.GetAttributes to examine information we need.
9391
9392         (GetValidPlaces): Same here.
9393
9394         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
9395
9396         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
9397
9398         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
9399
9400         (Method::Define): Set appropriate flags if we have a DllImport attribute.
9401
9402         (Method::Emit): Handle the case when we are a PInvoke method.
9403
9404 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
9405
9406         * expression.cs: Use ResolveWithSimpleName on compound names.
9407
9408 2001-12-02  Ravi Pratap  <ravi@ximian.com>
9409
9410         * constant.cs (EmitConstant): Make sure we resolve the associated expression
9411         before trying to reduce it.
9412
9413         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
9414
9415         * constant.cs (LookupConstantValue): Implement.
9416
9417         (EmitConstant): Use the above in emitting the constant.
9418
9419         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
9420         that are user-defined by doing a LookupConstantValue on them.
9421
9422         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
9423         too, like above.
9424
9425 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
9426
9427         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
9428
9429         (BaseAccess.DoResolve): Implement.
9430
9431         (MemberAccess.DoResolve): Split this routine into a
9432         ResolveMemberAccess routine that can be used independently
9433
9434 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
9435
9436         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
9437         As that share bits of the implementation.  Is returns a boolean,
9438         while As returns the Type that is being probed.
9439
9440 2001-12-01  Ravi Pratap  <ravi@ximian.com>
9441
9442         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
9443         instead of a Literal - much easier.
9444
9445         (EnumInTransit): Remove - utterly useless :-)
9446
9447         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
9448
9449         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
9450
9451         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
9452         chain when we have no associated expression.
9453
9454 2001-11-30  Ravi Pratap  <ravi@ximian.com>
9455
9456         * constant.cs (Define): Use Location while reporting the errror.
9457
9458         Also emit a warning when 'new' is used and there is no inherited
9459         member to hide.
9460
9461         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
9462         populated.
9463
9464         (LookupEnumValue): Implement to lookup an enum member's value and define it
9465         if necessary.
9466
9467         (Populate): Re-write accordingly to use the above routine.
9468
9469 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
9470
9471         * expression.cs (This): Fix prototype for DoResolveLValue to
9472         override the base class DoResolveLValue.
9473
9474         * cs-parser.cs: Report errors cs574 and cs575 (destructor
9475         declarations) 
9476
9477         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
9478         (we need to load the address of the field here).  This fixes
9479         test-22. 
9480         
9481         (FieldExpr.DoResolveLValue): Call the DoResolve
9482         function to initialize the Instance expression.
9483         
9484         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
9485         correctly the GetEnumerator operation on a value type.
9486
9487         * cs-parser.jay: Add more simple parsing error catches.
9488
9489         * statement.cs (Switch): Add support for string switches.
9490         Handle null specially.
9491
9492         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
9493
9494 2001-11-28  Ravi Pratap  <ravi@ximian.com>
9495
9496         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
9497
9498         (declare_local_constant): New helper function.
9499
9500         * statement.cs (AddConstant): Keep a separate record of constants
9501
9502         (IsConstant): Implement to determine if a variable is a constant.
9503
9504         (GetConstantExpression): Implement.
9505
9506         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
9507
9508         * statement.cs (IsVariableDefined): Re-write.
9509
9510 2001-11-27  Ravi Pratap  <ravi@ximian.com>
9511
9512         * class.cs (TypeContainer::FindMembers): Look for constants
9513         in the case when we are looking for MemberTypes.Field
9514
9515         * expression.cs (MemberAccess::DoResolve): Check that in the
9516         case we are a FieldExpr and a Literal, we are not being accessed
9517         by an instance reference.
9518
9519         * cs-parser.jay (local_constant_declaration): Implement.
9520
9521         (declaration_statement): Implement for constant declarations.
9522
9523 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
9524
9525         * statement.cs (Switch): Catch double defaults.
9526
9527         (Switch): More work on the switch() statement
9528         implementation.  It works for integral values now, need to finish
9529         string support.
9530
9531
9532 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9533
9534         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9535         integer literals into other integer literals.  To be used by
9536         switch. 
9537
9538 2001-11-24  Ravi Pratap  <ravi@ximian.com>
9539
9540         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9541         some memory.
9542
9543         (EmitDynamicInitializers): Cope with the above since we extract data
9544         directly from ArrayData now.
9545
9546         (ExpectInitializers): Keep track of whether initializers are mandatory
9547         or not.
9548
9549         (Bounds): Make it a hashtable to prevent the same dimension being 
9550         recorded for every element in that dimension.
9551
9552         (EmitDynamicInitializers): Fix bug which prevented the Set array method
9553         from being found.
9554
9555         Also fix bug which was causing the indices to be emitted in the reverse
9556         order.
9557
9558 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
9559
9560         * expression.cs (ArrayCreation): Implement the bits that Ravi left
9561         unfinished.  They do not work, because the underlying code is
9562         sloppy.
9563
9564 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9565
9566         * cs-parser.jay: Remove bogus fixme.
9567
9568         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9569         on Switch statement.
9570         
9571 2001-11-23  Ravi Pratap  <ravi@ximian.com>
9572
9573         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9574         the same. 
9575         
9576         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9577         parameter. Apparently, any expression is allowed. 
9578
9579         (ValidateInitializers): Update accordingly.
9580
9581         (CheckIndices): Fix some tricky bugs thanks to recursion.
9582
9583         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
9584         I was being completely brain-dead.
9585
9586         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9587         and re-write acordingly.
9588
9589         (DelegateInvocation): Re-write accordingly.
9590
9591         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9592
9593         (MakeByteBlob): Handle types more correctly.
9594
9595         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9596         initialization from expressions but it is incomplete because I am a complete
9597         Dodo :-|
9598
9599 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9600
9601         * statement.cs (If.Emit): Fix a bug that generated incorrect code
9602         on If.  Basically, we have to return `true' (ie, we do return to
9603         our caller) only if both branches of the if return.
9604
9605         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9606         short-circuit operators, handle them as short circuit operators. 
9607
9608         (Cast.DoResolve): Resolve type.
9609         (Cast.Cast): Take an expression as the target type.
9610
9611         * cs-parser.jay (cast_expression): Remove old hack that only
9612         allowed a limited set of types to be handled.  Now we take a
9613         unary_expression and we resolve to a type during semantic
9614         analysis.
9615
9616         Use the grammar productions from Rhys to handle casts (this is
9617         not complete like Rhys syntax yet, we fail to handle that corner
9618         case that C# has regarding (-x), but we will get there.
9619         
9620 2001-11-22  Ravi Pratap  <ravi@ximian.com>
9621
9622         * class.cs (EmitFieldInitializer): Take care of the case when we have a
9623         field which is an array type.
9624
9625         * cs-parser.jay (declare_local_variables): Support array initialization too.
9626
9627         * typemanager.cs (MakeKey): Implement.
9628
9629         (everywhere): Use the above appropriately.
9630
9631         * cs-parser.jay (for_statement): Update for array initialization while
9632         declaring variables.
9633
9634         * ecore.cs : The error message was correct, it's the variable's names that
9635         were misleading ;-) Make the code more readable.
9636
9637         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9638         the correct type etc.
9639
9640         (ConvertExplicit): Handle Enum types by examining the underlying type.
9641
9642 2001-11-21  Ravi Pratap  <ravi@ximian.com>
9643
9644         * parameter.cs (GetCallingConvention): Always return
9645         CallingConventions.Standard for now.
9646
9647 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
9648
9649         * expression.cs (Binary.ResolveOperator): Update the values of `l'
9650         and `r' after calling DoNumericPromotions.
9651
9652         * ecore.cs: Fix error message (the types were in the wrong order).
9653
9654         * statement.cs (Foreach.ProbeCollectionType): Need to pass
9655         BindingFlags.Instance as well 
9656
9657         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9658         implicit int literal conversion in an empty cast so that we
9659         propagate the right type upstream.
9660
9661         (UnboxCast): new class used to unbox value types.
9662         (Expression.ConvertExplicit): Add explicit type conversions done
9663         by unboxing.
9664
9665         (Expression.ImplicitNumericConversion): Oops, forgot to test for
9666         the target type before applying the implicit LongLiterals to ULong
9667         literal cast.
9668
9669 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
9670
9671         * cs-parser.jay (for_statement): Reworked the way For works: now
9672         we declare manually any variables that are introduced in
9673         for_initializer to solve the problem of having out-of-band code
9674         emition (that is what got for broken).
9675
9676         (declaration_statement): Perform the actual variable declaration
9677         that used to be done in local_variable_declaration here.
9678
9679         (local_variable_declaration): Do not declare anything, just pass
9680         the information on a DictionaryEntry
9681
9682 2001-11-20  Ravi Pratap  <ravi@ximian.com>
9683
9684         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9685         re-write of the logic to now make it recursive.
9686
9687         (UpdateIndices): Re-write accordingly.
9688
9689         Store element data in a separate ArrayData list in the above methods.
9690
9691         (MakeByteBlob): Implement to dump the array data into a byte array.
9692
9693 2001-11-19  Ravi Pratap  <ravi@ximian.com>
9694
9695         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9696         into CheckIndices.
9697
9698         * constant.cs (Define): Implement.
9699
9700         (EmitConstant): Re-write fully.
9701
9702         Pass in location info.
9703
9704         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9705         respectively.
9706
9707         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9708         DictionaryEntry since we need location info too.
9709
9710         (constant_declaration): Update accordingly.
9711
9712         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9713         code into another method : UpdateIndices.
9714
9715 2001-11-18  Ravi Pratap  <ravi@ximian.com>
9716
9717         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9718         some type checking etc.
9719
9720 2001-11-17  Ravi Pratap  <ravi@ximian.com>
9721
9722         * expression.cs (ArrayCreation::ValidateInitializers): Implement
9723         bits to provide dimension info if the user skips doing that.
9724
9725         Update second constructor to store the rank correctly.
9726
9727 2001-11-16  Ravi Pratap  <ravi@ximian.com>
9728
9729         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9730         and try to implement.
9731
9732         * ../errors/cs0150.cs : Add.
9733
9734         * ../errors/cs0178.cs : Add.
9735
9736 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
9737
9738         * statement.cs: Implement foreach on multi-dimensional arrays. 
9739
9740         * parameter.cs (Parameters.GetParameterByName): Also lookup the
9741         name of the params argument.
9742
9743         * expression.cs: Use EmitStoreOpcode to get the right opcode while
9744         initializing the array.
9745
9746         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9747         we can use this elsewhere.
9748
9749         * statement.cs: Finish implementation of foreach for single
9750         dimension arrays.
9751
9752         * cs-parser.jay: Use an out-of-band stack to pass information
9753         around, I wonder why I need this.
9754
9755         foreach_block: Make the new foreach_block the current_block.
9756
9757         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9758         function used to return a static Parameters structure.  Used for
9759         empty parameters, as those are created very frequently.
9760
9761         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9762
9763 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9764
9765         * interface.cs : Default modifier is private, not public. The
9766         make verify test passes again.
9767
9768 2001-11-15  Ravi Pratap  <ravi@ximian.com>
9769
9770         * support.cs (ReflectionParameters): Fix logic to determine
9771         whether the last parameter is a params one. Test 9 passes again.
9772
9773         * delegate.cs (Populate): Register the builders we define with
9774         RegisterParameterForBuilder. Test 19 passes again.
9775
9776         * cs-parser.jay (property_declaration): Reference $6 instead
9777         of $$ to get at the location.
9778
9779         (indexer_declaration): Similar stuff.
9780
9781         (attribute): Ditto.
9782
9783         * class.cs (Property): Register parameters for the Get and Set methods
9784         if they exist. Test 23 passes again.
9785
9786         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9787         call to EmitArguments as we are sure there aren't any params arguments. 
9788         Test 32 passes again.
9789
9790         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9791         IndexOutOfRangeException. 
9792
9793         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9794         Test 33 now passes again.
9795         
9796 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
9797
9798         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9799         broke a bunch of things.  Will have to come up with a better way
9800         of tracking locations.
9801
9802         * statement.cs: Implemented foreach for single dimension arrays.
9803
9804 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
9805
9806         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9807         an error.  This removes the lookup from the critical path.
9808
9809         * cs-parser.jay: Removed use of temporary_loc, which is completely
9810         broken. 
9811
9812 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
9813
9814         * support.cs (ReflectionParameters.ParameterModifier): Report
9815         whether the argument is a PARAMS argument or not.
9816
9817         * class.cs: Set the attribute `ParamArrayAttribute' on the
9818         parameter argument.
9819
9820         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9821         and cons_param_array_attribute (ConstructorInfo for
9822         ParamArrayAttribute)., 
9823
9824         * codegen.cs: Emit the return using the `Return' statement, that
9825         way we can report the error correctly for missing return values. 
9826
9827         * class.cs (Method.Emit): Clean up.
9828
9829         * expression.cs (Argument.Resolve): Take another argument: the
9830         location where this argument is used.  Notice that this is not
9831         part of the "Argument" class as to reduce the size of the
9832         structure (we know the approximate location anyways).
9833
9834         Test if the argument is a variable-reference, if not, then
9835         complain with a 206.
9836
9837         (Argument.Emit): Emit addresses of variables.
9838
9839         (Argument.FullDesc): Simplify.
9840
9841         (Invocation.DoResolve): Update for Argument.Resolve.
9842
9843         (ElementAccess.DoResolve): ditto.
9844
9845         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9846         method should be virtual, as this method is always virtual.
9847
9848         (NewDelegate.DoResolve): Update for Argument.Resolve.
9849
9850         * class.cs (ConstructorInitializer.DoResolve): ditto.
9851         
9852         * attribute.cs (Attribute.Resolve): ditto.
9853
9854 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
9855
9856         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9857
9858         * expression.cs (ParameterReference): Drop IStackStorage and implement
9859         IAssignMethod instead. 
9860
9861         (LocalVariableReference): ditto.
9862         
9863         * ecore.cs (FieldExpr): Drop IStackStorage and implement
9864         IAssignMethod instead. 
9865
9866 2001-11-13  Miguel de Icaza <miguel@ximian.com>
9867
9868         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9869         enumerations that are used in heavily used structures derive from
9870         byte in a laughable and pathetic attempt to reduce memory usage.
9871         This is the kind of pre-optimzations that you should not do at
9872         home without adult supervision.
9873
9874         * expression.cs (UnaryMutator): New class, used to handle ++ and
9875         -- separatedly from the other unary operators.  Cleans up the
9876         code, and kills the ExpressionStatement dependency in Unary.
9877
9878         (Unary): Removed `method' and `Arguments' from this class, making
9879         it smaller, and moving it all to SimpleCall, so I can reuse this
9880         code in other locations and avoid creating a lot of transient data
9881         strucutres when not required.
9882
9883         * cs-parser.jay: Adjust for new changes.
9884
9885 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
9886
9887         * enum.cs (Enum.Populate): If there is a failure during
9888         definition, return
9889
9890         * cs-parser.jay (opt_enum_base): we used to catch type errors
9891         here, but this is really incorrect.  The type error should be
9892         catched during semantic analysis.
9893
9894 2001-12-11  Ravi Pratap  <ravi@ximian.com>
9895
9896         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9897         current_local_parameters as expected since I, in my stupidity, had forgotten
9898         to do this :-)
9899
9900         * attribute.cs (GetValidPlaces): Fix stupid bug.
9901
9902         * class.cs (Method::Emit): Perform check on applicability of attributes.
9903
9904         (Constructor::Emit): Ditto.
9905
9906         (Field::Emit): Ditto.
9907
9908         (Field.Location): Store location information.
9909
9910         (Property, Event, Indexer, Operator): Ditto.
9911
9912         * cs-parser.jay (field_declaration): Pass in location for each field.
9913
9914         * ../errors/cs0592.cs : Add.
9915
9916 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9917
9918         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9919
9920         (InitCoreTypes): Update accordingly.
9921
9922         (RegisterAttrType, LookupAttr): Implement.
9923
9924         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9925         info about the same.
9926
9927         (Resolve): Update to populate the above as necessary.
9928
9929         (Error592): Helper.
9930
9931         (GetValidPlaces): Helper to the above.
9932
9933         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9934
9935         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9936
9937 2001-11-12  Ravi Pratap  <ravi@ximian.com>
9938
9939         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9940
9941         * ../errors/cs0617.cs : Add.
9942
9943 2001-11-11  Ravi Pratap  <ravi@ximian.com>
9944
9945         * enum.cs (Emit): Rename to Populate to be more consistent with what
9946         we expect it to do and when exactly it is called.
9947
9948         * class.cs, rootcontext.cs : Update accordingly.
9949
9950         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9951         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9952
9953         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9954
9955         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9956         of a fieldinfo using the above, when dealing with a FieldBuilder.
9957
9958 2001-11-10  Ravi Pratap  <ravi@ximian.com>
9959
9960         * ../errors/cs0031.cs : Add.
9961
9962         * ../errors/cs1008.cs : Add.
9963
9964         * ../errrors/cs0543.cs : Add.
9965
9966         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9967         enum type.
9968
9969         (FindMembers): Implement.
9970
9971         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9972         enums and delegates too.
9973
9974         (enum_types): Rename to builder_to_enum.
9975
9976         (delegate_types): Rename to builder_to_delegate.
9977
9978         * delegate.cs (FindMembers): Implement.
9979
9980 2001-11-09  Ravi Pratap  <ravi@ximian.com>
9981
9982         * typemanager.cs (IsEnumType): Implement.
9983
9984         * enum.cs (Emit): Re-write parts to account for the underlying type
9985         better and perform checking etc.
9986
9987         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
9988         of the underlying type.
9989
9990         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
9991         value
9992
9993         * enum.cs (error31): Helper to report error #31.
9994
9995         * cs-parser.jay (enum_declaration): Store location of each member too.
9996
9997         * enum.cs (member_to_location): New hashtable. 
9998
9999         (AddEnumMember): Update location hashtable.
10000
10001         (Emit): Use the location of each member while reporting errors.
10002
10003 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
10004
10005         * cs-parser.jay: A for_initializer if is a
10006         local_variable_declaration really ammount to have an implicit
10007         block with the variable declaration and no initializer for for.
10008
10009         * statement.cs (For.Emit): Cope with null initializers.
10010
10011         This fixes the infinite loop on for initializers.
10012
10013 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
10014
10015         * enum.cs: More cleanup.
10016
10017         * ecore.cs: Remove dead code.
10018
10019         * class.cs (Property.Emit): More simplification.
10020         (Event.Emit): ditto.
10021
10022         Reworked to have less levels of indentation.
10023         
10024 2001-11-08  Ravi Pratap  <ravi@ximian.com>
10025
10026         * class.cs (Property): Emit attributes.
10027
10028         (Field): Ditto.
10029         
10030         (Event): Ditto.
10031
10032         (Indexer): Ditto.
10033
10034         (Operator): Ditto.
10035
10036         * enum.cs (Emit): Ditto.
10037
10038         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
10039         Enums too.
10040
10041         * class.cs (Field, Event, etc.): Move attribute generation into the
10042         Emit method everywhere.
10043
10044         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
10045         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
10046         as we had no way of defining nested enums !
10047
10048         * rootcontext.cs : Adjust code accordingly.
10049
10050         * typemanager.cs (AddEnumType): To keep track of enum types separately.
10051
10052 2001-11-07  Ravi Pratap  <ravi@ximian.com>
10053
10054         * expression.cs (EvalConstantExpression): Move into ecore.cs
10055         
10056         * enum.cs (Enum): Rename some members and make them public and readonly
10057         according to our convention.
10058
10059         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
10060         nothing else.
10061
10062         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
10063
10064         (Enum::Emit): Write a simple version for now which doesn't try to compute
10065         expressions. I shall modify this to be more robust in just a while.
10066
10067         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
10068
10069         (TypeContainer::CloseType): Create the Enum types too.
10070
10071         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
10072
10073         * expression.cs (EvalConstantExpression): Get rid of completely.
10074
10075         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
10076         user-defined values and other cases.
10077
10078         (IsValidEnumLiteral): Helper function.
10079
10080         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
10081         out there in the case we had a literal FieldExpr.
10082
10083         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
10084
10085         (Literalize): Revamp a bit to take two arguments.
10086         
10087         (EnumLiteral): New class which derives from Literal to wrap enum literals.
10088         
10089 2001-11-06  Ravi Pratap  <ravi@ximian.com>
10090
10091         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
10092
10093         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
10094
10095         (Resolve): Use the above to ensure we have proper initializers.
10096
10097 2001-11-05  Ravi Pratap  <ravi@ximian.com>
10098
10099         * expression.cs (Expression::EvalConstantExpression): New method to 
10100         evaluate constant expressions.
10101
10102         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
10103
10104 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
10105
10106         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
10107         in an array.
10108
10109         (Binary.ResolveOperator): Handle operator != (object a, object b)
10110         and operator == (object a, object b);
10111
10112         (Binary.DoNumericPromotions): Indicate whether the numeric
10113         promotion was possible.
10114
10115         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
10116         Implement.  
10117
10118         Made the ArrayAccess implement interface IAssignMethod instead of
10119         IStackStore as the order in which arguments are passed reflects
10120         this.
10121
10122         * assign.cs: Instead of using expr.ExprClass to select the way of
10123         assinging, probe for the IStackStore/IAssignMethod interfaces.
10124
10125         * typemanager.cs: Load InitializeArray definition.
10126
10127         * rootcontext.cs (RootContext.MakeStaticData): Used to define
10128         static data that can be used to initialize arrays. 
10129
10130 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
10131
10132         * expression.cs: Handle operator== and operator!= for booleans.
10133
10134         (Conditioal.Reduce): Implement reducer for the ?: operator.
10135
10136         (Conditional.Resolve): Implement dead code elimination.
10137
10138         (Binary.Resolve): Catch string literals and return a new
10139         concatenated string.
10140
10141         (Unary.Reduce): Implement reduction of unary expressions.
10142
10143         * ecore.cs: Split out the expression core handling here.
10144
10145         (Expression.Reduce): New method used to perform constant folding
10146         and CSE.  This is needed to support constant-expressions. 
10147         
10148         * statement.cs (Statement.EmitBoolExpression): Pass true and false
10149         targets, and optimize for !x.
10150
10151 2001-11-04  Ravi Pratap  <ravi@ximian.com>
10152
10153         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
10154         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
10155         set custom atttributes.
10156
10157         * literal.cs (Literal::GetValue): New abstract method to return the actual
10158         value of the literal, cast as an object.
10159
10160         (*Literal): Implement GetValue method.
10161
10162         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
10163         expressions to the arraylist but objects of type Argument.
10164
10165         * class.cs (TypeContainer::Emit): Emit our attributes too.
10166
10167         (Method::Emit, Constructor::Emit): Ditto.
10168
10169         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
10170         to be ignoring earlier.
10171
10172 2001-11-03  Ravi Pratap  <ravi@ximian.com>
10173
10174         * attribute.cs (AttributeSection::Define): Implement to do the business
10175         of constructing a CustomAttributeBuilder.
10176
10177         (Attribute): New trivial class. Increases readability of code.  
10178
10179         * cs-parser.jay : Update accordingly.
10180
10181         (positional_argument_list, named_argument_list, named_argument): New rules
10182
10183         (attribute_arguments): Use the above so that we are more correct.
10184         
10185 2001-11-02  Ravi Pratap  <ravi@ximian.com>
10186         
10187         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
10188         to perform all checks for a method with a params parameter.
10189
10190         (Invocation::OverloadResolve): Update to use the above method and therefore
10191         cope correctly with params method invocations.
10192
10193         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
10194         params too.
10195
10196         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
10197         constructors in our parent too because we can't afford to miss out on 
10198         protected ones ;-)
10199
10200         * attribute.cs (AttributeSection): New name for the class Attribute
10201
10202         Other trivial changes to improve readability.
10203
10204         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
10205         use the new class names.
10206         
10207 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10208
10209         * class.cs (Method::Define): Complete definition for params types too
10210
10211         (Indexer::Define): Ditto.
10212
10213         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
10214         Cope everywhere with a request for info about the array parameter.
10215
10216 2001-11-01  Ravi Pratap  <ravi@ximian.com>
10217
10218         * tree.cs (RecordNamespace): Fix up to check for the correct key.
10219
10220         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
10221         local_variable_type to extract the string corresponding to the type.
10222
10223         (local_variable_type): Fixup the action to use the new helper method.
10224
10225         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
10226         go.
10227
10228         * expression.cs : Clean out code which uses the above.
10229
10230 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10231         
10232         * typemanager.cs (RegisterMethod): Check if we already have an existing key
10233         and bale out if necessary by returning a false.
10234
10235         (RegisterProperty): Ditto.
10236
10237         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
10238         and print out appropriate error messages.
10239
10240         * interface.cs (everywhere): Ditto.
10241
10242         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
10243         location to constructor.
10244
10245         * class.cs (Property, Event, Indexer): Update accordingly.
10246
10247         * ../errors/cs111.cs : Added.
10248
10249         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
10250         of a method, as laid down by the spec.
10251
10252         (Invocation::OverloadResolve): Use the above method.
10253
10254 2001-10-31  Ravi Pratap  <ravi@ximian.com>
10255
10256         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
10257         now take a TypeContainer and a Parameters object.
10258
10259         (ParameterData): Modify return type of ParameterModifier method to be 
10260         Parameter.Modifier and not a string.
10261
10262         (ReflectionParameters, InternalParameters): Update accordingly.
10263
10264         * expression.cs (Argument::GetParameterModifier): Same here.
10265
10266         * support.cs (InternalParameters::ParameterType): Find a better way of determining
10267         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
10268         symbol in it at all so maybe this is only for now.
10269
10270 2001-10-30  Ravi Pratap  <ravi@ximian.com>
10271
10272         * support.cs (InternalParameters): Constructor now takes an extra argument 
10273         which is the actual Parameters class.
10274
10275         (ParameterDesc): Update to provide info on ref/out modifiers.
10276
10277         * class.cs (everywhere): Update call to InternalParameters to pass in
10278         the second argument too.
10279
10280         * support.cs (ParameterData): Add ParameterModifier, which is a method 
10281         to return the modifier info [ref/out etc]
10282
10283         (InternalParameters, ReflectionParameters): Implement the above.
10284
10285         * expression.cs (Argument::ParameterModifier): Similar function to return
10286         info about the argument's modifiers.
10287
10288         (Invocation::OverloadResolve): Update to take into account matching modifiers 
10289         too.
10290
10291         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
10292         a new SetFormalParameters object which we pass to InternalParameters.
10293
10294 2001-10-30  Ravi Pratap  <ravi@ximian.com>
10295
10296         * expression.cs (NewArray): Merge into the ArrayCreation class.
10297
10298 2001-10-29  Ravi Pratap  <ravi@ximian.com>
10299
10300         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
10301         NewUserdefinedArray into one as there wasn't much of a use in having
10302         two separate ones.
10303
10304         * expression.cs (Argument): Change field's name to ArgType from Type.
10305
10306         (Type): New readonly property which returns the proper type, taking into 
10307         account ref/out modifiers.
10308
10309         (everywhere): Adjust code accordingly for the above.
10310
10311         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
10312         whether we are emitting for a ref or out parameter.
10313
10314         * expression.cs (Argument::Emit): Use the above field to set the state.
10315
10316         (LocalVariableReference::Emit): Update to honour the flag and emit the
10317         right stuff.
10318
10319         * parameter.cs (Attributes): Set the correct flags for ref parameters.
10320
10321         * expression.cs (Argument::FullDesc): New function to provide a full desc.
10322
10323         * support.cs (ParameterData): Add method ParameterDesc to the interface.
10324
10325         (ReflectionParameters, InternalParameters): Implement the above method.
10326
10327         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
10328         reporting errors.
10329
10330         (Invocation::FullMethodDesc): Ditto. 
10331
10332 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
10333
10334         * cs-parser.jay: Add extra production for the second form of array
10335         creation. 
10336
10337         * expression.cs (ArrayCreation): Update to reflect the above
10338         change. 
10339
10340         * Small changes to prepare for Array initialization.
10341
10342 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
10343
10344         * typemanager.cs (ImplementsInterface): interface might be null;
10345         Deal with this problem;
10346
10347         Also, we do store negative hits on the cache (null values), so use
10348         this instead of calling t.GetInterfaces on the type everytime.
10349
10350 2001-10-28  Ravi Pratap  <ravi@ximian.com>
10351
10352         * typemanager.cs (IsBuiltinType): New method to help determine the same.
10353
10354         * expression.cs (New::DoResolve): Get rid of array creation code and instead
10355         split functionality out into different classes.
10356
10357         (New::FormArrayType): Move into NewBuiltinArray.
10358
10359         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
10360         quite useless.
10361
10362         (NewBuiltinArray): New class to handle creation of built-in arrays.
10363
10364         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
10365         account creation of one-dimensional arrays.
10366
10367         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
10368
10369         (NewUserdefinedArray::DoResolve): Implement.
10370
10371         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
10372
10373         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
10374         we maintain inside the TypeManager. This is necessary to perform lookups on the
10375         module builder.
10376
10377         (LookupType): Update to perform GetType on the module builders too.     
10378
10379         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
10380
10381         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
10382
10383 2001-10-23  Ravi Pratap  <ravi@ximian.com>
10384
10385         * expression.cs (New::DoResolve): Implement guts of array creation.
10386
10387         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
10388         
10389 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
10390
10391         * expression.cs: Fix bug I introduced lsat night that broke
10392         Delegates. 
10393
10394         (Expression.Resolve): Report a 246 error (can not resolve name)
10395         if we find a SimpleName in the stream.
10396         
10397         (Expression.ResolveLValue): Ditto.
10398         
10399         (Expression.ResolveWithSimpleName): This function is a variant of
10400         ResolveName, this one allows SimpleNames to be returned without a
10401         warning.  The only consumer of SimpleNames is MemberAccess
10402
10403 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
10404
10405         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
10406         might arrive here.  I have my doubts that this is correct.
10407
10408         * statement.cs (Lock): Implement lock statement.
10409
10410         * cs-parser.jay: Small fixes to support `lock' and `using'
10411
10412         * cs-tokenizer.cs: Remove extra space
10413
10414         * driver.cs: New flag --checked, allows to turn on integer math
10415         checking. 
10416
10417         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
10418         Threading.Monitor.Exit 
10419         
10420 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
10421
10422         * expression.cs (IndexerAccess::DoResolveLValue): Set the
10423         Expression Class to be IndexerAccess.
10424
10425         Notice that Indexer::DoResolve sets the eclass to Value.
10426
10427 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
10428
10429         * class.cs (TypeContainer::Emit): Emit code for indexers.
10430
10431         * assign.cs (IAssignMethod): New interface implemented by Indexers
10432         and Properties for handling assignment.
10433
10434         (Assign::Emit): Simplify and reuse code. 
10435         
10436         * expression.cs (IndexerAccess, PropertyExpr): Implement
10437         IAssignMethod, clean up old code. 
10438
10439 2001-10-22  Ravi Pratap  <ravi@ximian.com>
10440
10441         * typemanager.cs (ImplementsInterface): New method to determine if a type
10442         implements a given interface. Provides a nice cache too.
10443
10444         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
10445         method.
10446
10447         (ConvertReferenceExplicit): Ditto.
10448
10449         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
10450         various methods, with correct names etc.
10451
10452         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
10453         Operator.UnaryNegation.
10454
10455         * cs-parser.jay (operator_declarator): Be a little clever in the case where
10456         we have a unary plus or minus operator.
10457
10458         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
10459         UnaryMinus.
10460
10461         * everywhere : update accordingly.
10462
10463         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
10464         respectively.
10465
10466         * class.cs (Method::Define): For the case where we are implementing a method
10467         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
10468         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
10469         
10470 2001-10-21  Ravi Pratap  <ravi@ximian.com>
10471
10472         * interface.cs (FindMembers): Implement to work around S.R.E
10473         lameness.
10474
10475         * typemanager.cs (IsInterfaceType): Implement.
10476
10477         (FindMembers): Update to handle interface types too.
10478
10479         * expression.cs (ImplicitReferenceConversion): Re-write bits which
10480         use IsAssignableFrom as that is not correct - it doesn't work.
10481
10482         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
10483         and accordingly override EmitStatement.
10484
10485         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
10486         using the correct logic :-)
10487
10488 2001-10-19  Ravi Pratap  <ravi@ximian.com>
10489
10490         * ../errors/cs-11.cs : Add to demonstrate error -11 
10491
10492 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
10493
10494         * assign.cs (Assign::Resolve): Resolve right hand side first, and
10495         then pass this as a hint to ResolveLValue.
10496         
10497         * expression.cs (FieldExpr): Add Location information
10498
10499         (FieldExpr::LValueResolve): Report assignment to readonly
10500         variable. 
10501         
10502         (Expression::ExprClassFromMemberInfo): Pass location information.
10503
10504         (Expression::ResolveLValue): Add new method that resolves an
10505         LValue. 
10506
10507         (Expression::DoResolveLValue): Default invocation calls
10508         DoResolve. 
10509
10510         (Indexers): New class used to keep track of indexers in a given
10511         Type. 
10512
10513         (IStackStore): Renamed from LValue, as it did not really describe
10514         what this did.  Also ResolveLValue is gone from this interface and
10515         now is part of Expression.
10516
10517         (ElementAccess): Depending on the element access type
10518         
10519         * typemanager.cs: Add `indexer_name_type' as a Core type
10520         (System.Runtime.CompilerServices.IndexerNameAttribute)
10521
10522         * statement.cs (Goto): Take a location.
10523         
10524 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10525
10526         * delegate.cs (Delegate::VerifyDelegate): New method to verify
10527         if two delegates are compatible.
10528
10529         (NewDelegate::DoResolve): Update to take care of the case when
10530         we instantiate a delegate from another delegate.
10531
10532         * typemanager.cs (FindMembers): Don't even try to look up members
10533         of Delegate types for now.
10534
10535 2001-10-18  Ravi Pratap  <ravi@ximian.com>
10536
10537         * delegate.cs (NewDelegate): New class to take care of delegate
10538         instantiation.
10539
10540         * expression.cs (New): Split the delegate related code out into 
10541         the NewDelegate class.
10542
10543         * delegate.cs (DelegateInvocation): New class to handle delegate 
10544         invocation.
10545
10546         * expression.cs (Invocation): Split out delegate related code into
10547         the DelegateInvocation class.
10548
10549 2001-10-17  Ravi Pratap  <ravi@ximian.com>
10550
10551         * expression.cs (New::DoResolve): Implement delegate creation fully
10552         and according to the spec.
10553
10554         (New::DoEmit): Update to handle delegates differently.
10555
10556         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10557         because of which we were printing out arguments in reverse order !
10558
10559         * delegate.cs (VerifyMethod): Implement to check if the given method
10560         matches the delegate.
10561
10562         (FullDelegateDesc): Implement.
10563
10564         (VerifyApplicability): Implement.
10565
10566         * expression.cs (Invocation::DoResolve): Update to accordingly handle
10567         delegate invocations too.
10568
10569         (Invocation::Emit): Ditto.
10570
10571         * ../errors/cs1593.cs : Added.
10572
10573         * ../errors/cs1594.cs : Added.
10574
10575         * delegate.cs (InstanceExpression, TargetMethod): New properties.
10576
10577 2001-10-16  Ravi Pratap  <ravi@ximian.com>
10578
10579         * typemanager.cs (intptr_type): Core type for System.IntPtr
10580
10581         (InitCoreTypes): Update for the same.
10582
10583         (iasyncresult_type, asynccallback_type): Ditto.
10584
10585         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10586         correct.
10587
10588         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10589         too.
10590
10591         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10592         the builders for the 4 members of a delegate type :-)
10593
10594         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10595         type.
10596
10597         * expression.cs (New::DoResolve): Implement guts for delegate creation.
10598
10599         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10600
10601 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
10602
10603         * statement.cs (Break::Emit): Implement.   
10604         (Continue::Emit): Implement.
10605
10606         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10607         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10608         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
10609         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
10610         end loop
10611         
10612         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10613         properties that track the label for the current loop (begin of the
10614         loop and end of the loop).
10615
10616 2001-10-15  Ravi Pratap  <ravi@ximian.com>
10617
10618         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10619         use of emitting anything at all.
10620
10621         * class.cs, rootcontext.cs : Get rid of calls to the same.
10622
10623         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10624
10625         (Populate): Define the constructor correctly and set the implementation
10626         attributes.
10627
10628         * typemanager.cs (delegate_types): New hashtable to hold delegates that
10629         have been defined.
10630
10631         (AddDelegateType): Implement.
10632
10633         (IsDelegateType): Implement helper method.
10634
10635         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10636
10637         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10638         and accordingly handle it.
10639
10640         * delegate.cs (Populate): Take TypeContainer argument.
10641         Implement bits to define the Invoke method. However, I still haven't figured out
10642         how to take care of the native int bit :-(
10643
10644         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
10645         Qualify the name of the delegate, not its return type !
10646
10647         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10648         conversion.
10649
10650         (StandardConversionExists): Checking for array types turns out to be recursive.
10651
10652         (ConvertReferenceExplicit): Implement array conversion.
10653
10654         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10655         
10656 2001-10-12  Ravi Pratap  <ravi@ximian.com>
10657
10658         * cs-parser.jay (delegate_declaration): Store the fully qualified
10659         name as it is a type declaration.
10660
10661         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
10662         readonly.
10663
10664         (DefineDelegate): Renamed from Define. Does the same thing essentially,
10665         as TypeContainer::DefineType.
10666
10667         (Populate): Method in which all the definition of the various methods (Invoke)
10668         etc is done.
10669
10670         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10671         see.
10672         
10673         (CloseDelegate): Finally creates the delegate.
10674
10675         * class.cs (TypeContainer::DefineType): Update to define delegates.
10676         (Populate, Emit and CloseType): Do the same thing here too.
10677
10678         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10679         delegates in all these operations.
10680
10681 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
10682
10683         * expression.cs: LocalTemporary: a new expression used to
10684         reference a temporary that has been created.
10685
10686         * assign.cs: Handle PropertyAccess back here, so that we can
10687         provide the proper semantic access to properties.
10688
10689         * expression.cs (Expression::ConvertReferenceExplicit): Implement
10690         a few more explicit conversions. 
10691
10692         * modifiers.cs: `NEW' modifier maps to HideBySig.
10693
10694         * expression.cs (PropertyExpr): Make this into an
10695         ExpressionStatement, and support the EmitStatement code path. 
10696
10697         Perform get/set error checking, clean up the interface.
10698
10699         * assign.cs: recognize PropertyExprs as targets, and if so, turn
10700         them into toplevel access objects.
10701
10702 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
10703
10704         * expression.cs: PropertyExpr::PropertyExpr: use work around the
10705         SRE.
10706
10707         * typemanager.cs: Keep track here of our PropertyBuilders again to
10708         work around lameness in SRE.
10709
10710 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
10711
10712         * expression.cs (LValue::LValueResolve): New method in the
10713         interface, used to perform a second resolution pass for LValues. 
10714         
10715         (This::DoResolve): Catch the use of this in static methods.
10716
10717         (This::LValueResolve): Implement.
10718
10719         (This::Store): Remove warning, assigning to `this' in structures
10720         is 
10721
10722         (Invocation::Emit): Deal with invocation of
10723         methods on value types.  We need to pass the address to structure
10724         methods rather than the object itself.  (The equivalent code to
10725         emit "this" for structures leaves the entire structure on the
10726         stack instead of a pointer to it). 
10727
10728         (ParameterReference::DoResolve): Compute the real index for the
10729         argument based on whether the method takes or not a `this' pointer
10730         (ie, the method is static).
10731
10732         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10733         value types returned from functions when we need to invoke a
10734         method on the sturcture.
10735         
10736
10737 2001-10-11  Ravi Pratap  <ravi@ximian.com>
10738
10739         * class.cs (TypeContainer::DefineType): Method to actually do the business of
10740         defining the type in the Modulebuilder or Typebuilder. This is to take
10741         care of nested types which need to be defined on the TypeBuilder using
10742         DefineNestedMethod.
10743
10744         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
10745         methods in RootContext, only ported to be part of TypeContainer.
10746
10747         (TypeContainer::GetInterfaceOrClass): Ditto.
10748
10749         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10750
10751         * interface.cs (Interface::DefineInterface): New method. Does exactly
10752         what RootContext.CreateInterface did earlier, only it takes care of nested types 
10753         too.
10754
10755         (Interface::GetInterfaces): Move from RootContext here and port.
10756
10757         (Interface::GetInterfaceByName): Same here.
10758
10759         * rootcontext.cs (ResolveTree): Re-write.
10760
10761         (PopulateTypes): Re-write.
10762
10763         * class.cs (TypeContainer::Populate): Populate nested types too.
10764         (TypeContainer::Emit): Emit nested members too.
10765
10766         * typemanager.cs (AddUserType): Do not make use of the FullName property,
10767         instead just use the name argument passed in as it is already fully
10768         qualified.
10769
10770         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10771         to TypeContainer mapping to see if a type is user-defined.
10772
10773         * class.cs (TypeContainer::CloseType): Implement. 
10774
10775         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10776         the default constructor.
10777         
10778         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10779         twice.
10780
10781         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10782
10783         * interface.cs (CloseType): Create the type here.
10784         
10785         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10786         the hierarchy.
10787
10788         Remove all the methods which are now in TypeContainer.
10789
10790 2001-10-10  Ravi Pratap  <ravi@ximian.com>
10791
10792         * delegate.cs (Define): Re-write bits to define the delegate
10793         correctly.
10794
10795 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
10796
10797         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10798
10799         * expression.cs (ImplicitReferenceConversion): handle null as well
10800         as a source to convert to any reference type.
10801
10802         * statement.cs (Return): Perform any implicit conversions to
10803         expected return type.  
10804
10805         Validate use of return statement.  
10806
10807         * codegen.cs (EmitContext): Pass the expected return type here.
10808
10809         * class.cs (Method, Constructor, Property): Pass expected return
10810         type to EmitContext.
10811
10812 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
10813
10814         * expression.cs: Make DoResolve take an EmitContext instead of a
10815         TypeContainer.
10816
10817         Replaced `l' and `location' for `loc', for consistency.
10818         
10819         (Error, Warning): Remove unneeded Tc argument.
10820
10821         * assign.cs, literal.cs, constant.cs: Update to new calling
10822         convention. 
10823         
10824         * codegen.cs: EmitContext now contains a flag indicating whether
10825         code is being generated in a static method or not.
10826
10827         * cs-parser.jay: DecomposeQI, new function that replaces the old
10828         QualifiedIdentifier.  Now we always decompose the assembled
10829         strings from qualified_identifier productions into a group of
10830         memberaccesses.
10831
10832 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
10833
10834         * rootcontext.cs: Deal with field-less struct types correctly now
10835         by passing the size option to Define Type.
10836
10837         * class.cs: Removed hack that created one static field. 
10838
10839 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10840
10841         * statement.cs: Moved most of the code generation here. 
10842
10843 2001-10-09  Ravi Pratap  <ravi@ximian.com>
10844
10845         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10846         seem very right.
10847
10848         (ElementAccess): Remove useless bits for now - keep checks as the spec
10849         says.
10850
10851 2001-10-08  Ravi Pratap  <ravi@ximian.com>
10852
10853         * expression.cs (ElementAccess::DoResolve): Remove my crap code
10854         and start performing checks according to the spec.
10855
10856 2001-10-07  Ravi Pratap  <ravi@ximian.com>
10857
10858         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10859         rank_specifiers instead.
10860
10861         (rank_specifiers): Change the order in which the rank specifiers are stored
10862
10863         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10864
10865         * expression.cs (ElementAccess): Implement the LValue interface too.
10866         
10867 2001-10-06  Ravi Pratap  <ravi@ximian.com>
10868         
10869         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10870         except that user defined conversions are not included.
10871
10872         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
10873         perform the conversion of the return type, if necessary.
10874
10875         (New::DoResolve): Check whether we are creating an array or an object
10876         and accordingly do the needful.
10877
10878         (New::Emit): Same here.
10879
10880         (New::DoResolve): Implement guts of array creation.
10881
10882         (New::FormLookupType): Helper function.
10883
10884 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
10885
10886         * codegen.cs: Removed most of the code generation here, and move the
10887         corresponding code generation bits to the statement classes. 
10888
10889         Added support for try/catch/finalize and throw.
10890         
10891         * cs-parser.jay: Added support for try/catch/finalize.
10892
10893         * class.cs: Catch static methods having the flags override,
10894         virtual or abstract.
10895
10896         * expression.cs (UserCast): This user cast was not really doing
10897         what it was supposed to do.  Which is to be born in fully resolved
10898         state.  Parts of the resolution were being performed at Emit time! 
10899
10900         Fixed this code.
10901
10902 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10903
10904         * expression.cs: Implicity convert the result from UserCast.
10905
10906 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10907
10908         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10909         prevented it from working correctly. 
10910
10911         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10912         merely ConvertImplicit.
10913
10914 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
10915
10916         * typemanager.cs: Make the LookupTypeContainer function static,
10917         and not per-instance.  
10918
10919         * class.cs: Make static FindMembers (the one that takes a Type
10920         argument). 
10921
10922         * codegen.cs: Add EmitForeach here.
10923
10924         * cs-parser.jay: Make foreach a toplevel object instead of the
10925         inline expansion, as we need to perform semantic analysis on it. 
10926
10927 2001-10-05  Ravi Pratap  <ravi@ximian.com>
10928
10929         * expression.cs (Expression::ImplicitUserConversion): Rename to
10930         UserDefinedConversion.
10931
10932         (Expression::UserDefinedConversion): Take an extra argument specifying 
10933         whether we look for explicit user conversions too.
10934
10935         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10936
10937         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10938
10939         (ExplicitUserConversion): Make it a call to UserDefinedConversion
10940         with the appropriate arguments.
10941
10942         * cs-parser.jay (cast_expression): Record location too.
10943
10944         * expression.cs (Cast): Record location info.
10945
10946         (Expression::ConvertExplicit): Take location argument.
10947
10948         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10949         to determine if we are doing explicit conversions.
10950
10951         (UserCast::Emit): Update accordingly.
10952
10953         (Expression::ConvertExplicit): Report an error if everything fails.
10954
10955         * ../errors/cs0030.cs : Add.
10956
10957 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
10958
10959         * modifiers.cs: If the ABSTRACT keyword is present, also set the
10960         virtual and newslot bits. 
10961
10962         * class.cs (TypeContainer::RegisterRequiredImplementations):
10963         Record methods we need.
10964
10965         (TypeContainer::MakeKey): Helper function to make keys for
10966         MethodBases, since the Methodbase key is useless.
10967
10968         (TypeContainer::Populate): Call RegisterRequiredImplementations
10969         before defining the methods.   
10970
10971         Create a mapping for method_builders_to_methods ahead of time
10972         instead of inside a tight loop.
10973
10974         (::RequireMethods):  Accept an object as the data to set into the
10975         hashtable so we can report interface vs abstract method mismatch.
10976
10977 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
10978
10979         * report.cs: Make all of it static.
10980
10981         * rootcontext.cs: Drop object_type and value_type computations, as
10982         we have those in the TypeManager anyways.
10983
10984         Drop report instance variable too, now it is a global.
10985
10986         * driver.cs: Use try/catch on command line handling.
10987
10988         Add --probe option to debug the error reporting system with a test
10989         suite. 
10990
10991         * report.cs: Add support for exiting program when a probe
10992         condition is reached.
10993
10994 2001-10-03  Ravi Pratap  <ravi@ximian.com>
10995
10996         * expression.cs (Binary::DoNumericPromotions): Fix the case when
10997         we do a forcible conversion regardless of type, to check if 
10998         ForceConversion returns a null.
10999
11000         (Binary::error19): Use location to report error.
11001
11002         (Unary::error23): Use location here too.
11003
11004         * ../errors/cs0019.cs : Check in.
11005
11006         * ../errors/cs0023.cs : Check in.
11007
11008         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
11009         case of a non-null MethodInfo object with a length of 0 !
11010
11011         (Binary::ResolveOperator): Flag error if overload resolution fails to find
11012         an applicable member - according to the spec :-)
11013         Also fix logic to find members in base types.
11014
11015         (Unary::ResolveOperator): Same here.
11016
11017         (Unary::report23): Change name to error23 and make first argument a TypeContainer
11018         as I was getting thoroughly confused between this and error19 :-)
11019         
11020         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
11021         (::FindMostEncompassedType): Implement.
11022         (::FindMostEncompassingType): Implement.
11023         (::StandardConversionExists): Implement.
11024
11025         (UserImplicitCast): Re-vamp. We now need info about most specific
11026         source and target types so that we can do the necessary conversions.
11027
11028         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
11029         mathematical union with no duplicates.
11030
11031 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
11032
11033         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
11034         in order from base classes to child classes, so that we can in
11035         child classes look up in our parent for method names and
11036         attributes (required for handling abstract, virtual, new, override
11037         constructs: we need to instrospect our base class, and if we dont
11038         populate the classes in order, the introspection might be
11039         incorrect.  For example, a method could query its parent before
11040         the parent has any methods and would determine that the parent has
11041         no abstract methods (while it could have had them)).
11042
11043         (RootContext::CreateType): Record the order in which we define the
11044         classes.
11045
11046 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
11047
11048         * class.cs (TypeContainer::Populate): Also method definitions can
11049         fail now, keep track of this.
11050
11051         (TypeContainer::FindMembers): Implement support for
11052         DeclaredOnly/noDeclaredOnly flag.
11053
11054         (Constructor::Emit) Return the ConstructorBuilder.
11055
11056         (Method::Emit) Return the MethodBuilder. 
11057         Check for abstract or virtual methods to be public.
11058
11059         * rootcontext.cs (RootContext::CreateType): Register all the
11060         abstract methods required for the class to be complete and the
11061         interface methods that must be implemented. 
11062
11063         * cs-parser.jay: Report error 501 (method requires body if it is
11064         not marked abstract or extern).
11065
11066         * expression.cs (TypeOf::Emit): Implement.
11067
11068         * typemanager.cs: runtime_handle_type, new global type.
11069
11070         * class.cs (Property::Emit): Generate code for properties.
11071
11072 2001-10-02  Ravi Pratap  <ravi@ximian.com>
11073
11074         * expression.cs (Unary::ResolveOperator): Find operators on base type
11075         too - we now conform exactly to the spec.
11076
11077         (Binary::ResolveOperator): Same here.
11078
11079         * class.cs (Operator::Define): Fix minor quirk in the tests.
11080
11081         * ../errors/cs0215.cs : Added.
11082
11083         * ../errors/cs0556.cs : Added.
11084
11085         * ../errors/cs0555.cs : Added.
11086
11087 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
11088
11089         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
11090         single integer which is really efficient
11091
11092 2001-10-01  Ravi Pratap  <ravi@ximian.com>
11093
11094         *  expression.cs (Expression::ImplicitUserConversion): Use location
11095         even in the case when we are examining True operators.
11096  
11097         * class.cs (Operator::Define): Perform extensive checks to conform
11098         with the rules for operator overloading in the spec.
11099
11100         * expression.cs (Expression::ImplicitReferenceConversion): Implement
11101         some of the other conversions mentioned in the spec.
11102
11103         * typemanager.cs (array_type): New static member for the System.Array built-in
11104         type.
11105
11106         (cloneable_interface): For System.ICloneable interface.
11107
11108         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
11109         we start resolving the tree and populating types.
11110
11111         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
11112  
11113 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
11114
11115         * expression.cs (Expression::ExprClassFromMemberInfo,
11116         Expression::Literalize): Create literal expressions from
11117         FieldInfos which are literals.
11118
11119         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
11120         type casts, because they were wrong.  The test suite in tests
11121         caught these ones.
11122
11123         (ImplicitNumericConversion): ushort to ulong requires a widening
11124         cast. 
11125
11126         Int32 constant to long requires widening cast as well.
11127
11128         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
11129         for integers because the type on the stack is not i4.
11130
11131 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
11132
11133         * expression.cs (report118): require location argument. 
11134
11135         * parameter.cs: Do not dereference potential null value.
11136
11137         * class.cs: Catch methods that lack the `new' keyword when
11138         overriding a name.  Report warnings when `new' is used without
11139         anything being there to override.
11140
11141         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
11142
11143         * class.cs: Only add constructor to hashtable if it is non-null
11144         (as now constructors can fail on define).
11145
11146         (TypeManager, Class, Struct): Take location arguments.
11147
11148         Catch field instance initialization in structs as errors.
11149
11150         accepting_filter: a new filter for FindMembers that is static so
11151         that we dont create an instance per invocation.
11152
11153         (Constructor::Define): Catch errors where a struct constructor is
11154         parameterless 
11155
11156         * cs-parser.jay: Pass location information for various new
11157         constructs. 
11158         
11159         * delegate.cs (Delegate): take a location argument.
11160
11161         * driver.cs: Do not call EmitCode if there were problesm in the
11162         Definition of the types, as many Builders wont be there. 
11163
11164         * decl.cs (Decl::Decl): Require a location argument.
11165
11166         * cs-tokenizer.cs: Handle properly hex constants that can not fit
11167         into integers, and find the most appropiate integer for it.
11168
11169         * literal.cs: Implement ULongLiteral.
11170
11171         * rootcontext.cs: Provide better information about the location of
11172         failure when CreateType fails.
11173         
11174 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
11175
11176         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
11177         as well.
11178
11179         * expression.cs (Binary::CheckShiftArguments): Add missing type
11180         computation.
11181         (Binary::ResolveOperator): Add type to the logical and and logical
11182         or, Bitwise And/Or and Exclusive Or code paths, it was missing
11183         before.
11184
11185         (Binary::DoNumericPromotions): In the case where either argument
11186         is ulong (and most signed types combined with ulong cause an
11187         error) perform implicit integer constant conversions as well.
11188
11189 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
11190
11191         * expression.cs (UserImplicitCast): Method should always be
11192         non-null. 
11193         (Invocation::BetterConversion): Simplified test for IntLiteral.
11194
11195         (Expression::ImplicitNumericConversion): Split this routine out.
11196         Put the code that performs implicit constant integer conversions
11197         here. 
11198
11199         (Expression::Resolve): Become a wrapper around DoResolve so we can
11200         check eclass and type being set after resolve.
11201
11202         (Invocation::Badness): Remove this dead function
11203
11204         (Binary::ResolveOperator): Do not compute the expensive argumnets
11205         unless we have a union for it.
11206
11207         (Probe::Emit): Is needs to do an isinst and then
11208         compare against null.
11209
11210         (::CanConvert): Added Location argument.  If the Location argument
11211         is null (Location.Null), then we do not report errors.  This is
11212         used by the `probe' mechanism of the Explicit conversion.  We do
11213         not want to generate an error for something that the user
11214         explicitly requested to be casted.  But the pipeline for an
11215         explicit cast first tests for potential implicit casts.
11216
11217         So for now, if the Location is null, it means `Probe only' to
11218         avoid adding another argument.   Might have to revise this
11219         strategy later.
11220
11221         (ClassCast): New class used to type cast objects into arbitrary
11222         classes (used in Explicit Reference Conversions).
11223
11224         Implement `as' as well.
11225
11226         Reverted all the patches from Ravi below: they were broken:
11227
11228                 * The use of `level' as a mechanism to stop recursive
11229                   invocations is wrong.  That was there just to catch the
11230                   bug with a strack trace but not as a way of addressing
11231                   the problem.
11232
11233                   To fix the problem we have to *understand* what is going
11234                   on and the interactions and come up with a plan, not
11235                   just get things going.
11236
11237                 * The use of the type conversion cache that I proposed
11238                   last night had an open topic: How does this work across
11239                   protection domains.  A user defined conversion might not
11240                   be public in the location where we are applying the
11241                   conversion, a different conversion might be selected
11242                   (ie, private A->B (better) but public B->A (worse),
11243                   inside A, A->B applies, but outside it, B->A will
11244                   apply).
11245
11246                 * On top of that (ie, even if the above is solved),
11247                   conversions in a cache need to be abstract.  Ie, `To
11248                   convert from an Int to a Short use an OpcodeCast', not
11249                   `To convert from an Int to a Short use the OpcodeCast on
11250                   the variable 5' (which is what this patch was doing).
11251         
11252 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11253
11254         * expression.cs (Invocation::ConversionExists): Re-write to use
11255         the conversion cache
11256         
11257         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
11258         cache all conversions done, not just user-defined ones.
11259
11260         (Invocation::BetterConversion): The real culprit. Use ConversionExists
11261         to determine if a conversion exists instead of acutually trying to 
11262         perform the conversion. It's faster too.
11263
11264         (Expression::ConvertExplicit): Modify to use ConversionExists to check
11265         and only then attempt the implicit conversion.
11266
11267 2001-09-28  Ravi Pratap  <ravi@ximian.com>
11268
11269         * expression.cs (ConvertImplicit): Use a cache for conversions
11270         already found. Check level of recursion and bail out if necessary.
11271         
11272 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
11273
11274         * typemanager.cs (string_concat_string_string, string_concat_object_object):
11275         Export standard methods that we expect for string operations.
11276         
11277         * statement.cs (Block::UsageWarning): Track usage of variables and
11278         report the errors for not used variables.
11279
11280         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
11281         operator. 
11282
11283 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
11284
11285         * codegen.cs: remove unnneded code 
11286
11287         * expression.cs: Removed BuiltinTypeAccess class
11288
11289         Fix the order in which implicit conversions are
11290         done.  
11291
11292         The previous fixed dropped support for boxed conversions (adding a
11293         test to the test suite now)
11294
11295         (UserImplicitCast::CanConvert): Remove test for source being null,
11296         that code is broken.  We should not feed a null to begin with, if
11297         we do, then we should track the bug where the problem originates
11298         and not try to cover it up here.
11299
11300         Return a resolved expression of type UserImplicitCast on success
11301         rather than true/false.  Ravi: this is what I was talking about,
11302         the pattern is to use a static method as a "constructor" for
11303         objects. 
11304
11305         Also, do not create arguments until the very last minute,
11306         otherwise we always create the arguments even for lookups that
11307         will never be performed. 
11308
11309         (UserImplicitCast::Resolve): Eliminate, objects of type
11310         UserImplicitCast are born in a fully resolved state. 
11311         
11312         * typemanager.cs (InitCoreTypes): Init also value_type
11313         (System.ValueType). 
11314
11315         * expression.cs (Cast::Resolve): First resolve the child expression.
11316
11317         (LValue): Add new method AddressOf to be used by
11318         the `&' operator.  
11319
11320         Change the argument of Store to take an EmitContext instead of an
11321         ILGenerator, because things like FieldExpr need to be able to call
11322         their children expression to generate the instance code. 
11323
11324         (Expression::Error, Expression::Warning): Sugar functions for
11325         reporting errors.
11326
11327         (Expression::MemberLookup): Accept a TypeContainer instead of a
11328         Report as the first argument.
11329
11330         (Expression::ResolvePrimary): Killed.  I still want to improve
11331         this as currently the code is just not right.
11332
11333         (Expression::ResolveMemberAccess): Simplify, but it is still
11334         wrong. 
11335
11336         (Unary::Resolve): Catch errors in AddressOf operators.
11337
11338         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
11339         index to a byte for the short-version, or the compiler will choose
11340         the wrong Emit call, which generates the wrong data.
11341
11342         (ParameterReference::Emit, ::Store): same.
11343
11344         (FieldExpr::AddressOf): Implement.
11345         
11346         * typemanager.cs: TypeManager: made public variable instead of
11347         property.
11348         
11349         * driver.cs: document --fatal.
11350
11351         * report.cs (ErrorMessage, WarningMessage): new names for the old
11352         Error and Warning classes.
11353
11354         * cs-parser.jay (member_access): Turn built-in access to types
11355         into a normal simplename
11356
11357 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11358
11359         * expression.cs (Invocation::BetterConversion): Fix to cope
11360         with q being null, since this was introducing a bug.
11361
11362         * expression.cs (ConvertImplicit): Do built-in conversions first.
11363
11364 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11365
11366         * expression.cs (UserImplicitCast::Resolve): Fix bug.
11367
11368 2001-09-27  Ravi Pratap  <ravi@ximian.com>
11369
11370         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
11371         I had introduced long ago (what's new ?).
11372
11373         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
11374         the work of all the checking. 
11375         (ConvertImplicit): Call CanConvert and only then create object if necessary.
11376         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
11377
11378         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
11379         that is the right way. 
11380
11381         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
11382         overloading resolution. Use everywhere instead of cutting and pasting code.
11383
11384         (Binary::ResolveOperator): Use MakeUnionSet.
11385
11386         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
11387         we have to convert to bool types. Not complete yet.
11388         
11389 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
11390
11391         * typemanager.cs (TypeManager::CSharpName): support ushort.
11392
11393         * expression.cs (Expression::TryImplicitIntConversion): Attempts
11394         to provide an expression that performsn an implicit constant int
11395         conversion (section 6.1.6).
11396         (Expression::ConvertImplicitRequired): Reworked to include
11397         implicit constant expression conversions.
11398
11399         (Expression::ConvertNumericExplicit): Finished.
11400
11401         (Invocation::Emit): If InstanceExpression is null, then it means
11402         that we perform a call on this.
11403         
11404 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
11405
11406         * expression.cs (Unary::Emit): Remove some dead code.
11407         (Probe): Implement Resolve and Emit for `is'.
11408         (Expression::ConvertImplicitRequired): Attempt to do constant
11409         expression conversions here.  Maybe should be moved to
11410         ConvertImplicit, but I am not sure.
11411         (Expression::ImplicitLongConstantConversionPossible,
11412         Expression::ImplicitIntConstantConversionPossible): New functions
11413         that tell whether is it possible to apply an implicit constant
11414         expression conversion.
11415
11416         (ConvertNumericExplicit): Started work on explicit numeric
11417         conversions.
11418
11419         * cs-parser.jay: Update operator constants.
11420
11421         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
11422         (Parameters::GetSignature): Hook up VerifyArgs here.
11423         (Parameters::VerifyArgs): Verifies that no two arguments have the
11424         same name. 
11425
11426         * class.cs (Operator): Update the operator names to reflect the
11427         ones that the spec expects (as we are just stringizing the
11428         operator names).
11429         
11430         * expression.cs (Unary::ResolveOperator): Fix bug: Use
11431         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
11432         previous usage did only work for our methods.
11433         (Expression::ConvertImplicit): Handle decimal implicit numeric
11434         conversions as well.
11435         (Expression::InternalTypeConstructor): Used to invoke constructors
11436         on internal types for default promotions.
11437
11438         (Unary::Emit): Implement special handling for the pre/post
11439         increment/decrement for overloaded operators, as they need to have
11440         the same semantics as the other operators.
11441
11442         (Binary::ResolveOperator): ditto.
11443         (Invocation::ConversionExists): ditto.
11444         (UserImplicitCast::Resolve): ditto.
11445         
11446 2001-09-26  Ravi Pratap  <ravi@ximian.com>
11447
11448         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
11449         operator, return after emitting body. Regression tests pass again !
11450
11451         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
11452         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
11453         (Invocation::OverloadResolve): Ditto.
11454         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
11455
11456         * everywhere : update calls to the above methods accordingly.
11457
11458 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
11459
11460         * assign.cs (Assign): Make it inherit from ExpressionStatement.
11461
11462         * expression.cs (ExpressionStatement): New base class used for
11463         expressions that can appear in statements, so that we can provide
11464         an alternate path to generate expression that do not leave a value
11465         on the stack.
11466
11467         (Expression::Emit, and all the derivatives): We no longer return
11468         whether a value is left on the stack or not.  Every expression
11469         after being emitted leaves a single value on the stack.
11470
11471         * codegen.cs (EmitContext::EmitStatementExpression): Use the
11472         facilties of ExpressionStatement if possible.
11473
11474         * cs-parser.jay: Update statement_expression.
11475
11476 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
11477
11478         * driver.cs: Change the wording of message
11479
11480 2001-09-25  Ravi Pratap  <ravi@ximian.com>
11481
11482         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
11483         the type of the expression to the return type of the method if
11484         we have an overloaded operator match ! The regression tests pass again !
11485         (Unary::ResolveOperator): Ditto.
11486
11487         * expression.cs (Invocation::ConversionExists): Correct the member lookup
11488         to find "op_Implicit", not "implicit" ;-)
11489         (UserImplicitCast): New class to take care of user-defined implicit conversions.
11490         (ConvertImplicit, ForceConversion): Take TypeContainer argument
11491
11492         * everywhere : Correct calls to the above accordingly.
11493
11494         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
11495         (ConvertImplicit): Do user-defined conversion if it exists.
11496
11497 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
11498
11499         * assign.cs: track location.
11500         (Resolve): Use implicit conversions on assignment.
11501
11502         * literal.cs: Oops.  Not good, Emit of short access values should
11503         pass (Bytes) or the wrong argument will be selected.
11504
11505         * expression.cs (Unary::Emit): Emit code for -expr.
11506         
11507         (Unary::ResolveOperator): Handle `Substract' for non-constants
11508         (substract from zero from the non-constants).
11509         Deal with Doubles as well. 
11510         
11511         (Expression::ConvertImplicitRequired): New routine that reports an
11512         error if no implicit conversion exists. 
11513
11514         (Invocation::OverloadResolve): Store the converted implicit
11515         expressions if we make them
11516         
11517 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11518
11519         * class.cs (ConstructorInitializer): Take a Location argument.
11520         (ConstructorBaseInitializer): Same here.
11521         (ConstructorThisInitializer): Same here.
11522
11523         * cs-parser.jay : Update all calls accordingly.
11524
11525         * expression.cs (Unary, Binary, New): Take location argument.
11526         Update accordingly everywhere.
11527
11528         * cs-parser.jay : Update all calls to the above to take a location
11529         argument.
11530
11531         * class.cs : Ditto.
11532
11533 2001-09-24  Ravi Pratap  <ravi@ximian.com>
11534
11535         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11536         (Invocation::BetterConversion): Same here
11537         (Invocation::ConversionExists): Ditto.
11538
11539         (Invocation::ConversionExists): Implement.
11540
11541 2001-09-22  Ravi Pratap  <ravi@ximian.com>
11542
11543         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11544         Also take an additional TypeContainer argument.
11545
11546         * All over : Pass in TypeContainer as argument to OverloadResolve.
11547
11548         * typemanager.cs (CSharpName): Update to check for the string type and return
11549         that too.
11550
11551         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11552         a given method.
11553         
11554 2001-09-21  Ravi Pratap  <ravi@ximian.com>
11555
11556         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11557         (Invocation::BetterFunction): Implement.
11558         (Invocation::BetterConversion): Implement.
11559         (Invocation::ConversionExists): Skeleton, no implementation yet.
11560
11561         Okay, things work fine !
11562
11563 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
11564
11565         * typemanager.cs: declare and load enum_type, delegate_type and
11566         void_type. 
11567
11568         * expression.cs (Expression::Emit): Now emit returns a value that
11569         tells whether a value is left on the stack or not.  This strategy
11570         might be reveted tomorrow with a mechanism that would address
11571         multiple assignments.
11572         (Expression::report118): Utility routine to report mismatches on
11573         the ExprClass.
11574
11575         (Unary::Report23): Report impossible type/operator combination
11576         utility function.
11577
11578         (Unary::IsIncrementableNumber): Whether the type can be
11579         incremented or decremented with add.
11580         (Unary::ResolveOperator): Also allow enumerations to be bitwise
11581         complemented. 
11582         (Unary::ResolveOperator): Implement ++, !, ~,
11583
11584         (Invocation::Emit): Deal with new Emit convetion.
11585         
11586         * All Expression derivatives: Updated their Emit method to return
11587         whether they leave values on the stack or not.
11588         
11589         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11590         stack for expressions that are statements. 
11591
11592 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11593
11594         * expression.cs (LValue): New interface.  Must be implemented by
11595         LValue objects.
11596         (LocalVariableReference, ParameterReference, FieldExpr): Implement
11597         LValue interface.
11598         
11599         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11600         interface for generating code, simplifies the code.
11601
11602 2001-09-20  Ravi Pratap  <ravi@ximian.com>
11603
11604         * expression.cs (everywhere): Comment out return statements in ::Resolve
11605         methods to avoid the warnings.
11606
11607 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
11608
11609         * driver.cs (parse): Report error 2001 if we can not open the
11610         source file.
11611
11612         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11613         not resolve it.
11614
11615         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11616         object. 
11617
11618         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11619         otherwise nested blocks end up with the same index.
11620
11621         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11622
11623         * expression.cs:  Instead of having FIXMEs in the Resolve
11624         functions, throw exceptions so it is obvious that we are facing a
11625         bug. 
11626
11627         * cs-parser.jay (invocation_expression): Pass Location information.
11628
11629         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11630         Use a basename for those routines because .NET does not like paths
11631         on them. 
11632
11633         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11634         already defined.
11635
11636 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
11637
11638         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11639         are loading the correct data types (throws an exception if not).
11640         (TypeManager::InitCoreTypes): Use CoreLookupType
11641
11642         * expression.cs (Unary::ResolveOperator): return the child
11643         expression for expressions which are just +expr.
11644         (Unary::ResolveOperator): Return negative literals for -LITERAL
11645         expressions (otherwise they are Unary {Literal}).
11646         (Invocation::Badness): Take into account `Implicit constant
11647         expression conversions'.
11648
11649         * literal.cs (LongLiteral): Implement long literal class.
11650         (IntLiteral): export the `Value' of the intliteral. 
11651
11652 2001-09-19  Ravi Pratap  <ravi@ximian.com>
11653
11654         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11655
11656         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
11657         instead of 'Operator'
11658
11659         * expression.cs (Binary::ResolveOperator): Update accordingly.
11660         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11661         and 'Minus'
11662
11663         * cs-parser.jay (unary_expression): Update to use the new names.
11664
11665         * gen-treedump.cs (GetUnary): Same here.
11666
11667         * expression.cs (Unary::Resolve): Implement.
11668         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
11669         operators are found instead of making noise ;-)
11670         (Unary::ResolveOperator): New method to do precisely the same thing which
11671         Binary::ResolveOperator does for Binary expressions.
11672         (Unary.method, .Arguments): Add.
11673         (Unary::OperName): Implement.   
11674         (Unary::ForceConversion): Copy and Paste !
11675
11676         * class.cs (Operator::Define): Fix a small bug for the case when we have 
11677         a unary operator.
11678
11679         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11680         for the inbuilt operators. Only overloading works for now ;-)
11681
11682 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
11683
11684         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11685         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11686
11687         * expression.cs (This::Emit): Implement. 
11688         (This::Resolve): Implement.
11689         (TypeOf:Resolve): Implement.
11690         (Expression::ResolveSimpleName): Add an implicit this to instance
11691         field references. 
11692         (MemberAccess::Resolve): Deal with Parameters and Fields. 
11693         Bind instance variable to Field expressions.
11694         (FieldExpr::Instance): New field used to track the expression that
11695         represents the object instance.
11696         (FieldExpr::Resolve): Track potential errors from MemberLookup not
11697         binding 
11698         (FieldExpr::Emit): Implement.
11699
11700         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11701         the last instruction contains a return opcode to avoid generating
11702         the last `ret' instruction (this generates correct code, and it is
11703         nice to pass the peverify output).
11704
11705         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11706         initializer for static and instance variables.
11707         (Constructor::Emit): Allow initializer to be null in the case of
11708         static constructors.  Only emit initializer for instance
11709         constructors. 
11710
11711         (TypeContainer::FindMembers): Return a null array if there are no
11712         matches.
11713
11714         Also fix the code for the MemberTypes.Method branch, as it was not
11715         scanning that for operators (or tried to access null variables before).
11716
11717         * assign.cs (Assign::Emit): Handle instance and static fields. 
11718
11719         * TODO: Updated.
11720
11721         * driver.cs: Stop compilation if there are parse errors.
11722
11723         * cs-parser.jay (constructor_declaration): Provide default base
11724         initializer for non-static constructors.
11725         (constructor_declarator): Do not provide a default base
11726         initializers if none was specified.
11727         Catch the fact that constructors should not have parameters.
11728
11729         * class.cs: Do not emit parent class initializers for static
11730         constructors, that should be flagged as an error.
11731
11732 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11733
11734         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11735         Move back code into TypeContainer::Populate.
11736
11737 2001-09-18  Ravi Pratap  <ravi@ximian.com>
11738
11739         * class.cs (TypeContainer::AddConstructor): Fix the check to
11740         compare against Name, not Basename. 
11741         (Operator::OpType): Change Plus and Minus to Add and Subtract.
11742
11743         * cs-parser.jay : Update accordingly.
11744
11745         * class.cs (TypeContainer::FindMembers): For the case where we are searching
11746         for methods, don't forget to look into the operators too.
11747         (RegisterMethodBuilder): Helper method to take care of this for
11748         methods, constructors and operators.
11749         (Operator::Define): Completely revamp.
11750         (Operator.OperatorMethod, MethodName): New fields.
11751         (TypeContainer::Populate): Move the registering of builders into
11752         RegisterMethodBuilder.
11753         (Operator::Emit): Re-write.
11754
11755         * expression.cs (Binary::Emit): Comment out code path to emit method
11756         invocation stuff for the case when we have a user defined operator. I am
11757         just not able to get it right !
11758         
11759 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11760
11761         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11762         argument. 
11763
11764         (Expression::MemberLookup): Provide a version that allows to
11765         specify the MemberTypes and BindingFlags. 
11766
11767         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11768         so it was not fetching variable information from outer blocks.
11769
11770         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11771         Beforefieldinit as it was buggy.
11772
11773         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11774         that Ravi put here.  
11775
11776         * class.cs (Constructor::Emit): Only emit if block is not null.
11777         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11778         deal with this by semantically definining it as if the user had
11779         done it.
11780
11781         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11782         constructors as we now "emit" them at a higher level.
11783
11784         (TypeContainer::DefineDefaultConstructor): Used to define the
11785         default constructors if none was provided.
11786
11787         (ConstructorInitializer): Add methods Resolve and Emit. 
11788         
11789         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11790
11791 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11792
11793         * class.cs (TypeContainer::EmitDefaultConstructor): Register
11794         the default constructor builder with our hashtable for methodbuilders
11795         to methodcores.
11796
11797         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11798         and argument_count is 0 in which case we have a match.
11799         (Binary::ResolveOperator): More null checking and miscellaneous coding
11800         style cleanup.
11801
11802 2001-09-17  Ravi Pratap  <ravi@ximian.com>
11803
11804         * rootcontext.cs (IsNameSpace): Compare against null.
11805
11806         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11807
11808         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11809         and Unary::Operator.
11810
11811         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11812         accordingly.
11813
11814         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11815         we have overloaded operators.
11816         (Binary::ResolveOperator): Implement the part which does the operator overload
11817         resolution.
11818
11819         * class.cs (Operator::Emit): Implement.
11820         (TypeContainer::Emit): Emit the operators we have too.
11821
11822         * expression.cs (Binary::Emit): Update to emit the appropriate code for
11823         the case when we have a user-defined operator.
11824         
11825 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
11826
11827         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11828
11829 2001-09-16  Ravi Pratap  <ravi@ximian.com>
11830
11831         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11832         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11833         (Constructor::Emit): Implement.
11834         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11835         if we have no work to do. 
11836         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
11837         Emit method.
11838
11839         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11840         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11841
11842         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11843         of parent.parent.
11844
11845 2001-09-15  Ravi Pratap  <ravi@ximian.com>
11846
11847         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11848         in the source.
11849         (Tree::RecordNamespace): Method to do what the name says ;-)
11850         (Tree::Namespaces): Property to get at the namespaces hashtable.
11851
11852         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
11853         keep track.
11854
11855         * rootcontext.cs (IsNamespace): Fixed it :-)
11856
11857 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11858
11859         * class.cs (TypeContainer::FindMembers): Add support for
11860         constructors. 
11861         (MethodCore): New class that encapsulates both the shared aspects
11862         of a Constructor and a Method.  
11863         (Method, Constructor): Factored pieces into MethodCore.
11864
11865         * driver.cs: Added --fatal which makes errors throw exceptions.
11866         Load System assembly as well as part of the standard library.
11867
11868         * report.cs: Allow throwing exceptions on errors for debugging.
11869
11870         * modifiers.cs: Do not use `parent', instead use the real type
11871         container to evaluate permission settings.
11872
11873         * class.cs: Put Ravi's patch back in.  He is right, and we will
11874         have to cope with the
11875
11876 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11877
11878         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11879         FamORAssem, not FamANDAssem.
11880         
11881 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
11882
11883         * driver.cs: Added --parse option that only parses its input files
11884         and terminates.
11885
11886         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
11887         incorrect.  IsTopLevel is not used to tell whether an object is
11888         root_types or not (that can be achieved by testing this ==
11889         root_types).  But to see if this is a top-level *class* (not
11890         necessarly our "toplevel" container). 
11891
11892 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11893
11894         * enum.cs (Enum::Define): Modify to call the Lookup method on the
11895         parent instead of a direct call to GetType.
11896
11897 2001-09-14  Ravi Pratap  <ravi@ximian.com>
11898
11899         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11900         Modifiers.TypeAttr. This should just be a call to that method.
11901
11902         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11903         object so that we can determine if we are top-level or not.
11904
11905         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
11906         TypeContainer too.
11907
11908         * enum.cs (Enum::Define): Ditto.
11909
11910         * modifiers.cs (FieldAttr): Re-write.
11911
11912         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11913         (TypeContainer::HaveStaticConstructor): New property to provide access
11914         to precisely that info.
11915
11916         * modifiers.cs (MethodAttr): Re-write.
11917         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11918
11919         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11920         of top-level types as claimed.
11921         
11922 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
11923
11924         * expression.cs (MemberLookup): Fruitless attempt to lookup
11925         constructors.  Maybe I need to emit default constructors?  That
11926         might be it (currently .NET emits this for me automatically).
11927         (Invocation::OverloadResolve): Cope with Arguments == null.
11928         (Invocation::EmitArguments): new function, shared by the new
11929         constructor and us.
11930         (Invocation::Emit): Handle static and instance methods.  Emit
11931         proper call instruction for virtual or non-virtual invocations.
11932         (New::Emit): Implement.
11933         (New::Resolve): Implement.
11934         (MemberAccess:Resolve): Implement.
11935         (MethodGroupExpr::InstanceExpression): used conforming to the spec
11936         to track instances.
11937         (FieldExpr::Resolve): Set type.
11938
11939         * support.cs: Handle empty arguments.
11940                 
11941         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11942         SimpleLookup): Auxiliary routines to help parse a qualifier
11943         identifier.  
11944
11945         Update qualifier_identifier rule.
11946
11947         * codegen.cs: Removed debugging messages.
11948
11949         * class.cs: Make this a global thing, this acts just as a "key" to
11950         objects that we might have around.
11951
11952         (Populate): Only initialize method_builders_to_methods once.
11953
11954         * expression.cs (PropertyExpr): Initialize type from the
11955         PropertyType. 
11956
11957         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11958         Resolve pattern.  Attempt to implicitly convert value to boolean.
11959         Emit code.
11960
11961         * expression.cs: Set the type for the int32/int32 argument case.
11962         (Binary::ResolveOperator): Set the return type to boolean for
11963         comparission operators
11964
11965         * typemanager.cs: Remove debugging print code.
11966
11967         (Invocation::Resolve): resolve type.
11968
11969         * class.cs: Allocate a MemberInfo of the correct size, as the code
11970         elsewhere depends on the test to reflect the correct contents.
11971
11972         (Method::) Keep track of parameters, due to System.Reflection holes
11973
11974         (TypeContainer::Populate): Keep track of MethodBuilders to Method
11975         mapping here.
11976
11977         (TypeContainer::FindMembers): Use ArrayList and then copy an array
11978         of the exact size and return that.
11979
11980         (Class::LookupMethodByBuilder): New function that maps
11981         MethodBuilders to its methods.  Required to locate the information
11982         on methods because System.Reflection bit us again.
11983
11984         * support.cs: New file, contains an interface ParameterData and
11985         two implementations: ReflectionParameters and InternalParameters
11986         used to access Parameter information.  We will need to grow this
11987         as required.
11988
11989         * expression.cs (Invocation::GetParameterData): implement a cache
11990         and a wrapper around the ParameterData creation for methods. 
11991         (Invocation::OverloadResolve): Use new code.
11992
11993 2001-09-13  Ravi Pratap  <ravi@ximian.com>
11994
11995         * class.cs (TypeContainer::EmitField): Remove and move into 
11996         (Field::Define): here and modify accordingly.
11997         (Field.FieldBuilder): New member.
11998         (TypeContainer::Populate): Update accordingly.
11999         (TypeContainer::FindMembers): Implement.
12000
12001 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
12002
12003         * statement.cs: (VariableInfo::VariableType): New field to be
12004         initialized with the full type once it is resolved. 
12005
12006 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
12007
12008         * parameter.cs (GetParameterInfo): Use a type cache to compute
12009         things only once, and to reuse this information
12010
12011         * expression.cs (LocalVariableReference::Emit): Implement.
12012         (OpcodeCast::Emit): fix.
12013
12014         (ParameterReference::Resolve): Implement.
12015         (ParameterReference::Emit): Implement.
12016
12017         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
12018         that are expressions need to stay as Expressions.
12019
12020         * typemanager.cs (CSharpName): Returns the C# name of a type if
12021         possible. 
12022
12023         * expression.cs (Expression::ConvertImplicit): New function that
12024         implements implicit type conversions.
12025
12026         (Expression::ImplicitReferenceConversion): Implements implicit
12027         reference conversions.
12028
12029         (EmptyCast): New type for transparent casts.
12030
12031         (OpcodeCast): New type for casts of types that are performed with
12032         a sequence of bytecodes.
12033         
12034         (BoxedCast): New type used for casting value types into reference
12035         types.  Emits a box opcode.
12036
12037         (Binary::DoNumericPromotions): Implements numeric promotions of
12038         and computation of the Binary::Type.
12039
12040         (Binary::EmitBranchable): Optimization.
12041
12042         (Binary::Emit): Implement code emission for expressions.
12043         
12044         * typemanager.cs (TypeManager): Added two new core types: sbyte
12045         and byte.
12046
12047 2001-09-12  Ravi Pratap  <ravi@ximian.com>
12048
12049         * class.cs (TypeContainer::FindMembers): Method which does exactly
12050         what Type.FindMembers does, only we don't have to use reflection. No
12051         implementation yet.
12052
12053         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
12054         typecontainer objects as we need to get at them.
12055         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
12056
12057         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
12058         typecontainer object.
12059
12060         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
12061         of just a Report object.
12062
12063 2001-09-11  Ravi Pratap  <ravi@ximian.com>
12064
12065         * class.cs (Event::Define): Go back to using the prefixes "add_" and
12066         "remove_"
12067         (TypeContainer::Populate): Now define the delegates of the type too.
12068         (TypeContainer.Delegates): Property to access the list of delegates defined
12069         in the type.
12070
12071         * delegates.cs (Delegate::Define): Implement partially.
12072
12073         * modifiers.cs (TypeAttr): Handle more flags.
12074
12075 2001-09-11  Ravi Pratap  <ravi@ximian.com>
12076
12077         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
12078         and not <=
12079         (Operator::Define): Re-write logic to get types by using the LookupType method
12080         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
12081         (Indexer::Define): Ditto.
12082         (Event::Define): Ditto.
12083         (Property::Define): Ditto.
12084         
12085 2001-09-10  Ravi Pratap  <ravi@ximian.com>
12086
12087         * class.cs (TypeContainer::Populate): Now define operators too. 
12088         (TypeContainer.Operators): New property to access the list of operators
12089         in a type.
12090         (Operator.OperatorMethodBuilder): New member to hold the method builder
12091         for the operator we are defining.
12092         (Operator::Define): Implement.
12093
12094 2001-09-10  Ravi Pratap  <ravi@ximian.com>
12095
12096         * class.cs (Event::Define): Make the prefixes of the accessor methods
12097         addOn_ and removeOn_ 
12098
12099         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
12100         of the location being passed in too. Ideally, this should go later since all
12101         error reporting should be done through the Report object.
12102
12103         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
12104         (Populate): Iterate thru the indexers we have and define them too.
12105         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
12106         for the get and set accessors.
12107         (Indexer::Define): Implement.
12108         
12109 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
12110
12111         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
12112         my previous implementation, did not work.
12113
12114         * typemanager.cs: Add a couple of missing types (the longs).
12115
12116         * literal.cs: Use TypeManager.bool_type instead of getting it.
12117
12118         * expression.cs (EventExpr): New kind of expressions.
12119         (Expressio::ExprClassFromMemberInfo): finish
12120
12121 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
12122
12123         * assign.cs: Emit stores to static fields differently.
12124
12125 2001-09-08  Ravi Pratap  <ravi@ximian.com>
12126
12127         * Merge in changes and adjust code to tackle conflicts. Backed out my
12128         code in Assign::Resolve ;-) 
12129
12130 2001-09-08  Ravi Pratap  <ravi@ximian.com>
12131
12132         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
12133         instead Report.Error and also pass in the location.
12134         (CSharpParser::Lexer): New readonly property to return the reference
12135         to the Tokenizer object.
12136         (declare_local_variables): Use Report.Error with location instead of plain 
12137         old error.
12138         (CheckDef): Ditto.
12139
12140         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
12141         (Operator.CheckBinaryOperator): Ditto.
12142
12143         * cs-parser.jay (operator_declarator): Update accordingly.
12144
12145         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
12146         (CheckBinaryOperator): Same here.
12147
12148         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
12149         on the name without any prefixes of namespace names etc. This is because we
12150         already might have something already fully qualified like 
12151         'System.Console.WriteLine'
12152
12153         * assign.cs (Resolve): Begin implementation. Stuck ;-)
12154
12155 2001-09-07  Ravi Pratap  <ravi@ximian.com>
12156
12157         * cs-tokenizer.cs (location): Return a string which also contains
12158         the file name.
12159
12160         * expression.cs (ElementAccess): New class for expressions of the
12161         type 'element access.'
12162         (BaseAccess): New class for expressions of the type 'base access.'
12163         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
12164         respectively.
12165         
12166         * cs-parser.jay (element_access): Implement action.
12167         (base_access): Implement actions.
12168         (checked_expression, unchecked_expression): Implement.
12169
12170         * cs-parser.jay (local_variable_type): Correct and implement.
12171         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
12172
12173         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
12174
12175         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
12176         name and the specifiers.
12177
12178         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
12179         
12180         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
12181         making them all public ;-)
12182
12183         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
12184         class anyways.
12185         
12186 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
12187
12188         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
12189         PropertyExprs.
12190         (FieldExpr, PropertyExprs): New resolved expressions.
12191         (SimpleName::MemberStaticCheck): Perform static checks for access
12192         to non-static fields on static methods. Maybe this should be
12193         generalized for MemberAccesses. 
12194         (SimpleName::ResolveSimpleName): More work on simple name
12195         resolution. 
12196
12197         * cs-parser.jay (primary_expression/qualified_identifier): track
12198         the parameter index.
12199
12200         * codegen.cs (CodeGen::Save): Catch save exception, report error.
12201         (EmitContext::EmitBoolExpression): Chain to expression generation
12202         instead of temporary hack.
12203         (::EmitStatementExpression): Put generic expression code generation.
12204
12205         * assign.cs (Assign::Emit): Implement variable assignments to
12206         local variables, parameters and fields.
12207
12208 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
12209
12210         * statement.cs (Block::GetVariableInfo): New method, returns the
12211         VariableInfo for a variable name in a block.
12212         (Block::GetVariableType): Implement in terms of GetVariableInfo
12213
12214         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
12215         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
12216
12217 2001-09-06  Ravi Pratap  <ravi@ximian.com>
12218
12219         * cs-parser.jay (operator_declaration): Continue on my quest : update
12220         to take attributes argument.
12221         (event_declaration): Ditto.
12222         (enum_declaration): Ditto.
12223         (indexer_declaration): Ditto.
12224         
12225         * class.cs (Operator::Operator): Update constructor accordingly.
12226         (Event::Event): Ditto.
12227
12228         * delegate.cs (Delegate::Delegate): Same here.
12229
12230         * enum.cs (Enum::Enum): Same here.
12231         
12232 2001-09-05  Ravi Pratap  <ravi@ximian.com>
12233
12234         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
12235
12236         * ../tests/cs0658.cs : New file to demonstrate error 0658.
12237
12238         * attribute.cs (Attributes): New class to encapsulate all attributes which were
12239         being passed around as an arraylist.
12240         (Attributes::AddAttribute): Method to add attribute sections.
12241
12242         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
12243         (struct_declaration): Update accordingly.
12244         (constant_declaration): Update.
12245         (field_declaration): Update.
12246         (method_header): Update.
12247         (fixed_parameter): Update.
12248         (parameter_array): Ditto.
12249         (property_declaration): Ditto.
12250         (destructor_declaration): Ditto.
12251         
12252         * class.cs (Struct::Struct): Update constructors accordingly.
12253         (Class::Class): Ditto.
12254         (Field::Field): Ditto.
12255         (Method::Method): Ditto.
12256         (Property::Property): Ditto.
12257         (TypeContainer::OptAttribute): update property's return type.
12258         
12259         * interface.cs (Interface.opt_attributes): New member.
12260         (Interface::Interface): Update to take the extra Attributes argument.
12261
12262         * parameter.cs (Parameter::Parameter): Ditto.
12263
12264         * constant.cs (Constant::Constant): Ditto.
12265
12266         * interface.cs (InterfaceMemberBase): New OptAttributes field.
12267         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
12268         the attributes as a parameter.
12269         (InterfaceProperty): Update constructor call.
12270         (InterfaceEvent): Ditto.
12271         (InterfaceMethod): Ditto.
12272         (InterfaceIndexer): Ditto.
12273
12274         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
12275         pass the attributes too.
12276         (interface_event_declaration): Ditto.
12277         (interface_property_declaration): Ditto.
12278         (interface_method_declaration): Ditto.
12279         (interface_declaration): Ditto.
12280
12281 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
12282
12283         * class.cs (Method::Define): Track the "static Main" definition to
12284         create an entry point. 
12285
12286         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
12287         EntryPoint if we find it. 
12288
12289         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
12290         (EmitContext::ig): Make this variable public.
12291
12292         * driver.cs: Make the default output file be the first file name
12293         with the .exe extension.  
12294
12295         Detect empty compilations
12296
12297         Handle various kinds of output targets.  Handle --target and
12298         rename -t to --dumper.
12299
12300         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
12301         methods inherited from Expression return now an Expression.  This
12302         will is used during the tree rewriting as we resolve them during
12303         semantic analysis.
12304
12305         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
12306         the spec.  Missing entirely is the information about
12307         accessability of elements of it.
12308
12309         (Expression::ExprClassFromMemberInfo): New constructor for
12310         Expressions that creates a fully initialized Expression based on
12311         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
12312         a Type.
12313
12314         (Invocation::Resolve): Begin implementing resolution of invocations.
12315         
12316         * literal.cs (StringLiteral):  Implement Emit.
12317
12318 2001-09-05  Ravi Pratap  <ravi@ximian.com>
12319
12320         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
12321         member.
12322         
12323 2001-09-04  Ravi Pratap  <ravi@ximian.com>
12324
12325         * cs-parser.jay (attribute_arguments): Implement actions.
12326         (attribute): Fix bug in production. Implement action.
12327         (attribute_list): Implement.
12328         (attribute_target): Implement.
12329         (attribute_target_specifier, opt_target_specifier): Implement
12330         (CheckAttributeTarget): New method to check if the attribute target
12331         is valid.
12332         (attribute_section): Implement.
12333         (opt_attributes): Implement.
12334
12335         * attribute.cs : New file to handle attributes.
12336         (Attribute): Class to hold attribute info.
12337
12338         * cs-parser.jay (opt_attribute_target_specifier): Remove production
12339         (attribute_section): Modify production to use 2 different rules to 
12340         achieve the same thing. 1 s/r conflict down !
12341         Clean out commented, useless, non-reducing dimension_separator rules.
12342         
12343         * class.cs (TypeContainer.attributes): New member to hold list
12344         of attributes for a type.
12345         (Struct::Struct): Modify to take one more argument, the attribute list.
12346         (Class::Class): Ditto.
12347         (Field::Field): Ditto.
12348         (Method::Method): Ditto.
12349         (Property::Property): Ditto.
12350         
12351         * cs-parser.jay (struct_declaration): Update constructor call to
12352         pass in the attributes too.
12353         (class_declaration): Ditto.
12354         (constant_declaration): Ditto.
12355         (field_declaration): Ditto.
12356         (method_header): Ditto.
12357         (fixed_parameter): Ditto.
12358         (parameter_array): Ditto.
12359         (property_declaration): Ditto.
12360
12361         * constant.cs (Constant::Constant): Update constructor similarly.
12362         Use System.Collections.
12363
12364         * parameter.cs (Parameter::Parameter): Update as above.
12365
12366 2001-09-02  Ravi Pratap  <ravi@ximian.com>
12367
12368         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
12369         (TypeContainer.delegates): New member to hold list of delegates.
12370
12371         * cs-parser.jay (delegate_declaration): Implement the action correctly 
12372         this time as I seem to be on crack ;-)
12373
12374 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
12375
12376         * rootcontext.cs (RootContext::IsNamespace): new function, used to
12377         tell whether an identifier represents a namespace.
12378
12379         * expression.cs (NamespaceExpr): A namespace expression, used only
12380         temporarly during expression resolution.
12381         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
12382         utility functions to resolve names on expressions.
12383
12384 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
12385
12386         * codegen.cs: Add hook for StatementExpressions. 
12387
12388         * class.cs: Fix inverted test for static flag in methods.
12389
12390 2001-09-02  Ravi Pratap  <ravi@ximian.com>
12391
12392         * class.cs (Operator::CheckUnaryOperator): Correct error number used
12393         to make it coincide with MS' number.
12394         (Operator::CheckBinaryOperator): Ditto.
12395
12396         * ../errors/errors.txt : Remove error numbers added earlier.
12397
12398         * ../errors/cs1019.cs : Test case for error # 1019
12399
12400         * ../errros/cs1020.cs : Test case for error # 1020
12401
12402         * cs-parser.jay : Clean out commented cruft.
12403         (dimension_separators, dimension_separator): Comment out. Ostensibly not
12404         used anywhere - non-reducing rule.
12405         (namespace_declarations): Non-reducing rule - comment out.
12406
12407         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
12408         with TypeContainer::AddEnum.
12409
12410         * delegate.cs : New file for delegate handling classes.
12411         (Delegate): Class for declaring delegates.
12412
12413         * makefile : Update.
12414
12415         * cs-parser.jay (delegate_declaration): Implement.
12416
12417 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
12418
12419         * class.cs (Event::Define): Implement.
12420         (Event.EventBuilder): New member.
12421
12422         * class.cs (TypeContainer::Populate): Update to define all enums and events
12423         we have.
12424         (Events): New property for the events arraylist we hold. Shouldn't we move to using
12425         readonly fields for all these cases ?
12426
12427 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
12428
12429         * class.cs (Property): Revamp to use the convention of making fields readonly.
12430         Accordingly modify code elsewhere.
12431
12432         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
12433         the Define method of the Property class.
12434
12435         * class.cs : Clean up applied patch and update references to variables etc. Fix 
12436         trivial bug.
12437         (TypeContainer::Populate): Update to define all the properties we have. Also
12438         define all enumerations.
12439
12440         * enum.cs (Define): Implement.
12441         
12442 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
12443
12444         * cs-parser.jay (overloadable_operator): The semantic value is an
12445         enum of the Operator class.
12446         (operator_declarator): Implement actions.
12447         (operator_declaration): Implement.
12448
12449         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
12450         validity of definitions.
12451         (Operator::CheckBinaryOperator): Static method to check for binary operators
12452         (TypeContainer::AddOperator): New method to add an operator to a type.
12453
12454         * cs-parser.jay (indexer_declaration): Added line to actually call the
12455         AddIndexer method so it gets added ;-)
12456
12457         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
12458         already taken care of by the MS compiler ?  
12459
12460 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
12461
12462         * class.cs (Operator): New class for operator declarations.
12463         (Operator::OpType): Enum for the various operators.
12464
12465 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
12466
12467         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
12468         ostensibly handle this in semantic analysis.
12469
12470         * cs-parser.jay (general_catch_clause): Comment out
12471         (specific_catch_clauses, specific_catch_clause): Ditto.
12472         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
12473         (catch_args, opt_catch_args): New productions.
12474         (catch_clause): Rewrite to use the new productions above
12475         (catch_clauses): Modify accordingly.
12476         (opt_catch_clauses): New production to use in try_statement
12477         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
12478         and re-write the code in the actions to extract the specific and
12479         general catch clauses by being a little smart ;-)
12480
12481         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
12482         Hooray, try and catch statements parse fine !
12483         
12484 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12485
12486         * statement.cs (Block::GetVariableType): Fix logic to extract the type
12487         string from the hashtable of variables.
12488
12489         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
12490         I end up making that mistake ;-)
12491         (catch_clauses): Fixed gross error which made Key and Value of the 
12492         DictionaryEntry the same : $1 !!
12493
12494 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12495
12496         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
12497
12498         * cs-parser.jay (event_declaration): Correct to remove the semicolon
12499         when the add and remove accessors are specified. 
12500
12501 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
12502
12503         * cs-parser.jay (IndexerDeclaration): New helper class to hold
12504         information about indexer_declarator.
12505         (indexer_declarator): Implement actions.
12506         (parsing_indexer): New local boolean used to keep track of whether
12507         we are parsing indexers or properties. This is necessary because 
12508         implicit_parameters come into picture even for the get accessor in the 
12509         case of an indexer.
12510         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12511
12512         * class.cs (Indexer): New class for indexer declarations.
12513         (TypeContainer::AddIndexer): New method to add an indexer to a type.
12514         (TypeContainer::indexers): New member to hold list of indexers for the
12515         type.
12516
12517 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12518
12519         * cs-parser.jay (add_accessor_declaration): Implement action.
12520         (remove_accessor_declaration): Implement action.
12521         (event_accessors_declaration): Implement
12522         (variable_declarators): swap statements for first rule - trivial.
12523
12524         * class.cs (Event): New class to hold information about event
12525         declarations.
12526         (TypeContainer::AddEvent): New method to add an event to a type
12527         (TypeContainer::events): New member to hold list of events.
12528
12529         * cs-parser.jay (event_declaration): Implement actions.
12530
12531 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
12532
12533         * cs-parser.jay (dim_separators): Implement. Make it a string
12534         concatenating all the commas together, just as they appear.
12535         (opt_dim_separators): Modify accordingly
12536         (rank_specifiers): Update accordingly. Basically do the same
12537         thing - instead, collect the brackets here.
12538         (opt_rank_sepcifiers): Modify accordingly.
12539         (array_type): Modify to actually return the complete type string
12540         instead of ignoring the rank_specifiers.
12541         (expression_list): Implement to collect the expressions
12542         (variable_initializer): Implement. We make it a list of expressions
12543         essentially so that we can handle the array_initializer case neatly too.
12544         (variable_initializer_list): Implement.
12545         (array_initializer): Make it a list of variable_initializers
12546         (opt_array_initializer): Modify accordingly.
12547
12548         * expression.cs (New::NType): Add enumeration to help us
12549         keep track of whether we have an object/delegate creation
12550         or an array creation.
12551         (New:NewType, New::Rank, New::Indices, New::Initializers): New
12552         members to hold data about array creation.
12553         (New:New): Modify to update NewType
12554         (New:New): New Overloaded contructor for the array creation
12555         case.
12556
12557         * cs-parser.jay (array_creation_expression): Implement to call
12558         the overloaded New constructor.
12559         
12560 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
12561
12562         * class.cs (TypeContainer::Constructors): Return member
12563         constructors instead of returning null.
12564
12565 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
12566
12567         * typemanager.cs (InitCoreTypes): Initialize the various core
12568         types after we have populated the type manager with the user
12569         defined types (this distinction will be important later while
12570         compiling corlib.dll)
12571
12572         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12573         on Expression Classification.  Now all expressions have a method
12574         `Resolve' and a method `Emit'.
12575
12576         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12577         generation from working.     Also add some temporary debugging
12578         code. 
12579         
12580 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
12581
12582         * codegen.cs: Lots of code generation pieces.  This is only the
12583         beginning, will continue tomorrow with more touches of polish.  We
12584         handle the fundamentals of if, while, do, for, return.  Others are
12585         trickier and I need to start working on invocations soon.
12586         
12587         * gen-treedump.cs: Bug fix, use s.Increment here instead of
12588         s.InitStatement. 
12589
12590         * codegen.cs (EmitContext): New struct, used during code
12591         emission to keep a context.   Most of the code generation will be
12592         here. 
12593
12594         * cs-parser.jay: Add embedded blocks to the list of statements of
12595         this block.  So code generation proceeds in a top down fashion.
12596
12597 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
12598
12599         * statement.cs: Add support for multiple child blocks.
12600
12601 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
12602
12603         * codegen.cs (EmitCode): New function, will emit the code for a
12604         Block of code given a TypeContainer and its ILGenerator. 
12605
12606         * statement.cs (Block): Standard public readonly optimization.
12607         (Block::Block constructors): Link children. 
12608         (Block::Child): Child Linker.
12609         (Block::EmitVariables): Emits IL variable declarations.
12610
12611         * class.cs: Drop support for MethodGroups here, delay until
12612         Semantic Analysis.
12613         (Method::): Applied the same simplification that I did before, and
12614         move from Properties to public readonly fields.
12615         (Method::ParameterTypes): Returns the parameter types for the
12616         function, and implements a cache that will be useful later when I
12617         do error checking and the semantic analysis on the methods is
12618         performed.
12619         (Constructor::GetCallingConvention): Renamed from CallingConvetion
12620         and made a method, optional argument tells whether this is a class
12621         or a structure to apply the `has-this' bit.
12622         (Method::GetCallingConvention): Implement, returns the calling
12623         convention. 
12624         (Method::Define): Defines the type, a second pass is performed
12625         later to populate the methods.
12626
12627         (Constructor::ParameterTypes): implement a cache similar to the
12628         one on Method::ParameterTypes, useful later when we do semantic
12629         analysis. 
12630
12631         (TypeContainer::EmitMethod):  New method.  Emits methods.
12632
12633         * expression.cs: Removed MethodGroup class from here.
12634         
12635         * parameter.cs (Parameters::GetCallingConvention): new method.
12636
12637 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
12638
12639         * class.cs (TypeContainer::Populate): Drop RootContext from the
12640         argument. 
12641
12642         (Constructor::CallingConvention): Returns the calling convention.
12643         (Constructor::ParameterTypes): Returns the constructor parameter
12644         types. 
12645         
12646         (TypeContainer::AddConstructor): Keep track of default constructor
12647         and the default static constructor.
12648
12649         (Constructor::) Another class that starts using `public readonly'
12650         instead of properties. 
12651
12652         (Constructor::IsDefault): Whether this is a default constructor. 
12653
12654         (Field::) use readonly public fields instead of properties also.
12655
12656         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12657         track of static constructors;  If none is used, turn on
12658         BeforeFieldInit in the TypeAttributes. 
12659
12660         * cs-parser.jay (opt_argument_list): now the return can be null
12661         for the cases where there are no arguments. 
12662
12663         (constructor_declarator): If there is no implicit `base' or
12664         `this', then invoke the default parent constructor. 
12665         
12666         * modifiers.cs (MethodAttr): New static function maps a set of
12667         modifiers flags into a MethodAttributes enum
12668         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
12669         MethodAttr, TypeAttr to represent the various mappings where the
12670         modifiers are used.
12671         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
12672
12673 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
12674
12675         * parameter.cs (GetParameterInfo): Fix bug where there would be no
12676         method arguments.
12677
12678         * interface.cs (PopulateIndexer): Implemented the code generator
12679         for interface indexers.
12680
12681 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
12682
12683         * interface.cs (InterfaceMemberBase): Now we track the new status
12684         here.  
12685
12686         (PopulateProperty): Implement property population.  Woohoo!  Got
12687         Methods and Properties going today. 
12688
12689         Removed all the properties for interfaces, and replaced them with
12690         `public readonly' fields. 
12691
12692 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
12693
12694         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12695         initialize their hashtables/arraylists only when they are needed
12696         instead of doing this always.
12697
12698         * parameter.cs: Handle refs and out parameters.
12699
12700         * cs-parser.jay: Use an ArrayList to construct the arguments
12701         instead of the ParameterCollection, and then cast that to a
12702         Parameter[] array.
12703
12704         * parameter.cs: Drop the use of ParameterCollection and use
12705         instead arrays of Parameters.
12706
12707         (GetParameterInfo): Use the Type, not the Name when resolving
12708         types. 
12709
12710 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
12711
12712         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12713         and instead use public readonly fields.
12714
12715         * class.cs: Put back walking code for type containers.
12716
12717 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
12718
12719         * class.cs (MakeConstant): Code to define constants.
12720
12721         * rootcontext.cs (LookupType): New function.  Used to locate types 
12722
12723         
12724 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
12725
12726         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
12727         this System.Reflection code is.  Kudos to Microsoft
12728         
12729         * typemanager.cs: Implement a type cache and avoid loading all
12730         types at boot time.  Wrap in LookupType the internals.  This made
12731         the compiler so much faster.  Wow.  I rule!
12732         
12733         * driver.cs: Make sure we always load mscorlib first (for
12734         debugging purposes, nothing really important).
12735
12736         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
12737         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
12738
12739         * rootcontext.cs: Lookup types on their namespace;  Lookup types
12740         on namespaces that have been imported using the `using' keyword.
12741
12742         * class.cs (TypeContainer::TypeAttr): Virtualize.
12743         (Class::TypeAttr): Return attributes suitable for this bad boy.
12744         (Struct::TypeAttr): ditto.
12745         Handle nested classes.
12746         (TypeContainer::) Remove all the type visiting code, it is now
12747         replaced with the rootcontext.cs code
12748
12749         * rootcontext.cs (GetClassBases): Added support for structs. 
12750
12751 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
12752
12753         * interface.cs, statement.cs, class.cs, parameter.cs,
12754         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12755         Drop use of TypeRefs, and use strings instead.
12756
12757 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
12758
12759         * rootcontext.cs: 
12760
12761         * class.cs (Struct::Struct): set the SEALED flags after
12762         checking the modifiers.
12763         (TypeContainer::TypeAttr): new property, returns the
12764         TypeAttributes for a class.  
12765
12766         * cs-parser.jay (type_list): Oops, list production was creating a
12767         new list of base types.
12768
12769         * rootcontext.cs (StdLib): New property.
12770         (GetInterfaceTypeByName): returns an interface by type name, and
12771         encapsulates error handling here.
12772         (GetInterfaces): simplified.
12773         (ResolveTree): Encapsulated all the tree resolution here.
12774         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12775         types. 
12776         
12777         * driver.cs: Add support for --nostdlib, to avoid loading the
12778         default assemblies.
12779         (Main): Do not put tree resolution here. 
12780
12781         * rootcontext.cs: Beginning of the class resolution.
12782
12783 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
12784
12785         * rootcontext.cs: Provide better error reporting. 
12786
12787         * cs-parser.jay (interface_base): set our $$ to be interfaces.
12788
12789         * rootcontext.cs (CreateInterface): Handle the case where there
12790         are no parent interfaces.
12791         
12792         (CloseTypes): Routine to flush types at the end.
12793         (CreateInterface): Track types.
12794         (GetInterfaces): Returns an array of Types from the list of
12795         defined interfaces.
12796
12797         * typemanager.c (AddUserType): Mechanism to track user types (puts
12798         the type on the global type hash, and allows us to close it at the
12799         end). 
12800         
12801 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
12802
12803         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12804         RecordInterface instead.
12805
12806         * cs-parser.jay: Updated to reflect changes above.
12807
12808         * decl.cs (Definition): Keep track of the TypeBuilder type that
12809         represents this type here.  Not sure we will use it in the long
12810         run, but wont hurt for now.
12811
12812         * driver.cs: Smaller changes to accomodate the new code.
12813
12814         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12815         when done. 
12816
12817         * rootcontext.cs (CreateInterface):  New method, used to create
12818         the System.TypeBuilder type for interfaces.
12819         (ResolveInterfaces): new entry point to resolve the interface
12820         hierarchy. 
12821         (CodeGen): Property, used to keep track of the code generator.
12822
12823 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
12824
12825         * cs-parser.jay: Add a second production for delegate_declaration
12826         with `VOID'.
12827
12828         (enum_body): Put an opt_comma here instead of putting it on
12829         enum_body or enum_member_declarations so we can handle trailing
12830         commas on enumeration members.  Gets rid of a shift/reduce.
12831         
12832         (type_list): Need a COMMA in the middle.
12833
12834         (indexer_declaration): Tell tokenizer to recognize get/set
12835
12836         * Remove old targets.
12837
12838         * Re-add the parser target.
12839
12840 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12841
12842         * cs-parser.jay: Add precendence rules for a number of operators
12843         ot reduce the number of shift/reduce conflicts in the grammar.
12844         
12845 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
12846
12847         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12848         and put it here.
12849
12850         Get rid of old crufty code.
12851
12852         * rootcontext.cs: Use this to keep track of the parsed
12853         representation and the defined types available to the program. 
12854
12855         * gen-treedump.cs: adjust for new convention.
12856
12857         * type.cs: Split out the type manager, and the assembly builder
12858         from here. 
12859
12860         * typemanager.cs: the type manager will live here now.
12861
12862         * cil-codegen.cs: And the code generator here. 
12863
12864 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
12865
12866         * makefile: Fixed up for easy making.
12867
12868 2001-07-13  Simon Cozens <simon@simon-cozens.org>
12869
12870         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12871         the 
12872
12873         (unary_expression): Expand pre_increment_expression and
12874         post_decrement_expression to reduce a shift/reduce.
12875
12876 2001-07-11  Simon Cozens
12877
12878         * cs-tokenizer.cs: Hex numbers should begin with a 0.
12879
12880         Improve allow_keyword_as_indent name.
12881
12882 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
12883
12884         * Adjustments for Beta2. 
12885
12886 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
12887
12888         * decl.cs: Added `Define' abstract method.
12889         (InTransit): new property, used to catch recursive definitions. 
12890
12891         * interface.cs: Implement `Define'. 
12892
12893         * modifiers.cs: Map Modifiers.constants to
12894         System.Reflection.TypeAttribute flags.
12895
12896         * class.cs: Keep track of types and user-defined types.
12897         (BuilderInit): New method for creating an assembly
12898         (ResolveType): New function to launch the resolution process, only
12899         used by interfaces for now.
12900
12901         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12902         that are inserted into the name space. 
12903
12904 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
12905
12906         * ARGH.  I have screwed up my tree so many times due to the use of
12907         rsync rather than using CVS.  Going to fix this at once. 
12908
12909         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
12910         load types.
12911
12912 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
12913
12914         * Experiment successful: Use System.Type rather that our own
12915         version of Type.  
12916
12917 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
12918
12919         * cs-parser.jay: Removed nsAliases from here.
12920
12921         Use new namespaces, handle `using XXX;' 
12922
12923         * namespace.cs: Reimplemented namespace handling, use a recursive
12924         definition of the class.  Now we can keep track of using clauses
12925         and catch invalid using clauses.
12926
12927 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
12928
12929         * gen-treedump.cs: Adapted for all the renaming.
12930
12931         * expression.cs (Expression): this class now has a Type property
12932         which returns an expression Type.
12933
12934         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12935         `Type', as this has a different meaning now in the base
12936
12937 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
12938
12939         * interface.cs, class.cs: Removed from all the sources the
12940         references to signature computation, as we can not do method
12941         signature computation during the parsing time, as we are not
12942         trying to solve at that point distinguishing:
12943
12944         class X {
12945                 void a (Blah x) {}
12946                 void a (NS.Blah x) {}
12947         }
12948
12949         Which depending on the context might be valid or not, as we do not
12950         know if Blah is the same thing as NS.Blah at that point.
12951
12952         * Redid everything so the code uses TypeRefs now instead of
12953         Types.  TypeRefs are just temporary type placeholders, that need
12954         to be resolved.  They initially have a pointer to a string and the
12955         current scope in which they are used.  This is used later by the
12956         compiler to resolve the reference to an actual Type. 
12957
12958         * DeclSpace is no longer a CIR.Type, and neither are
12959         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
12960         are all DeclSpaces, but no Types. 
12961
12962         * type.cs (TypeRefManager): This implements the TypeRef manager,
12963         which keeps track of all the types that need to be resolved after
12964         the parsing has finished. 
12965
12966 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
12967
12968         * ARGH.  We are going to have to store `foreach' as a class rather
12969         than resolving it, as we need to verify error 1579 after name
12970         resolution.   *OR* we could keep a flag that says `This request to
12971         IEnumerator comes from a foreach statement' which we can then use
12972         to generate the error.
12973
12974 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
12975
12976         * class.cs (TypeContainer.AddMethod): we now add methods to the
12977         MethodGroup instead of the method hashtable.  
12978
12979         * expression.cs: Add MethodGroup abstraction, which gets us one
12980         step closer to the specification in the way we handle method
12981         declarations.  
12982
12983         * cs-parser.jay (primary_expression): qualified_identifier now
12984         tried to match up an identifier to a local variable reference or
12985         to a parameter reference.
12986
12987         current_local_parameters is now a parser global variable that
12988         points to the current parameters for the block, used during name
12989         lookup.
12990
12991         (property_declaration): Now creates an implicit `value' argument to
12992         the set accessor.
12993
12994 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
12995
12996         * parameter.cs: Do not use `param' arguments as part of the
12997         signature, per the spec.
12998
12999 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
13000
13001         * decl.cs: Base class for classes, structs and interfaces.  This
13002         is the "Declaration Space" 
13003
13004         * cs-parser.jay: Use CheckDef for checking declaration errors
13005         instead of having one on each function.
13006
13007         * class.cs: Factor out some code for handling error handling in
13008         accordance to the "Declarations" section in the "Basic Concepts"
13009         chapter in the ECMA C# spec.
13010
13011         * interface.cs: Make all interface member classes derive from
13012         InterfaceMemberBase.
13013
13014 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
13015
13016         * Many things: all interfaces are parsed and generated in
13017         gen-treedump.  Support for member variables, constructors,
13018         destructors, properties, constants is there.
13019
13020         Beginning of the IL backend, but very little done, just there for
13021         testing purposes. 
13022
13023 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
13024
13025         * cs-parser.jay: Fix labeled statement.
13026
13027         * cs-tokenizer.cs (escape): Escape " and ' always.
13028         ref_line, ref_name: keep track of the line/filename as instructed
13029         by #line by the compiler.
13030         Parse #line.
13031
13032 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
13033
13034         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
13035         to match the values in System.CodeDOM.
13036
13037         Divid renamed to Divide.
13038
13039         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
13040         statements. 
13041         (Statements.set): remove.
13042
13043         * System.CodeDOM/CodeCatchClause.cs: always have a valid
13044         statements. 
13045
13046         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
13047         falseStatements always have valid values. 
13048
13049         * cs-parser.jay: Use System.CodeDOM now.
13050