2004-03-29 Martin Baulig <martin@ximian.com>
[mono.git] / mcs / gmcs / ChangeLog
1 2004-03-29  Martin Baulig  <martin@ximian.com>
2
3         * class.cs (MethodBase.CheckGenericOverride): New abstract method.
4         (MethodCore.CheckGenericOverride): When overriding a generic
5         method, check whether the constraints match.
6
7         * support.cs (GenericConstraints): New public interface.
8         (ParameterData.GenericConstraints): New public method.
9
10         * parameter.cs (Parameter.Resolve): Check whether we're a generic
11         method parameter and compute our constraints if appropriate.
12         (Parameter.GenericConstraints): New public property.
13
14         * generic.cs (Constraints): Implement GenericConstraints.
15
16 2004-03-29  Martin Baulig  <martin@ximian.com>
17
18         * decl.cs (MemberCache.FindMemberToOverride): Use
19         `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
20
21 2004-03-29  Martin Baulig  <martin@ximian.com>
22
23         * generic.cs (GenericMethod.Define): Resolve our type parameters.
24
25 2004-03-29  Martin Baulig  <martin@ximian.com>
26
27         * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
28         not allowed on non-generic declarations").
29
30 2004-03-29  Martin Baulig  <martin@ximian.com>
31
32         * expression.cs (Invocation.InferTypeArguments): Added overloaded
33         public version of this method.
34
35         * class.cs (MethodCore.IsDuplicateImplementation): Use
36         Invocation.InferTypeArguments() to check this.
37
38 2004-03-29  Martin Baulig  <martin@ximian.com>
39
40         * convert.cs: Use TypeManager.IsDelegateType() instead of
41         comparing types correctly.
42
43 2004-03-29  Martin Baulig  <martin@ximian.com>
44
45         * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
46         types directly to make it work for generic instances.
47
48         * typemanager.cs (TypeManager.IsSubclassOf): New static method.
49
50 2004-03-29  Martin Baulig  <martin@ximian.com>
51
52         * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
53         support for arrays.     
54
55 2004-03-24  Martin Baulig  <martin@ximian.com>
56
57         * decl.cs (DeclSpace.FindType): Also use
58         TypeManager.CheckGeneric() for types from the using clauses.
59
60 2004-03-23  Martin Baulig  <martin@ximian.com>
61
62         * expression.cs (Invocation.OverloadResolve): Added `bool
63         may_fail' argument and use it instead of the Location.IsNull() hack.
64
65 2004-03-23  Martin Baulig  <martin@ximian.com>
66
67         * expression.cs (Invocation.InferType): Use correct type inference
68         rules here.     
69
70 2004-03-23  Martin Baulig  <martin@ximian.com>
71
72         * ecore.cs (MethodGroupExpr.Name): Use
73         TypeManager.CSharpSignature() instead of just the name.
74
75         * expression.cs (Invocation.OverloadResolve): Provide better error
76         reporting.
77         (Invocation.DoResolve): OverloadResolve() never returns null
78         without reporting an error, so removed the error -6 reporting here.
79
80 2004-03-23  Martin Baulig  <martin@ximian.com>
81
82         * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
83         generic methods.
84
85         * cs-parser.jay (delegate_declaration): Support generic delegates.
86
87         * delegate.cs: Support generic delegates.
88
89 2004-03-22  Martin Baulig  <martin@ximian.com>
90
91         * expression.cs (Invocation.InferParamsTypeArguments): New static
92         method; does type inference for params arguments.
93
94 2004-03-21  Martin Baulig  <martin@ximian.com>
95
96         * typemanager.cs (TypeManager.IsGenericMethod): New public static
97         method; checks whether a method is a generic method.    
98
99         * expression.cs (Invocation.InferTypeArguments): New static method;
100         infer type arguments for generic method invocation.
101
102         * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
103         property; we set this to true if we're resolving a generic method
104         invocation and the user specified type arguments, ie. we're not
105         doing type inference.
106
107 2004-03-20  Martin Baulig  <martin@ximian.com>
108
109         * class.cs (MethodData.DeclaringType): New public property.
110         (MethodData.Define): Set DeclaringType here.
111         (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
112         instead of OperatorMethodBuilder.DeclaringType.
113
114 2004-03-20  Martin Baulig  <martin@ximian.com>
115
116         * cs-tokenizer.cs (xtoken): Return a special
117         Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
118
119         * cs-parser.jay (default_value_expression): Switch to the new
120         syntax (14.5.13).
121
122 2004-03-19  Martin Baulig  <martin@ximian.com>
123
124         * decl.cs (MemberName): New class.  We use this to "construct"
125         namespace_or_type_name's.
126
127         * generics.cs (TypeArguments.GetDeclarations): New public method;
128         returns the type arguments as a string[] and reports a CS0081 if
129         one of them is not an identifier.
130
131         * class.cs (MemberBase): The .ctor now takes the name as a
132         MemberName instead of a string.
133         (MemberBase.ExplicitInterfaceName): Changed type from string to
134         Expression.
135         (MemberBase.DoDefine): If we're an explicit implementation, the
136         InterfaceType may be a generic instance.
137
138         * cs-parser.jay (namespace_or_type_name): Return a MemberName.
139         (namespace_name): Call MemberName.GetName () to transform the
140         MemberName into a string and ensure we don't have any type
141         arguments.
142         (type_name): Call MemberName.GetTypeExpression() to transfrom the
143         MemberName into an expression.
144         (method_header): Use namespace_or_type_name instead of member_name.     
145
146 2004-03-19  Martin Baulig  <martin@ximian.com>
147
148         * class.cs (MemberCore.IsDuplicateImplementation): Check whether
149         two overloads may unify for some type parameter substitutions and
150         report a CS0408 if appropriate.
151
152 2004-03-19  Martin Baulig  <martin@ximian.com>
153
154         * class.cs (MemberCore.IsDuplicateImplementation): Report the
155         error here and not in our caller.
156
157 2004-03-19  Martin Baulig  <martin@ximian.com>
158
159         * interface.cs: Completely killed this file.
160         (Interface): We're now a TypeContainer and live in class.cs.
161
162         * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
163         argument; we're now also called for interfaces.
164         (TypeContainer.DefineMembers): Allow this method being called
165         multiple times.
166         (TypeContainer.GetMethods): New public method; formerly known as
167         Interface.GetMethod().  This is used by PendingImplementation.
168         (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
169         it's now private and non-static.
170         (Interface): Moved this here; it's now implemented similar to
171         Class and Struct.
172         (Method, Property, Event, Indexer): Added `bool is_interface'
173         argument to their .ctor's.
174         (MemberBase.IsInterface): New public field.
175
176         * cs-parser.jay: Create normal Method, Property, Event, Indexer
177         instances instead of InterfaceMethod, InterfaceProperty, etc.
178         (opt_interface_base): Removed; we now use `opt_class_base' instead.
179         (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
180
181 2004-03-19  Martin Baulig  <martin@ximian.com>
182
183         * class.cs (MethodCore.IsDuplicateImplementation): New private
184         method which does the CS0111 checking.
185         (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
186         Use IsDuplicateImplementation().
187
188 2004-03-17 Ben Maurer  <bmaurer@users.sourceforge.net>
189
190         * decl.cs (FindMemberToOverride): New method to find the correct
191         method or property to override in the base class.
192         * class.cs
193             - Make Method/Property use the above method to find the
194               version in the base class.
195             - Remove the InheritableMemberSignatureCompare as it is now
196               dead code.
197
198         This patch makes large code bases much faster to compile, as it is
199         O(n) rather than O(n^2) to do this validation.
200
201         Also, it fixes bug 52458 which is that nested classes are not
202         taken into account when finding the base class member.
203         
204         Reviewed/Approved by Martin.
205
206 2004-03-17  Martin Baulig  <martin@ximian.com>
207
208         * expression.cs (MemberAccess.DoResolve): Take the parent's number
209         of type arguments into account; use the `real_num_type_args'
210         approach like in DoResolveAsTypeStep().
211
212         * generic.cs (GenericMemberAccess.DoResolve): Make this work for
213         nested types.
214
215 2004-03-17  Marek Safar  <marek.safar@seznam.cz>
216
217         * interface.cs: In all interface classes removed redundant
218         member initialization.
219
220 2004-03-16  Martin Baulig  <martin@ximian.com>
221
222         * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
223
224 2004-03-15  Miguel de Icaza  <miguel@ximian.com>
225
226         * decl.cs (DefineTypeAndParents): New helper method to define a
227         type's containers before the type itself is defined;  This is a
228         bug exposed by the recent changes to Windows.Forms when an
229         implemented interface was defined inside a class that had not been
230         built yet.   
231
232         * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
233
234         (Check): Loop correctly to report errors modifiers
235         (UNSAFE was not in the loop, since it was the same as TOP).
236
237         * interface.cs: Every interface member now takes a ModFlags,
238         instead of a "is_new" bool, which we set on the base MemberCore. 
239
240         Every place where we called "UnsafeOk" in the interface, now we
241         call the proper member (InterfaceMethod.UnsafeOK) instead to get
242         the unsafe settings from the member declaration instead of the
243         container interface. 
244
245         * cs-parser.jay (opt_new): Allow unsafe here per the spec. 
246
247         * pending.cs (TypeAndMethods): Add `get_indexer_name' and
248         `set_indexer_name' to the pending bits (one per type).
249
250         We fixed a bug today that was picking the wrong method to
251         override, since for properties the existing InterfaceMethod code
252         basically ignored the method name.  Now we make sure that the
253         method name is one of the valid indexer names.
254
255 2004-03-14  Gustavo Giráldez  <gustavo.giraldez@gmx.net>
256  
257         * support.cs (SeekableStreamReader): Keep track of stream byte
258         positions and don't mix them with character offsets to the buffer.
259
260         Patch from Gustavo Giráldez
261         
262 2004-03-15  Marek Safar  <marek.safar@seznam.cz>
263
264         * interface.cs (InterfaceSetGetBase): Removed double member
265         initialization, base class does it as well.
266
267 2004-03-13  Martin Baulig  <martin@ximian.com>
268
269         * class.cs: Reverted Miguel's latest commit; it makes mcs crash
270         when compiling corlib.
271
272 2004-03-13  Miguel de Icaza  <miguel@ximian.com>
273
274         * convert.cs (ExplicitConversion): We were reporting an error on
275         certain conversions (object_type source to a value type, when the
276         expression was `null') before we had a chance to pass it through
277         the user defined conversions.
278
279         * driver.cs: Replace / and \ in resource specifications to dots.
280         Fixes 50752
281
282         * class.cs: Add check for duplicate operators.  Fixes 52477
283
284 2004-03-11  Miguel de Icaza  <miguel@ximian.com>
285
286         * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
287         that are in the middle of the statements, not only at the end.
288         Fixes #54987
289
290         * class.cs (TypeContainer.AddField): No longer set the
291         `HaveStaticConstructor' flag, now we call it
292         `UserDefineStaticConstructor' to diferentiate the slightly
293         semantic difference.
294
295         The situation is that we were not adding BeforeFieldInit (from
296         Modifiers.TypeAttr) to classes that could have it.
297         BeforeFieldInit should be set to classes that have no static
298         constructor. 
299
300         See:
301
302         http://www.yoda.arachsys.com/csharp/beforefieldinit.html
303
304         And most importantly Zoltan's comment:
305
306         http://bugzilla.ximian.com/show_bug.cgi?id=44229
307
308         "I think beforefieldinit means 'it's ok to initialize the type sometime 
309          before its static fields are used', i.e. initialization does not need
310          to be triggered by the first access to the type. Setting this flag
311          helps the JIT to compile better code, since it can run the static
312          constructor at JIT time, and does not need to generate code to call it
313          (possibly lots of times) at runtime. Unfortunately, mcs does not set
314          this flag for lots of classes like String. 
315          
316          csc sets this flag if the type does not have an explicit static 
317          constructor. The reasoning seems to be that if there are only static
318          initalizers for a type, and no static constructor, then the programmer
319          does not care when this initialization happens, so beforefieldinit
320          can be used.
321          
322          This bug prevents the AOT compiler from being usable, since it 
323          generates so many calls to mono_runtime_class_init that the AOT code
324          is much slower than the JITted code. The JITted code is faster, 
325          because it does not generate these calls if the vtable is type is
326          already initialized, which is true in the majority of cases. But the
327          AOT compiler can't do this."
328
329 2004-03-10  Miguel de Icaza  <miguel@ximian.com>
330
331         * class.cs (MethodData.Emit): Refactor the code so symbolic
332         information is generated for destructors;  For some reasons we
333         were taking a code path that did not generate symbolic information
334         before. 
335
336 2004-03-11 Ben Maurer  <bmaurer@users.sourceforge.net>
337
338         * class.cs: Create a Constructor.CheckBase method that
339         takes care of all validation type code. The method
340         contains some code that was moved from Define.
341
342         It also includes new code that checks for duplicate ctors.
343         This fixes bug #55148.
344
345 2004-03-09  Joshua Tauberer <tauberer@for.net>
346
347         * expression.cs (ArrayCreation): Fix: More than 6 nulls in
348         a { ... }-style array creation invokes EmitStaticInitializers
349         which is not good for reference-type arrays.  String, decimal
350         and now null constants (NullCast) are not counted toward
351         static initializers.
352
353 2004-03-05  Martin Baulig  <martin@ximian.com>
354
355         * location.cs (SourceFile.HasLineDirective): New public field;
356         specifies whether the file contains or is referenced by a "#line"
357         directive.
358         (Location.DefineSymbolDocuments): Ignore source files which
359         either contain or are referenced by a "#line" directive.        
360
361 2004-02-29  Ben Maurer <bmaurer@users.sourceforge.net>
362
363         * class.cs (Method.CheckBase): Avoid using FindMembers, we have
364         direct access to our parent, so check the method inline there.
365
366 2004-02-27 Ben Maurer  <bmaurer@users.sourceforge.net>
367
368         * expression.cs (Invocation.EmitCall): Miguel's last commit
369         caused a regression. If you had:
370         
371             T t = null;
372             t.Foo ();
373
374         In Foo the implict this would be null.
375         
376 2004-02-27  Miguel de Icaza  <miguel@ximian.com>
377
378         * expression.cs (Invocation.EmitCall): If the method is not
379         virtual, do not emit a CallVirt to it, use Call.
380
381         * typemanager.cs (GetFullNameSignature): Improve the method to
382         cope with ".ctor" and replace it with the type name.
383
384         * class.cs (ConstructorInitializer.Resolve): Now the method takes
385         as an argument the ConstructorBuilder where it is being defined,
386         to catch the recursive constructor invocations.
387
388 2004-03-16  Martin Baulig  <martin@ximian.com>
389
390         * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
391         ConstructedType, call ResolveType() on it to get the type rather
392         than just using `expr.Type'.
393
394 2004-03-16  Martin Baulig  <martin@ximian.com>
395
396         * generics.cs (ConstructedType.GetMemberAccess): Take the
397         EmitContext instead on the TypeExpr and use
398         ec.TypeContainer.CurrentType/ec.ContainerType.
399
400 2004-03-16  Martin Baulig  <martin@ximian.com>
401
402         * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
403         parameters before aliases.
404
405 2004-03-16  Martin Baulig  <martin@ximian.com>
406
407         * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
408         New oublic function; checks whether two generic instances may become
409         equal under some instantiations (26.3.1).
410
411         * class.cs (TypeContainer.Define): Call
412         TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
413         error.
414
415 2004-03-16  Martin Baulig  <martin@ximian.com>
416
417         * class.cs (TypeContainer.GetClassBases): Moved
418         Error_TypeParameterAsBase() here and also check whether the base
419         class is not an attribute.
420
421 2004-03-16  Martin Baulig  <martin@ximian.com>
422
423         * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
424
425 2004-03-16  Martin Baulig  <martin@ximian.com>
426
427         * class.cs (Error_TypeParameterAsBase): Use correct error number
428         here (CS0689).  
429
430 2004-03-16  Martin Baulig  <martin@ximian.com>
431
432         * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
433         for generics.
434
435         * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
436         error reporting.
437
438 2004-03-15  Martin Baulig  <martin@ximian.com>
439
440         * typemanager.cs (TypeManager.GetFullName): New public method.
441         (TypeManager.MemberLookup): Added `int_num_type_arguments'
442         argument; only return members with the correct number of type
443         arguments.
444         (TypeManager.CheckGeneric): Allow -1 to bypass the check.
445         (TypeManager.FilterWithClosure): Call CheckGeneric() to check
446         whether the number of type arguments matches.
447
448         * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
449         not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
450
451         * expression.cs (MemberAccess): Added public `NumTypeArguments'
452         field; it's set by the protected .ctor when we're actually a
453         GenericMemberAccess.
454         (MemberAccess.ResolveAsTypeStep): Compute the total number of type
455         arguments and pass it to MemberLookupFinal ().
456
457         * ecore.cs (Expression.MemberLookup): Added `int
458         num_type_arguments' argument; only return members with the correct
459         number of type arguments.
460         (Expression.MemberLookupFailed): Check whether the MemberLookup
461         failed because we did not have the correct number of type
462         arguments; report CS0305 in this case.
463
464         * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
465         `e.ResolveAsTypeTerminal()' already did so.
466
467 2004-03-15  Martin Baulig  <martin@ximian.com>
468
469         * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
470         we're a ConstructedType; in this case, the caller must report an
471         error (for instance CS0131).
472
473         * generic.cs (TypeArguments): Added Location argument to the .ctor.
474         (TypeArguments.Resolve): Actually report errors here.
475
476 2004-03-15  Miguel de Icaza  <miguel@ximian.com>
477
478         * pending.cs (TypeAndMethods): Add `get_indexer_name' and
479         `set_indexer_name' to the pending bits (one per type).
480
481         We fixed a bug today that was picking the wrong method to
482         override, since for properties the existing InterfaceMethod code
483         basically ignored the method name.  Now we make sure that the
484         method name is one of the valid indexer names.
485
486 2004-03-15  Martin Baulig  <martin@ximian.com>
487
488         * typemanager.cs (TypeManager.IndexerPropertyName): Added support
489         for generic instances.
490
491 2004-03-13  Martin Baulig  <martin@ximian.com>
492
493         * class.cs (TypeContainer.DefineType): Call
494         TypeManager.AddUserType() immediately after creating the
495         TypeBuilder; pass all type parameters when creating the
496         CurrentType.
497
498         * decl.cs (DeclSpace.FindNestedType): New public method.
499         (DeclSpace.FindType): Added `int num_type_args' argument; only
500         return types with the correct number of type parameters.
501         (DeclSpace.CountTypeParams): New public property.
502
503         * ecore.cs (SimpleName.ctor): Added overloaded version which takes
504         the number of type parameters; defaults to zero.
505
506         * generic.cs (TypeArguments.Count): New public property.
507         (ConstructedType.DoResolveAsTypeStep): First call
508         ds.FindNestedType() to find out whether we're nested in the
509         current generic type; in this case, we inherit all type parameters
510         from the current class.
511
512         * rootcontext.cs (RootContext.NamespaceLookup): Added `int
513         num_type_args' argument.
514         (RootContext.LookupType): Added overloaded version which takes the
515         number of type arguments; only return types with the correct
516         number of type arguments.
517
518         * typemanager.cs (TypeManager.CheckGeneric): New public function;
519         checks whether `Type t' has `int num_type_args'.
520
521 2004-03-13  Martin Baulig  <martin@ximian.com>
522
523         * generic.cs (GenericMethod.DefineType): New method; calls
524         DefineType() on all the type parameters.
525
526         * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
527         (MethodData.Define): If we're a generic method, call
528         GenericMethod.DefineType() to define the type parameters.       
529
530 2004-03-10  Martin Baulig  <martin@ximian.com>
531
532         * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
533         instead of IsAssignableFrom.    
534
535 2004-03-10  Martin Baulig  <martin@ximian.com>
536
537         * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
538
539         * support.cs (ParameterData.HasArrayParameter): New property.
540         (ReflectionParameters.ctor): Take a MethodBase instead of a
541         ParameterInfo[].  If we have any type parameters, get the generic
542         method definition and ask it whether we have variable arguments.
543
544 2004-02-26  Miguel de Icaza  <miguel@ximian.com>
545
546         * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
547         routines to check if a type is an enumerable/enumerator allow
548         classes that implement the IEnumerable or IEnumerator interfaces.
549
550         * class.cs (Property, Operator): Implement IIteratorContainer, and
551         implement SetYields.
552
553         (Property.Define): Do the block swapping for get_methods in the
554         context of iterators.   We need to check if Properties also
555         include indexers or not.
556
557         (Operator): Assign the Block before invoking the
558         OperatorMethod.Define, so we can trigger the Iterator code
559         replacement. 
560
561         * cs-parser.jay (SimpleIteratorContainer): new helper class.  Both
562         Property and Operator classes are not created when we parse the
563         declarator but until we have the block completed, so we use a
564         singleton SimpleIteratorContainer.Simple to flag whether the
565         SetYields has been invoked.
566
567         We propagate this setting then to the Property or the Operator to
568         allow the `yield' to function.
569
570 2004-02-25  Marek Safar  <marek.safar@seznam.cz>
571
572         * codegen.cs: Implemented attribute support for modules.
573         New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
574         Assembly/Module functionality.
575         
576         * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
577         interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
578         Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
579
580 2004-02-16  Marek Safar  <marek.safar@seznam.cz>
581
582         * interface.cs (FindMembers): The operation is performed on all base
583         interfaces and not only on the first. It is required for future CLS Compliance patch.
584
585 2004-02-12 Ben Maurer  <bmaurer@users.sourceforge.net>
586
587         * statement.cs, codegen.cs:
588         This patch deals with patterns such as:
589
590         public class List : IEnumerable {
591
592                 public MyEnumerator GetEnumerator () {
593                         return new MyEnumerator(this);
594                 }
595         
596                 IEnumerator IEnumerable.GetEnumerator () {
597                         ...
598                 }
599                 
600                 public struct MyEnumerator : IEnumerator {
601                         ...
602                 }
603         }
604
605         Before, there were a few things we did wrong:
606         1) we would emit callvirt on a struct, which is illegal
607         2) we emited ldarg when we needed to emit ldarga
608         3) we would mistakenly call the interface methods on an enumerator
609         type that derived from IEnumerator and was in another assembly. For example:
610
611         public class MyEnumerator : IEnumerator
612
613         Would have the interface methods called, even if there were public impls of the
614         method. In a struct, this lead to invalid IL code.
615         
616 2004-02-11  Marek Safar  <marek.safar@seznam.cz>
617
618         * const.cs: Const is now derived from FieldBase. Method EmitConstant name
619           renamed to Emit.
620
621         * delegate.cs (Define): Fixed crash when delegate type is undefined.
622         
623 2004-02-11  Miguel de Icaza  <miguel@ximian.com>
624
625         * cs-parser.jay: Fix small regression: we were not testing V2
626         compiler features correctly.
627
628         * interface.cs: If the emit context is null, then create one
629
630 2004-02-09  Marek Safar  <marek.safar@seznam.cz>
631
632         * decl.cs (GetSignatureForError): New virtual method to get full name
633           for error messages.
634         
635         * attribute.cs (IAttributeSupport): New interface for attribute setting.
636           Now it is possible to rewrite ApplyAttributes method to be less if/else.
637
638         * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
639           Duplicated members and code in these classes has been removed.
640           Better encapsulation in these classes.
641
642 2004-02-07  Miguel de Icaza  <miguel@ximian.com>
643
644         * assign.cs (Assign.DoResolve): When dealing with compound
645         assignments, there is a new rule in ECMA C# 2.4 (might have been
646         there before, but it is documented here) that states that in:
647
648         a op= b;
649
650         If b is of type int, and the `op' is a shift-operator, then the
651         above is evaluated as:
652
653         a = (int) a op b 
654
655         * expression.cs (Binary.ResolveOperator): Instead of testing for
656         int/uint/long/ulong, try to implicitly convert to any of those
657         types and use that in pointer arithmetic.
658
659         * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
660         method to print information for from the type, not from the
661         null-method we were given.
662
663 2004-02-01  Duncan Mak  <duncan@ximian.com>
664
665         * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
666         parsing for cmd, fixes bug #53694.
667
668 2004-02-04  Marek Safar  <marek.safar@seznam.cz>
669
670         * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
671         in the member name duplication tests. Property and operator name duplication
672         was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
673
674 2004-02-03  Marek Safar  <marek.safar@seznam.cz>
675
676         * interface.cs (PopulateMethod): Fixed crash when interface method
677         returns not existing type (error test cs0246-3.cs).
678
679 2004-02-02  Ravi Pratap M <ravi@ximian.com>
680
681         * cs-parser.jay (interface_accessors): Re-write actions to also
682         store attributes attached to get and set methods. Fix spelling
683         while at it.
684
685         (inteface_property_declaration): Modify accordingly.
686
687         (InterfaceAccessorInfo): New helper class to store information to pass
688         around between rules that use interface_accessors.
689
690         * interface.cs (Emit): Apply attributes on the get and set
691         accessors of properties and indexers too.
692         
693         * attribute.cs (ApplyAttributes): Modify accordingly to use the
694         right MethodBuilder when applying attributes to the get and set accessors.
695
696 2004-01-31  Miguel de Icaza  <miguel@ximian.com>
697
698         * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
699
700 2004-01-26  Miguel de Icaza  <miguel@ximian.com>
701
702         * cs-tokenizer.cs: Handle #line hidden from PDC bits.
703
704 2004-01-25  Miguel de Icaza  <miguel@ximian.com>
705
706         * cs-parser.jay: Remove YIELD token, instead use the new grammar
707         changes that treat `yield' specially when present before `break'
708         or `return' tokens.
709
710         * cs-tokenizer.cs: yield is no longer a keyword.
711
712 2004-01-23  Marek Safar  <marek.safar@seznam.cz>
713
714         * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
715         setting for default constructors.
716         For default constructors are almost every time set wrong Modifier. The
717         generated IL code has been alright. But inside mcs this values was
718         wrong and this was reason why several of my CLS Compliance tests
719         failed.
720
721 2004-02-27  Martin Baulig  <martin@ximian.com>
722
723         * generics.cs (ConstructedType.ResolveType): Make the nested type
724         stuff actually work.
725
726 2004-02-25  Martin Baulig  <martin@ximian.com>
727
728         * decl.cs (DeclSpace.CurrentTypeParameters): New protected
729         property; returns the type parameters just from the current type,
730         ie. with the ones from outer classes.
731         (DeclSpace.LookupGeneric): First search in the current class, then
732         in outer classes.
733         (DeclSpace.initialize_type_params): When hiding a type parameter
734         from an outer class, put it into the `type_param_list' anyways.
735
736         * expression.cs (MemberAccess.expr): Made this field protected.
737
738         * class.cs (TypeContainer.Define): The `CurrentType' just contains
739         the type parameters from the current class.
740
741         * generic.cs (ConstructedType.ResolveType): Support nested generic
742         types by taking the type parameters which we inherit from outer
743         classes into account.
744         (GenericMemberAccess.ResolveAsTypeStep): Override this and added
745         support for nested generic types.
746
747 2004-02-23  Martin Baulig  <martin@ximian.com>
748
749         * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
750         field and check whether we're nested inside a generic type.
751         (DeclSpace.ResolveType): If we're resolving to a generic type
752         definition, create a ConstructedType and return its resolved type.
753         (DeclSpace.initialize_type_params): New private method;
754         initializes the `type_param_list' field from the type parameters
755         from this and all enclosing classes.
756         (DeclSpace.TypeParameters): Call initialize_type_params() unless
757         we're already initialized.
758
759 2004-02-23  Martin Baulig  <martin@ximian.com>
760
761         * class.cs (Method.Define): Create the generic method before
762         calling DoDefine().
763         (Memberbase.DoDefine): Added DeclSpace argument (in addition to
764         the TypeContainer one); we use this for generic methods.
765
766         * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
767         parent's TypeBuilder.
768
769 2004-02-18  Martin Baulig  <martin@ximian.com>
770
771         * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
772         to check for equality.
773
774 2004-02-05  Martin Baulig  <martin@ximian.com>
775
776         * ecore.cs (FieldExpr.DoResolveLValue): If we have an
777         `ec.TypeContainer.CurrentType', use it instead of
778         `ec.ContainerType' to check whether we're in the type's ctor.
779
780 2004-01-29  Martin Baulig  <martin@ximian.com>
781
782         * expression.cs (Invocation.DoResolve): If we're a
783         `ConstructedType', then we're actually a generic method, so
784         rewrite the expr as a GenericMemberAccess.
785
786         * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
787         here; manually parse it into a string.
788
789 2004-01-28  Martin Baulig  <martin@ximian.com>
790
791         * typemanager.cs (TypeManager.IsEqual): New static method.
792         (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
793         check for equality instead of using `=='.
794
795 2004-01-26  Martin Baulig  <martin@ximian.com>
796
797         * decl.cs (DeclSpace.CurrentType): New public field.
798
799         * expression.cs (This.ResolveBase): If we have an
800         `ec.TypeContainer.CurrentType', use it instead of
801         `ec.ContainerType'.
802
803         * class.cs (TypeContainer.DefineType): If we're a generic type,
804         create the `CurrentType' (unresolved).
805         (TypeContainer.GenericType): New private field.
806         (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
807         it and store it in `GenericType' before creating the MemberCache.
808         (TypeContainer.GetMembers): If we have a `GenericType', call
809         TypeManager.FindMembers() on it.
810
811         * interface.cs (Interface.GenericType): New private field.
812         (Interface.DefineType): If we're a generic type, create the
813         `CurrentType' (unresolved).
814         (Interface.DefineMembers): If we have a `CurrentType', resolve it
815         and store it in `GenericType' before creating the MemberCache.
816         (Interface.GetMembers): If we have a `GenericType', call
817         TypeManager.FindMembers() on it.
818
819 2004-01-22  Martin Baulig  <martin@ximian.com>
820
821         * cs-parser.jay (namespace_or_type_name): Return an Expression,
822         not a QualifiedIdentifier.  This is what `type_name_expression'
823         was previously doing.
824         (type_name_expression): Removed; the code is now in
825         `namespace_or_type_name'.
826         (qualified_identifier): Removed, use `namespace_or_type_name'
827         instead.
828         (QualifiedIdentifier): Removed this class.      
829
830 2004-01-22  Martin Baulig  <martin@ximian.com>
831
832         * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
833         not a string as alias name.
834
835 2004-01-21  Miguel de Icaza  <miguel@ximian.com>
836
837         * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
838         #52730 bug, and instead compute correctly the need to use a
839         temporary variable when requesting an address based on the
840         static/instace modified of the field and the constructor.
841  
842 2004-01-21  Martin Baulig  <martin@ximian.com>
843
844         * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
845         class and namespace before looking up aliases.  Fixes #52517.
846
847 2004-01-21  Martin Baulig  <martin@ximian.com>
848
849         * flowanalysis.cs (UsageVector.Merge): Allow variables being
850         assinged in a 'try'; fixes exception4.cs.
851
852 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
853         * class.cs : Implemented parameter-less constructor for TypeContainer
854         
855         * decl.cs: Attributes are now stored here. New property OptAttributes
856         
857         * delegate.cs, enum.cs, interface.cs: Removed attribute member.
858         
859         * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
860
861 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
862
863         * typemanager.cs (CSharpSignature): Now reports also inner class name.
864           (CSharpSignature): New method for indexer and property signature.
865
866 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
867
868         * pending.cs (IsVirtualFilter): Faster implementation.
869
870 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
871
872         * typemanager.cs: Avoid inclusion of same assembly more than once.
873
874 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
875
876         * cs-parser.jay: Fixed problem where the last assembly attribute
877           has been applied also to following declaration (class, struct, etc.)
878           
879 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
880
881         * class.cs: Added error CS0538, CS0539 reporting.
882         Fixed crash on Microsoft runtime when field type is void.
883
884         * cs-parser.jay: Added error CS0537 reporting.
885
886         * pending.cs: Added error CS0535 reporting.
887         Improved error report for errors CS0536, CS0534.
888
889 2004-01-20  Miguel de Icaza  <miguel@ximian.com>
890
891         Merge a few bits from the Anonymous Method MCS tree.
892         
893         * statement.cs (ToplevelBlock): New class for toplevel methods,
894         will hold anonymous methods, lifted variables.
895
896         * cs-parser.jay: Create toplevel blocks for delegates and for
897         regular blocks of code. 
898
899 2004-01-20  Martin Baulig  <martin@ximian.com>
900
901         * codegen.cs (EmitContext): Removed `InTry', `InCatch',
902         `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
903         and `NeedExplicitReturn'; added `IsLastStatement'.
904         (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
905         have a `ReturnLabel' or we're not unreachable.
906
907         * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
908         child's reachability; don't just override ours with it.  Fixes
909         #58058 (lluis's example).
910         (FlowBranching): Added public InTryOrCatch(), InCatch(),
911         InFinally(), InLoop(), InSwitch() and
912         BreakCrossesTryCatchBoundary() methods.
913
914         * statement.cs (Return): Do all error checking in Resolve().
915         Unless we are the last statement in a top-level block, always
916         create a return label and jump to it.
917         (Break, Continue): Do all error checking in Resolve(); also make
918         sure we aren't leaving a `finally'.
919         (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
920         statement in a top-level block.
921         (Block.Flags): Added `IsDestructor'.
922         (Block.IsDestructor): New public property.
923
924 2004-01-20  Martin Baulig  <martin@ximian.com>
925
926         * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
927
928 2004-01-20  Martin Baulig  <martin@ximian.com>
929
930         * statement.cs (Statement.ResolveUnreachable): New public method.
931         (If, While): Do the dead-code elimination in Resolve(), not in Emit().
932         (Block.Resolve): Resolve unreachable statements.
933
934 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
935
936         * expression.cs: We need to fix the case where we do
937         not have a temp variable here.
938
939         * assign.cs: Only expression compound assignments need
940         temporary variables.
941
942 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
943
944         * flowanalysis.cs: Reduce memory allocation in a few ways:
945           - A block with no variables should not allocate a bit
946             vector for itself.
947           - A method with no out parameters does not need any tracking
948             for assignment of the parameters, so we need not allocate
949             any data for it.
950           - The arrays:
951                 public readonly Type[] VariableTypes;
952                 public readonly string[] VariableNames;
953             Are redundant. The data is already stored in the variable
954             map, so we need not allocate another array for it.
955           - We need to add alot of checks for if (params | locals) == null
956             due to the first two changes.
957
958 2004-01-18  Miguel de Icaza  <miguel@ximian.com>
959
960         * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
961         implement IMemoryLocation, we store a copy on a local variable and
962         take the address of it.  Patch from Benjamin Jemlich
963
964         * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
965         to use a special "type_name_expression" rule which reduces the
966         number of "QualifiedIdentifier" classes created, and instead
967         directly creates MemberAccess expressions.
968
969 2004-01-17  Miguel de Icaza  <miguel@ximian.com>
970
971         * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
972         that fixes #52853.  Null literal assignment to ValueType
973
974         * class.cs (MethodData.Emit): Instead of checking the name of the
975         method to determine if its a destructor, create a new derived
976         class from Method called Destructor, and test for that.  
977
978         * cs-parser.jay: Create a Destructor object instead of a Method.  
979
980         Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
981
982         Fixes: 52933
983         
984 2004-01-16  Miguel de Icaza  <miguel@ximian.com>
985
986         * expression.cs (Binary.ResolveOperator): Perform an implicit
987         conversion from MethodGroups to their delegate types on the
988         Addition operation.
989
990         * delegate.cs: Introduce a new class DelegateCreation that is the
991         base class for `NewDelegate' and `ImplicitDelegateCreation',
992         factor some code in here.
993
994         * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
995         conversion from MethodGroups to compatible delegate types. 
996
997         * ecore.cs (Expression.Resolve): Do not flag error 654
998         (Methodgroupd needs parenthesis) if running on the V2 compiler, as
999         we allow conversions from MethodGroups to delegate types now.
1000         
1001         * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
1002         assignments in v2 either.
1003
1004 2004-01-10  Miguel de Icaza  <miguel@ximian.com>
1005
1006         * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
1007         static read-only fields in ctors.
1008
1009         Applied patch from Benjamin Jemlich 
1010
1011         * expression.cs (UnaryMutator): Avoid leaking local variables. 
1012         
1013 2004-01-09  Miguel de Icaza  <miguel@ximian.com>
1014
1015         * cs-tokenizer.cs (IsCastToken): Allow the various native types
1016         here to return true, as they can be used like this:
1017
1018                 (XXX) int.MEMBER ()
1019
1020         Fixed 49836 and all the other dups
1021         
1022 2004-01-09  Zoltan Varga  <vargaz@freemail.hu>
1023
1024         * driver.cs: Implement /win32res and /win32icon.
1025
1026 2004-01-08  Miguel de Icaza  <miguel@ximian.com>
1027
1028         * cs-parser.jay: Add a rule to improve error handling for the
1029         common mistake of placing modifiers after the type.
1030
1031 2004-01-07  Miguel de Icaza  <miguel@ximian.com>
1032
1033         * cs-parser.jay (interface_event_declaration): Catch
1034         initialization of events on interfaces, and report cs0068
1035
1036         * cs-parser.jay (interface_event_declaration): Catch
1037         initialization of events. 
1038
1039         * ecore.cs: Better report missing constructors.
1040         
1041         * expression.cs (Binary.ResolveOperator): My previous bug fix had
1042         the error reporting done in the wrong place.  Fix.
1043
1044         * expression.cs (Binary.ResolveOperator): Catch the 
1045         operator + (E x, E y) error earlier, and later allow for implicit
1046         conversions in operator +/- (E e, U x) from U to the underlying
1047         type of E.
1048
1049         * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
1050         52596, if the container class is abstract, the default constructor
1051         is protected otherwise its public (before, we were always public).
1052
1053         * statement.cs (Fixed.Resolve): Catch a couple more errors in the
1054         fixed statement.
1055
1056         (Using.EmitLocalVariableDecls): Applied patch from Benjamin
1057         Jemlich that fixes bug #52597, MCS was generating invalid code for
1058         idisposable structs.   Thanks to Ben for following up with this
1059         bug as well.
1060         
1061 2004-01-06  Miguel de Icaza  <miguel@ximian.com>
1062
1063         * driver.cs: Allow assemblies without code to be generated, fixes
1064         52230.
1065
1066 2004-01-07  Nick Drochak <ndrochak@gol.com>
1067
1068         * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
1069
1070 2004-01-05  Miguel de Icaza  <miguel@ximian.com>
1071
1072         * cs-parser.jay: Add rules to improve error reporting if fields or
1073         methods are declared at the namespace level (error 116)
1074
1075         * Add rules to catch event add/remove
1076
1077 2004-01-04  David Sheldon <dave-mono@earth.li>
1078
1079   * expression.cs: Added matching ")" to error message for 
1080   CS0077
1081
1082 2004-01-03 Todd Berman <tberman@gentoo.org>
1083         
1084         * ecore.cs, attribute.cs:
1085         Applying fix from #52429.
1086
1087 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1088
1089         * ecore.cs, expression.cs, statement.cs:
1090         Total rewrite of how we handle branching. We
1091         now handle complex boolean expressions with fewer
1092         jumps. As well if (x == 0) no longer emits a ceq.
1093
1094         if (x is Foo) is much faster now, because we generate
1095         better code.
1096
1097         Overall, we get a pretty big improvement on our benchmark
1098         tests. The code we generate is smaller and more readable.
1099
1100         I did a full two-stage bootstrap. The patch was reviewed
1101         by Martin and Miguel.
1102
1103 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1104
1105         * cs-parser.jay: Make primary_expression not take a QI.
1106         we dont need this because the member_access rule covers
1107         us here. So we replace the rule with just IDENTIFIER.
1108
1109         This has two good effects. First, we remove a s/r conflict.
1110         Second, we allocate many fewer QualifiedIdentifier objects.
1111
1112 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1113
1114         * attribute.cs: Handle MarshalAs attributes as pseudo, and
1115         set the correct information via SRE. This prevents
1116         hanging on the MS runtime. Fixes #29374.
1117
1118 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1119
1120         * convert.cs: correctly handle conversions to value types
1121         from Enum and ValueType as unboxing conversions.
1122
1123         Fixes bug #52569. Patch by Benjamin Jemlich.
1124
1125 2004-01-02  Ravi Pratap  <ravi@ximian.com>
1126
1127         * expression.cs (BetterConversion): Prefer int -> uint
1128         over int -> ulong (csc's behaviour). This fixed bug #52046.
1129
1130 2004-01-02 Ben Maurer  <bmaurer@users.sourceforge.net>
1131
1132         * decl.cs (MemberCache.FindMembers): now returns a
1133         MemberInfo [].
1134
1135         * typemanager.cs: In general, go with with ^^.
1136         (CopyNewMethods): take an IList.
1137         (RealMemberLookup): Only allocate an arraylist
1138         if we copy from two sets of methods.
1139
1140         This change basically does two things:
1141         1) Fewer array lists allocated due to CopyNewMethods.
1142         2) the explicit cast in MemberList costed ALOT.
1143
1144 2004-01-02  Zoltan Varga  <vargaz@freemail.hu>
1145
1146         * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
1147         a hashtable to avoid needless string allocations when an identifier is
1148         used more than once (the common case).
1149
1150 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
1151
1152         * pending.cs: MS's TypeBuilder.GetInterfaces ()
1153         is broken, it will not return anything. So, we
1154         have to use the information we have in mcs to
1155         do the task.
1156
1157         * typemanager.cs: Add a cache for GetInterfaces,
1158         since this will now be used more often (due to ^^)
1159
1160         (GetExplicitInterfaces) New method that gets the
1161         declared, not effective, interfaces on a type
1162         builder (eg, if you have interface IFoo, interface
1163         IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
1164         { IBar }.
1165
1166         This patch makes MCS able to bootstrap itself on
1167         Windows again.
1168
1169 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
1170
1171         * expression.cs: Remove the Nop's that Miguel put
1172         in by mistake.
1173
1174 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
1175
1176         * report.cs, codegen.cs: Give the real stack trace to
1177         the error when an exception is thrown.
1178
1179 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
1180
1181         * decl.cs: only allocate hashtables for ifaces if 
1182         it is an iface!
1183
1184 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
1185
1186         * expression.cs: fix the error from cs0121-2.cs
1187         (a parent interface has two child interfaces that
1188         have a function with the same name and 0 params
1189         and the function is called through the parent).
1190
1191 2003-12-30 Ben Maurer  <bmaurer@users.sourceforge.net>
1192
1193         * class.cs, rootcontext.cs, typmanager.cs: do not
1194         leak pointers.
1195
1196 2003-12-28 Ben Maurer  <bmaurer@users.sourceforge.net>
1197
1198         * codegen.cs: remove stack for the ec flow branching.
1199         It is already a linked list, so no need.
1200
1201 2003-12-27 Ben Maurer  <bmaurer@users.sourceforge.net>
1202
1203         * Makefile: Allow custom profiler here.
1204
1205 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
1206
1207         * typemanager.cs (LookupType):
1208           - Use a static char [], because split takes
1209             a param array for args, so it was allocating
1210             every time.
1211           - Do not store true in a hashtable, it boxes.
1212
1213 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
1214
1215         * flowanalysis.cs: bytify common enums.
1216
1217 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
1218
1219         * modifiers.cs: Add a new set of flags for the
1220         flags allowed on explicit interface impls.
1221         * cs-parser.jay: catch the use of modifiers in
1222         interfaces correctly.
1223         * class.cs: catch private void IFoo.Blah ().
1224
1225         All related to bug #50572.
1226
1227 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
1228
1229         * decl.cs: Rewrite the consistant accessability checking.
1230         Accessability is not linear, it must be implemented in
1231         a tableish way. Fixes #49704.
1232
1233 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
1234
1235         * expression.cs: Handle negation in a checked context.
1236         We must use subtraction from zero. Fixes #38674.
1237
1238 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1239
1240         * class.cs: Ignore static void main in DLLs.
1241         * rootcontext.cs: Handle the target type here,
1242         since we are have to access it from class.cs
1243         * driver.cs: account for the above.
1244
1245 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1246
1247         * report.cs: Give line numbers and files if available.
1248
1249 2003-12-20  Zoltan Varga  <vargaz@freemail.hu>
1250
1251         * driver.cs: Implement /addmodule.
1252
1253         * typemanager.cs:  Change 'modules' field so it now contains Modules not
1254         ModuleBuilders.
1255
1256 2003-12-20  Martin Baulig  <martin@ximian.com>
1257
1258         * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
1259         (FieldBase.IsAssigned): Removed this field.
1260         (FieldBase.SetAssigned): New public method.
1261         (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
1262
1263 2003-12-20  Martin Baulig  <martin@ximian.com>
1264
1265         * expression.cs (LocalVariableReference.DoResolve): Don't set
1266         `vi.Used' if we're called from DoResolveLValue().
1267
1268         * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
1269         returns the usage vector it just merged into the current one -
1270         pass this one to UsageWarning().
1271         (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
1272         of the `EmitContext', don't call this recursively on our children.
1273
1274 2003-12-19  Zoltan Varga  <vargaz@freemail.hu>
1275
1276         * driver.cs: Implement /target:module.
1277
1278 2003-12-18  Zoltan Varga  <vargaz@freemail.hu>
1279
1280         * support.cs (CharArrayHashtable): New helper class.
1281
1282         * cs-tokenizer.cs: Store keywords in a hashtable indexed by 
1283         char arrays, not strings, so we can avoid creating a string in
1284         consume_identifier if the identifier is a keyword.
1285
1286 2003-12-16  Martin Baulig  <martin@ximian.com>
1287
1288         * statement.cs (LocalInfo.Assigned): Removed this property.
1289         (LocalInfo.Flags): Removed `Assigned'.
1290         (LocalInfo.IsAssigned): New public method; takes the EmitContext
1291         and uses flow analysis.
1292         (Block.UsageWarning): Made this method private.
1293         (Block.Resolve): Call UsageWarning() if appropriate.
1294
1295         * expression.cs (LocalVariableReference.DoResolve): Always set
1296         LocalInfo.Used here.
1297
1298 2003-12-13  Martin Baulig  <martin@ximian.com>
1299
1300         * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
1301         any value here; we're now using flow analysis to figure out
1302         whether a statement/block returns a value.
1303
1304 2003-12-13  Martin Baulig  <martin@ximian.com>
1305
1306         * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
1307         working again.
1308         (FlowBranching.MergeFinally): Don't call
1309         `branching.CheckOutParameters()' here, this is called in
1310         MergeTopBlock().
1311         (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
1312         when adding the `finally' vector.       
1313
1314 2003-12-13  Martin Baulig  <martin@ximian.com>
1315
1316         * flowanalysis.cs
1317         (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
1318         actually work and also fix #48962.
1319
1320 2003-12-12 Ben Maurer  <bmaurer@users.sourceforge.net>
1321
1322         * decl.cs: Do not check System.Object for nested types,
1323         since we know it does not have any. Big bang for buck:
1324
1325         BEFORE:
1326            Run 1:   8.35 seconds
1327            Run 2:   8.32 seconds
1328            corlib:  17.99 seconds
1329         AFTER:
1330            Run 1:   8.17 seconds
1331            Run 2:   8.17 seconds
1332            corlib:  17.39 seconds
1333
1334 2003-12-11 Ben Maurer  <bmaurer@users.sourceforge.net>
1335
1336         * class.cs (FindMembers): Allocate arraylists on demand. Most of the
1337         time we are returning 0 members, so we save alot here.
1338
1339 2003-12-11  Martin Baulig  <martin@ximian.com>
1340
1341         * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
1342         `MergeChild()', also just take the `FlowBranching' as argument;
1343         call Merge() on it and return the result.
1344         (FlowBranching.Merge): We don't need to do anything if we just
1345         have one sibling.
1346
1347 2003-12-11  Martin Baulig  <martin@ximian.com>
1348
1349         * flowanalysis.cs: Use a list of `UsageVector's instead of storing
1350         them in an `ArrayList' to reduce memory usage.  Thanks to Ben
1351         Maurer for this idea.
1352
1353 2003-12-11  Martin Baulig  <martin@ximian.com>
1354
1355         * flowanalysis.cs (MergeResult): This class is now gone; we now
1356         use the `UsageVector' for this.  The reason for this is that if a
1357         branching just has one sibling, we don't need to "merge" them at
1358         all - that's the next step to do.
1359         (FlowBranching.Merge): We now return a `UsageVector' instead of a
1360         `MergeResult'.
1361
1362 2003-12-11  Martin Baulig  <martin@ximian.com>
1363
1364         Reworked flow analyis and made it more precise and bug-free.  The
1365         most important change is that we're now using a special `Reachability'
1366         class instead of having "magic" meanings of `FlowReturns'.  I'll
1367         do some more cleanups and optimizations and also add some more
1368         documentation this week.
1369
1370         * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
1371         largely reworked this class.
1372         (FlowReturns): Removed `Unreachable' and `Exception'; we now use
1373         the new `Reachability' class instead of having "magic" values here.
1374         (FlowBranching): We're now using an instance of `Reachability'
1375         instead of having separate `Returns', `Breaks' etc. fields.
1376
1377         * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
1378         based on flow analysis; ignore the return value of block.Emit ().
1379
1380 2003-12-10  Zoltan Varga  <vargaz@freemail.hu>
1381
1382         * driver.cs typemanager.cs: Find the mono extensions to corlib even
1383         if they are private.
1384
1385 2003-12-09  Martin Baulig  <martin@ximian.com>
1386
1387         * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
1388         call them directly on the UsageVector.
1389
1390 2003-12-09  Martin Baulig  <martin@ximian.com>
1391
1392         * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
1393         Changed return type from `FlowReturns' to `Reachability'.
1394
1395 2003-12-09  Martin Baulig  <martin@ximian.com>
1396
1397         * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
1398         (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
1399         `Reachable' fields with a single `Reachability' one.
1400
1401 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1402
1403         * class.cs (FindMembers): Remove foreach's.
1404
1405         Bootstrap times:
1406         
1407         BEFORE
1408                 Run 1:   8.74 seconds
1409                 Run 2:   8.71 seconds
1410         
1411         AFTER
1412                 Run 1:   8.64 seconds
1413                 Run 2:   8.58 seconds
1414         
1415
1416 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1417
1418         * cs-parser.jay:
1419         * gen-treedump.cs:
1420         * statement.cs:
1421         This patch does a few things:
1422                 1. EmptyStatement is now a singleton, so it is never reallocated.
1423                 2. All blah is EmptyStatement constructs have been changed to
1424                    blah == EmptyStatement.Value, which is much faster and valid
1425                    now that EmptyStatement is a singleton.
1426                 3. When resolving a block, rather than allocating a new array for
1427                    the non-empty statements, empty statements are replaced with
1428                    EmptyStatement.Value
1429                 4. Some recursive functions have been made non-recursive.
1430         Mainly the performance impact is from (3), however (1) and (2) are needed for
1431         this to work. (4) does not make a big difference in normal situations, however
1432         it makes the profile look saner.
1433
1434         Bootstrap times:
1435
1436         BEFORE
1437         9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
1438         9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
1439         Total memory allocated: 56397 KB
1440         
1441         AFTER
1442         9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
1443         8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
1444         Total memory allocated: 55666 KB
1445
1446 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1447
1448         * support.cs: Rewrite DoubleHash to use its own impl. Is faster
1449         than the hashtable in a hashtable version
1450
1451         * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
1452         we always end up concating a string. This results in a huge perf
1453         loss, because many strings have to be tracked by the GC. In this
1454         patch, we first use a hashtable that works with two keys, so that
1455         the strings do not need to be concat'ed.
1456
1457         Bootstrap times:
1458         BEFORE
1459                 Run 1:   8.74 seconds
1460                 Run 2:   8.71 seconds
1461         
1462         AFTER
1463                 Run 1:   8.65 seconds
1464                 Run 2:   8.56 seconds
1465         
1466 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1467
1468         * Makefile: Add a new target `do-time' that does a quick and simple
1469         profile, leaving easy to parse output.
1470
1471 2003-12-08  Zoltan Varga  <vargaz@freemail.hu>
1472
1473         * codegen.cs (Init): Create the dynamic assembly with 
1474         AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
1475
1476 2003-12-02 Ben Maurer  <bmaurer@users.sourceforge.net>
1477
1478         * support.cs: Make the PtrHashtable use only one
1479         instance of its comparer.
1480
1481 2003-11-30  Zoltan Varga  <vargaz@freemail.hu>
1482
1483         * typemanager.cs: Fix lookup of GetNamespaces.
1484
1485 2003-11-29  Miguel de Icaza  <miguel@ximian.com>
1486
1487         * expression.cs: Removed redundant line.
1488
1489         * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
1490         ArrayLists, use for loops with bounds.  
1491
1492         * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
1493         arraylist.
1494
1495         * expression.cs (Invocation.OverloadResolve): Avoid foreach on
1496         arraylists, use for loop with bounds.
1497
1498         The above three changes give us a 0.071 second performance
1499         improvement out of 3.294 seconds down to 3.223.  On my machine
1500         the above changes reduced the memory usage by 1,387 KB during
1501         compiler bootstrap.
1502
1503         * cs-parser.jay (QualifiedIdentifier): New class used to represent
1504         QualifiedIdentifiers.  Before we created a new string through
1505         concatenation, and mostly later on, the result would be
1506         manipulated by DecomposeQI through string manipulation.
1507
1508         This reduced the compiler memory usage for bootstrapping from
1509         59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
1510         compile times in 0.05 seconds.
1511
1512 2003-11-28  Dick Porter  <dick@ximian.com>
1513
1514         * support.cs: Do string compares with the Invariant culture.
1515
1516         * rootcontext.cs: 
1517         * gen-treedump.cs: 
1518         * expression.cs: 
1519         * driver.cs: 
1520         * decl.cs: 
1521         * codegen.cs: 
1522         * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
1523         the comparison is done with the Invariant culture.
1524
1525 2003-11-27  Miguel de Icaza  <miguel@ximian.com>
1526
1527         * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
1528         GetEnumerator method.
1529
1530         (ProbeCollectionType): Iterate starting at the most specific type
1531         upwards looking for a GetEnumerator
1532
1533         * expression.cs: Shift count can be up to 31 for int/uint and 63
1534         for long/ulong.
1535
1536 2003-11-26  Miguel de Icaza  <miguel@ximian.com>
1537
1538         * statement.cs (Block.LookupLabel): Also look for the label on the
1539         children blocks.  Use a hash table to keep track of visited
1540         nodes. 
1541
1542         * cfold.cs (IntConstant to UIntConstant mapping): Only return if
1543         we actually did transform the other operand, otherwise fall back
1544         to the common codepath that casts to long.
1545
1546         * cs-tokenizer.cs: Use the same code pattern as the int case.
1547         Maybe I should do the parsing myself, and avoid depending on the
1548         Parse routines to get this done.
1549
1550 2003-11-25  Miguel de Icaza  <miguel@ximian.com>
1551
1552         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
1553         which fixes bug 51347.  This time test it.
1554         
1555         * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
1556         attributes for example can not tell the difference between these.
1557         The difference was only a syntax feature of the language. 
1558
1559         * attribute.cs: Apply attributes to delegates.
1560
1561         * delegate.cs: Call the apply attributes method.
1562
1563 2003-11-24  Miguel de Icaza  <miguel@ximian.com>
1564
1565         * convert.cs (TryImplicitIntConversion): One line bug fix: we were
1566         comparing 0 vs Byte.MinValue, not the value
1567
1568         (ImplicitConversionRequired): When reporting a conversion error,
1569         use error 31 to print out the constant error instead of the
1570         simpler 29.
1571
1572         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
1573         which fixes bug 51347.
1574         
1575 2003-11-22  Miguel de Icaza  <miguel@ximian.com>
1576
1577         * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen) 
1578         which fixes the -warnaserror command line option.
1579         
1580 2003-11-21  Miguel de Icaza  <miguel@ximian.com>
1581
1582         * cfold.cs (DoNumericPromotions): During constant folding of
1583         additions on UIntConstant, special case intconstants with
1584         IntConstants like we do on the expression binary operator. 
1585
1586 2003-11-12  Miguel de Icaza  <miguel@ximian.com>
1587
1588         * convert.cs (ImplicitReferenceConversion): We were missing a case
1589         (System.Enum are not value types or class types, so we need to
1590         classify them separatedly).
1591
1592         * driver.cs: We do not support error 2007.
1593
1594 2003-11-12 Jackson Harper <jackson@ximian.com>
1595
1596         * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
1597         system directory. Also use the full file name so users can
1598         libraries names mscorlib-o-tron.dll in a non system dir.
1599         
1600 2004-01-04  David Sheldon <dave-mono@earth.li>
1601
1602         * expression.cs: Added matching ")" to error message for CS0077.
1603
1604 2003-12-19  Martin Baulig  <martin@ximian.com>
1605
1606         * typemanager.cs (TypeManager.IsEqualGenericType): New public
1607         static method; see documentation in the method.
1608         (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
1609
1610         * convert.cs (Convert.ImplicitReferenceConversion,
1611         Convert.ImplicitReferenceConversionExists): Add support for
1612         generic type declarations; see gen-36.cs.
1613
1614 2003-12-19  Martin Baulig  <martin@ximian.com>
1615
1616         * pending.cs (Pending.InterfaceMethod): Use
1617         `Type.IsAssignableFrom()' instead of `=='.
1618
1619 2003-12-18  Martin Baulig  <martin@ximian.com>
1620
1621         * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
1622         byref types first.
1623
1624         * convert.cs (Convert.ImplicitStandardConversionExists): Use
1625         `expr_type.Equals (target_type)' instead of `=='.
1626
1627 2003-12-08  Martin Baulig  <martin@ximian.com>
1628
1629         * generics.cs (Constraints.Types): Removed.
1630         (Constraints.Resolve): Just resolve everything to TypeExpr's, not
1631         to Type's.
1632         (Constraints.ResolveTypes): New public method; resolves the
1633         TypeExpr's to Type's.
1634         (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
1635         longer takes the constraints.
1636         (TypeParameter.DefineMethod): Likewise.
1637         (TypeParameter.DefineType): New public method.  Calls
1638         `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
1639         the constraints.
1640
1641 2003-12-08  Martin Baulig  <martin@ximian.com>
1642
1643         * convert.cs (Convert.ImplicitConversionStandard): Use
1644         `expr_type.Equals (target_type)' instead of `=='.
1645
1646 2003-12-08  Martin Baulig  <martin@ximian.com>
1647
1648         * typemanager.cs (TypeManager.GetReferenceType): Call
1649         `Type.MakeByRefType ()'.
1650
1651 2003-12-08  Martin Baulig  <martin@ximian.com>
1652
1653         * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
1654         just has some special meaning in some situations.  For instance,
1655         it is allowed to use `where' as the name of a variable etc.
1656
1657 2003-12-04  Martin Baulig  <martin@ximian.com>
1658
1659         * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
1660         `Type.MakeArrayType()' for array types.
1661
1662 2003-11-18  Miguel de Icaza  <miguel@ximian.com>
1663
1664         * expression.cs (Invocation.VerifyArgumentsCompat): Remove
1665         debugging message.
1666
1667         (SizeOf.DoResolve): assign the `type_queried' field.  This gets
1668         corlib to compile.
1669
1670 2003-11-16  Martin Baulig  <martin@ximian.com>
1671
1672         * codegen.cs (EmitContext.IsGeneric): Removed.
1673
1674         * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
1675         ResolveGeneric() on the DeclSpace.
1676
1677 2003-11-16  Martin Baulig  <martin@ximian.com>
1678
1679         * generic.cs (TypeArguments.Resolve):
1680         `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
1681         `ResolveType()' on it to get the Type.
1682
1683 2003-11-15  Martin Baulig  <martin@ximian.com>
1684
1685         * generic.cs (ConstructedType.GetInterfaces): Override this.
1686
1687 2003-11-14  Martin Baulig  <martin@ximian.com>
1688
1689         * interface.cs (Interface.DefineType): Define all type parameters
1690         before adding the interfaces we inherit.
1691
1692 2003-11-11  Martin Baulig  <martin@ximian.com>
1693
1694         * generic.cs (ConstructedType.ResolveType): Always call
1695         `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
1696
1697 2003-11-10  Martin Baulig  <martin@ximian.com>
1698
1699         * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
1700         (TypeManager.InitCoreTypes): Initialize them here, but instead of
1701         calling `ResolveType()' on them, directly assign their `Type'.
1702
1703 2003-11-08  Martin Baulig  <martin@ximian.com>
1704
1705         * generic.cs (ConstructedType): Override `IsClass' etc.
1706
1707 2003-11-08  Martin Baulig  <martin@ximian.com>
1708
1709         * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
1710         return value and the `out parent' parameter.
1711         (TypeContainer.DefineType): Moved the CS0644 check into
1712         GetClassBases().  Don't pass the interface types to the
1713         `builder.DefineType()'/`builder.DefineNestedType()', but resolve
1714         them later and then call `TypeBuilder.AddInterfaceImplementation()'.
1715
1716         * ecore.cs (TypeExpr.IsAttribute): New property.
1717         (TypeExpr.GetInterfaces): New method.
1718
1719         * interface.cs (Interface.GetInterfaceTypeByName): Return a
1720         TypeExpr instead of a Type.
1721         (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
1722         (Interface.DefineType): Don't pass the interface types to the
1723         `builder.Definetype()'/`builder.DefineNestedType()', but resolve
1724         them later and then call `TypeBulider.AddInterfaceImplementation()'.
1725
1726         * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
1727         instead of a `Type[]'.
1728         (TypeManager.RegisterBuilder): Likewise.
1729         (TypeManager.AddUserInterface): Likewise.
1730         (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
1731         `Type[]' and also return a `TypeExpr[]'.
1732         (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
1733
1734 2003-11-08  Martin Baulig  <martin@ximian.com>
1735
1736         * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
1737         Expression.     
1738
1739 2003-11-08  Martin Baulig  <martin@ximian.com>
1740
1741         * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
1742         TypeManager.ResolveExpressionTypes().
1743
1744         * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
1745         instead of an Expression.
1746         (TypeExpr): This is now an abstract base class for `TypeExpression'.
1747         (TypeExpression): New public class; formerly known as `TypeExpr'.
1748
1749         * expression.cs (ComposedCast): Derive from TypeExpr.
1750
1751         * typemanager.cs (TypeManager.system_*_expr): These are now
1752         TypExpr's instead of Expression's.
1753         (TypeManager.ResolveExpressionTypes): New public static function;
1754         called from DeclSpace.GetTypeResolveEmitContext() to resolve all
1755         of them.        
1756
1757 2003-11-06  Miguel de Icaza  <miguel@ximian.com>
1758
1759         * expression.cs (New.DoResolve): Do not dereference value that
1760         might be a null return.
1761
1762         * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
1763         sure that the constant value has the right type.  Fixes an
1764         unreported bug, similar to 50425.
1765
1766         * const.cs (Const.LookupConstantValue): Call
1767         ImplicitStandardConversionExists before doing a conversion to
1768         avoid havng the TypeManager.ChangeType do conversions.
1769
1770         Reduced the number of casts used
1771
1772         (Const.ChangeType): New routine to enable reuse of the constant
1773         type changing code from statement.
1774
1775         * typemanager.cs (ChangeType): Move common initialization to
1776         static global variables.
1777
1778         Fixes #50425.
1779
1780         * convert.cs (ImplicitReferenceConversion): Somehow we allowed
1781         every value type to go through, even if it was void.  Fix that. 
1782
1783         * cs-tokenizer.cs: Use is_identifier_start_character on the start
1784         character of the define, and the is_identifier_part_character for
1785         the rest of the string.
1786
1787 2003-11-05  Miguel de Icaza  <miguel@ximian.com>
1788
1789         * expression.cs (UnaryMutator.EmitCode): When I updated
1790         LocalVariableReference.DoResolve, I overdid it, and dropped an
1791         optimization done on local variable references.
1792
1793 2003-11-04  Miguel de Icaza  <miguel@ximian.com>
1794
1795         * ecore.cs: Convert the return from Ldlen into an int.
1796
1797 2003-10-20  Miguel de Icaza  <miguel@ximian.com>
1798
1799         * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
1800         the accessibility, this is a special case for toplevel non-public
1801         classes (internal for instance).
1802
1803 2003-10-20  Nick Drochak <ndrochak@gol.com>
1804
1805         * ecore.cs: Fix typo and build.  Needed another right paren.
1806
1807 2003-10-19  Miguel de Icaza  <miguel@ximian.com>
1808
1809         * ecore.cs: Applied fix from Ben Maurer.   We were handling in the
1810         `internal' case regular and protected, but not allowing protected
1811         to be evaluated later.  Bug 49840
1812
1813 2003-10-15  Miguel de Icaza  <miguel@ximian.com>
1814
1815         * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
1816         to kb.Nlast, and not the kb.nFirst to isolate the switch
1817         statement.
1818
1819         Extract the underlying type, so enumerations of long/ulong are
1820         treated like long/ulong.
1821
1822 2003-10-14  Miguel de Icaza  <miguel@ximian.com>
1823
1824         * expression.cs (New): Overload the meaning of RequestedType to
1825         track the possible creation of the NewDelegate type, since
1826         DoResolve is invoked more than once for new constructors on field
1827         initialization.
1828
1829         See bugs: #48800 and #37014
1830
1831         * cs-parser.jay (declare_local_constants): Take an arraylist
1832         instead of a single constant.
1833
1834         (local_constant_declaration): It should take a
1835         constant_declarators, not a constant_declarator.  Fixes 49487
1836
1837         * convert.cs: Fix error report.
1838
1839 2003-10-13 Jackson Harper <jackson@ximian.com>
1840
1841         * typemanager.cs (TypeToCoreType): Add float and double this fixes
1842         bug #49611
1843         
1844 2003-11-03  Martin Baulig  <martin@ximian.com>
1845
1846         * expression.cs (ArrayAccess.GetStoreOpcode): Added
1847         `out bool has_type_arg'; if set, we need to pass the type to
1848         ig.Emit().
1849         (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
1850         Stelem_Any/Ldelem_Any for generic parameters.   
1851
1852 2003-11-02  Martin Baulig  <martin@ximian.com>
1853
1854         * expression.cs (Invocation.EmitCall): Use
1855         `TypeManager.IsValueType()' to check whether it's a value type.
1856         Don't set `struct_call' when calling a method on a type parameter.
1857
1858 2003-11-02  Martin Baulig  <martin@ximian.com>
1859
1860         * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
1861         and removed the TypeBuilder argument.
1862
1863         * typemanager.cs (TypeManager.IsValueType): Return
1864         `t.IsGenericParameter || t.IsValueType'.
1865
1866 2003-10-25  Martin Baulig  <martin@ximian.com>
1867
1868         * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
1869         call ConstructedType.Resolve() on it.
1870
1871         * generic.cs (ConstructedType.Resolve): Set `type' on success.
1872
1873 2003-10-25  Martin Baulig  <martin@ximian.com>
1874
1875         * class.cs (TypeContainer.GetClassBases): Changed
1876         `out Type parent' into `out TypeExpr parent'.  Moved CS0644 and
1877         CS8214 reporting here.
1878         (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
1879         instead of a `Type' for our parent.  In case of a recursive
1880         declaration (see tests/gen-23.cs for an example), our parent is a
1881         ConstructedType and it doesn't have its type set.  So, first
1882         create our own TypeBuilder, then call constructed.Resolve() to get
1883         the parent's type and finally TypeBuilder.SetParent() it.
1884
1885         * ecore.cs (TypeExpr.Name): New public virtual property.
1886
1887         * generic.cs
1888         (ConstructedType): We're now a TypeExpr and not just an Expression.
1889         (ConstructedType.ResolveAsTypeStep): Don't resolve our type
1890         arguments here; this is done later.
1891         (ConstructedType.Resolve): New public method to resolve the type
1892         arguments and bind them.
1893
1894 2003-10-21  Martin Baulig  <martin@ximian.com>
1895
1896         * convert.cs: Use `TypeManager.IsValueType' instead of
1897         'type.IsValueType' everywhere.
1898
1899         * typemanager.cs (TypeManager.IsValueType): Return true for type
1900         parameters.  The reason for this is that we need to box a type
1901         parameter when converting it to a reference type.
1902
1903         * cs-parser.jay: Added support for default value expressions.
1904
1905         * generics.cs (DefaultValueExpression): New public class.       
1906
1907 2003-10-17  Martin Baulig  <martin@ximian.com>
1908
1909         * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
1910         TypeContainer so we can also use this for Interfaces.
1911         (TypeParameter.Resolve): Likewise.
1912
1913         * interface.cs (Interface.DefineType): Added support for generic
1914         interfaces.
1915
1916         * cs-parser.jay: Added support for generic structs and interfaces.
1917
1918 2003-10-17  Martin Baulig  <martin@ximian.com>
1919
1920         * generic.cs (GenericMemberAccess.DoResolve): We can now actually
1921         call generic methods :-)
1922
1923 2003-10-16  Martin Baulig  <martin@ximian.com>
1924
1925         * cs-parser.jay (namespace_or_type_name): Only create a
1926         GenericMemberAccess if we actually have type arguments.
1927
1928 2003-10-13  Martin Baulig  <martin@ximian.com>
1929
1930         * class.cs (Method.Define): If we're a generic method, call
1931         TypeBuilder.DefineGenericMethod () before resolving
1932         the parameters.
1933         (MethodData): Added .ctor which takes an additional MethodBuilder
1934         argument; this is used for generic methods.
1935         (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
1936         we already have a MethodBuilder.
1937
1938 2003-10-10  Martin Baulig  <martin@ximian.com>
1939
1940         * class.cs (Method): Added .ctor which takes a `GenericMethod'
1941         instead of a `DeclSpace'.  This is used for generic methods.
1942
1943         * cs-parser.jay (method_header): Added support for generic
1944         methods; create a `GenericMethod' instance and pass it to the
1945         `Method's .ctor; it'll be used as the `DeclSpace' to lookup
1946         parameters and locals.
1947
1948         * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
1949         since we already have the location.  Check whether we're a generic
1950         type declaration or a generic method and create the correct type
1951         parameter.
1952
1953         * generic.cs (TypeParameter.DefineMethod): New public method.
1954         (GenericMethod): New public class; derives from DeclSpace and is
1955         used for generic methods.       
1956
1957 2003-10-09  Martin Baulig  <martin@ximian.com>
1958
1959         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
1960         to the .ctor.
1961         (MethodCore.DoDefineParameters): Removed the TypeContainer
1962         argument; use the DeclSpace which was passed to the .ctor instead.
1963         (MethodCore.CheckParameter): Take a DeclSpace instead of a
1964         TypeContainer; we only need a DeclSpace here.
1965
1966 2003-10-09  Martin Baulig  <martin@ximian.com>
1967
1968         * class.cs (MethodData): Added additional `DeclSpace ds' argument
1969         to the .ctor.
1970         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
1971         EmitContext's .ctor.    
1972
1973 2003-10-09  Martin Baulig  <martin@ximian.com>
1974
1975         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
1976         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
1977         AsAccessible(), moved them as well.
1978
1979         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
1980
1981 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
1982
1983         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
1984         generation for >=, as spotted by Paolo, bug 48679.  
1985         Patch from David Waite.
1986
1987         * cs-tokenizer.cs: Add handling for #pragma.
1988
1989         * cs-parser.jay: Allow for both yield and yield return in the
1990         syntax.  The anti-cobolization of C# fight will go on!
1991
1992         * class.cs (TypeBuilder.DefineType): Catch error condition here
1993         (Parent.DefineType erroring out and returning null).
1994
1995         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1996         coping with enumerations variables, we were mistakenly processing
1997         them as a regular value type instead of built-in types.  Fixes the
1998         bug #48063
1999
2000         * typemanager.cs (IsBuiltinOrEnum): New method.
2001
2002 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
2003
2004         * cs-parser.jay: Upgrade: yield now needs the return clause.
2005
2006 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
2007
2008         * cs-parser.jay : Renamed yyName to yyNames related to jay.
2009
2010 2003-09-29  Martin Baulig  <martin@ximian.com>
2011
2012         * typemanager.cs (TypeManager.GetMethodFlags): Added support for
2013         inflated generic methods.
2014
2015         * generics.cs (ConstructedType): Distinguish between open and
2016         closed constructed types; correctly resolve the arguments.
2017
2018 2003-09-22  Martin Baulig  <martin@ximian.com>
2019
2020         * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
2021         all type arguments meet their constraints.
2022
2023 2003-09-19  Martin Baulig  <martin@ximian.com>
2024
2025         * decl.cs (MemberCache.SetupCacheForInterface): Take a
2026         `MemberCache parent' argument.  Normally, an interface doesn't
2027         have a parent type except System.Object, but we use this in gmcs
2028         for generic type parameters.
2029
2030 2003-09-18  Martin Baulig  <martin@ximian.com>
2031
2032         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
2033         on `type.IsInterface'; don't check whether the type has a parent
2034         to determine whether it's an interface.
2035
2036 2003-09-17  Martin Baulig  <martin@ximian.com>
2037
2038         * generic.cs (ConstructedType.ToString): Always use `name' as the
2039         type name.
2040
2041 2003-09-15  Martin Baulig  <martin@ximian.com>
2042
2043         * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
2044
2045         * generic.cs (Constraints.Resolve): New public method; this is
2046         called to resolve the constraint types and to check whether all
2047         the constraints are correct.
2048         (Constraints.Types): New public property.
2049         (TypeParameter.Resolve): New public method; resolves all the
2050         type's constraints.
2051
2052         * class.cs (TypeContainer.DefineType): Call
2053         TypeParameter.Resolve() before actually defining the type.
2054
2055 2003-09-15  Martin Baulig  <martin@ximian.com>
2056
2057         * class.cs (TypeContainer.DefineType): Added an error flag to
2058         avoid reporting duplicate CS0146's ("class definition is
2059         circular.").
2060
2061         * driver.cs (Driver.MainDriver): Abort if
2062         RootContext.ResolveTree() reported any errors.
2063
2064 2003-09-07  Martin Baulig  <martin@ximian.com>
2065
2066         * report.cs (Error, Warning): Added overloaded versions which take
2067         a `params object[] args' and call String.Format().
2068
2069 2003-09-07  Martin Baulig  <martin@ximian.com>
2070
2071         * decl.cs (DeclSpace..ctor): Don't call
2072         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
2073         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
2074         (DeclSpace.RecordDecl): New method.
2075
2076         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
2077
2078 2003-09-02  Ravi Pratap  <ravi@ximian.com>
2079
2080         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
2081         value attributes to be applied to ParameterBuilders.
2082
2083         * class.cs (MethodCore.LabelParameters): Make static and more
2084         generic so that it can be used from other places - like interface
2085         methods, for instance.
2086
2087         * interface.cs (Interface.Emit): Call LabelParameters before
2088         emitting attributes on the InterfaceMethod.
2089
2090 2003-09-07  Martin Baulig  <martin@ximian.com>
2091
2092         * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
2093         if the number of type parameters doesn't match.
2094
2095 2003-09-04  Martin Baulig  <martin@ximian.com>
2096
2097         * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
2098         for arrays of generic type params (ie. `!0[]').
2099
2100 2003-09-04  Martin Baulig  <martin@ximian.com>
2101
2102         * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
2103         for the moment.
2104
2105 2003-09-04  Martin Baulig  <martin@ximian.com>
2106
2107         * decl.cs (DeclSpace.LookupGeneric): New method.
2108         (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
2109         moment.
2110
2111         * generic.cs (TypeParameterExpr): Take a TypeParameter as
2112         argument, not just a string.
2113         (TypeParameter.Define): New public method; this is called to
2114         actually define the generic parameter; after this, you can use the
2115         new `Type' property to get the type.
2116
2117 2003-09-04  Martin Baulig  <martin@ximian.com>
2118
2119         * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
2120         is now an ArrayList; initialize the result of the `TypeParameters'
2121         property here.
2122         (DeclSpace.GetGenericData): Removed.
2123         (DeclSpace.LookupGeneric): Temporarily removed; we need to
2124         implement this in a different way.
2125         (DeclSpace.GetTypeParameters): Removed; there's now a
2126         `TypeParameters' property.
2127         (DeclSpace.TypeParameters): New public property.
2128
2129         * generic.cs (Constraints): Make this class public.
2130         (TypeParameter): New public class.
2131
2132 2003-09-04  Martin Baulig  <martin@ximian.com>
2133
2134         * decl.cs (DeclSpace.GetTypeParameters): New method to return the
2135         generic parameters.
2136
2137         * class.cs (TypeContainer.DefineType): Call
2138         TypeBuilder.DefineGenericParameter () on all generic parameters if
2139         this is a generic type.
2140
2141 2003-08-28  Martin Baulig  <martin@ximian.com>
2142
2143         * sample-stack.il: Compile this with ilasm: "ilasm /dll
2144         sample-stack.il".
2145
2146         * sample-hello.cs: Compile this with gmcs: "gmcs
2147         /r:sample-stack.dll sample-hello.cs".
2148
2149 2003-08-28  Martin Baulig  <martin@ximian.com>
2150
2151         * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
2152         the parameters to the generic type.
2153
2154 2003-08-28  Martin Baulig  <martin@ximian.com>
2155
2156         * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
2157
2158 2003-08-28  Martin Baulig  <martin@ximian.com>
2159
2160         * cs-parser.jay (opt_type_argument_list): Use
2161         `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
2162         (primary_expression): Replace `qualified_identifier' with `type_name'.
2163         (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
2164
2165         * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
2166         parser to check whether it is syntactically a type parameter list;
2167         return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
2168         this case.
2169
2170 2003-08-26  Martin Baulig  <martin@ximian.com>
2171
2172         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
2173         resolving aliases; fixes #47927.
2174
2175 2003-08-26  Martin Baulig  <martin@ximian.com>
2176
2177         * statement.cs (Using.DoResolve): This is internally emitting a
2178         try/finally clause, so we need to set ec.NeedExplicitReturn if we
2179         do not always return.  Fixes #47681.
2180
2181 2003-08-26  Martin Baulig  <martin@ximian.com>
2182
2183         * decl.cs (MemberCore): Moved WarningNotHiding(),
2184         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
2185         into MemberBase.
2186         (AdditionResult): Make this nested in DeclSpace.
2187         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
2188         argument; call NamespaceEntry.Define() unless we're nested in a
2189         class or struct.
2190
2191         * namespace.cs (Namespace.DefineName): New public function.  This
2192         is called from DeclSpace's .ctor to add 
2193         (Namespace.Lookup): Include DeclSpaces in the lookup.
2194
2195         * class.cs (Operator): Derive from MemberBase, not MemberCore.
2196
2197         * const.cs (Const): Derive from MemberBase, not MemberCore.     
2198
2199 2003-08-25  Martin Baulig  <martin@ximian.com>
2200
2201         * convert.cs (Convert.ExplicitReferenceConversion): When
2202         converting from an interface type to a class, unbox if the target
2203         type is a struct type.  Fixes #47822.
2204
2205 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2206
2207         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
2208         #47854.
2209
2210 2003-08-22  Martin Baulig  <martin@ximian.com>
2211
2212         * class.cs (TypeManager.DefineType): When defining a nested type,
2213         call DefineType() on our parent; fixes #47801.
2214
2215 2003-08-22  Martin Baulig  <martin@ximian.com>
2216
2217         * class.cs (MethodData.Define): While checking if a method is an
2218         interface implementation, improve the test a bit more to fix #47654.
2219
2220 2003-08-22  Martin Baulig  <martin@ximian.com>
2221
2222         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
2223         correctly; fixes #47722.
2224
2225 2003-08-22  Martin Baulig  <martin@ximian.com>
2226
2227         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
2228         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
2229
2230         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
2231
2232 2003-08-22  Martin Baulig  <martin@ximian.com>
2233
2234         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
2235         can only be assigned in static constructors.  Fixes #47161.
2236
2237 2003-08-22  Martin Baulig  <martin@ximian.com>
2238
2239         Rewrote and improved the flow analysis code.
2240
2241         * flowbranching.cs (FlowBranching): Make this class abstract.
2242         (FlowBranching.CreateBranching): New static function to create a
2243         new flow branching.
2244         (FlowBranchingBlock, FlowBranchingException): New classes.
2245         (FlowBranching.UsageVector.Type): New public readonly field.
2246         (FlowBranching.UsageVector.Breaks): Removed the setter.
2247         (FlowBranching.UsageVector.Returns): Removed the setter.
2248         (FlowBranching.UsageVector): Added Break(), Return(),
2249         NeverReachable() and Throw() methods to modify the reachability.
2250         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
2251         done by FlowBranching.Merge().
2252         (FlowBranching.UsageVector.MergeChild): New method; merges the
2253         merge result into the current vector.
2254         (FlowBranching.Merge): New abstract method to merge a branching.
2255
2256 2003-08-12  Martin Baulig  <martin@ximian.com>
2257
2258         * expression.cs (Indirection.CacheTemporaries): Create the
2259         LocalTemporary with the pointer type, not its element type.
2260
2261 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
2262
2263         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
2264         token was a keyword or not.
2265
2266         Add `error' options where an IDENTIFIER was expected;  Provide
2267         CheckToken and CheckIdentifierToken convenience error reporting
2268         functions. 
2269
2270         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
2271
2272         * decl.cs: Rename `NamespaceEntry Namespace' public field into
2273         NameSpaceEntry NameSpaceEntry.
2274
2275         (LookupInterfaceOrClass): Avoid creating a full qualified name
2276         from namespace and name: avoid doing lookups when we know the
2277         namespace is non-existant.   Use new Tree.LookupByNamespace which
2278         looks up DeclSpaces based on their namespace, name pair.
2279
2280         * driver.cs: Provide a new `parser verbose' to display the
2281         exception thrown during parsing.  This is turned off by default
2282         now, so the output of a failure from mcs is more graceful.
2283
2284         * namespace.cs: Track all the namespaces defined in a hashtable
2285         for quick lookup.
2286         
2287         (IsNamespace): New method
2288
2289 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
2290
2291         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
2292         we know that we need to concatenate (full typename can never be
2293         null). 
2294
2295         * class.cs: ditto.
2296
2297         * statement.cs: Use a bitfield;  Do not initialize to null things
2298         which are done by the constructor by default.
2299
2300         * cs-parser.jay: bug fix, parameter was 4, not 3.
2301
2302         * expression.cs: Just use the property;
2303
2304         * statement.cs: No need for GetVariableInfo method.
2305
2306 2003-08-08  Martin Baulig  <martin@ximian.com>
2307
2308         * flowanalysis.cs (FlowReturns): This is now nested in the
2309         `FlowBranching' class.
2310         (MyBitVector): Moved this here from statement.cs.
2311         (FlowBranching.SiblingType): New enum type.
2312         (FlowBranching.CreateSibling): Added `SiblingType' argument.
2313
2314 2003-08-07  Martin Baulig  <martin@ximian.com>
2315
2316         * flowanalysis.cs (FlowBranchingType): This is now nested in the
2317         `FlowBranching' class and called `BranchingType'.
2318
2319 2003-08-07  Martin Baulig  <martin@ximian.com>
2320
2321         * flowanalysis.cs: Moved all the control flow analysis code into
2322         its own file.
2323
2324 2003-08-07  Martin Baulig  <martin@ximian.com>
2325
2326         * assign.cs (Assign.DoResolve): `target' must either be an
2327         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
2328         #37319.
2329
2330 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
2331
2332         * expression.cs (BinaryMethod): This kind of expression is created by the
2333         Binary class if it determines that the operator has to be handled
2334         by a method.
2335
2336         (BinaryDelegate): This kind of expression is created if we are
2337         dealing with a + or - operator on delegates.
2338
2339         (Binary): remove method, argumetns, and DelegateOperator: when
2340         dealing with methods, 
2341         
2342         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
2343
2344         * statement.cs (Block): use bitfields for the three extra booleans
2345         we had in use.   Remove unused topblock parameter.
2346
2347         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
2348
2349         * assign.cs: Drop extra unneeded tests.
2350
2351 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
2352
2353         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
2354
2355         * statement.cs (Foreach): Use VariableStorage instead of
2356         LocalBuilders.   
2357
2358         * codegen.cs (VariableStorage): New class used by clients that
2359         require a variable stored: locals or fields for variables that
2360         need to live across yield.
2361
2362         Maybe provide a convenience api for EmitThis+EmitLoad?
2363
2364         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
2365         these bad boys.
2366
2367 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
2368
2369         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
2370         RemapParameterLValue): New methods that are used to turn a
2371         precomputed FieldInfo into an expression like this:
2372
2373                 instance.FieldInfo
2374
2375         The idea is to use this instead of making LocalVariableReference
2376         have more than one meaning.
2377
2378         * cs-parser.jay: Add error production to BASE.
2379
2380         * ecore.cs: Deal with TypeManager.GetField returning null, which
2381         is now a valid return value.
2382
2383         (FieldExprNoAddress): New expression for Fields whose address can
2384         not be taken.
2385
2386         * expression.cs (LocalVariableReference): During the resolve
2387         phases, create new expressions if we are in a remapping context.
2388         Remove code that dealt with remapping here.
2389
2390         (ParameterReference): same.
2391
2392         (ProxyInstance): New expression, like the `This' expression, but
2393         it is born fully resolved.  We know what we are doing, so remove
2394         the errors that are targeted to user-provided uses of `this'.
2395
2396         * statement.cs (Foreach): our variable is now stored as an
2397         Expression;  During resolution, follow the protocol, dont just
2398         assume it will return this.
2399         
2400 2003-08-06  Martin Baulig  <martin@ximian.com>
2401
2402         * support.cs (SeekableStreamReader.cs): New public class.
2403
2404         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
2405         SeekableStreamReader instead of the normal StreamReader.
2406
2407 2003-08-04  Martin Baulig  <martin@ximian.com>
2408
2409         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
2410         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
2411         deambiguate casts and delegate invocations.
2412         (parenthesized_expression): Use the new tokens to ensure this is
2413         not a cast of method invocation.
2414
2415         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
2416         when reading a `)' and Deambiguate_CloseParens () was previously
2417         called.
2418
2419         * expression.cs (ParenthesizedExpression): New class.  This is
2420         just used for the CS0075 test.
2421         (Binary.DoResolve): Check for CS0075.   
2422
2423 2003-07-29  Ravi Pratap  <ravi@ximian.com>
2424
2425         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
2426         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
2427         reference comparison.
2428
2429         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
2430         examine the ReturnType for equality - this is necessary in the
2431         cases of implicit and explicit operators whose signature also
2432         includes the return type.
2433
2434 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
2435
2436         * namespace.cs: Cache the result of the namespace computation,
2437         instead of computing it every time.
2438
2439 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
2440
2441         * decl.cs: Use a global arraylist that we reuse over invocations
2442         to avoid excesive memory consumption.  Reduces memory usage on an
2443         mcs compile by one meg (45 average).
2444
2445         * typemanager.cs (LookupTypeReflection): In .NET pointers are
2446         private, work around that.
2447
2448 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
2449
2450         * literal.cs (IntLiteral): Define Zero and One static literals. 
2451
2452         * cs-parser.jay (integer_literal): use static literals to reduce
2453         memory usage for the most used literals (0, 1 and -1).  211kb
2454         reduced in memory usage.
2455
2456         Replace all calls to `new ArrayList' with `new
2457         ArrayList(4)' which is a good average number for most allocations,
2458         and also requires only 16 bytes of memory for its buffer by
2459         default. 
2460
2461         This reduced MCS memory usage in seven megabytes for the RSS after
2462         bootstrapping.
2463
2464 2003-07-28  Ravi Pratap  <ravi@ximian.com>
2465
2466         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
2467         handle params methods the correct way by forming only one
2468         applicable set with params and normal methods in them. Earlier we
2469         were looking at params methods only if we found no normal methods
2470         which was not the correct thing to do.
2471
2472         (Invocation.BetterFunction): Take separate arguments indicating
2473         when candidate and the best method are params methods in their
2474         expanded form.
2475
2476         This fixes bugs #43367 and #46199.
2477
2478         * attribute.cs: Documentation updates.
2479
2480         (CheckAttribute): Rename to CheckAttributeTarget.
2481         (GetValidPlaces): Rename to GetValidTargets.
2482
2483         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
2484         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
2485
2486         Fixes bug #44468.
2487
2488 2003-07-28  Miguel de Icaza  <miguel@ximian.com>
2489
2490         * codegen.cs: Compute IsGeneric correctly.
2491
2492         * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
2493         resolution. 
2494
2495         Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
2496         OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN.  There were too many
2497         regressions, and I was chasing more bugs than I required.
2498
2499         * interface.cs: Use expressions for base type names (like classes
2500         and structs have been doing for a while now), and resolve that.
2501         This patch should probably go into head as well.
2502
2503         This makes it one less user of FindType.
2504
2505 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
2506
2507         This compiler can not self host currently.  Need to fix that.
2508         
2509         * Makefile: compile to `gmcs.exe'
2510
2511         * driver.cs: Turn on v2 by default on gmcs.
2512
2513         * generic.cs (ConstructedType): Does no longer take a container
2514         type argument;  That will be taken care of later.
2515
2516         (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
2517         Use SimpleName to resolve for now, so we can continue the work on
2518         the parser, until we get Type.GetType that understands generics.
2519
2520         (ConstructedType.ToString): Implement
2521
2522         (TypeArguments.Resolve): Resolve the child expressions as types. 
2523         
2524         * cs-parser.jay: Rename interface_constraints to
2525         type_parameter_constraints
2526
2527         (namespace_or_type_name): Only use constructed types for the basic
2528         construction, we will deal with identifier<...> later.
2529
2530         (type/type_name): No longer call DecomposeQI, as
2531         namespace_or_type_name is always decoded now.
2532         
2533 2003-07-22  Ravi Pratap  <ravi@ximian.com>
2534
2535         * expression.cs (Invocation.OverloadResolve): Follow the spec more
2536         closely: we eliminate methods in base types when we have an
2537         applicable method in a top-level type.
2538
2539         Please see section 14.5.5.1 for an exact description of what goes
2540         on. 
2541
2542         This fixes bug #45127 and a host of other related to corlib compilation.
2543
2544         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
2545         array is the method corresponding to the top-level type (this is
2546         because of the changes made to icall.c) so we change this
2547         accordingly.
2548
2549         (MethodGroupExpr.Name): This too.
2550
2551         * typemanager.cs (GetElementType): New method which does the right
2552         thing when compiling corlib. 
2553
2554         * everywhere: Make use of the above in the relevant places.
2555
2556 2003-07-22  Martin Baulig  <martin@ximian.com>
2557
2558         * cs-parser.jay (invocation_expression): Moved
2559         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
2560         `cast_expression', but create a InvocationOrCast which later
2561         resolves to either an Invocation or a Cast.
2562
2563         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
2564         method; call this before EmitStatement() to make sure that this
2565         expression can be used as a statement.
2566
2567         * expression.cs (InvocationOrCast): New class; resolves to either
2568         an Invocation or a Cast.
2569
2570         * statement.cs (StatementExpression): Call ResolveStatement() on
2571         the ExpressionStatement before emitting it.
2572
2573 2003-07-21  Martin Baulig  <martin@ximian.com>
2574
2575         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
2576         `ref' and `out' attributes match; fixes #46220.
2577         (MemberAccess.ResolveMemberAccess): You can't reference a type
2578         through an expression; fixes #33180.
2579         (Indexers.GetIndexersForType): Don't return the indexers from
2580         interfaces the class implements; fixes #46502.
2581
2582 2003-07-21  Martin Baulig  <martin@ximian.com>
2583
2584         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
2585         CS0661 checks; fixes bug #30442.
2586
2587 2003-07-21  Martin Baulig  <martin@ximian.com>
2588
2589         * decl.cs (AdditionResult): Added `Error'.
2590
2591         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
2592
2593         * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
2594         cs0031.cs actually work.
2595
2596  2003-07-20  Miguel de Icaza  <miguel@ximian.com>
2597  
2598         * cs-parser.jay (namespace_name): do not use
2599         namespace_or_type_name, use qualified_identifier, because
2600         namespace_or_type_name will soon return a composed expression
2601         instead of a string.
2602  
2603         (namespace_or_type_name): Instead of returning a string, now this
2604         production returns an expression.
2605  
2606         * codegen.cs (EmitContext): Setup IsGeneric property based on
2607         whether our DeclSpace is generic, our the method is generic.
2608  
2609         * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
2610         the method is generic.
2611  
2612         * cs-parser.jay (type_arguments, opt_type_argument_list,
2613         type_parameters, type_parameter_list, opt_type_parameter_list,
2614         type_parameter,, opt_type_parameter_constraints_clauses,
2615         type_parameter_constraints_clauses,
2616         type_parameter_constraint_clause, type_parameter_constraint,
2617         interface_constraints): Add new production
2618  
2619         * decl.cs (DeclSpace): IsGeneric, flag to track whether this
2620         DeclSpace is generic or not.
2621  
2622         (DeclSpace.SetParameterInfo): New routine, used to set the
2623         parameter info for a type.
2624  
2625         (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
2626         returns a GenericTypeExpr
2627  
2628         * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
2629         generic, lookup the generic argument.
2630  
2631         * attribute.cs: Do not allow TypeParameterExpressions in
2632         Attributes.
2633  
2634         * class.cs: Do not allow the Main method to be defined in a
2635         Generic container.
2636  
2637         * expression.cs (SizeOf): Do not allow generic types to be used as
2638         arguments to sizeof.
2639  
2640         * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
2641         it: whether a type is generic or not.  Only works for types we are
2642         currently building for now.
2643         
2644 2003-07-20  Martin Baulig  <martin@ximian.com>
2645
2646         * namespace.cs: Fixed that bug which caused a crash when compiling
2647         the debugger's GUI.
2648
2649 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
2650
2651         * typemanager.cs (LookupTypeReflection): Never expose types which
2652         are NotPublic, NestedPrivate, NestedAssembly, or
2653         NestedFamANDAssem.  We used to return these, and later do a check
2654         that would report a meaningful error, but the problem is that we
2655         would not get the real match, if there was a name override.
2656
2657 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
2658
2659         * namespace.cs (Namespace, Name): Do not compute the namespace
2660         name dynamically, compute it in the constructor.  This reduced
2661         memory usage by 1697 KB.
2662
2663         * driver.cs: Use --pause to pause at the end.
2664
2665 2003-07-17  Peter Williams  <peter@newton.cx>
2666
2667         * Makefile: Change the name of the test target so that it doesn't
2668         conflict with the recursive test target.
2669
2670 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
2671
2672         * expression.cs (LocalVariableReference.Emit, EmitAssign,
2673         AddressOf): Do not use EmitThis, that was wrong, use the actual
2674         this pointer.
2675
2676 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
2677
2678         * class.cs (MethodData.Define): While checking if a method is an
2679         interface implementation, improve the test: If we are not public
2680         (use new test here: use the computed MethodAttributes directly,
2681         instead of the parsed modifier flags) check if the `implementing'
2682         method comes from an interface or not.
2683
2684         * pending.cs (VerifyPendingMethods): Slightly better error
2685         message.
2686
2687         * makefile: add test target that does the mcs bootstrap.
2688
2689 2003-07-16  Ravi Pratap  <ravi@ximian.com>
2690
2691         * interface.cs (Define): Do nothing here since there are no
2692         members to populate etc. Move the attribute emission out of here
2693         since this was just totally the wrong place to put it. Attribute
2694         application happens during the 'Emit' phase, not in the 'Define'
2695         phase.
2696
2697         (Emit): Add this method and move the attribute emission here
2698
2699         * rootcontext.cs (EmitCode): Call the Emit method on interface
2700         types too.
2701
2702 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
2703
2704         * expression.cs (OverloadResolve): Report error only if Location
2705         is not 'Null' which means that there was a probe going on.
2706
2707 2003-07-14  Martin Baulig  <martin@ximian.com>
2708
2709         * expression.cs (ConditionalLogicalOperator): New public class to
2710         implement user defined conditional logical operators.
2711         This is section 14.11.2 in the spec and bug #40505.
2712
2713 2003-07-14  Martin Baulig  <martin@ximian.com>
2714
2715         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
2716
2717 2003-07-14  Martin Baulig  <martin@ximian.com>
2718
2719         * codegen.cs (EmitContext.InFixedInitializer): New public field.
2720
2721         * ecore.cs (IVariable.VerifyFixed): New interface method.
2722
2723         * expression.cs (Unary.ResolveOperator): When resolving the `&'
2724         operator, check whether the variable is actually fixed.  Fixes bug
2725         #36055.  Set a variable definitely assigned when taking its
2726         address as required by the spec.
2727
2728         * statement.cs (LocalInfo.IsFixed): New field.
2729         (LocalInfo.MakePinned): Set `IsFixed' to true.
2730
2731 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
2732
2733         * attribute.cs (Attribute.Resolve): While doing a Member lookup
2734         for .ctors, ensure that we only ask for members declared in the
2735         attribute type (BindingFlags.DeclaredOnly).
2736
2737         Fixes bug #43632.
2738
2739         * expression.cs (Error_WrongNumArguments): Report error 1501
2740         correctly the way CSC does.
2741
2742 2003-07-13  Martin Baulig  <martin@ximian.com>
2743
2744         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
2745         lookup on the fully qualified name, to make things like "X.X" work
2746         where "X.X" is a fully qualified type name, but we also have a
2747         namespace "X" in the using list.  Fixes #41975.
2748
2749 2003-07-13  Martin Baulig  <martin@ximian.com>
2750
2751         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
2752         function. If we're a CompoundAssign, we need to create an embedded
2753         CompoundAssign, not an embedded Assign.
2754         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
2755         Fixes #45854.
2756
2757 2003-07-13  Martin Baulig  <martin@ximian.com>
2758
2759         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
2760         work to fix bug #46088.
2761
2762 2003-07-13  Ravi Pratap <ravi@ximian.com>
2763
2764         * class.cs (Operator.Emit): Do not emit attributes here - it is
2765         taken care of by the Method class that we delegate too. This takes
2766         care of bug #45876.
2767         
2768 2003-07-10  Martin Baulig  <martin@ximian.com>
2769
2770         * expression.cs (TypeOfVoid): New class.
2771         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
2772
2773 2003-07-10  Martin Baulig  <martin@ximian.com>
2774
2775         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
2776         bug #35957.
2777
2778 2003-07-10  Martin Baulig  <martin@ximian.com>
2779
2780         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
2781         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
2782
2783         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
2784
2785         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
2786
2787 2003-07-10  Martin Baulig  <martin@ximian.com>
2788
2789         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
2790         of decimal.  Fixes #42850.
2791
2792         NOTE: I also fixed the created byte blob, but this doesn't work on
2793         the MS runtime and csc never produces any byte blobs for decimal
2794         arrays.
2795
2796 2003-07-10  Martin Baulig  <martin@ximian.com>
2797
2798         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
2799         structs; fixes #32068.
2800         (Block.AddChildVariableNames): Fixed #44302.
2801
2802 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2803
2804         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
2805         
2806 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2807
2808         * attribute.cs: And this test is onger needed.
2809
2810 2003-07-08  Martin Baulig  <martin@ximian.com>
2811
2812         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
2813         inaccessible types.  Fixes #36313.
2814
2815         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
2816
2817         * namespace.cs (NamespaceEntry): Create implicit entries for all
2818         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
2819         implicit entries for N1.N2 and N1.
2820
2821 2003-07-08  Martin Baulig  <martin@ximian.com>
2822
2823         Rewrote the handling of namespaces to fix a lot of the issues
2824         wrt. `using' aliases etc.
2825
2826         * namespace.cs (Namespace): Splitted this class into a
2827         per-assembly `Namespace' and a per-file `NamespaceEntry'.
2828
2829         * typemanager.cs (TypeManager.IsNamespace): Removed.
2830         (TypeManager.ComputeNamespaces): Only compute namespaces from
2831         loaded assemblies here, not the namespaces from the assembly we're
2832         currently compiling.
2833
2834 2003-07-08  Martin Baulig  <martin@ximian.com>
2835
2836         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
2837
2838 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2839
2840         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
2841         already fixed it.  
2842
2843         I thought about the memory savings here, but LookupTypeReflection
2844         is used under already very constrained scenarios.  Compiling
2845         corlib or mcs only exposes one hit, so it would not really reduce
2846         any memory consumption.
2847
2848 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2849
2850         * typemanager.cs: fixes bug #45889 by only adding public types from
2851         other assemblies to the list of known types.
2852
2853 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2854
2855         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
2856         on the type we resolved.
2857
2858 2003-07-05  Martin Baulig  <martin@ximian.com>
2859
2860         * pending.cs (PendingImplementation.ParentImplements): Don't
2861         create the proxy if the parent is abstract.
2862
2863         * class.cs (TypeContainer.DefineIndexers): Process explicit
2864         interface implementations first.  Fixes #37714.
2865
2866 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
2867
2868         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
2869         defined recursively;  but since we modify the input parameters
2870         (left is set to `this' temporarily), we reset this value if the
2871         left_is_explicit is false, which gives the original semantics to
2872         the code.  
2873
2874         * literal.cs (NullPointer): new class used to represent a null
2875         literal in a pointer context.
2876
2877         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
2878         type is a pointer, use a NullPointer object instead of a
2879         NullLiteral.   Closes 43687
2880
2881         (ExplicitConversion): Convert pointer values using
2882         the conv opcode to the proper type.
2883
2884         * ecore.cs (New): change ValueTypeVariable property into a method,
2885         that returns whether the valuetype is suitable for being used.
2886
2887         * expression.cs (Binary.DoNumericPromotions): Only return if we
2888         the int constant was a valid uint, and we can return both left and
2889         right as uints.  If not, we continue processing, to trigger the
2890         type conversion.  This fixes 39018.
2891
2892         * statement.cs (Block.EmitMeta): During constant resolution, set
2893         the CurrentBlock property on the emitcontext, so that we resolve
2894         constants propertly.
2895
2896 2003-07-02  Martin Baulig  <martin@ximian.com>
2897
2898         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
2899         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
2900
2901         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
2902         than emitting it here.
2903
2904         * statement.cs: Fixed some more flow analysis bugs.
2905
2906 2003-07-02  Martin Baulig  <martin@ximian.com>
2907
2908         * class.cs (MethodData.Define): When implementing interface
2909         methods, set Final unless we're Virtual.
2910
2911         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
2912         check work for interface methods.
2913
2914 2003-07-01  Martin Baulig  <martin@ximian.com>
2915
2916         * ecore.cs (EmitContext.This): Replaced this property with a
2917         GetThis() method which takes a Location argument.  This ensures
2918         that we get the correct error location for a CS0188.
2919
2920 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
2921
2922         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
2923         ImplicitStandardConversion.
2924
2925         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
2926
2927 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
2928
2929         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
2930         optimization.
2931
2932 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
2933
2934         * class.cs (Constructor.Define): Turn off initlocals for unsafe
2935         constructors.
2936
2937         (MethodData.Define): Turn off initlocals for unsafe methods.
2938
2939 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
2940
2941         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
2942         complete;  Fixes #37521.
2943
2944         * delegate.cs: Use Modifiers.TypeAttr to compute the
2945         TypeAttributes, instead of rolling our own.  This makes the flags
2946         correct for the delegates.
2947
2948 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
2949
2950         * class.cs (Constructor.Define): Set the private flag for static
2951         constructors as well.
2952
2953         * cs-parser.jay (statement_expression): Set the return value to
2954         null, to avoid a crash when we catch an error.
2955
2956 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
2957
2958         * cs-parser.jay: Applied patch from Jackson that adds support for
2959         extern and unsafe modifiers to destructor declarations.
2960
2961         * expression.cs: Report error 21 if the user is trying to index a
2962         System.Array.
2963
2964         * driver.cs: Add an error message, suggested by the bug report.
2965
2966         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
2967         if we do not have a ": this ()" constructor initializer.  Fixes 45149
2968
2969 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
2970
2971         * namespace.cs: Add some information to reduce FAQs.
2972
2973 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
2974
2975         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
2976         underlying enumeration types.  Fixes #43915.
2977
2978         * expression.cs: Treat ushort/short as legal values to be used in
2979         bitwise operations.
2980
2981 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
2982
2983         * delegate.cs: transfer custom attributes for paramenters from
2984         the delegate declaration to Invoke and BeginInvoke.
2985
2986 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
2987
2988         * attribute.cs: handle custom marshalers and emit marshal info
2989         for fields, too.
2990
2991 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
2992
2993         * makefile.gnu: Added anonymous.cs to the compiler sources.
2994
2995 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
2996
2997         * iterators.cs: Change the name of the proxy class to include two
2998         underscores.
2999
3000         * cs-parser.jay: Update grammar to include anonymous methods.
3001         
3002         * anonymous.cs: new file.
3003
3004 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
3005
3006         * class.cs (Field.Define): Add missing test for pointers and
3007         safety. 
3008
3009 2003-05-27  Ravi Pratap  <ravi@ximian.com>
3010
3011         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
3012         we use the stobj opcode.
3013
3014         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
3015         since it wasn't the correct fix. 
3016
3017         It still is puzzling that we are required to use stobj for IntPtr
3018         which seems to be a ValueType.
3019
3020 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
3021
3022         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
3023         during regular simple name resolution.   Now, the trick is that
3024         instead of returning for processing the simplename, we do a
3025         TypeManager.LookupType (ie, a rooted lookup as opposed to a
3026         contextual lookup type).   If a match is found, return that, if
3027         not, return for further composition.
3028
3029         This fixes long-standing 30485.
3030
3031         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
3032         using the address to initialize an object, do an Stobj instead of
3033         using the regular Stelem.
3034
3035         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
3036         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
3037         Because if we are a BaseIndexerAccess that value will be true.
3038         Fixes 43643.
3039
3040         * statement.cs (GotoCase.Resolve): Return after reporting an
3041         error, do not attempt to continue. 
3042
3043         * expression.cs (PointerArithmetic.Emit): If our operand is a
3044         long, convert our constants to match the operand before
3045         multiplying.  Convert to I type before adding.   Fixes 43670.
3046         
3047 2003-05-14  Ravi Pratap  <ravi@ximian.com>
3048
3049         * enum.cs (ImplicitConversionExists) : Rename to
3050         ImplicitEnumConversionExists to remove ambiguity. 
3051
3052         * ecore.cs (NullCast): New type of cast expression class which
3053         basically is very similar to EmptyCast with the difference being
3054         it still is a constant since it is used only to cast a null to
3055         something else
3056         (eg. (string) null)
3057
3058         * convert.cs (ImplicitReferenceConversion): When casting a null
3059         literal, we return a NullCast.
3060
3061         * literal.cs (NullLiteralTyped): Remove - I don't see why this
3062         should be around anymore.
3063
3064         The renaming (reported was slightly wrong). Corrections:
3065
3066         ConvertImplicitStandard -> ImplicitConversionStandard
3067         ConvertExplicitStandard -> ExplicitConversionStandard
3068
3069         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
3070         before passing them in !
3071
3072         * convert.cs (ImplicitConversionStandard): When comparing for
3073         equal expr and target types, ensure that expr is not a
3074         NullLiteral.
3075
3076         In general, we must not be checking (expr_type ==
3077         target_type) in the top level conversion methods
3078         (ImplicitConversion, ExplicitConversion etc). This checking is
3079         done in the methods that they delegate to.
3080
3081 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
3082
3083         * convert.cs: Move Error_CannotConvertType,
3084         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
3085         ImplicitNumericConversion, ImplicitConversionExists,
3086         ImplicitUserConversionExists, StandardConversionExists,
3087         FindMostEncompassedType, FindMostSpecificSource,
3088         FindMostSpecificTarget, ImplicitUserConversion,
3089         ExplicitUserConversion, GetConversionOperators,
3090         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
3091         TryImplicitIntConversion, Error_CannotConvertImplicit,
3092         ConvertImplicitRequired, ConvertNumericExplicit,
3093         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
3094         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
3095         its own file.
3096
3097         Perform the following renames:
3098         
3099         StandardConversionExists -> ImplicitStandardConversionExists
3100         ConvertImplicit -> ImplicitConversion
3101         ConvertImplicitStandard -> ImplicitStandardConversion
3102         TryImplicitIntConversion -> ImplicitIntConversion
3103         ConvertImplicitRequired -> ImplicitConversionRequired
3104         ConvertNumericExplicit -> ExplicitNumericConversion
3105         ConvertReferenceExplicit -> ExplicitReferenceConversion
3106         ConvertExplicit -> ExplicitConversion
3107         ConvertExplicitStandard -> ExplicitStandardConversion
3108
3109 2003-05-19  Martin Baulig  <martin@ximian.com>
3110
3111         * statement.cs (TypeInfo.StructInfo): Made this type protected.
3112         (TypeInfo): Added support for structs having structs as fields.
3113
3114         * ecore.cs (FieldExpr): Implement IVariable.
3115         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
3116         VariableInfo for the field.
3117
3118 2003-05-18  Martin Baulig  <martin@ximian.com>
3119
3120         * expression.cs (This.DoResolve): Report a CS0027 if we're
3121         emitting a field initializer.
3122
3123 2003-05-18  Martin Baulig  <martin@ximian.com>
3124
3125         * expression.cs (This.ResolveBase): New public function.
3126         (This.DoResolve): Check for CS0188.
3127
3128         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
3129         This.Resolve().
3130
3131         * ecore.cs (MethodGroupExpr.DoResolve): Set the
3132         `instance_expression' to null if we don't have any non-static
3133         methods.
3134
3135 2003-05-18  Martin Baulig  <martin@ximian.com>
3136
3137         Reworked the way how local variables and parameters are handled by
3138         the flow analysis code.
3139
3140         * statement.cs (TypeInfo, VariableMap): New public classes.
3141         (VariableInfo): New public class.  This is now responsible for
3142         checking whether a variable has been assigned.  It is used for
3143         parameters and local variables.
3144         (Block.EmitMeta): Take the InternalParameters as argument; compute
3145         the layout of the flow vectors here.
3146         (Block.LocalMap, Block.ParameterMap): New public properties.
3147         (FlowBranching): The .ctor doesn't get the InternalParameters
3148         anymore since Block.EmitMeta() now computes the layout of the flow
3149         vector.
3150         (MyStructInfo): This class is now known as `StructInfo' and nested
3151         in `TypeInfo'; we don't access this directly anymore.
3152
3153         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
3154         property and removed IsAssigned(), IsFieldAssigned(),
3155         SetAssigned() and SetFieldAssigned(); we now call them on the
3156         VariableInfo so we don't need to duplicate this code everywhere.
3157
3158         * expression.cs (ParameterReference): Added `Block block' argument
3159         to the .ctor.
3160         (LocalVariableReference, ParameterReference, This): The new
3161         VariableInfo class is now responsible for all the definite
3162         assignment stuff.
3163
3164         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
3165         IsParameterAssigned, SetParameterAssigned): Removed.
3166
3167 2003-05-18  Martin Baulig  <martin@ximian.com>
3168
3169         * typemanager.cs (InitCoreTypes): Try calling
3170         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
3171         the 3-args-version.  Corlib now also needs our `void_type'.
3172         (GetMethod): Added overloaded version which takes an optional
3173         `bool report_errors' to allow lookups of optional methods.
3174
3175 2003-05-12  Martin Baulig  <martin@ximian.com>
3176
3177         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
3178         only used for locals and not for parameters.
3179
3180 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
3181
3182         * support.cs (InternalParameters.ParameterType): Return the
3183         ExternalType of the parameter.
3184
3185         * parameter.cs (Parameter.ExternalType): drop the two arguments,
3186         they were unused.
3187
3188 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
3189
3190         * class.cs (MethodData.Define): Do not set the `newslot' on
3191         interface members, if they are also flagged as "override".
3192
3193         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
3194         better code for ++i and i++.  This only works for static fields
3195         and local variables.
3196
3197         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
3198         want to pull the DeclSpace out of the builder_to_declspace instead
3199         of the TypeBuilder (like in TypeContainer.FindMembers).
3200
3201         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
3202         instead of LookupTypeContainer.  Fixes the crash on .NET for
3203         looking up interface members.
3204
3205         * const.cs: Create our own emit context during the Definition
3206         stage, so that constants are evaluated in the proper context, when
3207         a recursive definition happens.
3208
3209 2003-05-11  Martin Baulig  <martin@ximian.com>
3210
3211         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
3212         new block for a switch section.
3213         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
3214         the adding/lookup in the switch block.  Fixes #39828.
3215
3216 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
3217
3218         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
3219         functionality: I needed to convert the data after I had performed
3220         the add/sub operation into the operands type size.
3221
3222         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
3223         pass the type for the box operation, otherwise the resulting
3224         object would have been of type object.
3225
3226         (BoxedCast): Add constructor to specify the type to box as.
3227
3228 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
3229
3230         * iterators.cs: I was reusing the `count' variable inadvertently,
3231         take steps to not allow this to happen.
3232
3233 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
3234
3235         * attribute.cs (Attribute.Resolve): Params attributes are encoded
3236         by creating an array at the point where the params starts and
3237         putting all those arguments there, then adjusting the size of the
3238         array.
3239
3240 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
3241
3242         * expression.cs (New.AddressOf): Implement interface
3243         IMemoryLocation.  This is used when the `new' operator is used in
3244         the context of an invocation to a method on a value type.
3245
3246         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
3247         example. 
3248
3249         * namespace.cs: Also check the using aliases here.
3250
3251         * driver.cs: Move the test for using validity after the types have
3252         been entered, so we do a single pass that also includes the using
3253         aliases. 
3254
3255         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
3256         in the regular case.   CreateSiblingForFinally is doing extra
3257         error checking.
3258
3259         * attribute.cs (GetAttributeArgumentExpression): Store the result
3260         on an out value, and use the return value to indicate failure
3261         instead of using null (which is a valid return for Constant.GetValue).
3262
3263         * statement.cs: Perform the analysis flow for the increment
3264         portion after the statement, because this will be the real flow of
3265         execution.  Fixes #42385
3266
3267         * codegen.cs (EmitContext.EmitArgument,
3268         EmitContext.EmitStoreArgument): New helper functions when the
3269         RemapToProxy flag is set.
3270
3271         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
3272         function.
3273
3274         Add support for remapping parameters. 
3275
3276         * iterators.cs: Propagate parameter values;  Store parameter
3277         values in the proxy classes.
3278         
3279 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
3280
3281         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
3282         need a proxy reference;  I do not know what I was thinking
3283
3284         * cs-parser.jay (constructor_initializer): catch another error,
3285         and display nice message.
3286         
3287         (field_declaration): catch void field declaration
3288         to flag a better error. 
3289
3290         * class.cs (MemberBase.CheckBase): Report an error instead of a
3291         warning if a new protected member is declared in a struct. 
3292         (Field.Define): catch the error of readonly/volatile.
3293
3294         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
3295
3296         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
3297         volatile variable is taken
3298
3299 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
3300
3301         * statement.cs (Fixed.Resolve): Report an error if we are not in
3302         an unsafe context.
3303
3304 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
3305
3306         * typemanager.cs: reuse the code that handles type clashes for
3307         delegates and enumerations.
3308
3309         * class.cs (Report28): Always report.
3310
3311         * expression.cs (EncodeAsAttribute): Allow nulls here.
3312
3313 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
3314
3315         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
3316         the functionality for testing whether an expression is valid for
3317         an attribute here.  Also handle the case of arrays of elements
3318         being stored. 
3319
3320         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
3321         encoding a linear array into an array of objects that are suitable
3322         to be passed to an CustomAttributeBuilder.
3323
3324         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
3325
3326         * ecore.cs: (FieldExpr): Handle field remapping here.
3327
3328         * iteratators.cs: Pass the instance variable (if the method is an
3329         instance method) to the constructors, so we can access the field
3330         variables on the class.
3331
3332         TODO: Test this with structs.  I think the THIS variable on
3333         structs might have to be a pointer, and not a refenrece
3334
3335 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
3336
3337         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
3338         local variables to fields in a proxy class.
3339
3340         * iterators.cs (PopulateProxy): Rename our internal fields to
3341         <XXX>.  
3342         Create a <THIS> field if we are an instance method, so we can
3343         reference our parent container variables.
3344         (MapVariable): Called back from the EmitContext code to enter a
3345         new variable to field mapping into the proxy class (we just create
3346         a FieldBuilder).
3347
3348         * expression.cs
3349         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
3350         for using the remapped locals to fields.
3351
3352         I placed the code here, because that gives the same semantics to
3353         local variables, and only changes the Emit code.
3354
3355         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
3356         statements inside iterators.
3357         (VariableInfo): Add a FieldBuilder for the cases when we are
3358         remapping local variables to fields in a proxy class
3359
3360         * ecore.cs (SimpleNameResolve): Avoid testing two times for
3361         current_block != null.
3362
3363         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
3364         not cope with strings, as it has been moved to the
3365         TableSwitchEmit.  Fixed bug in switch generation.
3366
3367         * expression.cs (New.DoResolve): Provide more context for the user
3368         when reporting an error.
3369
3370         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
3371         pointers. 
3372
3373         * expression.cs (MemberAccess.DoResolve): When we get a type back,
3374         check the permissions for it.  Note than in a type-resolution
3375         context the check was already present in DeclSpace.ResolveType,
3376         but was missing from the MemberAccess.
3377
3378         (ArrayCreation.CheckIndices): warn if the user has
3379         more nested levels of expressions, but there are no more
3380         dimensions specified.  Avoids crash on bug 41906.
3381
3382 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
3383
3384         * statement.cs (Block): replace Implicit bool, for a generic
3385         flags.   
3386         New flag: `Unchecked'.  This is used during the EmitMeta phase
3387         (which is out-of-line with the regular Resolve/Emit process for a
3388         statement, as this is done ahead of time, but still gets a chance
3389         to call constant resolve).
3390         
3391         (Block.Flags): new enum for adding a new flag.
3392
3393         (Block.EmitMeta): track the state of unchecked.
3394         
3395         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
3396         to enable constant resolution to work there as well.
3397
3398 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
3399
3400         * typemanager.cs (ienumerable_type): Also look up
3401         System.Collections.IEnumerable. 
3402
3403 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
3404
3405         TODO: Test more than one conditional per method.
3406         
3407         * class.cs (Indexer.Define): Report the location where the user is
3408         referencing the unsupported feature.
3409
3410         (MethodData): Overload the use of `conditionals' to
3411         minimize the creation of needless ArrayLists.   This saves roughly
3412         212kb on my machine.
3413
3414         (Method): Implement the new IIteratorContainer interface.
3415         (Method.SetYields): Implement the method by setting the ModFlags
3416         to contain METHOD_YIELDS.
3417         
3418         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
3419         which just got set to null.
3420
3421         * iterators.cs: New file.
3422
3423         (Yield, YieldBreak): New statements.
3424
3425         * statement.cs (Return.Resolve): Flag an error if we are used in
3426         an iterator method.
3427
3428         * codegen.cs (InIterator): New flag set if the code is being
3429         compiled in an iterator method.
3430
3431         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
3432         internal modifier, and we just use it to avoid adding extra
3433         fields, as this is seldom used.  
3434
3435         * cs-parser.jay: Add yield_statement (yield and yield break).
3436
3437         * driver.cs: New flag -v2 to turn on version 2 features. 
3438
3439         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
3440         hashtable when v2 is enabled.
3441
3442 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
3443
3444         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
3445         there is already a namespace defined with this name.
3446
3447         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
3448         people upgraded their corlibs.
3449
3450         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
3451         always use fully qualified types, no need to use the compiler
3452         front end.
3453
3454         (TypeManager.IsNamespace): Use binarysearch.
3455         
3456         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
3457         AddDelegate): I did not quite use the new IsValid API properly: I
3458         have to pass the short-name and the fullname.  I was passing only
3459         the basename instead of the fullname sometimes. 
3460
3461         (TypeContainer.DefineType): call NamespaceClash.
3462
3463         * interface.cs (Interface.DefineType): use NamespaceClash before
3464         defining the type.
3465
3466         * delegate.cs (Delegate.DefineType): use NamespaceClash before
3467         defining the type.
3468
3469         * enum.cs: (Enum.DefineType): use NamespaceClash before
3470         defining the type.
3471
3472         * typemanager.cs (: 3-line patch that gives us some tasty 11%
3473         speed increase.  First, use the negative_hits cache when we get a
3474         negative.  Second, add the type with its full original name
3475         instead of the new . and + encoded name (reflection uses + to
3476         separate type from a nested type).  Use LookupTypeReflection
3477         directly which bypasses the type->name hashtable (that we already
3478         know does not contain the type.
3479         
3480         * decl.cs (DeclSpace.ResolveTypeExpr): track the
3481         location/container type. 
3482
3483         * driver.cs: When passing utf8, use directly the UTF8Encoding.
3484
3485 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
3486
3487         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
3488
3489         * delegate.cs (NewDelegate.Resolve): Test whether an instance
3490         method is being referenced in the method group from a static
3491         context, and report error 120 if so.
3492
3493         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
3494         Error118. 
3495
3496         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
3497         is created, we create the A namespace).
3498
3499         * cs-parser.jay: A namespace also introduces a DeclarationFound.
3500         Fixes #41591
3501
3502 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
3503
3504         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
3505         invocation to ModuleBuilder.GetType with the same values will
3506         return a new type instance, so we need to cache its return
3507         values. 
3508
3509         * expression.cs (Binary.ResolveOperator): Only allow the compare
3510         operators on enums if they are of the same type.
3511
3512         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
3513         types of ValueType on their own case.  Before we were giving them
3514         the same treatment as objects.
3515
3516         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
3517         fullname.  Short name is used to compare against container name.
3518         Fullname is used to check against defined namespace names.
3519         
3520         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
3521         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
3522
3523         (Method.CheckBase): Call parent.
3524         (MemberBase.CheckBase): Check for protected members on sealed
3525         classes.
3526         (PropertyBase.CheckBase): Call parent.
3527         (Field.Define): Call parent.
3528
3529         * report.cs: Negative error codes are now mapped to 8000 - code,
3530         so that the display is render more nicely.
3531
3532         * typemanager.cs: Do not use try/catch, instead report a regular
3533         error. 
3534
3535         (GetPointerType, GetReferenceType): These methods provide
3536         mechanisms to obtain the T* and T& from a T.  We had the code
3537         previously scattered around the code base, and it also used
3538         TypeManager.LookupType that would go through plenty of caches.
3539         This one goes directly to the type source.
3540
3541         In some places we did the Type.GetType followed by
3542         ModuleBuilder.GetType, but not in others, so this unifies the
3543         processing as well.
3544
3545         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
3546         statements now that we have namespace information.
3547
3548         * typemanager.cs (IsNamespace): New method, returns whether the
3549         string presented is a namespace or not.
3550
3551         (ComputeNamespaces): New public entry point, computes the list of
3552         available namespaces, using the GetNamespaces API call in Mono, or
3553         the slower version in MS.NET.   
3554
3555         Now before we start the semantic analysis phase, we have a
3556         complete list of namespaces including everything that the user has
3557         provided.
3558
3559         Deleted old code to cache namespaces in .nsc files.
3560
3561 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
3562
3563         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
3564         class/struct location definition Location for the implicit
3565         constructor location.
3566
3567         (Operator.Define): Use the location of the operator for the
3568         implicit Method definition.
3569
3570         (Constructor.Emit): use the constructor location for the implicit
3571         base initializer constructor.
3572
3573         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
3574         and the Expression class now contains two new methods:
3575
3576         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
3577         isolate type lookup from the rest of the resolution process.
3578
3579         Since we use Expressions to hold type definitions due to the way
3580         we parse the input we have historically overloaded Resolve to
3581         perform the Type lookups if a special flag is passed.  Now this is
3582         eliminated and two methods take their place. 
3583         
3584         The differences in the two methods between xStep and xTerminal is
3585         that xStep is involved in our current lookup system that uses
3586         SimpleNames to compose a name, while xTerminal is used just to
3587         catch the case where the simplename lookup failed.
3588         
3589 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
3590
3591         * expression.cs (ResolveMemberAccess): Remove redundant code.
3592         TypeExpr expressions are always born fully resolved.
3593
3594         * interface.cs (PopulateMethod): Do not lookup the types twice.
3595         We were doing it once during SemanticAnalysis and once during
3596         PopulateMethod.
3597
3598         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
3599         in local variable type definitions, were being returned as a
3600         SimpleName (we decomposed everything into a string), that is
3601         because primary_expression was being used instead of a type in the
3602         grammar (reduce/reduce conflicts).
3603
3604         The part that was wrong is that we converted the expression into a
3605         string (an oversimplification in one hand, compounded with primary
3606         expressions doing string concatenation).
3607
3608         So things like:
3609
3610         A.B.C [] x;
3611
3612         Would return "A.B.C[]" as a SimpleName.  This stopped things like
3613         using clauses from working on this particular context.  And a type
3614         was being matched directly against "A.B.C[]".
3615
3616         We now use the correct approach, and allow for ComposedCast to be
3617         part of the unary expression.  So the "A.B.C []" become a composed
3618         cast of "A.B.C" (as a nested group of MemberAccess with a
3619         SimpleName at the end) plus the rank composition "[]". 
3620
3621         Also fixes 35567
3622         
3623 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
3624
3625         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
3626         for the access level checking.
3627
3628         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
3629         `TypeContainer container', because I kept getting confused when I
3630         was debugging this code.
3631
3632         * expression.cs (Indexers): Instead of tracking getters/setters,
3633         we now track them in parallel.  We create one arraylist less, but
3634         most importantly it is possible now for the LValue code to find a
3635         matching get for a set.
3636
3637         (IndexerAccess.DoResolveLValue): Update the code.
3638         GetIndexersForType has been modified already to extract all the
3639         indexers from a type.  The code assumed it did not.
3640
3641         Also make the code set the correct return type for the indexer.
3642         This was fixed a long time ago for properties, but was missing for
3643         indexers.  It used to be void_type.
3644
3645         (Binary.Emit): Test first for doubles instead of
3646         floats, as they are more common.
3647
3648         (Binary.EmitBranchable): Use the .un version of the branch opcodes
3649         when dealing with floats and the <=, >= operators.  This fixes bug
3650         #39314 
3651
3652         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
3653         to load the array value by emitting a load on the foreach variable
3654         type.  This was incorrect.  
3655
3656         We now emit the code to load an element using the the array
3657         variable type, and then we emit the conversion operator.
3658
3659         Fixed #40176
3660
3661 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
3662
3663         * attribute.cs: Avoid allocation of ArrayLists in the common case.
3664
3665 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
3666
3667         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
3668         test for protection before we test for signatures. 
3669
3670         (MethodSignature.ToString): implement.
3671
3672         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
3673         to the case where we reduced into a LongConstant.
3674
3675         * decl.cs (CheckAccessLevel): If the type is an array, we can not
3676         depend on whether the information is acurrate, because the
3677         Microsoft runtime will always claim that the array type is public,
3678         regardless of the real state.
3679
3680         If the type is a pointer, another problem happens: the type is
3681         reported as non-public in Microsoft.  
3682
3683         In both cases we have to call CheckAccessLevel recursively with
3684         the underlying type as the argument to be tested.
3685
3686 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
3687
3688         * assign.cs (Assign.Emit): If we are dealing with a compound
3689         assignment expression, we should use the code path that stores the
3690         intermediate result in a temporary value.  This fixes #40903.
3691
3692         *expression.cs (Indirection.ToString): Provide ToString method for
3693         debugging. 
3694         
3695 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
3696
3697         * class.cs: Null out fields holding references to Block objects so
3698         they can be garbage collected.
3699
3700         * expression.cs (OverloadResolve): Remove unused local.
3701
3702 2003-04-07  Martin Baulig  <martin@ximian.com>
3703
3704         * codegen.cs (EmitContext.CurrentFile): New public field.
3705         (EmitContext.Mark): Use the CurrentFile to check whether the
3706         location is in the correct file.
3707         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
3708
3709 2003-04-07  Martin Baulig  <martin@ximian.com>
3710
3711         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
3712
3713         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
3714         location.  [FIXME: The location argument which gets passed to this
3715         method is sometimes wrong!]
3716
3717 2003-04-07  Nick Drochak <ndrochak@gol.com>
3718
3719         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
3720
3721 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
3722
3723         * expression.cs (Indirection.EmitAssign): We were using the
3724         temporary, but returning immediately instead of continuing the
3725         EmitAssing flow.
3726
3727 2003-04-06  Martin Baulig  <martin@ximian.com>
3728
3729         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
3730         if it's a nested child, but also deriving from the outer class.
3731         See test 190.cs.
3732
3733         * typemanager.cs (IsNestedChildOf): Make this work if it's a
3734         nested child, but also deriving from the outer class.  See
3735         test-190.cs.
3736         (FilterWithClosure): We may access private members of the outer
3737         class if we're a nested child and deriving from the outer class.
3738         (RealMemberLookup): Only set `closure_private_ok' if the
3739         `original_bf' contained BindingFlags.NonPublic.
3740
3741 2003-04-05  Martin Baulig  <martin@ximian.com>
3742
3743         * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
3744         probe if its a type parameter, and if so, flag an error.
3745
3746         * decl.cs: Move here the SetParameterInfo code from class.cs.
3747         Handle IsGeneric here.
3748
3749         Handle a variety of errors in the parameter info definition.
3750
3751         * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
3752         type parameters here.
3753
3754         * cs-parser.jay (class_declaration): report errors for parameters
3755         here as well.
3756
3757 2003-01-21  Miguel de Icaza  <miguel@ximian.com>
3758
3759         * generic.cs: New file, contains support code for generics.
3760
3761         * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
3762         OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
3763
3764         Update parser for the above removals.
3765
3766         * cs-tokenizer.cs: Do not handle <<= or >>= specially.  This is
3767         now taken care of in the parser.
3768
3769 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
3770
3771         * class.cs (Event.Define): Do not allow abstract events to have
3772         initializers. 
3773
3774 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
3775
3776         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
3777         block in event declarations.
3778
3779         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
3780         value type, get its address.
3781
3782         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
3783         leaving a class on the stack instead of a boolean value (int
3784         0/1).  Change the code so we compare against null, and then the
3785         result against zero.
3786
3787         * class.cs (TypeContainer.GetClassBases): We were checking for the
3788         parent class being sealed too late.
3789
3790         * expression.cs (Binary.Emit): For <= and >= when dealing with
3791         floating point values, use cgt.un and clt.un instead of cgt and
3792         clt alone.
3793
3794 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
3795
3796         * statement.cs: Apply the same optimization as MS: skip the 
3797         GetEnumerator returning an IEnumerator, and use the one returning a 
3798         CharEnumerator instead. This allows us to avoid the try-finally block 
3799         and the boxing.
3800
3801 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
3802
3803         * cs-parser.jay: Attributes cannot be applied to
3804                          namespaces. Fixes #40473
3805
3806 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3807
3808         * class.cs:
3809         (Add*): check if the name is valid using the full name for constants,
3810         fields, properties and events.
3811
3812 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
3813
3814         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
3815         char constants to be part of the enumeration.
3816
3817         * expression.cs (Conditional.DoResolve): Add support for operator
3818         true. Implements the missing functionality from 14.12
3819
3820         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
3821         operator true/false as required by the spec.
3822
3823         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
3824         implicit conversion to boolean.
3825
3826         * statement.cs (Statement.ResolveBoolean): A boolean expression is
3827         also one where the type implements `operator true'. 
3828
3829         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
3830         get an expression that will invoke operator true based on an
3831         expression.  
3832
3833         (GetConversionOperators): Removed the hack that called op_True
3834         here.  
3835
3836         (Expression.ResolveBoolean): Move this from Statement.
3837
3838 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
3839
3840         * ecore.cs (FieldExpr): do not allow initialization of initonly
3841         fields on derived classes
3842
3843 2003-03-13  Martin Baulig  <martin@ximian.com>
3844
3845         * statement.cs (Block.Emit): Call ig.BeginScope() and
3846         ig.EndScope() when compiling with debugging info; call
3847         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
3848
3849 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
3850
3851         * expression.cs (Indexers): Do not construct immediately, allow
3852         for new members to be appended as we go.  Fixes 38143
3853
3854 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3855
3856         * expression.cs: save/restore context when resolving an unchecked
3857         expression.
3858
3859 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
3860
3861         * cfold.cs: Catch division by zero in modulus operator during
3862         constant folding.
3863
3864 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
3865
3866         * interface.cs (Interface.DefineMembers): Avoid defining members
3867         twice. 
3868
3869 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
3870
3871         * driver.cs: handle the +/- options for -noconfig
3872
3873         * statement.cs (Unckeched.Resolve): Also track the state of
3874         unchecked in the Resolve phase.
3875
3876 2003-02-27  Martin Baulig  <martin@ximian.com>
3877
3878         * ecore.cs (Expression.MemberLookup): Don't create a
3879         MethodGroupExpr for something which is not a method.  Fixes #38291.
3880
3881 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
3882
3883         * class.cs (MemberBase.CheckParameters): Also check that the type
3884         is unmanaged if it is a pointer.
3885
3886         * expression.cs (SizeOf.Resolve): Add location information.
3887
3888         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
3889         a managed type is declared.
3890
3891         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
3892         parameter modifiers as well.  Fixes bug 38606
3893
3894         * class.cs: Very sad.  Am backing out the speed up changes
3895         introduced by the ArrayList -> Array in the TypeContainer, as they
3896         were not actually that much faster, and introduced a bug (no error
3897         reports on duplicated methods).
3898
3899         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
3900         source first, this will guarantee that we have a valid expression
3901         before calling in lower levels functions that will require a
3902         resolved object.  Then use this original_source in the
3903         target.ResolveLValue instead of the original source that was
3904         passed to us.
3905
3906         Another change.  Use target.Resolve instead of LValueResolve.
3907         Although we are resolving for LValues, we will let the Assign code
3908         take care of that (it will be called again from Resolve).  This
3909         basically allows code like this:
3910
3911         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
3912         class Y { void A (X x) { x [0] += o; }
3913
3914         The problem was that the indexer was trying to resolve for
3915         set_Item (idx, object o) and never finding one.  The real set_Item
3916         was set_Item (idx, X).  By delaying the process we get the right
3917         semantics. 
3918
3919         Fixes bug 36505
3920         
3921 2003-02-23  Martin Baulig  <martin@ximian.com>
3922
3923         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
3924         while calling DoEmit ().
3925
3926         * codegen.cs (EmitContext.Mark): Don't mark locations in other
3927         source files; if you use the #line directive inside a method, the
3928         compiler stops emitting line numbers for the debugger until it
3929         reaches the end of the method or another #line directive which
3930         restores the original file.
3931
3932 2003-02-23  Martin Baulig  <martin@ximian.com>
3933
3934         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
3935
3936 2003-02-23  Martin Baulig  <martin@ximian.com>
3937
3938         * statement.cs (Block.AddChildVariableNames): We need to call this
3939         recursively, not just for our immediate children.
3940
3941 2003-02-23  Martin Baulig  <martin@ximian.com>
3942
3943         * class.cs (Event.Define): Always make the field private, like csc does.
3944
3945         * typemanager.cs (TypeManager.RealMemberLookup): Make events
3946         actually work, fixes bug #37521.
3947
3948 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
3949
3950         * delegate.cs: When creating the various temporary "Parameters"
3951         classes, make sure that we call the ComputeAndDefineParameterTypes
3952         on those new parameters (just like we do with the formal ones), to
3953         allow them to be resolved in the context of the DeclSpace.
3954
3955         This fixes the bug that Dick observed in Bugzilla #38530.
3956
3957 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
3958
3959         * expression.cs (ResolveMemberAccess): When resolving a constant,
3960         do not attempt to pull a constant if the value was not able to
3961         generate a valid constant.
3962
3963         * const.cs (LookupConstantValue): Do not report more errors than required.
3964
3965 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3966
3967         * expression.cs: fixes bug #38328.
3968
3969 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
3970
3971         * class.cs: Changed all the various members that can be part of a
3972         class from being an ArrayList to be an Array of the right type.
3973         During the DefineType type_list, interface_list, delegate_list and
3974         enum_list are turned into types, interfaces, delegates and enums
3975         arrays.  
3976
3977         And during the member population, indexer_list, event_list,
3978         constant_list, field_list, instance_constructor_list, method_list,
3979         operator_list and property_list are turned into their real arrays.
3980
3981         Although we could probably perform this operation earlier, for
3982         good error reporting we need to keep the lists and remove the
3983         lists for longer than required.
3984
3985         This optimization was triggered by Paolo profiling the compiler
3986         speed on the output of `gen-sample-program.pl' perl script. 
3987
3988         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
3989         not crash in methods like MemberLookupFailed that use this field.  
3990
3991         This problem arises when the compiler fails to resolve a type
3992         during interface type definition for example.
3993
3994 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
3995
3996         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
3997         inherit from System.Object, so we have to stop at null, not only
3998         when reaching System.Object.
3999
4000 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
4001
4002         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
4003         DeclaredOnly because the parent indexer might have had a different
4004         name, but did not loop until the top of the hierarchy was reached.
4005
4006         The problem this one fixes is 35492: when a class implemented an
4007         indexer from an interface, we were getting the interface method
4008         (which was abstract) and we were flagging an error (can not invoke
4009         abstract method).
4010
4011         This also keeps bug 33089 functioning, and test-148 functioning.
4012
4013         * typemanager.cs (IsSpecialMethod): The correct way of figuring
4014         out if a method is special is to see if it is declared in a
4015         property or event, or whether it is one of the predefined operator
4016         names.   This should fix correctly #36804.
4017
4018 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
4019
4020         The goal here is to remove the dependency on EmptyCast.Peel ().
4021         Killing it completely.
4022         
4023         The problem is that currently in a number of places where
4024         constants are expected, we have to "probe" for an EmptyCast, and
4025         Peel, which is not the correct thing to do, as this will be
4026         repetitive and will likely lead to errors. 
4027
4028         The idea is to remove any EmptyCasts that are used in casts that
4029         can be reduced to constants, so we only have to cope with
4030         constants. 
4031
4032         This bug hunt was triggered by Bug 37363 and the desire to remove
4033         the duplicate pattern where we were "peeling" emptycasts to check
4034         whether they were constants.  Now constants will always be
4035         constants.
4036         
4037         * ecore.cs: Use an enumconstant here instead of wrapping with
4038         EmptyCast.  
4039
4040         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
4041         throwing me off.  By handling this we can get rid of a few hacks.
4042         
4043         * statement.cs (Switch): Removed Peel() code.
4044
4045 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
4046
4047         * class.cs: Location information for error 508
4048
4049         * expression.cs (New.DoResolve): Add a guard against double
4050         resolution of an expression.  
4051
4052         The New DoResolve might be called twice when initializing field
4053         expressions (see EmitFieldInitializers, the call to
4054         GetInitializerExpression will perform a resolve on the expression,
4055         and later the assign will trigger another resolution
4056
4057         This leads to bugs (#37014)
4058
4059         * delegate.cs: The signature for EndInvoke should contain any ref
4060         or out parameters as well.  We were not doing this in the past. 
4061
4062         * class.cs (Field.Define): Do not overwrite the type definition
4063         inside the `volatile' group.  Turns out that volatile enumerations
4064         were changing the type here to perform a validity test, which
4065         broke conversions. 
4066
4067 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
4068
4069         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
4070         and structs, we do not want to load the instance variable
4071
4072         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
4073         enum_type has to be handled like an object reference (implicit
4074         conversions exists from this to object), but the regular IsClass
4075         and IsValueType tests will never return true for this one.
4076
4077         Also we use TypeManager.IsValueType instead of type.IsValueType,
4078         just for consistency with the rest of the code (this is only
4079         needed if we ever use the construct exposed by test-180.cs inside
4080         corlib, which we dont today).
4081
4082 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
4083
4084         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
4085         just InternalCall.
4086
4087 2003-02-09  Martin Baulig  <martin@ximian.com>
4088
4089         * namespace.cs (Namespace..ctor): Added SourceFile argument.
4090         (Namespace.DefineNamespaces): New static public method; this is
4091         called when we're compiling with debugging to add all namespaces
4092         to the symbol file.
4093
4094         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
4095         pass it to the Namespace's .ctor.
4096
4097         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
4098         and MethodBase arguments; pass the namespace ID to the symwriter;
4099         pass the MethodBase instead of the token to the symwriter.
4100         (SymbolWriter.DefineNamespace): New method to add a namespace to
4101         the symbol file.
4102
4103 2003-02-09  Martin Baulig  <martin@ximian.com>
4104
4105         * symbolwriter.cs: New file.  This is a wrapper around
4106         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
4107         methods here in near future.
4108
4109 2003-02-09  Martin Baulig  <martin@ximian.com>
4110
4111         * codegen.cs (EmitContext.Mark): Just pass the arguments to
4112         ILGenerator.MarkSequencePoint() which are actually used by the
4113         symbol writer.
4114
4115 2003-02-09  Martin Baulig  <martin@ximian.com>
4116
4117         * location.cs (SourceFile): New public sealed class.  This
4118         contains the name and an index which is used in the location's token.
4119         (Location): Reserve an appropriate number of bits in the token for
4120         the source file instead of walking over that list, this gives us a
4121         really huge performance improvement when compiling with debugging.
4122
4123         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
4124         `SourceFile' argument instead of a string.
4125         (Driver.ProcessFile): Add all the files via Location.AddFile(),
4126         but don't parse/tokenize here, we need to generate the list of all
4127         source files before we do that.
4128         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
4129         the files.
4130
4131         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
4132         instead of a string.
4133
4134         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
4135         of a string.
4136
4137 2003-02-09  Martin Baulig  <martin@ximian.com>
4138
4139         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
4140         filename on `#line default'.
4141
4142 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
4143
4144         * statement.cs: don't clear the pinned var when the fixed statement
4145         returns from the method (fixes bug#37752).
4146
4147 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
4148
4149         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
4150         to IsValueType.
4151
4152 2003-02-07  Martin Baulig  <martin@ximian.com>
4153
4154         * driver.cs: Removed the `--debug-args' command line argument.
4155
4156         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
4157         automatically by the AsssemblyBuilder.
4158         (CodeGen.InitializeSymbolWriter): We don't need to call any
4159         initialization function on the symbol writer anymore.  This method
4160         doesn't take any arguments.
4161
4162 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
4163
4164         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
4165         from referenced assemblies as well.
4166
4167 2003-02-02  Martin Baulig  <martin@ximian.com>
4168
4169         * class.cs (MethodData.Emit): Generate debugging info for external methods.
4170
4171 2003-02-02  Martin Baulig  <martin@ximian.com>
4172
4173         * class.cs (Constructor.Emit): Open the symbol writer before
4174         emitting the constructor initializer.
4175         (ConstructorInitializer.Emit): Call ec.Mark() to allow
4176         single-stepping through constructor initializers.
4177
4178 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
4179
4180         * class.cs: Handle error 549: do not allow virtual methods in
4181         sealed classes. 
4182
4183 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
4184
4185         * decl.cs: Check access levels when resolving types
4186         
4187 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
4188
4189         * statement.cs: Add parameters and locals set in catch blocks that might 
4190         return to set vector
4191
4192 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
4193
4194         * class.cs (Operator): Set the SpecialName flags for operators.
4195         
4196         * expression.cs (Invocation.DoResolve): Only block calls to
4197         accessors and operators on SpecialName methods.
4198
4199         (Cast.TryReduce): Handle conversions from char constants.
4200
4201
4202 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
4203
4204         * statement.cs: small memory and time optimization in FlowBranching.
4205         
4206 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
4207
4208         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
4209         problem that the last fix but in the other sid (Set).
4210
4211         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
4212         access when there is no indexer in the hierarchy.
4213         
4214 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
4215
4216         * class.cs: Combine some if statements.
4217
4218 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4219
4220         * driver.cs: fixed bug #37187.
4221
4222 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
4223
4224         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
4225         any indexer, it's needed to build a list with all the indexers in the
4226         hierarchy (AllGetters), else we have problems. Fixes #35653.
4227
4228 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
4229
4230         * class.cs (MethodData.Define): It is wrong for an interface
4231         implementation to be static in both cases: explicit and implicit.
4232         We were only handling this in one case.
4233
4234         Improve the if situation there to not have negations.
4235         
4236         * class.cs (Field.Define): Turns out that we do not need to check
4237         the unsafe bit on field definition, only on usage.  Remove the test.
4238
4239 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4240
4241         * driver.cs: use assembly.Location instead of Codebase (the latest
4242         patch made mcs fail when using MS assemblies).
4243
4244 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
4245
4246         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
4247         get the path to *corlib.dll.
4248
4249 2003-01-21  Nick Drochak <ndrochak@gol.com>
4250
4251         * cs-tokenizer.cs:
4252         * pending.cs:
4253         * typemanager.cs: Remove compiler warnings
4254
4255 2003-01-20  Duncan Mak  <duncan@ximian.com>
4256
4257         * AssemblyInfo.cs: Bump the version number to 0.19.
4258         
4259 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4260
4261         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
4262
4263 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
4264
4265         * class.cs (Constructor::Emit): Emit debugging info for constructors.
4266
4267 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
4268
4269         * cs-parser.jay: Small fix: we were not comparing the constructor
4270         name correctly.   Thanks to Zoltan for the initial pointer.
4271
4272 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
4273
4274         * cs-tokenizer.cs: Set file name when specified with #line
4275
4276 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
4277
4278         * cs-parser.jay: Only perform the constructor checks here if we
4279         are named like the class;  This will help provider a better
4280         error.  The constructor path is taken when a type definition is
4281         not found, but most likely the user forgot to add the type, so
4282         report that rather than the constructor error.
4283
4284 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
4285
4286         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
4287         allocations.
4288
4289 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4290
4291         * cs-parser.jay: Add cleanup call.
4292
4293 2003-01-13  Duncan Mak  <duncan@ximian.com>
4294
4295         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
4296         consistent with other methods.
4297
4298 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4299
4300         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
4301         
4302 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
4303
4304         * attribute.cs: only set GuidAttr to true when we have a
4305         GuidAttribute.
4306
4307 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4308
4309         * ecore.cs:
4310         * expression.cs:
4311         * typemanager.cs: fixes to allow mcs compile corlib with the new
4312         Type.IsSubclassOf fix.
4313
4314 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
4315
4316         * expression.cs (LocalVariableReference.DoResolve): Classify a
4317         constant as a value, not as a variable.   Also, set the type for
4318         the variable.
4319
4320         * cs-parser.jay (fixed_statement): take a type instead of a
4321         pointer_type, so we can produce a better error message later.
4322         
4323         * statement.cs (Fixed.Resolve): Flag types that are not pointers
4324         as an error.  
4325         
4326         (For.DoEmit): Make inifinite loops have a
4327         non-conditional branch back.
4328
4329         (Fixed.DoEmit): First populate the pinned variables, then emit the
4330         statement, then clear the variables.  Before I was emitting the
4331         code once for each fixed piece.
4332
4333
4334 2003-01-08  Martin Baulig  <martin@ximian.com>
4335
4336         * statement.cs (FlowBranching.MergeChild): A break in a
4337         SWITCH_SECTION does not leave a loop.  Fixes #36155.
4338
4339 2003-01-08  Martin Baulig  <martin@ximian.com>
4340
4341         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
4342         lives in the same number space than `param_map'.  Fixes #36154.
4343
4344 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
4345
4346         * cs-parser.jay (constructor_declaration): Set the
4347         Constructor.ModFlags before probing for it.  This makes the
4348         compiler report 514, 515 and 132 (the code was there, but got
4349         broken). 
4350
4351         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
4352         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
4353         (GotoCase.Resolve): Set `Returns' to ALWAYS.
4354
4355 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
4356
4357         * enum.cs: create the enum static fields using the enum type.
4358
4359 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
4360
4361         * class.cs: don't try to create the ParamBuilder for the return
4362         type if it's not needed (and handle it breaking for the ms runtime
4363         anyway).
4364
4365 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
4366
4367         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
4368
4369 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
4370
4371         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
4372         the command.   This showed up while compiling the JANET source
4373         code, which used \r as its only newline separator.
4374
4375 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
4376
4377         * class.cs (Method.Define): If we are an operator (because it
4378         reuses our code), then set the SpecialName and HideBySig.  #36128
4379
4380 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
4381
4382         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
4383         exception, report error 120 `object reference required'.
4384
4385         * driver.cs: Add --pause option, used during to measure the size
4386         of the process as it goes with --timestamp.
4387
4388         * expression.cs (Invocation.DoResolve): Do not allow methods with
4389         SpecialName to be invoked.
4390
4391 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
4392
4393         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
4394         number before adding it.
4395
4396 2002-12-21  Ravi Pratap  <ravi@ximian.com>
4397
4398         * ecore.cs (StandardImplicitConversion): When in an unsafe
4399         context, we allow conversion between void * to any other pointer
4400         type. This fixes bug #35973.
4401
4402 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
4403
4404         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
4405         is not thrown when extensionless outputs are used 
4406
4407 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4408
4409         * rootcontext.cs: fixed compilation of corlib.
4410
4411 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
4412
4413         * attribute.cs (Attributes.Contains): Add new method.
4414
4415         * class.cs (MethodCore.LabelParameters): if the parameter is an
4416         `out' parameter, check that no attribute `[In]' has been passed.
4417
4418         * enum.cs: Handle the `value__' name in an enumeration.
4419
4420 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
4421
4422         * decl.cs: Added special case to allow overrides on "protected
4423         internal" methods
4424         
4425 2002-12-18  Ravi Pratap  <ravi@ximian.com>
4426
4427         * attribute.cs (Attributes.AddAttributeSection): Rename to this
4428         since it makes much more sense.
4429
4430         (Attributes.ctor): Don't require a Location parameter.
4431         
4432         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
4433
4434         * attribute.cs (ApplyAttributes): Remove extra Location parameters
4435         since we already have that information per attribute.
4436
4437         * everywhere : make appropriate changes.
4438
4439         * class.cs (LabelParameters): Write the code which actually
4440         applies attributes to the return type. We can't do this on the MS
4441         .NET runtime so we flag a warning in the case an exception is
4442         thrown.
4443
4444 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
4445
4446         * const.cs: Handle implicit null conversions here too.
4447
4448 2002-12-17  Ravi Pratap  <ravi@ximian.com>
4449
4450         * class.cs (MethodCore.LabelParameters): Remove the extra
4451         Type [] parameter since it is completely unnecessary. Instead
4452         pass in the method's attributes so that we can extract
4453         the "return" attribute.
4454
4455 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
4456
4457         * cs-parser.jay (parse): Use Report.Error to flag errors instead
4458         of ignoring it and letting the compile continue.
4459
4460         * typemanager.cs (ChangeType): use an extra argument to return an
4461         error condition instead of throwing an exception.
4462
4463 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
4464
4465         * expression.cs (Unary.TryReduce): mimic the code for the regular
4466         code path.  Perform an implicit cast in the cases where we can
4467         implicitly convert to one of the integral types, and then reduce
4468         based on that constant.   This fixes bug #35483.
4469
4470 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4471
4472         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
4473
4474 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4475
4476         * namespace.cs: fixed bug #35489.
4477
4478 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
4479
4480         * class.cs: Remove some dead code.
4481
4482         * cs-parser.jay: Estimate the number of methods needed
4483         (RootContext.MethodCount);
4484
4485         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
4486         numbers instead of StringBuilders.
4487
4488         * support.cs (PtrHashtable): Add constructor with initial size;
4489         We can now reduce reallocations of the method table.
4490
4491 2002-12-10  Ravi Pratap  <ravi@ximian.com>
4492
4493         * attribute.cs (ApplyAttributes): Keep track of the emitted
4494         attributes on a per-target basis. This fixes bug #35413.
4495
4496 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
4497
4498         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
4499         default to the Windows 1252 encoding.
4500
4501         (UnixParseOption): Support version, thanks to Alp for the missing
4502         pointer. 
4503
4504         * AssemblyInfo.cs: Add nice assembly information.
4505
4506         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
4507         (bug 35169).
4508
4509         * cs-parser.jay: Allow a trailing comma before the close bracked
4510         in the attribute_section production.
4511
4512         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
4513         address of the instance was being taken, I will take this out,
4514         because we take the address of the object immediately here.
4515
4516 2002-12-09  Ravi Pratap  <ravi@ximian.com>
4517
4518         * typemanager.cs (AreMultipleAllowed): Take care of the most
4519         obvious case where attribute type is not in the current assembly -
4520         stupid me ;-)
4521
4522 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
4523
4524         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
4525         definitions, instead of doing that afterwards.  
4526
4527         Also we use a nice little hack, depending on the constructor, we
4528         know if we are a "composed" name or a simple name.  Hence, we
4529         avoid the IndexOf test, and we avoid 
4530
4531         * codegen.cs: Add code to assist in a bug reporter to track down
4532         the source of a compiler crash. 
4533
4534 2002-12-07  Ravi Pratap  <ravi@ximian.com>
4535
4536         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
4537         types have been emitted for a given element and flag an error
4538         if something which does not have AllowMultiple set is used more
4539         than once.
4540
4541         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
4542         attribute types and their corresponding AllowMultiple properties
4543
4544         (AreMultipleAllowed): Check the property for a given type.
4545
4546         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
4547         property in the case we have a TypeContainer.
4548
4549         (Attributes.AddAttribute): Detect duplicates and just skip on
4550         adding them. This trivial fix catches a pretty gross error in our
4551         attribute emission - global attributes were being emitted twice!
4552
4553         Bugzilla bug #33187 is now fixed.
4554
4555 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
4556
4557         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
4558         instead of pp_and).
4559
4560         * expression.cs (Binary.ResolveOperator): I can only use the
4561         Concat (string, string, string) and Concat (string, string,
4562         string, string) if the child is actually a concatenation of
4563         strings. 
4564
4565 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
4566
4567         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
4568         context where we need a 2-character lookahead.
4569
4570         * pending.cs (PendingImplementation): Rework so we can keep track
4571         of interface types all the time, and flag those which were
4572         implemented by parents as optional.
4573
4574 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
4575
4576         * expression.cs (Binary.ResolveOperator): Use
4577         String.Concat(string,string,string) or
4578         String.Concat(string,string,string,string) when possible. 
4579
4580         * typemanager: More helper methods.
4581
4582
4583 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
4584
4585         * pending.cs: remove the bogus return from GetMissingInterfaces()
4586         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
4587
4588 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4589
4590         * namespace.cs: avoid duplicated 'using xxx' being added to
4591         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
4592         when we get more than one 'using' statement for the same namespace.
4593         Report a CS0105 warning for it.
4594
4595 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
4596
4597         * cs-tokenizer.cs (consume_identifier): use read directly, instead
4598         of calling getChar/putback, uses internal knowledge of it.    
4599
4600         (xtoken): Reorder tokenizer so most common patterns are checked
4601         first.  This reduces the compilation time in another 5% (from 8.11s
4602         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
4603
4604         The parsing time is 22% of the compilation in mcs, and from that
4605         64% is spent on the tokenization process.  
4606
4607         I tried using a binary search for keywords, but this is slower
4608         than the hashtable.  Another option would be to do a couple of
4609         things:
4610
4611                 * Not use a StringBuilder, instead use an array of chars,
4612                   with a set value.  Notice that this way we could catch
4613                   the 645 error without having to do it *afterwards*.
4614
4615                 * We could write a hand-parser to avoid the hashtable
4616                   compares altogether.
4617
4618         The identifier consumption process takes 37% of the tokenization
4619         time.  Another 15% is spent on is_number.  56% of the time spent
4620         on is_number is spent on Int64.Parse:
4621
4622                 * We could probably choose based on the string length to
4623                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
4624                   computations. 
4625
4626         Another 3% is spend on wrapping `xtoken' in the `token' function.
4627
4628         Handle 0xa0 as whitespace (#34752)
4629         
4630 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
4631
4632         * typemanager.cs (IsCLRType): New routine to tell whether a type
4633         is one of the builtin types.  
4634
4635         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
4636         typecode in more places instead of doing pointer comparissions.
4637         We could leverage some knowledge about the way the typecodes are
4638         laid out.
4639
4640         New code to cache namespaces in assemblies, it is currently not
4641         invoked, to be used soon.
4642
4643         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
4644
4645         * expression.cs (Binary.ResolveOperator): specially handle
4646         strings, and do not perform user-defined operator overloading for
4647         built-in types.
4648
4649 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
4650
4651         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
4652         internalcall as it is a pretty simple operation;  Avoid whenever
4653         possible to call Char.IsLetter.
4654
4655         (consume_identifier): Cut by half the number of
4656         hashtable calls by merging the is_keyword and GetKeyword behavior.
4657
4658         Do not short-circuit, because if we do, we
4659         report errors (ie, #if false && true would produce an invalid
4660         directive error);
4661         
4662
4663 2002-11-24  Martin Baulig  <martin@ximian.com>
4664
4665         * expression.cs (Cast.TryReduce): If we're in checked syntax,
4666         check constant ranges and report a CS0221.  Fixes #33186.
4667
4668 2002-11-24  Martin Baulig  <martin@ximian.com>
4669
4670         * cs-parser.jay: Make this work for uninitialized variable
4671         declarations in the `for' initializer.  Fixes #32416.
4672
4673 2002-11-24  Martin Baulig  <martin@ximian.com>
4674
4675         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
4676         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
4677
4678 2002-11-24  Martin Baulig  <martin@ximian.com>
4679
4680         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
4681         argument; if true, we also check for user-defined conversions.
4682         This is only needed if both arguments are of a user-defined type.
4683         Fixes #30443, added test-175.cs.
4684         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
4685
4686         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
4687
4688 2002-11-24  Martin Baulig  <martin@ximian.com>
4689
4690         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
4691         function to get the store opcode.
4692         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
4693         only emit the Ldelema if the store opcode is Stobj.  You must run
4694         both test-34 and test-167 to test this.  Fixes #34529.
4695
4696 2002-11-23  Martin Baulig  <martin@ximian.com>
4697
4698         * ecore.cs (Expression.MemberLookup): Added additional
4699         `qualifier_type' argument which is used when we're being called
4700         from MemberAccess.DoResolve() and null if we're called from a
4701         SimpleName lookup.
4702         (Expression.MemberLookupFailed): New method to report errors; this
4703         does the CS1540 check and reports the correct error message.
4704
4705         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
4706         argument for the CS1540 check and redone the way how we're dealing
4707         with private members.  See the comment in the source code for details.
4708         (FilterWithClosure): Reverted this back to revision 1.197; renamed
4709         `closure_start_type' to `closure_qualifier_type' and check whether
4710         it's not null.  It was not this filter being broken, it was just
4711         being called with the wrong arguments.
4712
4713         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
4714         and pass it the correct `qualifier_type'; this also does the error
4715         handling for us.
4716
4717 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
4718
4719         * expression.cs (Invocation.EmitParams): If the we are dealing
4720         with a non-built-in value type, load its address as well.
4721
4722         (ArrayCreation): Use a a pretty constant instead
4723         of the hardcoded value 2.   Use 6 instead of 2 for the number of
4724         static initializers.  
4725
4726         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
4727         because they are not really value types, just glorified integers. 
4728
4729         * driver.cs: Do not append .exe, the CSC compiler does not do it.
4730
4731         * ecore.cs: Remove redundant code for enumerations, make them use
4732         the same code path as everything else, fixes the casting issue
4733         with enumerations in Windows.Forms.
4734
4735         * attribute.cs: Do only cast to string if it is a string, the
4736         validation happens later.
4737
4738         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
4739         people upgrade their corlibs.
4740
4741         * ecore.cs: Oops, enumerations were not following the entire code path
4742
4743 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
4744
4745         * typemanager.cs (FilterWithClosure): Commented out the test for
4746         1540 in typemanager.cs, as it has problems when accessing
4747         protected methods from a parent class (see test-174.cs). 
4748
4749         * attribute.cs (Attribute.ValidateGuid): new method.
4750         (Attribute.Resolve): Use above.
4751
4752 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
4753
4754         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
4755
4756         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
4757         handling for enumerations, as we only needed the TypeContainer
4758         functionality to begin with (this is required for the fix below to
4759         work for enums that reference constants in a container class for
4760         example). 
4761
4762         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
4763
4764         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
4765         a valid TypeBuilder to perform lookups on.o
4766
4767         * class.cs (InheritableMemberSignatureCompare): Use true in the
4768         call to GetGetMethod and GetSetMethod, because we are comparing
4769         the signature, and we need to get the methods *even* if they are
4770         private. 
4771
4772         (PropertyBase.CheckBase): ditto.
4773
4774         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
4775         GotoCase.Resolve): Use Peel on EmpytCasts.
4776
4777         * ecore.cs (EmptyCast): drop child, add Peel method.
4778
4779 2002-11-17  Martin Baulig  <martin@ximian.com>
4780
4781         * ecore.cs (EmptyCast.Child): New public property.
4782
4783         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
4784         label resolved to an EmptyCast.  Fixes #34162.
4785         (GotoCase.Resolve): Likewise.
4786         (Block.EmitMeta): Likewise.
4787
4788 2002-11-17  Martin Baulig  <martin@ximian.com>
4789
4790         * expression.cs (Invocation.BetterConversion): Prefer int over
4791         uint; short over ushort; long over ulong for integer literals.
4792         Use ImplicitConversionExists instead of StandardConversionExists
4793         since we also need to check for user-defined implicit conversions.
4794         Fixes #34165.  Added test-173.cs.
4795
4796 2002-11-16  Martin Baulig  <martin@ximian.com>
4797
4798         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
4799         with the `true' and `false' literals.  Fixes #33151.
4800
4801 2002-11-16  Martin Baulig  <martin@ximian.com>
4802
4803         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
4804         October 22nd; don't do the cs1540 check for static members.
4805
4806         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
4807         now using our own filter here and doing the cs1540 check again.
4808
4809 2002-11-16  Martin Baulig  <martin@ximian.com>
4810
4811         * support.cs (InternalParameters): Don't crash if we don't have
4812         any fixed parameters.  Fixes #33532.
4813
4814 2002-11-16  Martin Baulig  <martin@ximian.com>
4815
4816         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
4817         when looking up static methods to make this work on Windows.
4818         Fixes #33773.
4819
4820 2002-11-16  Martin Baulig  <martin@ximian.com>
4821
4822         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
4823         a setter rather than using PropertyInfo.CanWrite.
4824
4825 2002-11-15  Nick Drochak  <ndrochak@gol.com>
4826
4827         * class.cs: Allow acces to block member by subclasses. Fixes build
4828         breaker.
4829
4830 2002-11-14  Martin Baulig  <martin@ximian.com>
4831
4832         * class.cs (Constructor.Emit): Added the extern/block check.
4833         Fixes bug #33678.
4834
4835 2002-11-14  Martin Baulig  <martin@ximian.com>
4836
4837         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
4838         iteration while looking for indexers, this is needed because the
4839         indexer may have a different name in our base classes.  Fixed the
4840         error reporting (no indexers at all, not get accessor, no
4841         overloaded match).  Fixes bug #33089.
4842         (IndexerAccess.DoResolveLValue): Likewise.
4843
4844 2002-11-14  Martin Baulig  <martin@ximian.com>
4845
4846         * class.cs (PropertyBase.CheckBase): Make this work for multiple
4847         indexers.  Fixes the first part of bug #33089.
4848         (MethodSignature.InheritableMemberSignatureCompare): Added support
4849         for properties.
4850
4851 2002-11-13  Ravi Pratap  <ravi@ximian.com>
4852
4853         * attribute.cs (Attribute.Resolve): Catch the
4854         NullReferenceException and report it since it isn't supposed to
4855         happen. 
4856         
4857 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
4858
4859         * expression.cs (Binary.EmitBranchable): Also handle the cases for
4860         LogicalOr and LogicalAnd that can benefit from recursively
4861         handling EmitBranchable.  The code now should be nice for Paolo.
4862
4863 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
4864
4865         * typemanager.cs (LookupType): Added a negative-hit hashtable for
4866         the Type lookups, as we perform quite a number of lookups on
4867         non-Types.  This can be removed once we can deterministically tell
4868         whether we have a type or a namespace in advance.
4869
4870         But this might require special hacks from our corlib.
4871
4872         * TODO: updated.
4873
4874         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
4875         and double which avoids a conversion from an integer to a double.
4876
4877         * expression.cs: tiny optimization, avoid calling IsConstant,
4878         because it effectively performs the lookup twice.
4879
4880 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
4881
4882         But a bogus return here to keep the semantics of the old code
4883         until the Mono runtime is fixed.
4884         
4885         * pending.cs (GetMissingInterfaces): New method used to remove all
4886         the interfaces that are already implemented by our parent
4887         classes from the list of pending methods. 
4888
4889         * interface.cs: Add checks for calls after ResolveTypeExpr.
4890
4891 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
4892
4893         * class.cs (Class.Emit): Report warning 67: event not used if the
4894         warning level is beyond 3.
4895
4896         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
4897         being a NullLiteral.
4898
4899         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
4900         specifiers. 
4901
4902         * class.cs (TypeContainer.GetClassBases): Cover a missing code
4903         path that might fail if a type can not be resolved.
4904
4905         * expression.cs (Binary.Emit): Emit unsigned versions of the
4906         operators. 
4907
4908         * driver.cs: use error 5.
4909         
4910 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
4911
4912         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
4913
4914 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
4915
4916         * cs-parser.jay (switch_section): A beautiful patch from Martin
4917         Baulig that fixed 33094.
4918
4919 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
4920
4921         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
4922         Check whether the base is abstract and report an error if so.
4923
4924         * expression.cs (IndexerAccess.DoResolveLValue,
4925         IndexerAccess.DoResolve): ditto. 
4926
4927         (Invocation.DoResolve): ditto.
4928         
4929         (Invocation.FullMethodDesc): Improve the report string.
4930
4931         * statement.cs (Block): Eliminate IsVariableDefined as it is
4932         basically just a wrapper for GetVariableInfo.
4933
4934         * ecore.cs (SimpleName): Use new 
4935
4936         * support.cs (ReflectionParamter.ParameterType): We unwrap the
4937         type, as we return the actual parameter ref/unref state on a
4938         different call.
4939
4940 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
4941
4942         * support.cs: Return proper flags REF/OUT fixing the previous
4943         commit.  
4944
4945         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
4946         not used to mean `ref' but `ref or out' in ParameterReference
4947         
4948         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
4949         full type signature instead of calling TypeManger.CSharpName
4950         ourselves. 
4951
4952         * support.cs (InternalParameters.ParameterDesc): Do not compare
4953         directly to the modflags, because REF/OUT will actually be bitsets
4954         if set. 
4955
4956         * delegate.cs (VerifyMethod): Check also the modifiers.
4957
4958         * cs-tokenizer.cs: Fix bug where floating point values with an
4959         exponent where a sign was missing was ignored.
4960
4961         * driver.cs: Allow multiple assemblies to be specified in a single
4962         /r: argument
4963
4964 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
4965
4966         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
4967         because identifiers after a parenthesis would end up in this kind
4968         of production, and we needed to desamiguate it for having casts
4969         like:
4970
4971                 (UserDefinedType *) xxx
4972
4973 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
4974
4975         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
4976         we should set on the Bindingflags.NonPublic, but not turn on
4977         private_ok.  private_ok controls whether a Private member is
4978         returned (this is chekced on the filter routine), while the
4979         BindingFlags.NonPublic just controls whether private/protected
4980         will be allowed.   This fixes the problem part of the problem of
4981         private properties being allowed to be used in derived classes.
4982
4983         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
4984         so we can call the children DoResolveLValue method (this will
4985         properly signal errors on lvalue assignments to base properties)
4986         
4987         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
4988         getter are null, and we have a property info, we know that this
4989         happened because the lookup failed, so we report an error 122 for
4990         protection level violation.
4991
4992         We also silently return if setter and getter are null in the
4993         resolve functions, this condition only happens if we have flagged
4994         the error before.  This is the other half of the problem. 
4995
4996         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
4997         not have accessibility information, that is why we were returning
4998         true in the filter function in typemanager.cs.
4999
5000         To properly report 122 (property is inaccessible because of its
5001         protection level) correctly, we report this error in ResolveAccess
5002         by failing if both the setter and the getter are lacking (ie, the
5003         lookup failed). 
5004
5005         DoResolve and DoLResolve have been modified to check for both
5006         setter/getter being null and returning silently, the reason being
5007         that I did not want to put the knowledge about this error in upper
5008         layers, like:
5009
5010         int old = Report.Errors;
5011         x = new PropertyExpr (...);
5012         if (old != Report.Errors)
5013                 return null;
5014         else
5015                 return x;
5016
5017         So the property expr is returned, but it is invalid, so the error
5018         will be flagged during the resolve process. 
5019
5020         * class.cs: Remove InheritablePropertySignatureCompare from the
5021         class, as we no longer depend on the property signature to compute
5022         whether it is possible to implement a method or not.
5023
5024         The reason is that calling PropertyInfo.GetGetMethod will return
5025         null (in .NET, in Mono it works, and we should change this), in
5026         cases where the Get Method does not exist in that particular
5027         class.
5028
5029         So this code:
5030
5031         class X { public virtual int A { get { return 1; } } }
5032         class Y : X { }
5033         class Z : Y { public override int A { get { return 2; } } }
5034
5035         Would fail in Z because the parent (Y) would not have the property
5036         defined.  So we avoid this completely now (because the alternative
5037         fix was ugly and slow), and we now depend exclusively on the
5038         method names.
5039
5040         (PropertyBase.CheckBase): Use a method-base mechanism to find our
5041         reference method, instead of using the property.
5042
5043         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
5044         routines are gone now.
5045
5046         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
5047         names, they were incorrectly named.
5048
5049         * cs-tokenizer.cs: Return are more gentle token on failure. 
5050
5051         * pending.cs (PendingImplementation.InterfaceMethod): This routine
5052         had an out-of-sync index variable, which caused it to remove from
5053         the list of pending methods the wrong method sometimes.
5054
5055 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
5056
5057         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
5058         CanWrite, because those refer to this particular instance of the
5059         property, and do not take into account the fact that we can
5060         override single members of a property.
5061
5062         Constructor requires an EmitContext.  The resolution process does
5063         not happen here, but we need to compute the accessors before,
5064         because the resolution does not always happen for properties.
5065         
5066         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
5067         subclass, before we did not update this flag, but we did update
5068         bindingflags. 
5069
5070         (GetAccessors): Drop this routine, as it did not work in the
5071         presence of partially overwritten set/get methods. 
5072
5073         Notice that this broke the cs1540 detection, but that will require
5074         more thinking. 
5075         
5076 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5077
5078         * class.cs:
5079         * codegen.cs:
5080         * driver.cs: issue a warning instead of an error if we don't support
5081         debugging for the platform. Also ignore a couple of errors that may
5082         arise when trying to write the symbols. Undo my previous patch.
5083
5084 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5085
5086         * driver.cs: ignore /debug switch except for Unix platforms.
5087
5088 2002-10-23  Nick Drochak  <ndrochak@gol.com>
5089
5090         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
5091
5092 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
5093
5094         * driver.cs: Do not make mcs-debug conditional, so we do not break
5095         builds that use it.
5096
5097         * statement.cs (UsageVector.MergeChildren): I would like Martin to
5098         review this patch.  But basically after all the children variables
5099         have been merged, the value of "Breaks" was not being set to
5100         new_breaks for Switch blocks.  I think that it should be set after
5101         it has executed.  Currently I set this to the value of new_breaks,
5102         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
5103         conservative, but I do not understand this code very well.
5104
5105         I did not break anything in the build, so that is good ;-)
5106
5107         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
5108
5109 2002-10-20  Mark Crichton  <crichton@gimp.org>
5110
5111         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
5112
5113 2002-10-20  Nick Drochak  <ndrochak@gol.com>
5114
5115         * cfold.cs: Fixed compile blocker.
5116
5117 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
5118
5119         * driver.cs: I was chekcing the key, not the file.
5120
5121 2002-10-19  Ravi Pratap  <ravi@ximian.com>
5122
5123         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
5124         message that we were generating - we just need to silently return
5125         a null.
5126
5127 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
5128
5129         * class.cs (Event.Define): Change my previous commit, as this
5130         breaks the debugger.  This is a temporary hack, as it seems like
5131         the compiler is generating events incorrectly to begin with.
5132
5133         * expression.cs (Binary.ResolveOperator): Added support for 
5134         "U operator - (E x, E y)"
5135
5136         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
5137         y)".
5138
5139         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
5140         init-only variables, but this path did not take into account that
5141         there might be also instance readonly variables.  Correct this
5142         problem. 
5143
5144         This fixes bug 32253
5145
5146         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
5147         delegates as well.
5148
5149         * driver.cs: Change the extension for modules to `netmodule'
5150
5151         * cs-parser.jay: Improved slightly the location tracking for
5152         the debugger symbols.
5153
5154         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
5155         modifiers that were specified instead of the hardcoded value
5156         (FamAndAssem).  This was basically ignoring the static modifier,
5157         and others.  Fixes 32429.
5158
5159         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
5160         fixed a bug in the process (32476)
5161
5162         * expression.cs (ArrayAccess.EmitAssign): Patch from
5163         hwang_rob@yahoo.ca that fixes bug 31834.3
5164
5165 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
5166
5167         * driver.cs: Make the module extension .netmodule.
5168
5169 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
5170
5171         * driver.cs: Report an error if the resource file is not found
5172         instead of crashing.
5173
5174         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
5175         false, like Emit does.
5176
5177 2002-10-16  Nick Drochak  <ndrochak@gol.com>
5178
5179         * typemanager.cs: Remove unused private member.  Also reported mcs
5180         bug to report this as a warning like csc.
5181
5182 2002-10-15  Martin Baulig  <martin@gnome.org>
5183
5184         * statement.cs (Statement.Emit): Made this a virtual method; emits
5185         the line number info and calls DoEmit().
5186         (Statement.DoEmit): New protected abstract method, formerly knows
5187         as Statement.Emit().
5188
5189         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
5190
5191 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
5192
5193         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
5194         have fixed a remaining problem: not every AddXXXX was adding a
5195         fully qualified name.  
5196
5197         Now everyone registers a fully qualified name in the DeclSpace as
5198         being defined instead of the partial name.  
5199
5200         Downsides: we are slower than we need to be due to the excess
5201         copies and the names being registered this way.  
5202
5203         The reason for this is that we currently depend (on the corlib
5204         bootstrap for instance) that types are fully qualified, because
5205         we dump all the types in the namespace, and we should really have
5206         types inserted into the proper namespace, so we can only store the
5207         basenames in the defined_names array.
5208
5209 2002-10-10  Martin Baulig  <martin@gnome.org>
5210
5211         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
5212         from bug #31834, see the bug report for a testcase which is
5213         miscompiled.
5214
5215 2002-10-10  Martin Baulig  <martin@gnome.org>
5216
5217         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
5218         flow analysis code for this.
5219
5220         * statement.cs (Do, While, For): Tell the flow analysis code about
5221         infinite loops.
5222         (FlowBranching.UsageVector): Added support for infinite loops.
5223         (Block.Resolve): Moved the dead code elimination here and use flow
5224         analysis to do it.
5225
5226 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
5227
5228         * class.cs (Field.Define): Catch cycles on struct type
5229         definitions. 
5230
5231         * typemanager.cs (IsUnmanagedtype): Do not recursively check
5232         fields if the fields are static.  We only need to check instance
5233         fields. 
5234
5235         * expression.cs (As.DoResolve): Test for reference type.
5236
5237         * statement.cs (Using.ResolveExpression): Use
5238         ConvertImplicitRequired, not ConvertImplicit which reports an
5239         error on failture
5240         (Using.ResolveLocalVariableDecls): ditto.
5241
5242         * expression.cs (Binary.ResolveOperator): Report errors in a few
5243         places where we had to.
5244
5245         * typemanager.cs (IsUnmanagedtype): Finish implementation.
5246
5247 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
5248
5249         * expression.cs: Use StoreFromPtr instead of extracting the type
5250         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
5251
5252         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
5253         an enumeration value to a System.Enum, but System.Enum is not a
5254         value type, but an class type, so we need to box.
5255
5256         (Expression.ConvertExplicit): One codepath could return
5257         errors but not flag them.  Fix this.  Fixes #31853
5258
5259         * parameter.cs (Resolve): Do not allow void as a parameter type.
5260
5261 2002-10-06  Martin Baulig  <martin@gnome.org>
5262
5263         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
5264         if it's a class type and not a struct.  Fixes #31815.
5265
5266 2002-10-06  Martin Baulig  <martin@gnome.org>
5267
5268         * statement.cs: Reworked the flow analysis code a bit to make it
5269         usable for dead code elimination.
5270
5271 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5272
5273         * cs-parser.jay: allow empty source files. Fixes bug #31781.
5274
5275 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
5276
5277         * expression.cs (ComposedCast.DoResolveType): A quick workaround
5278         to fix the test 165, will investigate deeper.
5279
5280 2002-10-04  Martin Baulig  <martin@gnome.org>
5281
5282         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
5283         finally blocks actually work.
5284         (Try.Resolve): We don't need to create a sibling for `finally' if
5285         there is no finally block.
5286
5287 2002-10-04  Martin Baulig  <martin@gnome.org>
5288
5289         * class.cs (Constructor.Define): The default accessibility for a
5290         non-default constructor is private, not public.
5291
5292 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
5293
5294         * class.cs (Constructor): Make AllowedModifiers public, add
5295         EXTERN.
5296
5297         * cs-parser.jay: Perform the modifiers test here, as the
5298         constructor for the Constructor class usually receives a zero
5299         because of the way we create it (first we create, later we
5300         customize, and we were never checking the modifiers).
5301
5302         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
5303         is a version of LookupTypeReflection that includes the type-name
5304         cache.  This can be used as a fast path for functions that know
5305         the fully qualified name and are only calling into *.GetType() to
5306         obtain a composed type.
5307
5308         This is also used by TypeManager.LookupType during its type
5309         composition.
5310
5311         (LookupType): We now also track the real type name, as sometimes
5312         we can get a quey for the real type name from things like
5313         ComposedCast.  This fixes bug 31422.
5314         
5315         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
5316         complete type fullname, it does not have to go through the type
5317         resolution system to obtain the composed version of the type (for
5318         obtaining arrays or pointers).
5319         
5320         (Conditional.Emit): Use the EmitBoolExpression to
5321         generate nicer code, as requested by Paolo.
5322
5323         (ArrayCreation.CheckIndices): Use the patch from
5324         hwang_rob@yahoo.ca to validate the array initializers. 
5325
5326 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
5327
5328         * class.cs (ConstructorInitializer.Emit): simplify code by using
5329         Invocation.EmitCall, and at the same time, fix the bugs in calling
5330         parent constructors that took variable arguments. 
5331
5332         * ecore.cs (Expression.ConvertNumericExplicit,
5333         Expression.ImplicitNumericConversion): Remove the code that
5334         manually wrapped decimal (InternalTypeConstructor call is now gone
5335         as well).
5336
5337         * expression.cs (Cast.TryReduce): Also handle decimal types when
5338         trying to perform a constant fold on the type.
5339
5340         * typemanager.cs (IsUnmanagedtype): Partially implemented.
5341
5342         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
5343         that only turned off an error report, and did nothing else. 
5344
5345 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
5346
5347         * driver.cs: Handle and ignore /fullpaths
5348
5349 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
5350
5351         * expression.cs (Binary.ResolveOperator): Catch the case where
5352         DoNumericPromotions returns true, 
5353
5354         (Binary.DoNumericPromotions): Simplify the code, and the tests.
5355
5356 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
5357
5358         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
5359         report error 70.
5360
5361 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
5362
5363         * ecore.cs (ConvertNumericExplicit): It is not enough that the
5364         conversion exists, but it is also required that the conversion be
5365         performed.  This manifested in "(Type64Enum) 2".  
5366
5367         * class.cs (TypeManager.AddMethod): The fix is not to change
5368         AddEnum, because that one was using a fully qualified name (every
5369         DeclSpace derivative does), but to change the AddMethod routine
5370         that was using an un-namespaced name.  This now correctly reports
5371         the duplicated name.
5372
5373         Revert patch until I can properly fix it.  The issue
5374         is that we have a shared Type space across all namespaces
5375         currently, which is wrong.
5376
5377         Options include making the Namespace a DeclSpace, and merge
5378         current_namespace/current_container in the parser.
5379
5380 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
5381
5382         * cs-parser.jay: Improve error reporting when we get a different
5383         kind of expression in local_variable_type and
5384         local_variable_pointer_type. 
5385
5386         Propagate this to avoid missleading errors being reported.
5387
5388         * ecore.cs (ImplicitReferenceConversion): treat
5389         TypeManager.value_type as a target just like object_type.   As
5390         code like this:
5391
5392         ValueType v = 1;
5393
5394         Is valid, and needs to result in the int 1 being boxed before it
5395         is assigned to the value type v.
5396
5397         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
5398         to validate the enumeration name.
5399
5400         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
5401         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
5402         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
5403
5404         * ecore.cs (TryImplicitIntConversion): When doing an
5405         implicit-enumeration-conversion, check if the type is 64-bits and
5406         perform a conversion before passing to EnumConstant.
5407
5408 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
5409
5410         * decl.cs (Error_AmbiguousTypeReference); New routine used to
5411         report ambiguous type references.  Unlike the MS version, we
5412         report what the ambiguity is.   Innovation at work ;-)
5413
5414         (DeclSpace.FindType): Require a location argument to
5415         display when we display an ambiguous error.
5416
5417         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
5418
5419         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
5420
5421         * expression.cs (EmitDynamicInitializers): Apply patch from
5422         hwang_rob@yahoo.ca that fixes the order in which we emit our
5423         initializers. 
5424
5425 2002-09-21  Martin Baulig  <martin@gnome.org>
5426
5427         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
5428         delegate takes no arguments.
5429
5430 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
5431
5432         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
5433         from integers.
5434
5435         * expression.cs: Extract the underlying type.
5436
5437         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
5438
5439         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
5440
5441 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
5442
5443         * class.cs (TypeContainer.DefineType): We can not use the nice
5444         PackingSize with the size set to 1 DefineType method, because it
5445         will not allow us to define the interfaces that the struct
5446         implements.
5447
5448         This completes the fixing of bug 27287
5449
5450         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
5451         means also structs.  This fixes part of the problem. 
5452         (Expresion.ImplicitReferenceConversionExists): ditto.
5453
5454         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
5455         error if there were no errors reported during the type lookup
5456         process, to avoid duplicates or redundant errors.  Without this
5457         you would get an ambiguous errors plus a type not found.  We have
5458         beaten the user enough with the first error.  
5459
5460         (DeclSparce.FindType): Emit a warning if we have an ambiguous
5461         reference. 
5462
5463         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
5464         during the resolution process, stop the lookup, this avoids
5465         repeated error reports (same error twice).
5466
5467         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
5468
5469         * typemanager.cs (LookupType): Redo the type lookup code to match
5470         the needs of System.Reflection.  
5471
5472         The issue is that System.Reflection requires references to nested
5473         types to begin with a "+" sign instead of a dot.  So toplevel
5474         types look like: "NameSpace.TopLevelClass", and nested ones look
5475         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
5476         levels. 
5477
5478 2002-09-19  Martin Baulig  <martin@gnome.org>
5479
5480         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
5481         says that a method always returns or always throws an exception,
5482         don't report the CS0161.
5483
5484         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
5485         set `Returns = new_returns'.
5486
5487 2002-09-19  Martin Baulig  <martin@gnome.org>
5488
5489         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
5490         to an enum constant, check for a CS0176.
5491
5492 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
5493
5494         * class.cs (TypeContainer.CheckPairedOperators): Now we check
5495         for operators that must be in pairs and report errors.
5496
5497         * ecore.cs (SimpleName.DoResolveType): During the initial type
5498         resolution process, when we define types recursively, we must
5499         check first for types in our current scope before we perform
5500         lookups in the enclosing scopes.
5501
5502         * expression.cs (MakeByteBlob): Handle Decimal blobs.
5503
5504         (Invocation.VerifyArgumentsCompat): Call
5505         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
5506         I thought we were supposed to always call this, but there are a
5507         few places in the code where we dont do it.
5508
5509 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
5510
5511         * driver.cs: Add support in -linkres and -resource to specify the
5512         name of the identifier.
5513
5514 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
5515
5516         * ecore.cs (StandardConversionExists): Sync with the conversion
5517         code: allow anything-* to void* conversions.
5518
5519         (FindMostSpecificSource): Use an Expression argument
5520         instead of a Type, because we might be handed over a Literal which
5521         gets a few more implicit conversions that plain types do not.  So
5522         this information was being lost.
5523
5524         Also, we drop the temporary type-holder expression when not
5525         required.
5526
5527 2002-09-17  Martin Baulig  <martin@gnome.org>
5528
5529         * class.cs (PropertyBase.CheckBase): Don't check the base class if
5530         this is an explicit interface implementation.
5531
5532 2002-09-17  Martin Baulig  <martin@gnome.org>
5533
5534         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
5535         different `IndexerName' attributes.
5536
5537         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
5538         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
5539         virtual CommonResolve().
5540
5541 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
5542
5543         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
5544         and convert that to the UnderlyingType.
5545
5546         * statement.cs (Foreach.Resolve): Indexers are just like variables
5547         or PropertyAccesses.
5548
5549         * cs-tokenizer.cs (consume_string): Track line numbers and columns
5550         inside quoted strings, we were not doing this before.
5551
5552 2002-09-16  Martin Baulig  <martin@gnome.org>
5553
5554         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
5555         resolve it.  This is needed for the definite assignment check of the
5556         instance expression, fixes bug #29846.
5557         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
5558
5559 2002-09-16  Nick Drochak  <ndrochak@gol.com>
5560
5561         * parameter.cs: Fix compile error.  Cannot reference static member
5562         from an instance object.  Is this an mcs bug?
5563
5564 2002-09-14  Martin Baulig  <martin@gnome.org>
5565
5566         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
5567         multiple times.  Fixes bug #30295, added test-166.cs.
5568
5569 2002-09-14  Martin Baulig  <martin@gnome.org>
5570
5571         * statement.cs (Block.Emit): Don't emit unreachable code.
5572         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
5573         `break' statements.
5574         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
5575
5576 2002-09-14  Martin Baulig  <martin@gnome.org>
5577
5578         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
5579         is set.
5580
5581 2002-09-14  Martin Baulig  <martin@gnome.org>
5582
5583         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
5584         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
5585         be false on the ms runtime.
5586
5587 2002-09-13  Martin Baulig  <martin@gnome.org>
5588
5589         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
5590         the CS0038 error message.
5591
5592 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
5593
5594         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
5595         constant inside, return it.
5596
5597 2002-09-12  Martin Baulig  <martin@gnome.org>
5598
5599         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
5600         implicit conversion can be done between enum types.
5601
5602         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
5603         check whether an implicit conversion to the current enum's UnderlyingType
5604         exists and report an error if not.
5605
5606         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
5607         without debugging support.
5608
5609         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
5610         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
5611
5612 2002-09-12  Martin Baulig  <martin@gnome.org>
5613
5614         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
5615
5616         * ecore.cs (IMemberExpr.DeclaringType): New property.
5617         (SimpleName.SimpleNameResolve): Check whether we're accessing a
5618         nonstatic member of an outer type (CS0038).
5619
5620 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
5621
5622         * driver.cs: Activate the using-error detector at warning level
5623         4 (at least for MS-compatible APIs).
5624
5625         * namespace.cs (VerifyUsing): Small buglett fix.
5626
5627         * pending.cs (PendingImplementation): pass the container pointer. 
5628
5629         * interface.cs (GetMethods): Allow for recursive definition.  Long
5630         term, I would like to move every type to support recursive
5631         definitions, not the current ordering mechanism that we have right
5632         now.
5633
5634         The situation is this: Attributes are handled before interfaces,
5635         so we can apply attributes to interfaces.  But some attributes
5636         implement interfaces, we will now handle the simple cases
5637         (recursive definitions will just get an error).  
5638
5639         * parameter.cs: Only invalidate types at the end if we fail to
5640         lookup all types.  
5641
5642 2002-09-09  Martin Baulig  <martin@gnome.org>
5643
5644         * ecore.cs (PropertyExpr.Emit): Also check for
5645         TypeManager.system_int_array_get_length so this'll also work when
5646         compiling corlib.  Fixes #30003.
5647
5648 2002-09-09  Martin Baulig  <martin@gnome.org>
5649
5650         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
5651         and throw an exception if we can't get the type's size.  Fixed #30040,
5652         added test-165.cs.
5653
5654 2002-09-09  Martin Baulig  <martin@gnome.org>
5655
5656         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
5657
5658         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
5659         context.  Fixes bug #30027.
5660
5661         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
5662         virtual functions.  Fixes bug #30043, added test-164.cs.
5663
5664 2002-09-08  Ravi Pratap  <ravi@ximian.com>
5665
5666         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
5667
5668 2002-09-08  Nick Drochak  <ndrochak@gol.com>
5669
5670         * driver.cs: Use an object to get the windows codepage since it's not a
5671         static property.
5672
5673 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
5674
5675         * statement.cs (For.Emit): for infinite loops (test == null)
5676         return whether there is a break inside, not always "true".
5677
5678         * namespace.cs (UsingEntry): New struct to hold the name of the
5679         using definition, the location where it is defined, and whether it
5680         has been used in a successful type lookup.
5681         
5682         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
5683         strings.
5684
5685         * decl.cs: ditto.
5686
5687 2002-09-06  Ravi Pratap  <ravi@ximian.com>
5688
5689         * attribute.cs : Fix incorrect code which relied on catching
5690         a NullReferenceException to detect a null being passed in
5691         where an object was expected.
5692
5693 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
5694
5695         * statement.cs (Try): flag the catch variable as assigned
5696
5697         * expression.cs (Cast): Simplified by using ResolveType instead of
5698         manually resolving.
5699
5700         * statement.cs (Catch): Fix bug by using ResolveType.
5701
5702 2002-09-06  Ravi Pratap  <ravi@ximian.com>
5703
5704         * expression.cs (BetterConversion): Special case for when we have
5705         a NullLiteral as the argument and we have to choose between string
5706         and object types - we choose string the way csc does.
5707
5708         * attribute.cs (Attribute.Resolve): Catch the
5709         NullReferenceException and report error #182 since the Mono
5710         runtime no more has the bug and having this exception raised means
5711         we tried to select a constructor which takes an object and is
5712         passed a null.
5713
5714 2002-09-05  Ravi Pratap  <ravi@ximian.com>
5715
5716         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
5717         message (1502, 1503) when we can't locate a method after overload
5718         resolution. This is much more informative and closes the bug
5719         Miguel reported.
5720
5721         * interface.cs (PopulateMethod): Return if there are no argument
5722         types. Fixes a NullReferenceException bug.
5723
5724         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
5725         expressions too. Previously we were checking only in one place for
5726         positional arguments leaving out named arguments.
5727
5728         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
5729         type to the enum type is not allowed. Remove code corresponding to
5730         that.
5731
5732         (ConvertNumericExplicit): Allow explicit conversions from
5733         the underlying type to enum type. This precisely follows the spec
5734         and closes a bug filed by Gonzalo.
5735         
5736 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5737
5738         * compiler.csproj:
5739         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
5740
5741 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
5742
5743         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
5744         it was important that we stored the right value after the
5745         reduction in `converted'.
5746
5747 2002-09-04  Martin Baulig  <martin@gnome.org>
5748
5749         * location.cs (Location.SymbolDocument): Use full pathnames for the
5750         source files.
5751
5752 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
5753
5754         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
5755         of the expression resolve mechanism, because that will catch the
5756         SimpleName error failures.
5757
5758         (Conditional): If we can not resolve the
5759         expression, return, do not crash.
5760
5761 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5762
5763         * cs-tokenizer.cs:
5764         (location): display token name instead of its number.
5765
5766 2002-08-28  Martin Baulig  <martin@gnome.org>
5767
5768         * expression.cs (Binary.ResolveOperator): Don't silently return
5769         but return an error if an operator cannot be applied between two
5770         enum types.
5771
5772 2002-08-28  Martin Baulig  <martin@gnome.org>
5773
5774         * class.cs (Constructor.Define): Set the permission attributes
5775         correctly instead of making all constructors public.
5776
5777 2002-08-28  Martin Baulig  <martin@gnome.org>
5778
5779         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
5780         for private members before reporting a CS0103; if we find anything,
5781         it's a CS0122.
5782
5783 2002-08-28  Martin Baulig  <martin@gnome.org>
5784
5785         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
5786         to check whether `closure_start_type == closure_invocation_type',
5787         we also need to check whether `m.DeclaringType == closure_invocation_type'
5788         before bypassing the permission checks.  We might be accessing
5789         protected/private members from the base class.
5790         (TypeManager.RealMemberLookup): Only set private_ok if private
5791         members were requested via BindingFlags.NonPublic.
5792
5793         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
5794
5795         * expression.cs (MemberAccess.ResolveMemberAccess): Set
5796         MethodGroupExpr.IsExplicitImpl if appropriate.
5797         (Invocation.DoResolve): Don't report the CS0120 for explicit
5798         interface implementations.
5799
5800 2002-08-27  Martin Baulig  <martin@gnome.org>
5801
5802         * expression.cs (Invocation.DoResolve): If this is a static
5803         method and we don't have an InstanceExpression, we must report
5804         a CS0120.
5805
5806 2002-08-25  Martin Baulig  <martin@gnome.org>
5807
5808         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
5809         `==' between a valuetype and an object.
5810
5811 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
5812
5813         * ecore.cs (TypeExpr): Provide a ToString method.
5814
5815 2002-08-24  Martin Baulig  <martin@gnome.org>
5816
5817         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
5818         now called proggie.dbg and it's a binary file.
5819
5820 2002-08-23  Martin Baulig  <martin@gnome.org>
5821
5822         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
5823
5824 2002-08-23  Martin Baulig  <martin@gnome.org>
5825
5826         * struct.cs (MyStructInfo.ctor): Make this work with empty
5827         structs; it's not allowed to use foreach() on null.
5828
5829 2002-08-23  Martin Baulig  <martin@gnome.org>
5830
5831         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
5832         writer the full pathname of the generated assembly.
5833
5834 2002-08-23  Martin Baulig  <martin@gnome.org>
5835
5836         * statements.cs (FlowBranching.UsageVector.MergeChildren):
5837         A `finally' block never returns or breaks; improved handling of
5838         unreachable code.
5839
5840 2002-08-23  Martin Baulig  <martin@gnome.org>
5841
5842         * statement.cs (Throw.Resolve): Allow `throw null'.
5843
5844 2002-08-23  Martin Baulig  <martin@gnome.org>
5845
5846         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
5847         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
5848         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
5849         MemberLookup would return a wrong event if this is an explicit
5850         interface implementation and the class has an event with the same
5851         name.
5852
5853 2002-08-23  Martin Baulig  <martin@gnome.org>
5854
5855         * statement.cs (Block.AddChildVariableNames): New public method.
5856         (Block.AddChildVariableName): Likewise.
5857         (Block.IsVariableNameUsedInChildBlock): Likewise.
5858         (Block.AddVariable): Check whether a variable name has already
5859         been used in a child block.
5860
5861         * cs-parser.jay (declare_local_variables): Mark all variable names
5862         from the current block as being used in a child block in the
5863         implicit block.
5864
5865 2002-08-23  Martin Baulig  <martin@gnome.org>
5866
5867         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
5868         find the symbol writer.
5869
5870         * driver.cs: csc also allows the arguments to /define being
5871         separated by commas, not only by semicolons.
5872
5873 2002-08-23  Martin Baulig  <martin@gnome.org>
5874
5875         * interface.cs (Interface.GetMembers): Added static check for events.
5876
5877 2002-08-15  Martin Baulig  <martin@gnome.org>
5878
5879         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
5880         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
5881
5882         * ecore.cs (Expression.MemberLookup): Added documentation and explained
5883         why the MethodData.EmitDestructor() change was necessary.
5884
5885 2002-08-20  Martin Baulig  <martin@gnome.org>
5886
5887         * class.cs (TypeContainer.FindMembers): Added static check for events.
5888
5889         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
5890
5891         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
5892         use Type.GetEvents(), not Type.FindMembers().
5893
5894 2002-08-20  Martin Baulig  <martin@gnome.org>
5895
5896         * decl.cs (MemberCache): Added a special method cache which will
5897         be used for method-only searched.  This ensures that a method
5898         search will return a MethodInfo with the correct ReflectedType for
5899         inherited methods.      
5900
5901 2002-08-20  Martin Baulig  <martin@gnome.org>
5902
5903         * decl.cs (DeclSpace.FindMembers): Made this public.
5904
5905 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5906
5907         * delegate.cs: fixed build on windows.
5908         [FIXME:  Filed as bug #29150: MCS must report these errors.]
5909
5910 2002-08-19  Ravi Pratap  <ravi@ximian.com>
5911
5912         * ecore.cs (StandardConversionExists): Return a false
5913         if we are trying to convert the void type to anything else
5914         since that is not allowed.
5915
5916         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
5917         we flag error 70 in the event an event is trying to be accessed
5918         directly from outside the declaring type.
5919
5920 2002-08-20  Martin Baulig  <martin@gnome.org>
5921
5922         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
5923         MemberCache from typemanager.cs to decl.cs.
5924
5925 2002-08-19  Martin Baulig  <martin@gnome.org>
5926
5927         * class.cs (TypeContainer): Implement IMemberContainer.
5928         (TypeContainer.DefineMembers): Create the MemberCache.
5929         (TypeContainer.FindMembers): Do better BindingFlags checking; only
5930         return public members if BindingFlags.Public was given, check
5931         whether members are static.
5932
5933 2002-08-16  Martin Baulig  <martin@gnome.org>
5934
5935         * decl.cs (DeclSpace.Define): Splitted this in Define and
5936         DefineMembers.  DefineMembers is called first and initializes the
5937         MemberCache.
5938
5939         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
5940         DefineMembers() on all our DeclSpaces.
5941
5942         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
5943         but call DefineMembers() on all nested interfaces.  We call their
5944         Define() in our new Define() function.
5945
5946         * interface.cs (Interface): Implement IMemberContainer.
5947         (Interface.Define): Moved all code except the attribute stuf to
5948         DefineMembers().
5949         (Interface.DefineMembers): Initialize the member cache.
5950
5951         * typemanager.cs (IMemberFinder): Removed this interface, we don't
5952         need this anymore since we can use MemberCache.FindMembers directly.
5953
5954 2002-08-19  Martin Baulig  <martin@gnome.org>
5955
5956         * typemanager.cs (MemberCache): When creating the cache for an
5957         interface type, add all inherited members.
5958         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
5959         to `out bool used_cache' and documented it.
5960         (TypeManager.MemberLookup): If we already used the cache in the first
5961         iteration, we don't need to do the interfaces check.
5962
5963 2002-08-19  Martin Baulig  <martin@gnome.org>
5964
5965         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
5966         here from IMemberFinder and don't implement this interface anymore.
5967         (DeclSpace.MemberCache): Moved here from IMemberFinder.
5968
5969         * typemanager.cs (IMemberFinder): This interface is now only used by
5970         classes which actually support the member cache.
5971         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
5972         since we only put DeclSpaces into this Hashtable.
5973         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
5974         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
5975
5976 2002-08-16  Martin Baulig  <martin@gnome.org>
5977
5978         * typemanager.cs (ICachingMemberFinder): Removed.
5979         (IMemberFinder.MemberCache): New property.
5980         (TypeManager.FindMembers): Merged this with RealFindMembers().
5981         This function will never be called from TypeManager.MemberLookup()
5982         so we can't use the cache here, just the IMemberFinder.
5983         (TypeManager.MemberLookup_FindMembers): Check whether the
5984         IMemberFinder has a MemberCache and call the cache's FindMembers
5985         function.
5986         (MemberCache): Rewrote larger parts of this yet another time and
5987         cleaned it up a bit.
5988
5989 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
5990
5991         * driver.cs (LoadArgs): Support quoting.
5992
5993         (Usage): Show the CSC-like command line arguments.
5994
5995         Improved a few error messages.
5996
5997 2002-08-15  Martin Baulig  <martin@gnome.org>
5998
5999         * typemanager.cs (IMemberContainer.Type): New property.
6000         (IMemberContainer.IsInterface): New property.
6001
6002         The following changes are conditional to BROKEN_RUNTIME, which is
6003         defined at the top of the file.
6004
6005         * typemanager.cs (MemberCache.MemberCache): Don't add the base
6006         class'es members, but add all members from TypeHandle.ObjectType
6007         if we're an interface.
6008         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
6009         is the current type.
6010         (MemberCache.CacheEntry.Container): Removed this field.
6011         (TypeHandle.GetMembers): Include inherited members.
6012
6013 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6014
6015         * typemanager.cs: fixed compilation and added a comment on a field that
6016         is never used.
6017
6018 2002-08-15  Martin Baulig  <martin@gnome.org>
6019
6020         * class.cs (ConstructorInitializer.Resolve): In the
6021         Expression.MemberLookup call, use the queried_type as
6022         invocation_type.
6023
6024         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
6025         declared' attribute, it's always true.
6026         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
6027         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
6028         temporary wrapper for FindMembers which tells MemberLookup whether
6029         members from the base classes are included in the return value.
6030         This will go away soon.
6031         (TypeManager.MemberLookup): Use this temporary hack here; once the
6032         new MemberCache is completed, we don't need to do the DeclaredOnly
6033         looping here anymore since the MemberCache will take care of this.
6034         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
6035         (MemberCache): When creating the MemberCache for a class, get
6036         members from the current class and all its base classes.
6037         (MemberCache.CacheEntry.Container): New field.  This is a
6038         temporary hack until the Mono runtime is fixed to distinguish
6039         between ReflectedType and DeclaringType.  It allows us to use MCS
6040         with both the MS runtime and the unfixed Mono runtime without
6041         problems and without accecting performance.
6042         (MemberCache.SearchMembers): The DeclaredOnly looping from
6043         TypeManager.MemberLookup is now done here.      
6044
6045 2002-08-14  Martin Baulig  <martin@gnome.org>
6046
6047         * statement.cs (MyStructInfo.MyStructInfo): Don't call
6048         Type.GetFields on dynamic types but get the fields from the
6049         corresponding TypeContainer.
6050         (MyStructInfo.GetStructInfo): Added check for enum types.
6051
6052         * typemanager.cs (MemberList.IsSynchronized): Implemented.
6053         (MemberList.SyncRoot): Implemented.
6054         (TypeManager.FilterWithClosure): No need to check permissions if
6055         closure_start_type == closure_invocation_type, don't crash if
6056         closure_invocation_type is null.
6057
6058 2002-08-13  Martin Baulig  <martin@gnome.org>
6059
6060         Rewrote TypeContainer.FindMembers to use a member cache.  This
6061         gives us a speed increase of about 35% for the self-hosting MCS
6062         build and of about 15-20% for the class libs (both on GNU/Linux).
6063
6064         * report.cs (Timer): New class to get enhanced profiling.  This
6065         whole class is "TIMER" conditional since it remarkably slows down
6066         compilation speed.
6067
6068         * class.cs (MemberList): New class.  This is an IList wrapper
6069         which we're now using instead of passing MemberInfo[]'s around to
6070         avoid copying this array unnecessarily.
6071         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
6072         (ICachingMemberFinder, IMemberContainer): New interface.
6073         (TypeManager.FilterWithClosure): If `criteria' is null, the name
6074         has already been checked, otherwise use it for the name comparision.
6075         (TypeManager.FindMembers): Renamed to RealMemberFinder and
6076         provided wrapper which tries to use ICachingMemberFinder.FindMembers
6077         if possible.  Returns a MemberList, not a MemberInfo [].
6078         (TypeHandle): New class, implements IMemberContainer.  We create
6079         one instance of this class per type, it contains a MemberCache
6080         which is used to do the member lookups.
6081         (MemberCache): New class.  Each instance of this class contains
6082         all members of a type and a name-based hash table.
6083         (MemberCache.FindMembers): This is our new member lookup
6084         function.  First, it looks up all members of the requested name in
6085         the hash table.  Then, it walks this list and sorts out all
6086         applicable members and returns them.
6087
6088 2002-08-13  Martin Baulig  <martin@gnome.org>
6089
6090         In addition to a nice code cleanup, this gives us a performance
6091         increase of about 1.4% on GNU/Linux - not much, but it's already
6092         half a second for the self-hosting MCS compilation.
6093
6094         * typemanager.cs (IMemberFinder): New interface.  It is used by
6095         TypeManager.FindMembers to call FindMembers on a TypeContainer,
6096         Enum, Delegate or Interface.
6097         (TypeManager.finder_to_member_finder): New PtrHashtable.
6098         (TypeManager.finder_to_container): Removed.
6099         (TypeManager.finder_to_delegate): Removed.
6100         (TypeManager.finder_to_interface): Removed.
6101         (TypeManager.finder_to_enum): Removed.
6102
6103         * interface.cs (Interface): Implement IMemberFinder.
6104
6105         * delegate.cs (Delegate): Implement IMemberFinder.
6106
6107         * enum.cs (Enum): Implement IMemberFinder.
6108
6109         * class.cs (TypeContainer): Implement IMemberFinder.
6110
6111 2002-08-12  Martin Baulig  <martin@gnome.org>
6112
6113         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
6114
6115 2002-08-12  Martin Baulig  <martin@gnome.org>
6116
6117         * ecore.cs (ITypeExpression): New interface for expressions which
6118         resolve to a type.
6119         (TypeExpression): Renamed to TypeLookupExpression.
6120         (Expression.DoResolve): If we're doing a types-only lookup, the
6121         expression must implement the ITypeExpression interface and we
6122         call DoResolveType() on it.
6123         (SimpleName): Implement the new ITypeExpression interface.
6124         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
6125         hack, the situation that we're only looking up types can't happen
6126         anymore when this method is called.  Moved the type lookup code to
6127         DoResolveType() and call it.
6128         (SimpleName.DoResolveType): This ITypeExpression interface method
6129         is now doing the types-only lookup.
6130         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
6131         (ResolveFlags): Added MaskExprClass.
6132
6133         * expression.cs (MemberAccess): Implement the ITypeExpression
6134         interface.
6135         (MemberAccess.DoResolve): Added support for a types-only lookup
6136         when we're called via ITypeExpression.DoResolveType().
6137         (ComposedCast): Implement the ITypeExpression interface.
6138
6139         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
6140         Expression.Resolve() with ResolveFlags.Type instead.
6141
6142 2002-08-12  Martin Baulig  <martin@gnome.org>
6143
6144         * interface.cs (Interface.Define): Apply attributes.
6145
6146         * attribute.cs (Attribute.ApplyAttributes): Added support for
6147         interface attributes.
6148
6149 2002-08-11  Martin Baulig  <martin@gnome.org>
6150
6151         * statement.cs (Block.Emit): Only check the "this" variable if we
6152         do not always throw an exception.
6153
6154         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
6155         whether the property has a set accessor.
6156
6157 2002-08-11  Martin Baulig  <martin@gnome.org>
6158
6159         Added control flow analysis support for structs.
6160
6161         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
6162         with control flow analysis turned off.
6163         (IVariable): New interface.
6164         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
6165         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
6166         (FieldExpr.DoResolve): Resolve the instance expression with flow
6167         analysis turned off and do the definite assignment check after the
6168         resolving when we know what the expression will resolve to.
6169
6170         * expression.cs (LocalVariableReference, ParameterReference):
6171         Implement the new IVariable interface, only call the flow analysis
6172         code if ec.DoFlowAnalysis is true.
6173         (This): Added constructor which takes a Block argument.  Implement
6174         the new IVariable interface.
6175         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
6176         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
6177         This does the definite assignment checks for struct members.
6178
6179         * class.cs (Constructor.Emit): If this is a non-static `struct'
6180         constructor which doesn't have any initializer, call
6181         Block.AddThisVariable() to tell the flow analysis code that all
6182         struct elements must be initialized before control returns from
6183         the constructor.
6184
6185         * statement.cs (MyStructInfo): New public class.
6186         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
6187         argument to this indexer.  If non-zero, check an individual struct
6188         member, not the whole struct.
6189         (FlowBranching.CheckOutParameters): Check struct members.
6190         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
6191         overloaded versions of these methods which take an additional
6192         `int field_idx' argument to check struct members.
6193         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
6194         overloaded versions of these methods which take an additional
6195         `string field_name' argument to check struct member.s
6196         (VariableInfo): Implement the IVariable interface.
6197         (VariableInfo.StructInfo): New public property.  Returns the
6198         MyStructInfo instance of the variable if it's a struct or null.
6199         (Block.AddThisVariable): New public method.  This is called from
6200         Constructor.Emit() for non-static `struct' constructor which do
6201         not have any initializer.  It creates a special variable for the
6202         "this" instance variable which will be checked by the flow
6203         analysis code to ensure that all of the struct's fields are
6204         initialized before control returns from the constructor.
6205         (UsageVector): Added support for struct members.  If a
6206         variable/parameter is a struct with N members, we reserve a slot
6207         in the usage vector for each member.  A struct is considered fully
6208         initialized if either the struct itself (slot 0) or all its
6209         members are initialized.
6210
6211 2002-08-08  Martin Baulig  <martin@gnome.org>
6212
6213         * driver.cs (Driver.MainDriver): Only report an error CS5001
6214         if there were no compilation errors.
6215
6216         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
6217         `UnsafeContext' property to determine whether the parent is in
6218         unsafe context rather than checking the parent's ModFlags:
6219         classes nested in an unsafe class are unsafe as well.
6220
6221 2002-08-08  Martin Baulig  <martin@gnome.org>
6222
6223         * statement.cs (UsageVector.MergeChildren): Distinguish between
6224         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
6225         we return.  Added test17() and test18() to test-154.cs.
6226
6227 2002-08-08  Martin Baulig  <martin@gnome.org>
6228
6229         * typemanager.cs (TypeManager.FilterWithClosure): If we have
6230         Family access, make sure the invoking type isn't a subclass of the
6231         queried type (that'd be a CS1540).
6232
6233         * ecore.cs (Expression.MemberLookup): Added overloaded version of
6234         this method which takes an additional `Type invocation_type'.
6235
6236         * expression.cs (BaseAccess.DoResolve): Use the base type as
6237         invocation and query type.
6238         (MemberAccess.DoResolve): If the lookup failed and we're about to
6239         report a CS0122, try a lookup with the ec.ContainerType - if this
6240         succeeds, we must report a CS1540.
6241
6242 2002-08-08  Martin Baulig  <martin@gnome.org>
6243
6244         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
6245         (MethodGroupExpr): Implement the IMemberExpr interface.
6246
6247         * expression (MemberAccess.ResolveMemberAccess): No need to have
6248         any special code for MethodGroupExprs anymore, they're now
6249         IMemberExprs.   
6250
6251 2002-08-08  Martin Baulig  <martin@gnome.org>
6252
6253         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
6254         Family, FamANDAssem and FamORAssem permissions.
6255         (TypeManager.IsSubclassOrNestedChildOf): New public method.
6256
6257 2002-08-08  Martin Baulig  <martin@gnome.org>
6258
6259         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
6260         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
6261         or loop block.
6262
6263 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
6264
6265         * driver.cs: implemented /resource option to embed managed resources.
6266
6267 2002-08-07  Martin Baulig  <martin@gnome.org>
6268
6269         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
6270         (FieldBase.HasFieldInitializer): New public property.
6271         (FieldBase.GetInitializerExpression): New public method.  Resolves and
6272         returns the field initializer and makes sure it is only resolved once.
6273         (TypeContainer.EmitFieldInitializers): Call
6274         FieldBase.GetInitializerExpression to get the initializer, this ensures
6275         that it isn't resolved multiple times.
6276
6277         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
6278         the resolving process (SimpleName/MemberLookup) that we're currently
6279         emitting a field initializer (which must not access any instance members,
6280         this is an error CS0236).
6281
6282         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
6283         argument, if the `IsFieldInitializer' flag is set, we must report and
6284         error CS0236 and not an error CS0120.   
6285
6286 2002-08-07  Martin Baulig  <martin@gnome.org>
6287
6288         * ecore.cs (IMemberExpr): New public interface.
6289         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
6290         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
6291         if the expression is an IMemberExpr.
6292
6293         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
6294         to be null, implicitly default to `this' if we're non-static in
6295         this case.  Simplified the code a lot by using the new IMemberExpr
6296         interface.  Also fixed bug #28176 here.
6297
6298 2002-08-06  Martin Baulig  <martin@gnome.org>
6299
6300         * cs-parser.jay (SimpleLookup): Removed.  We need to create
6301         ParameterReferences during semantic analysis so that we can do a
6302         type-only search when resolving Cast, TypeOf and SizeOf.
6303         (block): Pass the `current_local_parameters' to the Block's
6304         constructor.
6305
6306         * class.cs (ConstructorInitializer): Added `Parameters parameters'
6307         argument to the constructor.
6308         (ConstructorInitializer.Resolve): Create a temporary implicit
6309         block with the parameters.
6310
6311         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
6312         references here if we aren't doing a type-only search.
6313
6314         * statement.cs (Block): Added constructor which takes a
6315         `Parameters parameters' argument.
6316         (Block.Parameters): New public property.
6317
6318         * support.cs (InternalParameters.Parameters): Renamed `parameters'
6319         to `Parameters' and made it public readonly.
6320
6321 2002-08-06  Martin Baulig  <martin@gnome.org>
6322
6323         * ecore.cs (Expression.Warning): Made this public as well.
6324
6325         * report.cs (Report.Debug): Print the contents of collections.
6326
6327 2002-08-06  Martin Baulig  <martin@gnome.org>
6328
6329         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
6330         used to tell Resolve() which kinds of expressions it may return.
6331         (Expression.Resolve): Added overloaded version of this method which
6332         takes a `ResolveFlags flags' argument.  This can be used to tell
6333         Resolve() which kinds of expressions it may return.  Reports a
6334         CS0118 on error.
6335         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
6336         ResolveFlags.SimpleName.
6337         (Expression.Error118): Added overloaded version of this method which
6338         takes a `ResolveFlags flags' argument.  It uses the flags to determine
6339         which kinds of expressions are allowed.
6340
6341         * expression.cs (Argument.ResolveMethodGroup): New public method.
6342         Resolves an argument, but allows a MethodGroup to be returned.
6343         This is used when invoking a delegate.
6344
6345         * TODO: Updated a bit.
6346
6347 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6348
6349         Fixed compilation with csc.
6350
6351         * ecore.cs: Expression.Error made public. Is this correct? Should
6352         Warning be made public too?
6353
6354         * expression.cs: use ea.Location instead of ea.loc.
6355         [FIXME:  Filed as bug #28607: MCS must report these errors.]
6356
6357 2002-08-06  Martin Baulig  <martin@gnome.org>
6358
6359         * ecore.cs (Expression.loc): Moved the location here instead of
6360         duplicating it in all derived classes.
6361         (Expression.Location): New public property.
6362         (Expression.Error, Expression.Warning): Made them non-static and
6363         removed the location argument.
6364         (Expression.Warning): Added overloaded version which takes an
6365         `int level' argument.
6366         (Expression.Error118): Make this non-static and removed the
6367         expression and location arguments.
6368         (TypeExpr): Added location argument to the constructor.
6369
6370         * expression.cs (StaticCallExpr): Added location argument to
6371         the constructor.
6372         (Indirection, PointerArithmetic): Likewise.
6373         (CheckedExpr, UnCheckedExpr): Likewise.
6374         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
6375         (StringPtr): Likewise.
6376
6377
6378 2002-08-05  Martin Baulig  <martin@gnome.org>
6379
6380         * expression.cs (BaseAccess.DoResolve): Actually report errors.
6381
6382         * assign.cs (Assign.DoResolve): Check whether the source
6383         expression is a value or variable.
6384
6385         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
6386         while resolving the corresponding blocks.
6387
6388         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
6389         an error, don't silently return null.
6390
6391         * statement.cs (Block.AddVariable): Do the error reporting here
6392         and distinguish between CS0128 and CS0136.
6393         (Block.DoResolve): Report all unused labels (warning CS0164).
6394         (LabeledStatement): Pass the location to the constructor.
6395         (LabeledStatement.HasBeenReferenced): New property.
6396         (LabeledStatement.Resolve): Set it to true here.
6397
6398         * statement.cs (Return.Emit): Return success even after reporting
6399         a type mismatch error (CS0126 or CS0127), this is what csc does and
6400         it avoids confusing the users with any consecutive errors.
6401
6402 2002-08-05  Martin Baulig  <martin@gnome.org>
6403
6404         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
6405
6406         * const.cs (Const.LookupConstantValue): Catch circular definitions.
6407
6408         * expression.cs (MemberAccess.DoResolve): Silently return if an
6409         error has already been reported.
6410
6411         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
6412         error has already been reported.
6413
6414 2002-08-05  Martin Baulig  <martin@gnome.org>
6415
6416         * statement.cs (UsageVector): Only initialize the `parameters'
6417         vector if we actually have any "out" parameters.
6418
6419 2002-08-05  Martin Baulig  <martin@gnome.org>
6420
6421         * expression.cs (Binary.ResolveOperator): When combining delegates,
6422         they must have the same type.
6423
6424 2002-08-05  Martin Baulig  <martin@gnome.org>
6425
6426         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
6427         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
6428         work with the ms runtime and we also don't need it: if we're a
6429         PropertyBuilder and not in the `indexer_arguments' hash, then we
6430         are a property and not an indexer.
6431
6432         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
6433         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
6434         since the latter one doesn't work with the ms runtime.
6435
6436 2002-08-03  Martin Baulig  <martin@gnome.org>
6437
6438         Fixed bugs #27998 and #22735.
6439
6440         * class.cs (Method.IsOperator): New public field.
6441         (Method.CheckBase): Report CS0111 if there's already a method
6442         with the same parameters in the current class.  Report CS0508 when
6443         attempting to change the return type of an inherited method.
6444         (MethodData.Emit): Report CS0179 if a method doesn't have a body
6445         and it's not marked abstract or extern.
6446         (PropertyBase): New abstract base class for Property and Indexer.
6447         (PropertyBase.CheckBase): Moved here from Property and made it work
6448         for indexers.
6449         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
6450         the same so we can reuse it there.
6451         (Property, Indexer): Derive from PropertyBase.
6452         (MethodSignature.inheritable_property_signature_filter): New delegate
6453         to find properties and indexers.
6454
6455         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
6456         argument and improved error reporting.
6457
6458         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
6459         EmptyReadOnlyParameters and made it a property.
6460
6461         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
6462         version of this method which takes a `PropertyInfo indexer'.
6463         (TypeManager.RegisterIndexer): New method.
6464
6465         * class.cs: Added myself as author of this file :-)
6466
6467 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6468
6469         * class.cs: fixed compilation on windoze.
6470
6471 2002-08-03  Martin Baulig  <martin@gnome.org>
6472
6473         * interface.cs (Interface.GetInterfaceBases): Check whether all
6474         base interfaces are at least as accessible than the current one.
6475
6476         * class.cs (TypeContainer.GetClassBases): Check whether base types
6477         are at least as accessible than the current type.
6478         (TypeContainer.AsAccessible): Implemented and made non-static.
6479         (MemberBase.CheckParameters): Report errors if the accessibility
6480         checks fail.
6481
6482         * delegate.cs (Delegate.Delegate): The default visibility is
6483         internal for top-level types and private for nested types.
6484         (Delegate.Define): Report errors if the accessibility checks fail.
6485
6486         * enum.cs (Enum.Enum): The default visibility is internal for
6487         top-level types and private for nested types.
6488         (Enum.DefineType): Compute the correct visibility.
6489
6490         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
6491         function which takes a `bool is_toplevel' instead of a TypeContainer.
6492
6493         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
6494         builtin type.
6495
6496 2002-08-02  Martin Baulig  <martin@gnome.org>
6497
6498         * expression.cs (LocalVariableReferenc): Added constructor which
6499         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
6500         (LocalVariableReference.IsReadOnly): New property.
6501         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
6502         variable is readonly, use our own readonly flag to do this; you can
6503         use the new constructor to get a writable reference to a read-only
6504         variable.
6505
6506         * cs-parser.jay (foreach_statement, using_statement): Get a writable
6507         reference to the local variable.
6508
6509 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
6510
6511         * rootcontext.cs (ResolveCore): Also include System.Exception
6512
6513         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
6514         we reach an EmptyStatement.
6515
6516         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
6517         is also fine.
6518
6519         * expression.cs (Binary.ResolveOperator): Check error result in
6520         two places.
6521
6522         use brtrue/brfalse directly and avoid compares to null.
6523
6524 2002-08-02  Martin Baulig  <martin@gnome.org>
6525
6526         * class.cs (TypeContainer.Define): Define all nested interfaces here.
6527         Fixes bug #28407, added test-155.cs.
6528
6529 2002-08-01  Martin Baulig  <martin@gnome.org>
6530
6531         * class.cs (Event.EmitDefaultMethod): Make this work with static
6532         events.  Fixes #28311, added verify-3.cs.
6533
6534 2002-08-01  Martin Baulig  <martin@gnome.org>
6535
6536         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
6537         `is_disposable' fields.
6538         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
6539         `hm.is_disposable' if we're using the collection pattern.
6540         (Foreach.EmitCollectionForeach): Use the correct type for the
6541         enumerator's local variable, only emit the try/finally block if
6542         necessary (fixes #27713).
6543
6544 2002-08-01  Martin Baulig  <martin@gnome.org>
6545
6546         * ecore.cs (Expression.report118): Renamed to Error118 and made
6547         it public static.
6548
6549         * statement.cs (Throw.Resolve): Check whether the expression is of
6550         the correct type (CS0118) and whether the type derives from
6551         System.Exception (CS0155).
6552         (Catch.Resolve): New method.  Do the type lookup here and check
6553         whether it derives from System.Exception (CS0155).
6554         (Catch.CatchType, Catch.IsGeneral): New public properties.
6555
6556         * typemanager.cs (TypeManager.exception_type): Added.
6557
6558 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
6559
6560         * driver.cs: Updated About function.
6561
6562 2002-07-31  Martin Baulig  <martin@gnome.org>
6563
6564         Implemented Control Flow Analysis.
6565
6566         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
6567         (EmitContext.CurrentBranching): Added.
6568         (EmitContext.StartFlowBranching): Added.
6569         (EmitContext.EndFlowBranching): Added.
6570         (EmitContext.KillFlowBranching): Added.
6571         (EmitContext.IsVariableAssigned): Added.
6572         (EmitContext.SetVariableAssigned): Added.
6573         (EmitContext.IsParameterAssigned): Added.
6574         (EmitContext.SetParameterAssigned): Added.
6575         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
6576         Added control flow analysis stuff here.
6577
6578         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
6579         resolve the expression as lvalue.
6580         (LocalVariableReference.DoResolve): Check whether the variable has
6581         already been assigned.
6582         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
6583         the parameter as assigned here.
6584         (ParameterReference.DoResolve): Check whether the parameter has already
6585         been assigned.
6586         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
6587         expression as lvalue.
6588
6589         * statement.cs (FlowBranching): New class for the flow analysis code.
6590         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
6591         (LabeledStatement.IsDefined): New public property.
6592         (LabeledStatement.AddUsageVector): New public method to tell flow
6593         analyis that the label may be reached via a forward jump.
6594         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
6595         flow analysis.
6596         (VariableInfo.Number): New public field.  This is used by flow analysis
6597         to number all locals of a block.
6598         (Block.CountVariables): New public property.  This is the number of
6599         local variables in this block (including the locals from all parent
6600         blocks).
6601         (Block.EmitMeta): Number all the variables.
6602
6603         * statement.cs: Added flow analysis support to all classes.
6604
6605 2002-07-31  Martin Baulig  <martin@gnome.org>
6606
6607         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
6608         To get debugging messages, compile mcs with /define:MCS_DEBUG and
6609         then use this argument.
6610
6611         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
6612
6613         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
6614         use this to specify /define options.
6615
6616 2002-07-29  Martin Baulig  <martin@gnome.org>
6617
6618         * statement.cs (Fixed): Moved all code that does variable lookups
6619         and resolvings from Emit to Resolve.
6620
6621         * statement.cs (For): Moved all code that does variable lookups
6622         and resolvings from Emit to Resolve.
6623
6624         * statement.cs (Using): Moved all code that does variable lookups
6625         and resolvings from Emit to Resolve.
6626
6627 2002-07-29  Martin Baulig  <martin@gnome.org>
6628
6629         * attribute.cs (Attribute.Resolve): Explicitly catch a
6630         System.NullReferenceException when creating the
6631         CustromAttributeBuilder and report a different warning message.
6632
6633 2002-07-29  Martin Baulig  <martin@gnome.org>
6634
6635         * support.cs (ParameterData.ParameterName): Added method to
6636         get the name of a parameter.
6637
6638         * typemanager.cs (TypeManager.IsValueType): New public method.
6639
6640 2002-07-29  Martin Baulig  <martin@gnome.org>
6641
6642         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
6643         is a flag which specifies that it's either ref or out.
6644         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
6645         the out parameter to `out Parameter.Modifier mod', also set the
6646         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
6647
6648         * support.cs (InternalParameters.ParameterModifier): Distinguish
6649         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
6650         Parameter.Modifier.ISBYREF flag if it's either ref or out.
6651
6652         * expression.cs (Argument.GetParameterModifier): Distinguish
6653         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
6654         Parameter.Modifier.ISBYREF flag if it's either ref or out.
6655
6656 2002-07-29  Martin Baulig  <martin@gnome.org>
6657
6658         * expression.cs (ParameterReference.ParameterReference): Added
6659         `Location loc' argument to the constructor.
6660
6661         * cs-parser.jay: Pass location to ParameterReference.
6662
6663 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
6664
6665         * statement.cs (Try): Initialize the location.
6666
6667         * cs-parser.jay: pass location to Try.
6668
6669         * expression.cs (Unary.Reduce): Change the prototype to return
6670         whether a constant fold could be performed or not.  The result is
6671         returned in an out parameters.  In the case of Indirection and
6672         AddressOf, we want to perform the full tests.
6673
6674 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
6675
6676         * statement.cs (Statement.Emit): Flag dead code.
6677
6678 2002-07-27  Andrew Birkett  <andy@nobugs.org>
6679
6680         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
6681
6682 2002-07-27  Martin Baulig  <martin@gnome.org>
6683
6684         * class.cs (MethodData.Define): Put back call to
6685         TypeManager.AddMethod(), accidentally commented this out.
6686
6687         * report.cs (Debug): New public method to print debugging information,
6688         this is `[Conditional ("DEBUG")]'.
6689
6690 2002-07-26  Martin Baulig  <martin@gnome.org>
6691
6692         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
6693         (switch_statement): Push the current_block to the switch_stack and
6694         pop it again when we're done with the switch.
6695         (switch_section): The new block is a child of the current_block.
6696         Fixes bug #24007, added test-152.cs.
6697
6698 2002-07-27  Martin Baulig  <martin@gnome.org>
6699
6700         * expression.cs (Invocation.EmitArguments): When calling a varargs
6701         function with only its fixed arguments, we need to pass an empty
6702         array.
6703
6704 2002-07-27  Martin Baulig  <martin@gnome.org>
6705
6706         Mono 0.13 has been released.
6707
6708 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
6709
6710         * driver.cs: Rename --resource to --linkres, because that is what
6711         we do currently, we dont support --resource yet.
6712
6713         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
6714
6715 2002-07-25  Martin Baulig  <martin@gnome.org>
6716
6717         * class.cs (MethodData): New public class.  This is a `method builder'
6718         class for a method or one accessor of a Property/Indexer/Event.
6719         (MethodData.GetMethodFlags): Moved here from MemberBase.
6720         (MethodData.ApplyAttributes): Likewise.
6721         (MethodData.ApplyObsoleteAttribute): Likewise.
6722         (MethodData.ApplyConditionalAttribute): Likewise.
6723         (MethodData.ApplyDllImportAttribute): Likewise.
6724         (MethodData.CheckAbstractAndExternal): Likewise.
6725         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
6726         (MethodData.Emit): Formerly known as Method.Emit().
6727         (MemberBase): Moved everything which was specific to a single
6728         accessor/method to MethodData.
6729         (Method): Create a new MethodData and call Define() and Emit() on it.
6730         (Property, Indexer, Event): Create a new MethodData objects for each
6731         accessor and call Define() and Emit() on them.
6732
6733 2002-07-25  Martin Baulig  <martin@gnome.org>
6734
6735         Made MethodCore derive from MemberBase to reuse the code from there.
6736         MemberBase now also checks for attributes.
6737
6738         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
6739         (MemberBase.GetMethodFlags): Moved here from class Method and marked
6740         as virtual.
6741         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
6742         `CallingConventions cc' and `Attributes opt_attrs' arguments.
6743         (MemberBase.ApplyAttributes): New virtual method; applies the
6744         attributes to a method or accessor.
6745         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
6746         (MemberBase.ApplyConditionalAttribute): Likewise.
6747         (MemberBase.ApplyDllImportAttribute): Likewise.
6748         (MemberBase.CheckAbstractAndExternal): Likewise.
6749         (MethodCore.ParameterTypes): This is now a property instead of a
6750         method, it's initialized from DoDefineParameters().
6751         (MethodCore.ParameterInfo): Removed the set accessor.
6752         (MethodCore.DoDefineParameters): New protected virtual method to
6753         initialize ParameterTypes and ParameterInfo.
6754         (Method.GetReturnType): We can now simply return the MemberType.
6755         (Method.GetMethodFlags): Override the MemberBase version and add
6756         the conditional flags.
6757         (Method.CheckBase): Moved some code from Define() here, call
6758         DoDefineParameters() here.
6759         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
6760         here to avoid some larger code duplication.
6761         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
6762         ensure that abstract and external accessors don't declare a body.
6763
6764         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
6765         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
6766         lookup in the attribute's parent classes, so we need to abort as soon
6767         as we found the first match.
6768         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
6769         the attribute has no arguments.
6770
6771         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
6772         of a Method.
6773
6774 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6775
6776         * cs-parser.jay: reverted previous patch.
6777
6778 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6779
6780         * cs-parser.jay: fixed bug #22119.
6781
6782 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6783
6784         * attribute.cs: fixed compilation. The error was:
6785         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
6786         be assigned to before control leaves the current method."
6787         [FIXME:  Filed as bug #28186: MCS must report this error.]
6788
6789 2002-07-25  Martin Baulig  <martin@gnome.org>
6790
6791         * attribute.cs (Attribute.Conditional_GetConditionName): New static
6792         method to pull the condition name ouf of a Conditional attribute.
6793         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
6794         the obsolete message and error flag out of an Obsolete attribute.
6795
6796         * class.cs (Method.GetMethodFlags): New public method to get the
6797         TypeManager.MethodFlags for this method.
6798         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
6799         private methods.
6800         (Method.Define): Get and apply the Obsolete and Conditional attributes;
6801         if we're overriding a virtual function, set the new private variable
6802         `parent_method'; call the new TypeManager.AddMethod().
6803
6804         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
6805         the MethodBuilder and the Method in a PtrHashtable.
6806         (TypeManager.builder_to_method): Added for this purpose.
6807         (TypeManager.MethodFlags): Added IsObsoleteError.
6808         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
6809         Obsolete and Conditional arguments in MethodBuilders.  If we discover
6810         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
6811         the message from the attribute.
6812
6813 2002-07-24  Martin Baulig  <martin@gnome.org>
6814
6815         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
6816         preprocessor directives, ensure that the argument to #define/#undef is
6817         exactly one identifier and that it's actually an identifier.
6818
6819         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
6820         did not work ....
6821
6822 2002-07-24  Martin Baulig  <martin@gnome.org>
6823
6824         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
6825         initialize it to TypeManager.object_type in the constructor.
6826         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
6827         of the `hm.get_current' method if we're using the collection pattern.
6828         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
6829         for the explicit conversion to make it work when we're using the collection
6830         pattern and the `Current' property has a different return type than `object'.
6831         Fixes #27713.
6832
6833 2002-07-24  Martin Baulig  <martin@gnome.org>
6834
6835         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
6836         does not match, but don't report any errors.  This method is called in
6837         order for all methods in a MethodGroupExpr until a matching method is
6838         found, so we don't want to bail out if the first method doesn't match.
6839         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
6840         matches, report the 123.  Fixes #28070.
6841
6842 2002-07-24  Martin Baulig  <martin@gnome.org>
6843
6844         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
6845         TypeManager.TypeToCoreType() to the top of the method so the
6846         following equality checks will work.  Fixes #28107.
6847
6848 2002-07-24  Martin Baulig  <martin@gnome.org>
6849
6850         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
6851         operand is of type uint, and the other operand is of type sbyte,
6852         short or int, the operands are converted to type long." -
6853         Actually do what this comment already told us.  Fixes bug #28106,
6854         added test-150.cs.
6855
6856 2002-07-24  Martin Baulig  <martin@gnome.org>
6857
6858         * class.cs (MethodBase): New abstract class.  This is now a base
6859         class for Property, Indexer and Event to avoid some code duplication
6860         in their Define() and DefineMethods() methods.
6861         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
6862         generic methods for Define() and DefineMethods().
6863         (FieldBase): Derive from MemberBase, not MemberCore.
6864         (Property): Derive from MemberBase, not MemberCore.
6865         (Property.DefineMethod): Moved all the code from this method to the
6866         new MethodBase.DefineAccessor(), just call it with appropriate
6867         argumetnts.
6868         (Property.Define): Call the new Property.DoDefine(), this does some
6869         sanity checks and we don't need to duplicate the code everywhere.
6870         (Event): Derive from MemberBase, not MemberCore.
6871         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
6872         accessors, this will also make them work with interface events.
6873         (Indexer): Derive from MemberBase, not MemberCore.
6874         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
6875         (Indexer.Define): Use the new MethodBase functions.
6876
6877         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
6878         argument to the constructor.
6879         (Interface.FindMembers): Added support for interface events.
6880         (Interface.PopluateEvent): Implemented.
6881
6882         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
6883
6884 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
6885
6886         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
6887         but this is required to check for a method name being the same as
6888         the containing class.  
6889
6890         Handle this now.
6891
6892 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6893
6894         * interface.cs: initialize variable.
6895
6896 2002-07-23  Martin Baulig  <martin@gnome.org>
6897
6898         Implemented the IndexerName attribute in interfaces.
6899
6900         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
6901         name if this is an explicit interface implementation.
6902         (Indexer.InterfaceIndexerName): New public variable.  If we're
6903         implementing an interface indexer, this is the IndexerName in that
6904         interface.  Otherwise, it's the IndexerName.
6905         (Indexer.DefineMethod): If we're implementing interface indexer,
6906         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
6907         and Pending.ImplementIndexer methods.
6908         (Indexer.Define): Also define the PropertyBuilder if we're
6909         implementing an interface indexer and this is neither an explicit
6910         interface implementation nor do the IndexerName match the one in
6911         the interface.
6912
6913         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
6914         If a method is defined here, then we always need to create a proxy
6915         for it.  This is used when implementing interface indexers.
6916         (Pending.IsInterfaceIndexer): New public method.
6917         (Pending.ImplementIndexer): New public method.
6918         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
6919         This is used when implementing interface indexers to define a proxy
6920         if necessary.
6921         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
6922         define a proxy if necessary.
6923
6924         * interface.cs (Interface.IndexerName): New public variable.
6925         (Interface.PopulateIndexer): Set the IndexerName.
6926         (Interface.DefineIndexers): New private method.  Populate all the
6927         indexers and make sure their IndexerNames match.
6928
6929         * typemanager.cs (IndexerPropertyName): Added support for interface
6930         indexers.
6931
6932 2002-07-22  Martin Baulig  <martin@gnome.org>
6933
6934         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
6935         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
6936         ret if HasReturnLabel.
6937         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
6938         variables.
6939
6940         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
6941         and set the ec.LoopBeginTryCatchLevel.
6942         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
6943         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
6944         the current ec.TryCatchLevel, the branch goes out of an exception
6945         block.  In this case, we need to use Leave and not Br.
6946
6947 2002-07-22  Martin Baulig  <martin@gnome.org>
6948
6949         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
6950         block unless the block does not always return or it is contained in
6951         another try { ... } catch { ... } block.  Fixes bug #26506.
6952         Added verify-1.cs to the test suite.
6953
6954 2002-07-22  Martin Baulig  <martin@gnome.org>
6955
6956         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
6957         then we do not always return.  Fixes bug #24985.
6958
6959 2002-07-22  Martin Baulig  <martin@gnome.org>
6960
6961         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
6962         lookup on a per-class level; ie. walk up the class hierarchy until we
6963         found at least one applicable method, then choose the best among them.
6964         Fixes bug #24463 and test-29.cs.
6965
6966 2002-07-22  Martin Baulig  <martin@gnome.org>
6967
6968         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
6969         return types of the methods.  The return type is not part of the
6970         signature and we must not check it to make the `new' modifier work.
6971         Fixes bug #27999, also added test-147.cs.
6972         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
6973
6974         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
6975         on the method's return type.
6976
6977 2002-07-21  Martin Baulig  <martin@gnome.org>
6978
6979         * assign.cs: Make this work if the rightmost source is a constant and
6980         we need to do an implicit type conversion.  Also adding a few more tests
6981         to test-38.cs which should have caught this.
6982
6983         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
6984         target in the makefile for this.  The makefile.gnu is primarily intended
6985         for end-users who don't want to debug the compiler.
6986
6987 2002-07-21  Martin Baulig  <martin@gnome.org>
6988
6989         * assign.cs: Improved the Assign class so it can now handle embedded
6990         assignments (X = Y = Z = something).  As a side-effect this'll now also
6991         consume less local variables.  test-38.cs now passes with MCS, added
6992         a few new test cases to that test.
6993
6994 2002-07-20  Martin Baulig  <martin@gnome.org>
6995
6996         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
6997         instructions.  Fixes bug #27977, also added test-146.cs.
6998
6999 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7000
7001         * cs-tokenizer.cs: fixed getHex ().
7002
7003 2002-07-19  Martin Baulig  <martin@gnome.org>
7004
7005         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
7006         not Type.GetType() to lookup the array type.  This is needed when
7007         we're constructing an array of a user-defined type.
7008         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
7009         single-dimensional arrays, but also for single-dimensial arrays of
7010         type decimal.
7011
7012 2002-07-19  Martin Baulig  <martin@gnome.org>
7013
7014         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
7015         this function is called, it's not allowed to share LocalBuilders
7016         among ILGenerators.
7017
7018 2002-07-19  Martin Baulig  <martin@gnome.org>
7019
7020         * expression.cs (Argument.Resolve): Report an error 118 when trying
7021         to pass a type as argument.
7022
7023 2002-07-18  Martin Baulig  <martin@gnome.org>
7024
7025         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
7026         Conv_R_Un for the signed `long' type.
7027
7028 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
7029
7030         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
7031         `expr' for the temporary result, as that will fail if we do
7032         multiple resolves on the same expression.
7033
7034 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
7035
7036         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
7037         ec.TypeContainer for looking up aliases. 
7038
7039         * class.cs (TypeContainer): Remove LookupAlias from here.
7040
7041         * decl.cs (DeclSpace); Move here.
7042
7043 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
7044
7045         * class.cs (FindMembers): Only call filter if the constructor
7046         bulider is not null.
7047
7048         Also handle delegates in `NestedTypes' now.  Now we will perform
7049         type lookups using the standard resolution process.  This also
7050         fixes a bug.
7051
7052         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
7053         This uses Expressions (the limited kind that can be parsed by the
7054         tree) instead of strings.
7055
7056         * expression.cs (ComposedCast.ToString): Implement, used to flag
7057         errors since now we have to render expressions.
7058
7059         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
7060         FormArrayType. 
7061
7062         * ecore.cs (SimpleName.ToString): ditto.
7063
7064         * cs-parser.jay: Instead of using strings to assemble types, use
7065         Expressions to assemble the type (using SimpleName, ComposedCast,
7066         MemberAccess).  This should fix the type lookups in declarations,
7067         because we were using a different code path for this.
7068
7069         * statement.cs (Block.Resolve): Continue processing statements
7070         even when there is an error.
7071
7072 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
7073
7074         * class.cs (Event.Define): Also remove the `remove' method from
7075         the list of pending items.
7076
7077         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
7078         generate more compact code. 
7079
7080 2002-07-17  Martin Baulig  <martin@gnome.org>
7081
7082         * const.cs (Const.LookupConstantValue): Add support for constant
7083         `unchecked' and `checked' expressions.
7084         Also adding test case test-140.cs for this.
7085
7086 2002-07-17  Martin Baulig  <martin@gnome.org>
7087
7088         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
7089         check whether mi.ReturnType implements the IEnumerator interface; the
7090         `==' and the IsAssignableFrom() will fail in this situation.
7091
7092 2002-07-16  Ravi Pratap  <ravi@ximian.com>
7093
7094         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
7095         here too.
7096
7097 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7098
7099         * expression.cs: fixed bug #27811.
7100
7101 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
7102
7103         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
7104         Molaro: when we are a ref, the value already contains a pointer
7105         value, do not take the address of it.
7106
7107 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
7108         * removed mb-parser.jay and mb-tokenizer.cs
7109
7110 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7111
7112         * expression.cs: check against the building corlib void type.
7113
7114 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
7115
7116         * ecore.cs: fix for valuetype static readonly fields: when 
7117         initializing them, we need their address, not the address of a copy.
7118
7119 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
7120
7121         * typemanager.cs: register also enum_type in corlib.
7122
7123 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7124
7125         * class.cs: allow calling this (but not base) initializers in structs.
7126
7127 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
7128
7129         * ecore.cs: make sure we compare against the building base types
7130         in GetTypeSize ().
7131
7132 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
7133
7134         * typemanager.cs: fix TypeToCoreType() to handle void and object
7135         (corlib gets no more typerefs after this change).
7136
7137 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
7138
7139         * expression.cs (ArrayCreation.EmitArrayArguments): use
7140         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
7141
7142         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
7143         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
7144         array indexes, the runtime actually forbids them.
7145
7146         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
7147         for array arguments here.
7148
7149         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
7150         instead of the default for ValueTypes.
7151
7152         (New.DoEmit): Use IsValueType instead of
7153         IsSubclassOf (value_type)
7154         (New.DoResolve): ditto.
7155         (Invocation.EmitCall): ditto.
7156
7157         * assign.cs (Assign): ditto.
7158
7159         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
7160         Statements *are* currently doing part of their resolution during
7161         Emit.  
7162
7163         Expressions do always resolve during resolve, but statements are
7164         only required to propagate resolution to their children.
7165
7166 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
7167
7168         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
7169
7170         (LoadAssembly): Do not add the dll if it is already specified
7171         
7172         (MainDriver): Add the System directory to the link path at the end,
7173         after all the other -L arguments. 
7174
7175         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
7176         wrong opcode for loading bytes and bools (ldelem.i1 instead of
7177         ldelem.u1) and using the opposite for sbytes.
7178
7179         This fixes Digger, and we can finally run it.
7180
7181         * driver.cs (UnixParseOption): Move the option parsing here.  
7182         (CSCParseOption): Implement CSC-like parsing of options.
7183
7184         We now support both modes of operation, the old Unix way, and the
7185         new CSC-like way.  This should help those who wanted to make cross
7186         platform makefiles.
7187
7188         The only thing broken is that /r:, /reference: and /lib: are not
7189         implemented, because I want to make those have the same semantics
7190         as the CSC compiler has, and kill once and for all the confussion
7191         around this.   Will be doing this tomorrow.
7192
7193         * statement.cs (Unsafe.Resolve): The state is checked during
7194         resolve, not emit, so we have to set the flags for IsUnsfe here.
7195
7196 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
7197
7198         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
7199         not catch the Error_ObjectRefRequired in SimpleName (as it is
7200         possible to have a class/instance variable name that later gets
7201         deambiguated), we have to check this here.      
7202
7203 2002-07-10  Ravi Pratap  <ravi@ximian.com>
7204
7205         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
7206         make static and put into Expression.
7207
7208         (Event.Define): Register the private field of the event with the 
7209         TypeManager so that GetFieldFromEvent can get at it.
7210
7211         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
7212         keep track of the private field associated with an event which
7213         has no accessors.
7214
7215         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
7216         private field.
7217
7218         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
7219         
7220 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
7221
7222         * expression.cs (Binary.EmitBranchable): this routine emits the
7223         Binary expression in a branchable context.  This basically means:
7224         we need to branch somewhere, not just get the value on the stack.
7225
7226         This works together with Statement.EmitBoolExpression.
7227
7228         * statement.cs (Statement.EmitBoolExpression): Use
7229         EmitBranchable. 
7230
7231 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
7232
7233         * statement.cs (For): Reduce the number of jumps in loops.
7234
7235         (For): Implement loop inversion for the For statement.
7236
7237         (Break): We can be breaking out of a Try/Catch controlled section
7238         (foreach might have an implicit try/catch clause), so we need to
7239         use Leave instead of Br.
7240
7241         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
7242         now).  If the instace expression supports IMemoryLocation, we use
7243         the AddressOf method from the IMemoryLocation to extract the
7244         address instead of emitting the instance.
7245
7246         This showed up with `This', as we were emitting the instance
7247         always (Emit) instead of the Address of This.  Particularly
7248         interesting when This is a value type, as we dont want the Emit
7249         effect (which was to load the object).
7250         
7251 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
7252
7253         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
7254
7255         * statement.cs (Checked): Set the CheckedState during the resolve
7256         process too, as the ConvCast operations track the checked state on
7257         the resolve process, and not emit.
7258
7259         * cs-parser.jay (namespace_member_declaration): Flag that we have
7260         found a declaration when we do.  This is used to flag error 1529
7261
7262         * driver.cs: Report ok when we display the help only.
7263
7264 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
7265
7266         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
7267
7268 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
7269
7270         * cs-tokenizer.cs (define): We also have to track locally the
7271         defines.  AllDefines is just used for the Conditional Attribute,
7272         but we also need the local defines for the current source code. 
7273
7274 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
7275
7276         * statement.cs (While, For, Do): These loops can exit through a
7277         Break statement, use this information to tell whether the
7278         statement is the last piece of code.
7279
7280         (Break): Flag that we break.
7281
7282         * codegen.cs (EmitContexts): New `Breaks' state variable.
7283
7284 2002-07-03  Martin Baulig  <martin@gnome.org>
7285
7286         * class.cs (TypeContainer.MethodModifiersValid): Allow override
7287         modifiers in method declarations in structs.  Otherwise, you won't
7288         be able to override things like Object.Equals().
7289
7290 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
7291
7292         * class.cs (Method, Property, Indexer): Do not allow the public
7293         modifier to be used in explicit interface implementations.
7294
7295         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
7296         override modifiers in method declarations in structs
7297
7298 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
7299
7300         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
7301         integer or real overflow, report an error
7302
7303 2002-07-02  Martin Baulig  <martin@gnome.org>
7304
7305         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
7306         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
7307         to tell the runtime about our newly created System.Object and
7308         System.ValueType types.
7309
7310 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
7311
7312         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
7313         struct instead of Ldarg/Starg.
7314
7315 2002-07-02  Martin Baulig  <martin@gnome.org>
7316
7317         * expression.cs (Indirection.Indirection): Call
7318         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
7319
7320 2002-07-02  Martin Baulig  <martin@gnome.org>
7321
7322         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
7323         ValueType, call TypeManager.TypeToCoreType() on it.
7324         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
7325         the OpCodes.Newarr argument.
7326
7327 2002-07-02  Martin Baulig  <martin@gnome.org>
7328
7329         * expression.cs (Invocation.EmitCall): When compiling corlib,
7330         replace all calls to the system's System.Array type to calls to
7331         the newly created one.
7332
7333         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
7334         System.Array methods.
7335         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
7336         from the system's System.Array type which must be replaced.
7337
7338 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
7339
7340         * typemanager.cs: load unverifiable_code_ctor so we can build
7341         corlib using the correct type. Avoid using GetTypeCode() with
7342         TypeBuilders.
7343         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
7344         TypeManager.object_type to allow building corlib.
7345
7346 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
7347
7348         * ecore.cs: handle System.Enum separately in LoadFromPtr().
7349
7350 2002-07-01  Martin Baulig  <martin@gnome.org>
7351
7352         * class.cs: Make the last change actually work, we need to check
7353         whether `ifaces != null' to avoid a crash.
7354
7355 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7356
7357         * class.cs: when we build structs without fields that implement
7358         interfaces, we need to add the interfaces separately, since there is
7359         no API to both set the size and add the interfaces at type creation
7360         time.
7361
7362 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7363
7364         * expression.cs: the dimension arguments to the array constructors
7365         need to be converted if they are a long.
7366
7367 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
7368
7369         * class.cs: don't emit ldarg.0 if there is no parent constructor
7370         (fixes showstopper for corlib).
7371
7372 2002-06-29  Martin Baulig  <martin@gnome.org>
7373
7374         MCS now compiles corlib on GNU/Linux :-)
7375
7376         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
7377         ie. check for MethodImplOptions.InternalCall.
7378
7379         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
7380         and TypeManager.attribute_type are null, so we must explicitly check
7381         whether parent is not null to find out whether it's an attribute type.
7382         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
7383         and SetBuilder, not only if the property is neither abstract nor external.
7384         This is necessary to set the MethodImplOptions on the accessor methods.
7385         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
7386         SetBuilder, see Property.Emit().
7387
7388         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
7389         populate "System.Object", "System.ValueType" and "System.Attribute" since
7390         they've already been populated from BootCorlib_PopulateCoreTypes().
7391
7392 2002-06-29  Martin Baulig  <martin@gnome.org>
7393
7394         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
7395         is the NullLiteral, we also need to make sure that target_type is not
7396         an enum type.   
7397
7398 2002-06-29  Martin Baulig  <martin@gnome.org>
7399
7400         * rootcontext.cs (RootContext.ResolveCore): We must initialize
7401         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
7402         before calling BootstrapCorlib_ResolveDelegate ().
7403
7404 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7405
7406         * statement.cs: fixed build-breaker. All tests passed ok.
7407
7408 2002-06-27  Martin Baulig  <martin@gnome.org>
7409
7410         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
7411         for System.Decimal when compiling corlib.
7412
7413 2002-06-27  Martin Baulig  <martin@gnome.org>
7414
7415         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
7416         switch blocks which contain nothing but a default clause.
7417
7418 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
7419
7420        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
7421
7422 2002-06-27  Martin Baulig  <martin@gnome.org>
7423
7424         * ecore.cs (PropertyExpr.PropertyExpr): Call
7425         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
7426
7427         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
7428         is already a TypeBuilder.
7429
7430 2002-06-27  Martin Baulig  <martin@gnome.org>
7431
7432         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
7433         `target_type == TypeManager.array_type', not IsAssignableFrom() in
7434         the "from an array-type to System.Array" case.  This makes it work
7435         when compiling corlib.
7436
7437 2002-06-27  Martin Baulig  <martin@gnome.org>
7438
7439         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
7440         non-static PropertyExpr, set its InstanceExpression.  This makes
7441         the `ICollection.Count' property work in System/Array.cs.
7442
7443 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
7444
7445         * driver.cs: Made error handling more consistent.  Errors now
7446         tracked by Report class, so many methods which used to return int
7447         now return void.  Main() now prints success/failure and 
7448         errors/warnings message.
7449
7450         Renamed '--probe' compiler argument to '--expect-error'.  Removed
7451         the magic number return values (123 and 124).  Now, if the
7452         expected error occurs, the compiler exits with success (exit value
7453         0).  If the compilation completes without seeing that particular
7454         error, the compiler exits with failure (exit value 1).  The
7455         makefile in mcs/errors has been changed to handle the new behaviour.
7456
7457         * report.cs: Made 'expected error' number a property and renamed
7458         it from 'Probe' to 'ExpectedError'.
7459
7460         * genericparser.cs: Removed error handling support, since it is
7461         now all done by Report class.
7462
7463         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
7464         class, so parse() no longer returns an int.
7465
7466         * namespace.cs: Use Report.Error instead of GenericParser.error
7467
7468 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
7469
7470         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
7471         TypeContainer.AddOperator): At the front of the list put the
7472         explicit implementations, so they get resolved/defined first. 
7473
7474 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
7475
7476         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
7477         interface type is implemented by this TypeContainer.  Used during
7478         explicit interface implementation.
7479
7480         (Property.Define, Indexer.Define, Method.Define): Validate that
7481         the given interface in the explicit implementation is one of the
7482         base classes for the containing type.
7483
7484         Also if we are explicitly implementing an interface, but there is
7485         no match in the pending implementation table, report an error.
7486
7487         (Property.Define): Only define the property if we are
7488         not explicitly implementing a property from an interface.  Use the
7489         correct name also for those properties (the same CSC uses,
7490         although that is really not needed).
7491         
7492         (Property.Emit): Do not emit attributes for explicitly implemented
7493         properties, as there is no TypeBuilder.
7494
7495         (Indexer.Emit): ditto.
7496
7497         Hiding then means that we do not really *implement* a pending
7498         implementation, which makes code fail.
7499
7500 2002-06-22  Martin Baulig  <martin@gnome.org>
7501
7502         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
7503         the return value of Object.GetType().  [FIXME: we need to do this whenever
7504         we get a type back from the reflection library].
7505
7506 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
7507
7508         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
7509
7510 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
7511
7512         * attribute.cs: Return null if we can not look up the type.
7513
7514         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
7515         the interface types found.
7516
7517         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
7518         interface types found.
7519
7520         * typemanager.cs (GetInterfaces): Make this routine returns alll
7521         the interfaces and work around the lame differences between
7522         System.Type and System.Reflection.Emit.TypeBuilder in the results
7523         result for GetInterfaces.
7524         
7525         (ExpandInterfaces): Given an array of interface types, expand and
7526         eliminate repeated ocurrences of an interface.  This expands in
7527         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
7528         be IA, IB, IC.
7529         
7530 2002-06-21  Martin Baulig  <martin@gnome.org>
7531
7532         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
7533         on System.Enum.
7534
7535 2002-06-21  Martin Baulig  <martin@gnome.org>
7536
7537         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
7538         and called with one of the core types, return the corresponding typebuilder for
7539         that type.
7540
7541         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
7542         element type.
7543
7544 2002-06-21  Martin Baulig  <martin@gnome.org>
7545
7546         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
7547         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
7548         (Expression.ConvertReferenceExplicit): Likewise.
7549
7550         * expression.cs (ElementAccess.DoResolve): Likewise.
7551         (ElementAccess.DoResolveLValue): Likewise.
7552
7553 2002-06-10  Martin Baulig  <martin@gnome.org>
7554
7555         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
7556         add the "value" parameter to the parameter list.
7557
7558         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
7559         to our caller.
7560
7561 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
7562
7563         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
7564         the argument to an int, uint, long or ulong, per the spec.  Also
7565         catch negative constants in array creation.
7566
7567 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
7568
7569         * class.cs: do not allow the same interface to appear twice in
7570         the definition list.
7571
7572 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
7573
7574         * ecore.cs: don't use ldlen with System.Array.
7575
7576 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
7577
7578         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
7579
7580 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
7581
7582         * modifiers.cs: produce correct field attributes for protected
7583         internal. Easy fix so miguel can work on ther harder stuff:-)
7584
7585 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
7586
7587         * pending.cs: New file.  Move the code from class.cs here.
7588         Support clearning the pending flag for all methods (when not doing
7589         explicit interface implementation).
7590
7591 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
7592
7593         * rootcontext.cs: added a couple more types needed to bootstrap.
7594
7595 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
7596
7597         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
7598         constructor in the type, instead of any constructor in the type
7599         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
7600         a bug in the Mono runtime when applying the params attribute). 
7601
7602 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
7603         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
7604
7605 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
7606
7607         * expression.cs (Unary.ResolveOperator): Use TypeManager
7608         to resolve the type.
7609         
7610 2002-06-13  Ravi Pratap  <ravi@ximian.com>
7611
7612         * cs-parser.jay (enum_member_declaration): Pass in the attributes
7613         attached.
7614
7615         * enum.cs (AddEnumMember): Add support to store the attributes associated 
7616         with each member too.
7617
7618         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
7619         field builders too - this takes care of the enum member case.
7620
7621 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
7622
7623         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
7624         address-of operator on both value types and pointers.
7625         
7626 2002-06-10  Martin Baulig  <martin@gnome.org>
7627
7628         * interface.cs (Interface.PopulateIndexer): Add the indexer's
7629         PropertyBuilder to the `property_builders' list.
7630
7631         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
7632         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
7633         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
7634         find any indexers which are inherited from an interface.
7635
7636 2002-06-09  Martin Baulig  <martin@gnome.org>
7637
7638         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
7639         the same type as the constant if necessary.  There's also a test-130.cs
7640         for this.
7641
7642         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
7643
7644         * typemanager.cs (TypeManager.ChangeType): Previously known as
7645         Enum.ChangeEnumType().
7646
7647 2002-06-09  Martin Baulig  <martin@gnome.org>
7648
7649         * expression.cs (Cast.TryReduce): Added support for consts.
7650
7651 2002-06-08  Ravi Pratap  <ravi@ximian.com>
7652
7653         * class.cs (Accessor): Hold attributes information so we can pass
7654         it along.
7655
7656         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
7657         Modify to pass in attributes attached to the methods.
7658
7659         (add_accessor_declaration, remove_accessor_declaration): Ditto.
7660
7661         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
7662         to handle the Accessor kind :-)
7663
7664         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
7665         
7666 2002-06-08  Martin Baulig  <martin@gnome.org>
7667
7668         * expression.cs (Unary.TryReduceNegative): Added support for
7669         ULongConstants.
7670
7671 2002-06-08  Martin Baulig  <martin@gnome.org>
7672
7673         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
7674         name can't be found in the `defined_names' - the caller will do a
7675         MemberLookup in this case and thus find methods in System.Enum
7676         such as Enum.IsDefined().
7677
7678 2002-06-08  Martin Baulig  <martin@gnome.org>
7679
7680         * enum.cs (Enum.ChangeEnumType): This is a custom version of
7681         Convert.ChangeType() which works with TypeBuilder created types.
7682         (Enum.LookupEnumValue, Enum.Define): Use it here.
7683
7684         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
7685         `TypeBuilder.BaseType != null' check.
7686         (TypeContainer.FindMembers): Only lookup parent members if we
7687         actually have a parent.
7688         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
7689         (ConstructorInitializer.Resolve): Likewise.
7690
7691         * interface.cs (Interface.FindMembers): Added
7692         `TypeBuilder.BaseType != null' check.
7693
7694         * rootcontext.cs (RootContext.ResolveCore): Added
7695         "System.Runtime.CompilerServices.IndexerNameAttribute" to
7696         classes_second_stage.
7697
7698         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
7699         debug_type and trace_type when compiling with --nostdlib.       
7700
7701 2002-06-07  Martin Baulig  <martin@gnome.org>
7702
7703         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
7704         (AddField): Set it to true when adding a non-static field.
7705         (DefineType): Use `have_nonstatic_fields' to find out whether we
7706         have non-static fields, not `Fields != null'.
7707
7708 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
7709
7710         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
7711         dereferencing a null on the static-field code path)
7712
7713 2002-05-30  Martin Baulig  <martin@gnome.org>
7714
7715         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
7716         to take command line arguments.  Use reflection to call the new
7717         custom `Initialize' function on the symbol writer and pass it the
7718         command line arguments.
7719
7720         * driver.cs (--debug-args): New command line argument to pass command
7721         line arguments to the symbol writer.
7722
7723 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
7724
7725         * assign.cs (DoResolve): Forgot to do the implicit conversion to
7726         the target type for indexers and properties.  Thanks to Joe for
7727         catching this.
7728
7729 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
7730
7731         * typemanager.cs (MethodFlags): returns the method flags
7732         (Obsolete/ShouldIgnore) that control warning emission and whether
7733         the invocation should be made, or ignored. 
7734
7735         * expression.cs (Invocation.Emit): Remove previous hack, we should
7736         not do this on matching a base type, we should do this based on an attribute
7737
7738         Only emit calls to System.Diagnostics.Debug and
7739         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
7740         on the command line.
7741
7742         * rootcontext.cs: Global settings for tracing and debugging.
7743
7744         * cs-tokenizer.cs (define): New utility function to track
7745         defines.   Set the global settings for TRACE and DEBUG if found.
7746
7747 2002-05-25  Ravi Pratap  <ravi@ximian.com>
7748
7749         * interface.cs (Populate*): Pass in the TypeContainer as well as
7750         the DeclSpace as parameters so that we can create EmitContexts and
7751         then use that to apply attributes etc.
7752
7753         (PopulateMethod, PopulateEvent, PopulateProperty)
7754         (PopulateIndexer): Apply attributes everywhere.
7755
7756         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
7757         etc.
7758
7759         (ApplyAttributes): Update accordingly.
7760
7761         We now apply interface attributes for all members too.
7762
7763 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
7764
7765         * class.cs (Indexer.Define); Correctly check if we are explicit
7766         implementation (instead of checking the Name for a ".", we
7767         directly look up if the InterfaceType was specified).
7768
7769         Delay the creation of the PropertyBuilder.
7770
7771         Only create the PropertyBuilder if we are not an explicit
7772         interface implementation.   This means that explicit interface
7773         implementation members do not participate in regular function
7774         lookups, and hence fixes another major ambiguity problem in
7775         overload resolution (that was the visible effect).
7776
7777         (DefineMethod): Return whether we are doing an interface
7778         implementation. 
7779         
7780         * typemanager.cs: Temporary hack until we get attributes in
7781         interfaces (Ravi is working on that) and we get IndexerName
7782         support in interfaces.
7783
7784         * interface.cs: Register the indexers as properties.
7785
7786         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
7787         warning, I have verified that this is a bug in the .NET runtime
7788         (JavaScript suffers of the same problem).
7789
7790         * typemanager.cs (MemberLookup): When looking up members for
7791         interfaces, the parent of an interface is the implicit
7792         System.Object (so we succeed in searches of Object methods in an
7793         interface method invocation.  Example:  IEnumerable x;  x.ToString
7794         ()) 
7795
7796 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
7797
7798         * class.cs (Event): Events should also register if they do
7799         implement the methods that an interface requires.
7800
7801         * typemanager.cs (MemberLookup); use the new GetInterfaces
7802         method. 
7803
7804         (GetInterfaces): The code used to lookup interfaces for a type is
7805         used in more than one place, factor it here. 
7806
7807         * driver.cs: Track the errors at the bottom of the file, we kept
7808         on going.
7809
7810         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
7811         instance if the method we are calling is static!
7812
7813 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
7814
7815         * attribute.cs (ApplyAttributes): Make this function filter out
7816         the IndexerName attribute (as that attribute in reality is never
7817         applied) and return the string constant for the IndexerName
7818         attribute. 
7819
7820         * class.cs (TypeContainer.Emit): Validate that all the indexers
7821         have the same IndexerName attribute, and if so, set the
7822         DefaultName attribute on the class. 
7823
7824         * typemanager.cs: The return value might contain other stuff (not
7825         only methods).  For instance, consider a method with an "Item"
7826         property and an Item method.
7827
7828         * class.cs: If there is a problem with the parameter types,
7829         return. 
7830
7831 2002-05-24  Ravi Pratap  <ravi@ximian.com>
7832
7833         * ecore.cs (ImplicitConversionExists): Wrapper function which also
7834         looks at user defined conversion after making a call to 
7835         StandardConversionExists - we need this for overload resolution.
7836
7837         * expression.cs : Update accordingly the various method calls.
7838
7839         This fixes 2 bugs filed against implicit user defined conversions 
7840
7841 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
7842
7843         * statement.cs: Track the result of the assignment.
7844
7845 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
7846
7847         * expression.cs (MemberAccess): Improved error reporting for
7848         inaccessible members.
7849
7850 2002-05-22  Martin Baulig  <martin@gnome.org>
7851
7852         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
7853         itself with debugging support.
7854
7855 2002-05-22  Martin Baulig  <martin@gnome.org>
7856
7857         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
7858         Removed, this isn't needed anymore.
7859
7860 2002-05-20  Martin Baulig  <martin@gnome.org>
7861
7862         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
7863         be underlying type for an enum.
7864
7865 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
7866
7867         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
7868         that splits out the loading of just the core types.
7869
7870         * rootcontext.cs (ResolveCore): Split the struct resolution in
7871         two, so we can load the enumeration underlying types before any
7872         enums are used.
7873
7874         * expression.cs (Is): Bandaid until we fix properly Switch (see
7875         bug #24985 for details).
7876
7877         * typemanager.cs (ImplementsInterface): The hashtable will contain
7878         a null if there are no interfaces implemented.
7879
7880 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
7881
7882         * cs-parser.jay (indexer_declarator): It is fine to have array
7883         parameters
7884
7885 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
7886
7887         * typemanager.cs: (RegisterBuilder): New function used to register
7888         TypeBuilders that implement interfaces.  Since
7889         TypeBuilder.GetInterfaces (as usual) does not work with lame
7890         Reflection.Emit. 
7891         (AddUserType): register interfaces.
7892
7893         (ImplementsInterface): Use the builder_to_ifaces hash if we are
7894         dealing with TypeBuilder.  Also, arrays are showing up as
7895         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
7896         methods can not be invoked on them!
7897
7898         * ecore.cs (ExplicitReferenceConversionExists): Made public.
7899         (ImplicitReferenceConversionExists): Split out from
7900         StandardConversionExists. 
7901
7902         * expression.cs (As): We were only implementing one of the three
7903         cases for the as operator.  We now implement them all.
7904         (Is): Implement the various other cases for Is as well.
7905
7906         * typemanager.cs (CACHE): New define used to control if we want or
7907         not the FindMembers cache.  Seems to have a negative impact on
7908         performance currently
7909
7910         (MemberLookup): Nested types have full acess to
7911         enclosing type members
7912
7913         Remove code that coped with instance/static returns for events, we
7914         now catch this in RealFindMembers.
7915
7916         (RealFindMembers): only perform static lookup if the instance
7917         lookup did not return a type or an event.  
7918
7919 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
7920
7921         * assign.cs (CompoundAssign): We pass more semantic information
7922         now to Compound Assignments than we did before: now we have all
7923         the information at hand, and now we resolve the target *before* we
7924         do the expression expansion, which allows the "CacheValue" method
7925         to have the effect we intended (before, a [x] += 1 would generate
7926         two differen ArrayAccess expressions from the ElementAccess,
7927         during the resolution process).
7928
7929         (CompoundAssign.DoResolve): Resolve target and original_source here.
7930
7931 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
7932
7933         * expression.cs (ArrayAccess): dropped debugging information. 
7934
7935         * typemanager.cs: Small bug fix: I was always returning i_members,
7936         instead of one of i_members or s_members (depending on which had
7937         the content).
7938
7939         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
7940         method is invoked before any code generation takes place, and it
7941         is a mechanism to inform that the expression will be invoked more
7942         than once, and that the method should use temporary values to
7943         avoid having side effects
7944
7945         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
7946         
7947         * ecore.cs (Expression.CacheTemporaries): Provide empty default
7948         implementation.
7949
7950         * expression.cs (Indirection, ArrayAccess): Add support for
7951         CacheTemporaries in these two bad boys. 
7952
7953         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
7954         ldobj or ldind_ref.  
7955         (StoreFromPtr): Handle stobj as well.
7956
7957         * expression.cs (UnaryMutator): Share more code.
7958         
7959         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
7960         down: I was not tracking the Filter function as well, which
7961         was affecting the results of the cache.
7962
7963 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
7964
7965         * attribute.cs: Remove the hack to handle the CharSet property on
7966         StructLayouts. 
7967
7968 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
7969
7970         * attribute.cs (DoResolve): More uglyness, we now only try to
7971         resolve the attribute partially, to extract the CharSet
7972         information (only if we are a StructLayout attribute).  Otherwise 
7973
7974         (GetExtraTypeInfo): Add some code to conditionally kill in the
7975         future this.   I am more and more convinced that the .NET
7976         framework has special code to handle the attribute setting on
7977         certain elements.
7978
7979         * expression.cs (IsParamsMethodApplicable): Revert my previous
7980         foreach change here, it was wrong.
7981
7982 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
7983
7984         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
7985         (pp_expr): do not abort on unknown input, just return.
7986         (eval): abort if there are pending chars.
7987
7988         * attribute.cs (Attribute.Resolve): Positional parameters are
7989         optional.  Deal with that case.
7990
7991         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
7992         the Ansi/Unicode/Auto information for the type.
7993
7994         (TypeContainer.DefineType): instantiate the EmitContext here, as
7995         we will be using it during the type definition (to resolve
7996         attributes) and during the emit phase.
7997
7998         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
7999         to pull type information out of the attributes
8000
8001         (Attribute.Resolve): track the constructor builder, and allow for
8002         multiple invocations (structs and classes will use this).
8003
8004         * ecore.cs (MemberLookupFinal): new version with all the
8005         parameters customizable.
8006
8007         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
8008         constructors.  Return if the result value is null (as the error
8009         would have been flagged already by MemberLookupFinal)
8010
8011         Do not allow instances of abstract classes or interfaces to be
8012         created.
8013         
8014         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
8015         We have to compare the assembly property here when dealing with
8016         FamANDAssem and Assembly access modifiers, because we might be
8017         creating an assembly from *modules* (that means that we are not
8018         getting TypeBuilders for types defined in other modules that are
8019         part of this assembly).
8020
8021         (Method.Emit): If the method is marked abstract and has a body,
8022         emit an error. 
8023
8024         (TypeContainer.DefineMembers): If both the defined member and the
8025         parent name match are methods, then do not emit any warnings: let
8026         the Method.Define routine take care of flagging warnings.  But if
8027         there is a mismatch (method overrides something else, or method is
8028         overriwritten by something, then emit warning).
8029
8030         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
8031         set to null, this means `do not check for the return type on the
8032         signature'. 
8033
8034         (Method.Define): set the return type for the method signature to
8035         null, so that we get methods with the same name and parameters and
8036         different return types.  This is used to flag warning 114 (you are
8037         hiding a method, and you probably want to use the new/override
8038         keywords instead).
8039
8040         * typemanager.cs (MemberLookup): Implemented proper access
8041         control, closing a long standing set of bug reports.  The problem
8042         was that the Framework only has two bits: Public and NonPublic,
8043         and NonPublic includes private and protected methods, but we need
8044         to enforce the FamANDAssem, FamOrAssem and Family. 
8045
8046 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
8047
8048         * statement.cs (GotoCase): Return true: Ammounts to giving up
8049         knowledge on whether we return or not, and letting the other case
8050         be responsible for it.
8051
8052 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
8053
8054         * driver.cs: Do not load directories for each file processed, only
8055         do it if there is a pattern.
8056
8057         * ecore.cs: Report readonly assigns here as well, as we might have
8058         been resolved only by MemberAccess.
8059
8060         (SimpleName.SimpleNameResolve): Also be useful for LValue
8061         resolution.   We need this to propagate assign to local readonly variables
8062
8063         * typemanager.cs: Use a ptrhashtable for the criteria, because we
8064         do not want to reuse potential criteria memory.
8065
8066         * class.cs (MyEventBuilder): Set reflected_type;
8067
8068         * ecore.cs (Constantify): Added support for constifying bools.
8069
8070         (RootContext.LookupType): Added a cache for values looked up in
8071         the declaration space.
8072
8073         * typemanager.cs (FindMembers): Now is a front-end to
8074         RealFindMembers, and provides a two-level hashtable-based cache to
8075         the request.  
8076
8077         15% performance improvement: from 22.5 to 19.2 seconds.
8078
8079         * expression.cs (IsParamsMethodApplicable): use foreach.
8080         (Invocation.DoResolve): ditto.
8081         (New.DoResolve): ditto.
8082         (ArrayCreation.DoResolve): ditto.
8083
8084         * ecore.cs (FindMostEncompassingType): use foreach.
8085
8086         * delegate.cs (NewDelegate.DoResolve): Use foreach
8087
8088         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
8089         (RemoveMethods): use foreach.
8090
8091         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
8092         nested foreach statements instead of for, and also break out of
8093         the inner loop once a match is found.
8094         
8095         (Invocation.OverloadResolve): Use foreach, simplify the code. 
8096
8097 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
8098
8099         * cfold.cs (BinaryFold): During an enumeration evaluation context,
8100         we actually unwrap the expression to allow for extra information
8101         to be extracted. 
8102
8103         * expression.cs: Use Shr_Un on unsigned operations. 
8104
8105 2002-05-08  Ravi Pratap  <ravi@ximian.com>
8106
8107         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
8108         applicable operators was not being considered correctly. This closes
8109         the bug Miguel reported.
8110
8111 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
8112
8113         * attribute.cs: check that the type derives from System.Attribute
8114         and report the correct error in that case (moved the duplicate code to
8115         its own method, too).
8116
8117 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
8118
8119         * attribute.cs: lookup attribute type name as the spec says: first the
8120         bare attribute name and then name + "Attribute" (nant compiles with
8121         mcs after this fix).
8122
8123 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
8124
8125         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
8126         Because of the way we parse things, we should try to see if a
8127         UIntConstant can fit in an integer.
8128
8129 2002-05-07  Ravi Pratap  <ravi@ximian.com>
8130
8131         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
8132         when we are in an explicit context.
8133
8134         (ConvertReferenceExplicit): When converting from Iface type S to Class
8135         T make sure the rules are implemented as an OR.
8136
8137         * parameter.cs (ParameterType): Make it a property for now although the
8138         purpose really isn't anything immediate.
8139         
8140         * expression.cs (Is*Applicable): Do better checking on the parameter type
8141         of a ref/out parameter. The ones from the system assemblies are already 
8142         marked with the correct type so we don't need to do any correction.
8143
8144         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
8145         the object type is standard too so include that.
8146
8147 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8148
8149         * ecore.cs (StandardConversionExists): Augment with missing code:
8150         deal with IntConstant, LongConstants and Enumerations.
8151
8152         * assign.cs: Report the error, instead of failing silently
8153
8154         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
8155         typecontainer that they are declared, because the
8156         typecontainer/namespace will have the list of using clauses that
8157         need to be applied.
8158
8159         Assembly Attributes were escaping the normal registration
8160         mechanism. 
8161
8162         (EmitCode): Apply attributes within an EmitContext that represents
8163         the container they were declared on.
8164         
8165         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
8166
8167 2002-05-06  Ravi Pratap  <ravi@ximian.com>
8168
8169         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
8170         Revamp completely - make much cleaner as we now operate only
8171         on a set of Types.
8172
8173         (FindMostSpecificSource, FindMostSpecificTarget): New methods
8174         to implement the logic detailed in the spec more correctly.
8175
8176         (UserDefinedConversion): Update accordingly.
8177
8178 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8179
8180         * statement.cs: Return flow analysis information up.
8181
8182         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
8183         and the default.
8184
8185         (token): Do not consume an extra character before calling
8186         decimal_digits.
8187
8188 2002-05-06  Piers Haken <piersh@friskit.com>
8189
8190         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
8191
8192 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8193
8194         * class.cs (Constructor.Emit): Set the IsStatic flag in the
8195         EmitContext during the instance constructor initializer
8196         resolution, to stop access to instance variables.
8197
8198         This is mandated by the spec, last paragraph of the `constructor
8199         initializers' section. 
8200
8201 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
8202
8203         * cs-parser.jay, class.cs (Accessor): new class used to represent
8204         an accessor (get or set).  In the past we used `null' to represent
8205         a missing accessor.  But this is ambiguous because there was no
8206         way to tell in abstract indexers/properties if one of them was
8207         specified.
8208
8209         Now there is a way of addressing that.
8210
8211         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
8212         instead of FindMembers.
8213
8214         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
8215         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
8216
8217         * attribute.cs: Treat indexers and properties as the same in terms
8218         of applying attributes
8219
8220         * ecore.cs (FindMostEncompassedType): Use statically initialized
8221         EmptyExpressions()s like we do elsewhere to avoid creating useless
8222         objects (and we take this out of the tight loop).
8223
8224         (GetConversionOperators): Move the code to extract the actual
8225         operators to a separate routine to clean things up.
8226
8227 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
8228
8229         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
8230         events are always registered FieldBuilders.
8231         
8232         * class.cs (FieldBase): New class shared by Fields 
8233
8234         * delegate.cs: If we are a toplevel delegate, use our full name.
8235         If we are a nested delegate, then only use our tail name.
8236
8237 2002-05-02  Ravi Pratap  <ravi@ximian.com>
8238
8239         * expression.cs (IsApplicable): Ensure that we add the "&" to
8240         ref/out types before comparing it with the type of the argument.
8241
8242         (IsParamsMethodApplicable): Ditto.
8243
8244         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
8245         silly me ;-)
8246
8247         * delegate.cs : Handle the case when we have more than one applicable
8248         method. Flag an error only when we finish checking all.
8249
8250 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
8251
8252         * expression.cs: Add support for boolean static initializers.
8253
8254 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
8255
8256         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
8257
8258         * parameter.cs (ComputeParameterTypes,
8259         ComputeAndDefineParameterTypes): Better error handling: now we
8260         clear the `types' cache if we fail during any of the type lookups.
8261         We also return the status code correctly to our caller
8262
8263         * delegate.cs: If we fail to define a delegate, abort the extra
8264         steps. 
8265
8266         * expression.cs (Binary.ResolveOperator): for
8267         operator==(object,object) and operator !=(object, object) we also
8268         have to verify that there is an implicit conversion from one to
8269         the other.
8270
8271         (ArrayAccess.DoResolve): Array Access can operate on
8272         non-variables. 
8273
8274 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
8275
8276         * assign.cs (CompoundAssign): A new class used as a "flag" that
8277         the assignment actually is happening as part of a compound
8278         assignment operator.
8279
8280         During compound assignment, a few new rules exist to enable things
8281         like:
8282
8283         byte b |= 1 + 2
8284
8285         From the spec:
8286         
8287         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
8288         to the type of x) if y is implicitly convertible to the type of x,
8289         and the operator is a builtin operator and the return type of the
8290         operator is explicitly convertible to the type of x. 
8291
8292         * rootcontext.cs: Reset warning level to 2.  4 catches various
8293         "interesting" features in mcs, we must clean this up at some
8294         point, but currently am trying to kill other bugs ;-)
8295
8296         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
8297         in container classes as well.  
8298
8299         * expression.cs (Binary.ResolveOperator): Handle string case
8300         before anything else (as operator overloading does emit an error
8301         before doing anything else).
8302
8303         This code could go away when we move to a table driven model, but
8304         i could not come up with a good plan last night.
8305         
8306 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
8307
8308         * typemanager.cs (CSharpName): reimplementation using regex.
8309         * class.cs: added null check for fields in Emit
8310         * rootcontext.cs: set warninglevel to 4
8311
8312 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
8313
8314         * typemanager.cs (CSharpName): reimplemented with Lupus
8315         suggestion.
8316
8317 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
8318
8319         * statement.cs (If): correclty implement Resolve, because we were
8320         not catching sem errors in there.  The same process is needed
8321         everywhere else. 
8322         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
8323         
8324
8325         (Statement.Warning_DeadCodeFound): Factorize code.
8326         (While): Report dead code here too.
8327
8328         (Statement): Added Resolve virtual method to allow
8329         for resolution split from the emit code.
8330
8331 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
8332
8333         * statement.cs (EmitBoolExpression): No longer try to resolve the
8334         expression here.    
8335         (MakeBoolean): New utility function that resolve, implicitly
8336         converts to boolean and tags the expression. 
8337         
8338
8339         (If, Do): Implement dead code elimination.
8340         (While): Implement loop inversion
8341
8342         (Do, While, For, If): Resolve the expression prior to calling our
8343         code generation.
8344
8345 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
8346
8347         * class.cs:
8348           - added method Report28 (warning: program has more than one entry point)
8349           - added method IsEntryPoint, implements paragraph 10.1 of the spec
8350           - modified method Method.Define, the part at the end of the method
8351
8352         * rootcontext.cs: added static public Location EntryPointLocation;
8353           
8354         * ../errors/cs0028.cs : Add test case for the above warning.              
8355
8356         * typemanager.cs:
8357           - modified method CSharpName to allow arrays of primitive type to
8358             be printed nicely (e.g. instead of System.Int32[][] it now prints
8359             int[][])
8360           - added method CSharpSignature: returns the signature of a method
8361             in string format to be used in reporting errors, warnings, etc.
8362
8363         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
8364         with String.Empty.
8365         
8366 2002-04-26  Ravi Pratap  <ravi@ximian.com>
8367
8368         * delegate.cs (Define): Fix extremely silly bug where I was
8369         setting the type of the 'object' parameter of the BeginInvoke
8370         method to System.IAsyncResult instead of System.Object ;-)
8371
8372 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
8373
8374         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
8375         here. 
8376
8377         (Constructor.Emit): return if we fail to initialize the
8378         constructor.  Another door closed!  
8379
8380         * expression.cs (New.DoResolve): Improve error message (from -6 to
8381         1501).  Use DeclaredOnly lookup to find the exact constructor.
8382
8383         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
8384         loop.  This is useful.
8385
8386         * cs-parser.jay: Adjust the default parameters so that destructors
8387         have the proper signature.
8388
8389 2002-04-26  Martin Baulig  <martin@gnome.org>
8390
8391         * driver.cs (LoadAssembly): If `assembly' contains any characters
8392         which are only valid in path names and not in assembly names
8393         (currently slash, backslash and point), use Assembly.LoadFrom ()
8394         instead of Assembly.Load () on the `assembly' (before iteration
8395         over the link_paths).
8396
8397 2002-04-26  Martin Baulig  <martin@gnome.org>
8398
8399         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
8400
8401 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
8402
8403         * class.cs (Property): use the new typemanager.MemberLookup
8404
8405         (TypeContainer.MemberLookup): Implement using the
8406         TypeManager.MemberLookup now. 
8407         
8408         * typemanager.cs: Make MemberLookup a function of the TypeManager,
8409         and return MemberInfos, so that these can be used without an
8410         EmitContext (what we had before).
8411
8412 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
8413
8414         * expression.cs: Fix the case where the argument to params if the
8415         type of the params.  I omitted handling this before.   Fixed
8416
8417 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
8418
8419         * driver.cs: Call BootCorlib_PopulateCoreType
8420
8421         * class.cs (Property.CheckBase): Check for properties only, not
8422         for all members. 
8423
8424         * interface.cs: Temporary hack: try/catch around the
8425         CustomAttributeBuilder, because I am getting an exception that I
8426         do not understand.
8427
8428         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
8429         types whose definitions are required to be there (attributes are
8430         defined before standard types).
8431
8432         Compute definitions as we boot the various types, as they are used
8433         immediately (value_type class will need object_type, but if we do
8434         not initialize object_type, we will pass a null, which will let
8435         the runtime pick the System.Object from the existing corlib, which
8436         is not what we want).
8437
8438 2002-04-22  Patrik Torstensson <totte@labs2.com>
8439
8440         * cs-tokenizer.cs: fixed a number of trim() issues.
8441
8442 2002-04-22  Ravi Pratap  <ravi@ximian.com>
8443
8444         * expression.cs (Argument.Type): Ensure that we return the correct
8445         type when we have out or ref parameters [in which case we 
8446         append a "&"].
8447         
8448 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
8449
8450         * class.cs (Property, Indexer): Allow extern modifier in there. 
8451
8452         * typemanager.cs (InitBaseTypes): Initializes object_type and
8453         value_type, since those will be used early on during the bootstrap
8454         process to compile corlib.
8455
8456         (InitCoreTypes): Move code from here to InitBaseTypes.
8457
8458 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
8459
8460         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
8461         single-dimension arrays as using the ldlen opcode.  
8462
8463         Daniel Lewis discovered this optimization.  
8464
8465         * typemanager.cs: Add signature for System.Array::get_Length
8466
8467 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8468
8469         * statement.cs: report the error when the foreach does not apply to an
8470         array nor a collection.
8471
8472 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
8473
8474         * expression.cs: Add implicit conversions to the operator ~.
8475
8476         * constant.cs (DecimalConstant.Emit): Emit decimal value.
8477
8478         * typemanager.cs: Locate the decimal constructor.
8479
8480 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8481
8482         * attribute.cs: use the new property of TypeOf.
8483         * expression.cs: added 'get' property around typearg.
8484
8485         These changes fix a build breaker reported by NickD. Is this the
8486         correct way to fix?  If not, please, revert my changes and make it
8487         work :-).
8488
8489 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
8490
8491         * attribute.cs: Add support for typeof in attribute invocations.
8492         I am not sure that this is right though.
8493
8494 2002-04-14  Duncan Mak  <duncan@ximian.com>
8495
8496         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
8497         Binary.Operator.Division case.
8498
8499 2002-04-13  Ravi Pratap  <ravi@ximian.com>
8500
8501         * class.cs (DefineType): Ensure that we do a proper check on
8502         attribute types and also register it with the TypeManager.
8503
8504         (TypeContainer.Targets): The default for attribute types is
8505         AttributeTargets.All.
8506         
8507         * attribute.cs (ApplyAttributes): Registering the attribute type
8508         is done elsewhere, not when we discover we have a Usage attribute.
8509
8510 2002-04-12  Ravi Pratap  <ravi@ximian.com>
8511
8512         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
8513         and get rid of is_delegate parameter.
8514
8515         * everywhere : update.
8516         
8517 2002-04-12  Ravi Pratap  <ravi@ximian.com>
8518
8519         * cs-parser.jay (compilation_unit): Revamp completely to use
8520         some new ideas that I got from Rhys' grammar to solve the problems
8521         with assembly level attributes.
8522
8523         (outer_declaration): New grammar production.
8524
8525         (attribute_sections): Add.
8526
8527         (opt_attributes): Base on attribute_sections
8528
8529         (namespace_declaration): Allow opt_attributes to tackle the case
8530         when we have assembly level attributes - we are clever in this
8531         regard now ;-)
8532
8533         * attribute.cs (ApplyAttributes): Do not worry about assembly 
8534         attributes in the non-global context.
8535
8536         * rootcontext.cs (AddGlobalAttributes): Go back to using this
8537         instead of SetGlobalAttributes.
8538
8539         * class.cs, rootcontext.cs : Ensure we define and generate 
8540         attribute types before anything else.
8541
8542         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
8543         and flag the new error -20 for the case when the attribute type
8544         does not have valid targets specified. csc does not catch this.
8545
8546         * ../errors/errors.txt : update for error # -20
8547
8548 2002-04-11  Ravi Pratap  <ravi@ximian.com>
8549
8550         * support.cs (InternalParameters.ParameterModifier): Do some null
8551         checking and return sane values.
8552
8553         * class.cs (Method.Define): If we are a PInvoke method, ensure
8554         that we are static and extern. Report error # 601
8555
8556         * ../errors/cs0601.cs : Add test case for the above error.
8557
8558 2002-04-07  Ravi Pratap  <ravi@ximian.com>
8559
8560         * rootcontext.cs (attribute_types): We need to keep type of
8561         all attribute types separately and emit code for them first.
8562
8563         (RegisterAttribute) : Implement.
8564
8565         * class.cs (DefineType): Check if the current Type is a custom
8566         attribute type and register it accordingly.
8567
8568         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
8569         adding the first attribute twice and rename to
8570
8571         (SetGlobalAttributes): this.
8572
8573         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
8574         lookups.
8575
8576         * attribute.cs (ApplyAttributes): Take an additional argument telling us
8577         if we are processing global arguments. Hmm, I am unsure of this.
8578
8579 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8580
8581         * expression.cs: added static array of strings to avoid calling
8582         Enum.ToString () for Operator in Binary. Significant recover of
8583         performance.
8584
8585 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
8586
8587         * class.cs (FindMembers): Allow the Builders of the various
8588         members to be null.  If they are skip them.  This only happens
8589         during the PInvoke declaration.
8590
8591 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
8592
8593         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
8594         failure, so we do not keep going afterwards.
8595
8596         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
8597         wanted to pass `false' as the `is_delegate' argument.  If this is
8598         the case, why not use delegate_type == null to mean `is_delegate =
8599         false' and anything else as is_delegate = true.
8600
8601 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
8602
8603         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
8604         code for the section, not the beginning of the tests.
8605
8606 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
8607
8608         * cfold.cs: Handle operator + (Enum x, Underlying x) 
8609
8610         * expression.cs (Binary): same.  Warn about errors where we have
8611         Enum/Enum in operator + as well.
8612
8613 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
8614
8615         * statement.cs:
8616                 - added support for switch(bool)
8617                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
8618                 - add TableSwitchEmit() to handle table-based switch statements
8619
8620 2002-04-05  Ravi Pratap  <ravi@ximian.com>
8621
8622         * expression.cs (Invocation.OverloadResolve): Factor out code which
8623         does parameter compatibility checking with arguments so that we can 
8624         re-use the code even from Delegate.VerifyApplicability
8625
8626         (VerifyArgumentsCompat): Move above code here.
8627
8628         * delegate.cs (VerifyApplicability): Get rid of duplicate code
8629         and instead make a call to the above method.
8630
8631 2002-03-31  Ravi Pratap  <ravi@ximian.com>
8632
8633         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
8634         We use it to keep track of classes which are attribute types.
8635
8636 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
8637
8638         * delegate.cs (Delegate.Define): Correctly define the types in the
8639         presence of fixed and array parameters.
8640
8641         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
8642         doing FindMembers.
8643
8644         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
8645         include NonPublic after the first iteration.
8646
8647         * class.cs (Indexer.CheckBase): Only check if both parents are
8648         non-null. 
8649         
8650         * cs-parser.jay (accessor_body): If empty, set to null.
8651
8652         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
8653         same code path here to resolve constants names that we did have in
8654         MemberAccess.DoResolve.  There is too much code duplicated here.
8655
8656 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
8657
8658         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
8659
8660         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
8661         to MakeUnionSet.
8662
8663         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
8664         tokens, numbers and strings.
8665
8666         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
8667         parenthesis.
8668
8669         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
8670         asyncronous parameters and the regular parameters.  
8671
8672         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
8673         specify the target directory.
8674
8675         * expression.cs: (This.DoResolve): Simplify
8676         (As.Emit): Optimize, do not generate IsInst if the expression is
8677         always of the given type.
8678
8679         (Is.DoResolve): Bug fix, we were reporting both always/never for
8680         the is expression.
8681
8682         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
8683         creating too many unnecessary arrays.
8684
8685 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
8686
8687         * class.cs (EmitFieldInitializer): Use Assign expression to assign
8688         fields instead of rolling our own initializer.   Takes care of all
8689         implicit conversions, and drops unnecessary static checks/argument.
8690
8691 2002-03-31  Dick Porter  <dick@ximian.com>
8692
8693         * driver.cs: use the GetDirectories() return values properly, and
8694         use "/" as path separator.
8695
8696 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
8697
8698         * expression.cs (Unary): Optimize - - expr into expr.
8699         (Binary): Optimize a + (-b) into a -b.
8700
8701         * codegen.cs (CodeGen): Made all methods static.
8702
8703 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
8704
8705         * rootcontext.cs: 
8706
8707         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
8708         TypeBuilder property.
8709
8710         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
8711         instead. 
8712
8713         * tree.cs: Removed the various RecordXXXX, and replaced with a
8714         single RecordDecl.  Removed all the accessor methods, and just
8715         left a single access point Type 
8716
8717         * enum.cs: Rename DefineEnum to DefineType.
8718
8719         * decl.cs: New abstract method `DefineType' used to unify the
8720         Defines for Enumerations, Interfaces, TypeContainers and
8721         Delegates.
8722
8723         (FindType): Moved LookupInterfaceOrClass here.  Moved the
8724         LookupBaseClasses method that used to live in class.cs and
8725         interface.cs here, and renamed to FindType.
8726         
8727         * delegate.cs: Implement DefineType.  Take advantage of the
8728         refactored pattern for locating the parent builder without taking
8729         the parent_builder argument (which we know does not work if we are
8730         nested, and triggering a toplevel definition).
8731
8732 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
8733
8734         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
8735         accessibility of a member has changed during override and report
8736         an error if so.
8737
8738         * class.cs (Method.Define, Property.Define): Only complain on
8739         overrides if the method is private, any other accessibility is
8740         fine (and since we just checked the permission is the same, we are
8741         good to go).
8742
8743         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
8744         and elif are processed always.  The other pre-processing
8745         directives are only processed if we are "taking" the path
8746
8747 2002-03-29  Martin Baulig  <martin@gnome.org>
8748
8749         * class.cs (Method.Emit): Only emit symbolic debugging info if the
8750         current location is not Null.
8751
8752         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
8753         a separate method so we can profile it.
8754
8755         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
8756         `span.Seconds' are just seconds, but no minutes or hours.
8757         (MainDriver): Profile the CodeGen.SaveSymbols calls.
8758
8759 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
8760
8761         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
8762         Remove the gratuitous set of Final:
8763
8764                                 // If an interface implementation, then we can set Final.
8765                                 if (((flags & MethodAttributes.Abstract) == 0) &&
8766                                     implementing.DeclaringType.IsInterface)
8767                                         flags |= MethodAttributes.Final;
8768
8769         I do not know what I was smoking when I used that.
8770         
8771
8772         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
8773         step into fixing the name resolution issues for delegates and
8774         unifying the toplevel name resolution.
8775
8776 2002-03-28  Martin Baulig  <martin@gnome.org>
8777
8778         * class.cs (Method.Emit): If we have a symbol writer, call its
8779         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
8780         tell it about the current method.
8781
8782         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
8783         writer that we're going to emit the first byte of IL code for a new
8784         statement (a new source line).
8785         (EmitContext.EmitTopBlock): If we have a symbol writer, call
8786         EmitContext.Mark() before emitting any code.
8787
8788         * location.cs (SymbolDocument): Return null when we're Null.
8789
8790         * statement.cs (Statement): Moved the `Location loc' variable here.
8791         (Statement.EmitBoolExpression): If we have a symbol writer, call
8792         ec.Mark() before emitting any code to tell it that we're at the
8793         beginning of a new statement.
8794         (StatementExpression): Added `Location' argument to the constructor.
8795         (Block): Added public readonly variable `StartLocation' and public
8796         variable `EndLocation'.  The latter is to be set using SetEndLocation().
8797         (Block): Added constructor which takes a start and end location.
8798         (Block.SetEndLocation): New method. This sets the end location.
8799         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
8800         local variables we create.
8801         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
8802         each statement and do also mark the begin and end of the block.
8803
8804         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
8805         tell it the current lexer.Location, use Location.Null for the end of the
8806         block.
8807         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
8808         current block, set its end location using SetEndLocation().
8809         (statement_expression): StatementExpression constructor now takes the
8810         lexer.Location as additional argument.
8811         (for_statement, declare_local_variables): Likewise.
8812         (declare_local_variables): When creating a new implicit block, use the
8813         new Block constructor and pass it the lexer.Location.
8814
8815 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
8816
8817         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
8818         members also on the parent interfaces recursively.
8819
8820 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
8821
8822         * report.cs: Use new formats, since Gonzalo finished the missing
8823         bits. 
8824
8825         * expression.cs (Binary.ResolveOperator): added missing operator|
8826         operator& and operator^ for bool/bool.
8827
8828         * cs-parser.jay: CheckDef now takes a Location argument that is
8829         used to report errors more precisly (instead of reporting the end
8830         of a definition, we try to track something which is a lot closer
8831         to the source of the problem).
8832
8833         * cs-tokenizer.cs: Track global token use, so we can properly flag
8834         the use of #define/#undef after the first token has been seen.
8835
8836         Also, rename the reportXXXX to Error_DescriptiveName
8837
8838         * decl.cs (DeclSpace.IsTopLevel): Move property here from
8839         TypeContainer, so that Enum and Interface can use this too.
8840
8841         * class.cs (TypeContainer.LookupInterfaceOrClass,
8842         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
8843         `builder' argument.  Typically this was used to pass the parent
8844         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
8845         the definition).  
8846
8847         The problem is that a nested class could trigger the definition of
8848         a toplevel class, and the builder would be obviously wrong in that
8849         case. 
8850
8851         So we drop this argument, and we compute dynamically the
8852         TypeBuilder/ModuleBuilder (the correct information was available
8853         to us anyways from DeclSpace.Parent)
8854
8855         * interface.cs (Interface.DefineInterface): Drop builder
8856         parameter cleanup like class.cs
8857
8858         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
8859         like class.cs
8860
8861         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
8862         values. 
8863
8864         (Try.Emit): Propagate the returns value from the statement.
8865
8866         (Return.Emit): Even if we are leavning 
8867
8868         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
8869
8870         * modifiers.cs: Fix the computation of MethodAttributes flags.
8871
8872 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
8873
8874         * driver.cs: allow compilation of files that start with '/'.
8875         Add a default case when checking the argument of --target.
8876
8877 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
8878
8879         * interface.cs: Implement the same search algorithm for types in
8880         the interface code.
8881
8882         * delegate.cs: Do not allow multiple definition.
8883
8884         * Recovered ChangeLog that got accidentally amputated
8885
8886         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
8887
8888         * rootcontext.cs: Load manually enum to allow core classes to
8889         contain enumerations.
8890
8891         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
8892         Update to new static methods in TypeManager.
8893
8894         * typemanager.cs (GetMethod, GetConstructor): Use our
8895         implementation of FindMembers to find the members, since during
8896         corlib compilation, the types are TypeBuilders and GetMethod and
8897         GetConstructor do not work.
8898
8899         Make all methods in TypeManager static.
8900
8901         (InitCodeHelpers): Split the functionality from
8902         the InitCodeTypes function.
8903
8904         * driver.cs: Call InitCodeHelpers after we have populated the
8905         types. 
8906
8907         * cs-parser.jay (delegate_declaration): we did not used to compute
8908         the delegate name correctly for void delegates.
8909
8910 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
8911
8912         * rootcontext.cs (RootContext): Init the interface_resolve_order
8913         and type_container_resolve_order always.
8914
8915         (ResolveCore, BootstrapCorlib_ResolveClass,
8916         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
8917         compiler when compiling with --nostdlib
8918
8919         * class.cs (TypeContainer.DefineType): Check that our parent is
8920         not null.  This test is most important when we are bootstraping
8921         the core types.
8922
8923         * codegen.cs: Split out the symbol writing code.
8924
8925 2002-03-25  Martin Baulig  <martin@gnome.org>
8926
8927         * driver.cs (-g): Made -g an alias for --debug.
8928
8929 2002-03-24  Martin Baulig  <martin@gnome.org>
8930
8931         * codegen.cs (SymbolWriter): New public variable. Returns the
8932         current symbol writer.
8933         (CodeGen): Added `bool want_debugging_support' argument to the
8934          constructor. If true, tell the ModuleBuild that we want debugging
8935         support and ask it for the ISymbolWriter.
8936         (Save): If we have a symbol writer, call it's Close() method after
8937         saving the assembly.
8938
8939         * driver.c (--debug): New command line argument to create a
8940         debugger information file.
8941
8942         * location.cs (SymbolDocument): New public property. Returns an
8943         ISymbolDocumentWriter object for the current source file or null
8944         if we don't have a symbol writer.
8945
8946 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
8947
8948         * driver.cs (LoadAssembly): Correctly return when all the paths
8949         have been tried and not before.
8950
8951         * statement.cs (Switch.Emit): return the actual coverage for this
8952         statement (returns/not-returns)
8953
8954         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
8955         switch of the statement if we are the last switch section.  That
8956         kills two problems: try/catch problems (we used to emit an empty
8957         nop at the end) and switch statements where all branches would
8958         return. 
8959
8960 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
8961
8962         * driver.cs: Add default assemblies (the equivalent to the
8963         Microsoft CSC.RSP file)
8964
8965         * cs-tokenizer.cs: When updating `cols and setting it to zero,
8966         also update tokens_seen and set it to false.
8967
8968         * driver.cs: Implement --recurse for Mike.
8969
8970         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
8971         correctly splitting out the paths.
8972
8973 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
8974
8975         * interface.cs (Interface.PopulateProperty): Instead of using
8976         `parent' as the declaration space for the set parameters, use
8977         `this' 
8978
8979         * support.cs (InternalParameters): InternalParameters constructor
8980         takes a DeclSpace instead of a TypeContainer.
8981
8982         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
8983         types are being initialized, load the address of it before calling
8984         the function.  
8985
8986         (New): Provide a mechanism to disable the generation of local
8987         value type temporaries when the caller will be providing us with
8988         an address to store it.
8989
8990         (ArrayCreation.EmitDynamicInitializers): Use it.
8991
8992 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
8993
8994         * expression.cs (Invocation.EmitArguments): Only probe for array
8995         property if there is more than one argument.  Sorry about that.
8996
8997         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
8998         empty param arrays.
8999         
9000         * class.cs (Method.LabelParameters): Fix incorrect code path that
9001         prevented the `ParamArrayAttribute' from being applied to the
9002         params attribute.
9003
9004 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
9005
9006         * support.cs (ReflectionParameters): Correctly compute whether the
9007         last argument is a params array.  Fixes the problem with
9008         string.Split ('a')
9009
9010         * typemanager.cs: Make the assemblies array always be non-null
9011         (empty, but non-null)
9012
9013         * tree.cs (RecordDecl): New function that abstracts the recording
9014         of names.  This reports error 101, and provides a pointer to the
9015         previous declaration.  Fixes a crash in the compiler.
9016
9017         * cs-parser.jay (constructor_declaration): Update to new grammar,
9018         and provide a constructor_body that can be empty.
9019
9020 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
9021
9022         * driver.cs: Add support for --resources.
9023
9024         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
9025         Make all types for the various array helper methods be integer.
9026
9027         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
9028         CheckState to ConvCast.
9029
9030         (ConvCast): Now it takes a `checked' state argument, to avoid
9031         depending on the emit context for the conversion, and just using
9032         the resolve time setting.
9033
9034         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
9035         instead of Invocation.EmitArguments.  We do not emit the original
9036         arguments, instead we emit those which have been converted to
9037         unsigned int expressions.
9038
9039         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
9040
9041         * codegen.cs: ditto.
9042
9043         * expression.cs (LocalVariableReference): Drop the use of the
9044         Store function that depended on the variable index.
9045
9046         * statement.cs (VariableInfo): Drop the `Idx' property from this
9047         class, as this is not taking into account the indexes for
9048         temporaries tat we generate during the execution, getting the
9049         indexes wrong.
9050
9051         * class.cs: First emit class initializers, then call the parent
9052         constructor. 
9053
9054         * expression.cs (Binary): Fix opcode emision.
9055         (UnaryMutator.EmitCode): Support checked code generation
9056
9057         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
9058         matches for events for both the Static and Instance scans,
9059         pointing to the same element.   Fix that.
9060
9061 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
9062
9063         * rootcontext.cs (ResolveTree): Always set the
9064         interface_resolve_order, because nested interfaces will be calling
9065         into us.
9066
9067         * class.cs (GetInterfaceOrClass): Track the same resolution
9068         process used by TypeManager.LookupType.  This fixes the nested
9069         type lookups in class declarations (separate path from
9070         LookupType). 
9071
9072         (TypeContainer.DefineType): Also define nested interfaces.
9073         (TypeContainer.RegisterOrder): New public function used to
9074         register the order in which child interfaces need to be closed.
9075
9076         Nested interfaces need to be closed after their parents have been
9077         created. 
9078         
9079         * interface.cs (InterfaceAttr): Put all the logic for computing
9080         the interface attribute here. 
9081
9082         (DefineInterface): Register our interface order with the
9083         RootContext or with the TypeContainer depending on the case.
9084
9085 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
9086
9087         * cs-parser.jay: rework foreach statement to work with the new
9088         changes to the policy on SimpleNames.
9089         
9090         * report.cs: support Stacktrace on warnings as well.
9091
9092         * makefile: drop --unsafe and /unsafe from the compile.
9093
9094 2002-03-13  Ravi Pratap  <ravi@ximian.com>
9095
9096         * ecore.cs (StandardConversionExists): Modify to take an Expression
9097         as the first parameter. Ensure we do null -> reference type conversion
9098         checking.
9099
9100         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
9101         temporary Expression objects.
9102
9103 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
9104
9105         * interface.cs: workaround bug in method overloading resolution
9106         (there is already a bugzilla bug for it).
9107
9108 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
9109
9110         We could also solve this problem by having a separate path for
9111         performing type lookups, instead of DoResolve, we could have a
9112         ResolveType entry point, and only participating pieces of the
9113         production (simplename, deref, array) would implement this. 
9114         
9115         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
9116         signal SimpleName to only resolve type names and not attempt to
9117         resolve anything else.
9118
9119         * expression.cs (Cast): Set the flag.
9120
9121         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
9122
9123         * class.cs: Only report 108 if there is no `new' modifier.
9124
9125         * cs-parser.jay: rework foreach statement to work with the new
9126         changes to the policy on SimpleNames.
9127         
9128         * report.cs: support Stacktrace on warnings as well.
9129
9130         * makefile: drop --unsafe and /unsafe from the compile.
9131
9132 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
9133
9134         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9135         lookups here, instead of doing that at parse time.  This means
9136         that our grammar will not introduce `LocalVariableReferences' as
9137         expressions at this point.  That solves the problem of code like
9138         this:
9139
9140         class X {
9141            static void Main ()
9142            { int X = 1;
9143             { X x = null }}}
9144
9145         This is only half the fix.  The full fix requires parameters to
9146         also be handled in this way.
9147
9148         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
9149         makes the use more obvious of the DeclSpace.  The
9150         ec.TypeContainer.TypeBuilder is now only used to pull the
9151         TypeBuilder for it.
9152
9153         My theory is that I can get rid of the TypeBuilder completely from
9154         the EmitContext, and have typecasts where it is used (from
9155         DeclSpace to where it matters).  
9156
9157         The only pending problem is that the code that implements Aliases
9158         is on TypeContainer, and probably should go in DeclSpace.
9159
9160         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9161         lookups here, instead of doing that at parse time.  This means
9162         that our grammar will not introduce `LocalVariableReferences' as
9163         expressions at this point.  That solves the problem of code like
9164         this:
9165
9166         class X {
9167            static void Main ()
9168            { int X = 1;
9169             { X x = null }}}
9170
9171         This is only half the fix.  The full fix requires parameters to
9172         also be handled in this way.
9173
9174         * class.cs (Property.DefineMethod): When implementing an interface
9175         method, set newslot, when implementing an abstract method, do not
9176         set the flag (before we tried never setting it, or always setting
9177         it, which is the difference).
9178         (Indexer.DefineMethod): same.
9179         (Method.DefineMethod): same.
9180
9181         * ecore.cs: Only set the status used flag if we get back a Field.
9182
9183         * attribute.cs: Temporary hack, so Paolo can keep working.
9184
9185 2002-03-08  Ravi Pratap  <ravi@ximian.com>
9186
9187         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
9188         the unmanaged type in the case we have a MarshalAs attribute.
9189
9190         (Resolve): Handle the case when we are parsing the special MarshalAs
9191         attribute [we need to store the unmanaged type to use later]
9192         
9193         * typemanager.cs (marshal_as_attr_type): Built in type for the 
9194         MarshalAs Attribute.
9195
9196         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
9197         on parameters and accordingly set the marshalling info.
9198         
9199 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
9200
9201         * class.cs: Optimizing slightly by removing redundant code after
9202         we switched to the `NoTypes' return value.
9203         (Property.DefineMethod): use NoTypes here too.
9204
9205         This fixes the bug I introduced in my last batch of changes.
9206
9207 2002-03-05  Ravi Pratap  <ravi@ximian.com>
9208
9209         * tree.cs (RecordEnum): Add. We now keep track of enums too.
9210
9211         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
9212         Enums since those are types too. 
9213
9214         * cs-parser.jay (enum_declaration): Record enums as we parse them.
9215         
9216         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
9217         thanks to a call during the lookup process.
9218
9219 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
9220
9221         * statement.cs (Foreach): Lots of work to accomodate a particular
9222         kind of foreach statement that I had not kept in mind.  It is
9223         possible to have foreachs on classes that provide a GetEnumerator
9224         method that return objects that implement the "pattern" for using
9225         a foreach, there is no need to support GetEnumerator
9226         specifically. 
9227
9228         This is needed to compile nant.
9229
9230         * decl.cs: Only report 114 if the member is not `Finalize' and if
9231         the warning level is at least 2.
9232
9233         * class.cs: Moved the compare function from Method to
9234         MethodSignature. 
9235
9236         (MethodSignature.InheritableMemberSignatureCompare): Add new
9237         filter function that is used to extract inheritable methods from a
9238         class. 
9239
9240         (Method.Define): Use the new `inheritable_method_signature_filter'
9241         delegate
9242
9243         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
9244         command. 
9245
9246 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
9247
9248         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
9249
9250         * cs-parser.jay: Add opt_semicolon to the interface declaration.
9251
9252         * expression.cs: Pass location information to
9253         ConvertImplicitStandard. 
9254
9255         * class.cs: Added debugging code to track return values from
9256         interfaces. 
9257
9258 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
9259
9260         * expression.cs (Is.DoResolve): If either side of the `is' is an
9261         interface, do not flag the warning.
9262
9263         * ecore.cs (ImplicitReferenceConversion): We need a separate test
9264         for interfaces
9265
9266         * report.cs: Allow for --fatal to be used with --probe.
9267         
9268         * typemanager.cs (NoTypes): Move the definition for the empty Type
9269         array here. 
9270
9271         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
9272         properties. 
9273         (TypeContainer.DefineProxy): New function used to proxy to parent
9274         implementations when implementing interfaces.
9275         (TypeContainer.ParentImplements): used to lookup if our parent
9276         implements a public function that is required by an interface.
9277         (TypeContainer.VerifyPendingMethods): Hook this up.
9278
9279         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
9280         `modules' and `assemblies' arraylists into arrays.  We only grow
9281         these are the very early start up of the program, so this improves
9282         the speedof LookupType (nicely measured).
9283
9284         * expression.cs (MakeByteBlob): Replaced unsafe code with
9285         BitConverter, as suggested by Paolo.
9286
9287         * cfold.cs (ConstantFold.Binary): Special case: perform constant
9288         folding of string concatenation, but if either side is a string,
9289         and the other is not, then return null, and let the runtime use
9290         the concatenation on the string plus the object (using
9291         `Object.ToString'). 
9292
9293 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
9294
9295         Constant Folding has been implemented now.
9296         
9297         * expression.cs (Unary.Reduce): Do not throw an exception, catch
9298         the error instead on types that are not supported in one's
9299         complement. 
9300
9301         * constant.cs (Constant and all children): New set of functions to
9302         perform implict and explicit conversions.
9303         
9304         * ecore.cs (EnumConstant): Implement the new functions to perform
9305         conversion by proxying to the child expression.
9306
9307         * codegen.cs: (ConstantCheckState): Constant evaluation has its
9308         own separate setting that can not be turned off from the command
9309         line using --unchecked or --checked and is only controlled using
9310         the checked/unchecked statements and expressions.  This setting is
9311         used by the constant folder to flag errors.
9312
9313         * expression.cs (CheckedExpr, UncheckedExpr): Set the
9314         ConstantCheckState as well.   
9315
9316         During Resolve, they also have to flag the state, because the
9317         constant folder runs completely in the Resolve phase.
9318
9319         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
9320         well.
9321
9322 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
9323
9324         * cfold.cs: New file, this file contains the constant folder.
9325         
9326         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
9327         argument to track whether we are using the resulting address to
9328         load or store a value and provide better error messages. 
9329
9330         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
9331         new AddressOf arguments.
9332
9333         * statement.cs (Foreach.EmitCollectionForeach): Update
9334
9335         * expression.cs (Argument.Emit): Call AddressOf with proper
9336         arguments to track usage.
9337
9338         (New.DoEmit): Call AddressOf with new arguments.
9339
9340         (Unary.Emit): Adjust AddressOf call.
9341
9342 2002-03-01  Ravi Pratap  <ravi@ximian.com>
9343
9344         * cs-parser.jay (member_access): Change the case for pre-defined types
9345         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
9346         this suggestion.
9347
9348         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
9349         a method body.
9350
9351         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
9352         essentially like methods and apply attributes like MethodImplOptions to them too.
9353
9354         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
9355         not being null.
9356
9357         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
9358         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
9359         is the DeclSpace.
9360
9361         * Update code everywhere accordingly.
9362
9363         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
9364
9365         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
9366
9367 2002-02-28  Ravi Pratap  <ravi@ximian.com>
9368
9369         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
9370         try performing lookups against those instead of jumping straight into using
9371         the 'using' clauses.
9372
9373         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
9374
9375         (LookupType): Perform lookups in implicit parents too.
9376
9377         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
9378         sequence as RootContext.LookupType. 
9379
9380         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
9381         the various cases of namespace lookups into this method.
9382
9383 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
9384
9385         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
9386         in positional arguments)
9387
9388         * class.cs (Operator): Update the AllowedModifiers to contain
9389         extern. 
9390
9391         * cs-parser.jay: Update operator declaration to allow for the
9392         operator body to be empty.
9393
9394         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
9395         values. 
9396
9397 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
9398
9399         * class.cs (Method.Emit): Label parameters.
9400
9401         * driver.cs: Return 1 or 0 as the program exit code.
9402
9403 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
9404
9405         * expression.cs: Special case the `null' object when trying to
9406         auto-compute the type, as anything can be explicitly converted to
9407         that. 
9408
9409         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
9410         spotting this Paolo.
9411
9412         (Expression.ImplicitNumericConversion): Perform comparissions of
9413         the type using the underlying type in the case of an enumeration
9414         rather than using the enumeration type for the compare.
9415
9416         Cope with the underlying == type case, which is not possible to
9417         catch before. 
9418
9419         (Expression.ConvertNumericExplicit): Perform comparissions of
9420         the type using the underlying type in the case of an enumeration
9421         rather than using the enumeration type for the compare.
9422
9423         * driver.cs: If the user does not supply an extension, assume .exe
9424
9425         * cs-parser.jay (if_statement): Rewrote so that we can track the
9426         location for the if statement.
9427
9428         * expression.cs (Binary.ConstantFold): Only concat strings when
9429         the operation is "+", not everything ;-)
9430
9431         * statement.cs (Statement.EmitBoolExpression): Take a location
9432         argument. 
9433         (If, While, Do): Track location.
9434
9435         * expression.cs (Binary.ResolveOperator): In the object + string
9436         case, I was missing a call to ConvertImplicit
9437
9438 2002-02-25  Ravi Pratap  <ravi@ximian.com>
9439
9440         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
9441         Location arguments. Ensure we use RootContext.LookupType to do our work
9442         and not try to do a direct Type.GetType and ModuleBuilder.GetType
9443
9444         * interface.cs (PopulateMethod): Handle the type of the parameter being
9445         null gracefully.
9446
9447         * expression.cs (Invocation.BetterFunction): Handle the case when we 
9448         have a params method with no fixed arguments and a call is made with no
9449         arguments.
9450
9451 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
9452
9453         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
9454         the verbatim-string-literal
9455
9456         * support.cs (InternalParameters.ParameterModifier): handle null
9457         fixed parameters.
9458         (InternalParameters.ParameterType): ditto.
9459
9460         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
9461         duplicating the name of the variable parameter.
9462         (GetParameterByName): Fix bug where we were not looking up array
9463         paramters if they were the only present (thanks Paolo!).
9464         (GetParameterInfo): We only have an empty set of types if both
9465         fixed and array are set to null.
9466         (GetParameterInfo-idx): Handle FixedParameter == null
9467
9468         * cs-parser.jay: Handle the case where there is no catch
9469         statements (missing null test).
9470
9471 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
9472
9473         * driver.cs (MainDriver): Be conservative on our command line
9474         handling.
9475
9476         Catch DirectoryNotFoundException when calling GetFiles.
9477         
9478         (SplitPathAndPattern): Used to split the input specification into
9479         a path and a pattern that we can feed to Directory.GetFiles.
9480
9481 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
9482
9483         * statement.cs (Fixed): Implement the last case of the Fixed
9484         statement (string handling).
9485
9486         * expression.cs (StringPtr): New class used to return a char * to
9487         a string;  Used by the Fixed statement.
9488
9489         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
9490
9491         * expression.cs (Binary.ResolveOperator): Remove redundant
9492         MemberLookup pn parent type.
9493         Optimize union call, we do not need a union if the types are the same.
9494         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
9495         type.
9496
9497         Specialize the use of MemberLookup everywhere, instead of using
9498         the default settings. 
9499
9500         (StackAlloc): Implement stackalloc keyword.
9501
9502         * cs-parser.jay: Add rule to parse stackalloc.
9503         
9504         * driver.cs: Handle /h, /help, /?
9505
9506         * expression.cs (MakeByteBlob): Removed the hacks we had in place
9507         before we supported unsafe code.
9508         
9509         * makefile: add --unsafe to the self compilation of mcs.
9510
9511 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
9512
9513         * expression.cs (PointerArithmetic): New class that is used to
9514         perform pointer arithmetic.
9515         (Binary.Resolve): Handle pointer arithmetic
9516         Handle pointer comparission.
9517         (ArrayPtr): Utility expression class that is used to take the
9518         address of an array.
9519
9520         (ElementAccess): Implement array access for pointers
9521         
9522         * statement.cs (Fixed): Implement fixed statement for arrays, we
9523         are missing one more case before we are done.
9524
9525         * expression.cs (Indirection): Implement EmitAssign and set the
9526         ExprClass to Variable.  This allows pointer dereferences to be
9527         treated as variables, and to have values assigned to them.
9528         
9529         * ecore.cs (Expression.StoreFromPtr): New utility function to
9530         store values dereferencing.
9531
9532 2002-02-20  Ravi Pratap  <ravi@ximian.com>
9533
9534         * expression.cs (Binary.ResolveOperator): Ensure that we are
9535         not trying to operate on a void type - this fixes the reported
9536         bug.
9537
9538         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
9539         the parent implementation is sealed.
9540
9541         * ../errors/cs0239.cs : Add.
9542
9543         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
9544
9545         * typemanager.cs (unverifiable_code_type): Corresponds to 
9546         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
9547         which have unsafe code in them.
9548
9549         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
9550         unsafe context.
9551
9552 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
9553
9554         * cs-tokenizer.cs: Add support for @"litreal strings"
9555
9556         Make tokenizer accept pre-processor directives
9557         on any column (remove the old C-like limitation). 
9558
9559         * rootcontext.cs (EmitCode): Emit any global attributes.
9560         (AddGlobalAttributes): Used to keep track of assembly attributes. 
9561
9562         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
9563
9564         * cs-parser.jay: Add support for global attributes.  
9565
9566 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
9567
9568         * expression.cs (Indirection): New helper class.  Unary will
9569         create Indirection classes to be able to implement the
9570         IMemoryLocation interface on it.
9571
9572 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
9573
9574         * cs-parser.jay (fixed_statement): reference the right statement.
9575
9576         * statement.cs (Fixed.Emit): Finish implementing the fixed
9577         statement for the &x case.
9578
9579 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
9580
9581         * class.cs (Property.Define, Method.Define): Remove newslot when
9582         `implementing'.  
9583
9584         * modifiers.cs: My use of NewSlot when `Abstract' was set was
9585         wrong.  NewSlot should only be used if the `new' keyword is present.
9586
9587         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
9588         locating our system dir.  Sorry about this.
9589
9590 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
9591
9592         * driver.cs (GetSystemDir): Compute correctly the location of our
9593         system assemblies.  I was using the compiler directory instead of
9594         the library directory.
9595
9596 2002-02-13  Ravi Pratap  <ravi@ximian.com>
9597
9598         * expression.cs (BetterFunction): Put back in what Miguel commented out
9599         since it is the correct fix. The problem is elsewhere ;-)
9600
9601         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
9602         parameters of the parms method are themselves compatible or not !
9603
9604         (StandardConversionExists): Fix very dangerous bug where we were forgetting
9605         to check that a class implements an interface before saying that an implicit
9606         conversion was allowed. Use ImplementsInterface to do the checking.
9607
9608 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
9609
9610         * class.cs (Method.Define): Track whether we are an explicit
9611         implementation or not.  And only call DefineMethodOverride if we
9612         are an explicit implementation.
9613
9614         (Property.DefineMethod): Ditto.
9615
9616 2002-02-11  Ravi Pratap  <ravi@ximian.com>
9617
9618         * expression.cs (BetterFunction): Catch hideous bug which was
9619          preventing us from detecting ambiguous calls due to implicit casts i.e
9620         cs0121.
9621
9622 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
9623
9624         * support.cs (Pair): Remove un-needed method.  I figured why I was
9625         getting the error in cs-parser.jay, the variable in a foreach loop
9626         is readonly, and the compiler does not really treat this as a variable.
9627
9628         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
9629         instead of EQUALS in grammar.  
9630
9631         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
9632
9633         * expression.cs (Unary.DoResolve): Check whether the argument is
9634         managed or not.
9635
9636 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
9637
9638         * support.cs: Api for Pair to set a value.  Despite the fact that
9639         the variables are public the MS C# compiler refuses to compile
9640         code that accesses the field if the variable is part of a foreach
9641         statement. 
9642
9643         * statement.cs (Fixed): Begin implementation of the fixed
9644         statement.
9645
9646         (Block.AddVariable): Return the VariableInfo on success and null
9647         on failure instead of true/false. 
9648
9649         * cs-parser.jay (foreach): Catch errors on variables already
9650         defined (we were ignoring this value before) and properly unwind
9651         the block hierarchy
9652
9653         (fixed_statement): grammar for the fixed statement.
9654
9655 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
9656
9657         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
9658         pointer types to be incretemented.
9659
9660         (SizeOf): Implement.
9661
9662         * cs-parser.jay (pointer_member_access): Implement
9663         expr->IDENTIFIER production.
9664
9665         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
9666         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
9667         on safe contexts.
9668
9669         (Unary): Implement indirection.
9670
9671         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
9672         use in non-unsafe context).
9673
9674         (SimpleName.DoResolve): Check for pointers in field access on safe
9675         contexts. 
9676
9677         (Expression.LoadFromPtr): Factor the load-indirect code in this
9678         function.  This was duplicated in UnboxCast and ParameterReference
9679
9680 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
9681
9682         * expression.cs (ComposedCast): report an error if a pointer cast
9683         is used in a safe region.
9684
9685         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
9686         pointer type casts in unsafe context.
9687
9688         * codegen.cs (EmitContext): Set up IsUnsafe.
9689
9690         * cs-parser.jay (non_expression_type): Add productions for pointer
9691         casts. 
9692
9693         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
9694         code.  We should not use force into static mode if the method is
9695         not virtual.  Fixes bug in MIS
9696
9697         * statement.cs (Do.Emit, While.Emit, For.Emit,
9698         Statement.EmitBoolExpression): Add support to Do and While to
9699         propagate infinite loop as `I do return' semantics.
9700
9701         Improve the For case to also test for boolean constants.
9702
9703         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
9704         to the list of attributes we can add.
9705
9706         Remove `EmitContext' argument.
9707
9708         * class.cs (Method.Define): Apply parameter attributes.
9709         (Constructor.Define): Apply parameter attributes.
9710         (MethodCore.LabelParameters): Move here the core of labeling
9711         parameters. 
9712
9713         * support.cs (ReflectionParameters.ParameterModifier,
9714         InternalParameters.ParameterModifier): Use IsByRef on the type and
9715         only return the OUT bit for these parameters instead of in/out/ref
9716         flags.
9717
9718         This is because I miss-understood things.  The ParameterInfo.IsIn
9719         and IsOut represent whether the parameter has the [In] and [Out]
9720         attributes set.  
9721
9722 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
9723
9724         * ecore.cs (FieldExpr.Emit): Release temporaries.
9725
9726         * assign.cs (LocalTemporary.Release): new function.
9727
9728         * codegen.cs (EmitContext.GetTemporaryStorage,
9729         EmitContext.FreeTemporaryStorage): Rework the way we deal with
9730         temporary storage.  Now we can "put back" localbuilders when we
9731         are done with them
9732
9733 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
9734
9735         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
9736         need to make a copy of the variable to generate verifiable code.
9737
9738 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
9739
9740         * driver.cs: Compute dynamically the system directory.
9741
9742         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
9743         Slower, but more generally useful.  Used by the abstract
9744         registering implementation. 
9745
9746         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
9747         the rules for the special rule on Type/instances.  First check if
9748         we have the same name, and if so, try that special static path
9749         rather than the instance path.
9750         
9751 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
9752
9753         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
9754         for, while and if.
9755
9756         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
9757         Enum, ValueType, Delegate or Array for non-corlib compiles.
9758
9759         * cs-tokenizer.cs: Catch long identifiers (645)
9760
9761         * typemanager.cs (IndexerPropetyName): Ravi never tested this
9762         piece of code.
9763
9764         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
9765         fix, we were returning too early, so we were not registering
9766         pending methods from abstract classes.
9767
9768         Do not register pending methods if the class is abstract.
9769
9770         * expression.cs (Conditional.DoResolve): Report circular implicit
9771         conversions when we neecd to compute it for conditional
9772         expressions. 
9773
9774         (Is.DoResolve): If the expression is always of the provided type,
9775         flag warning 183.  If the expression can not ever be of the
9776         provided type flag warning 184.
9777
9778         * class.cs: Catch 169 as well.
9779
9780         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
9781         read. 
9782
9783 2002-01-18  Nick Drochak  <ndrochak@gol.com>
9784
9785         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
9786
9787 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
9788
9789         * interface.cs: (PopulateMethod): Check for pointers being defined
9790         only if the unsafe context is active.
9791         (PopulateProperty): ditto.
9792         (PopulateIndexer): ditto.
9793
9794         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
9795         specified.  If pointers are present, make sure that they are
9796         present in an unsafe context.
9797         (Constructor, Constructor.Define): ditto.
9798         (Field, Field.Define): ditto.
9799         (Property, Property.Define): ditto.
9800         (Event, Event.Define): ditto.
9801
9802         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
9803         hashtable if there are classes or structs defined.
9804
9805         * expression.cs (LocalVariableReference.DoResolve): Simplify this
9806         code, as the constant resolution moved.
9807
9808         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
9809         the metadata, so we can flag error 133. 
9810
9811         * decl.cs (MemberCore.UnsafeOK): New function to test that a
9812         pointer is being declared in an unsafe context.
9813
9814 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
9815
9816         * modifiers.cs (Modifiers.Check): Require a Location argument.
9817         Report error 227 for Unsafe use.
9818
9819         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
9820
9821         * statement.cs (For.Emit): If the test is null, then report that
9822         we do `return', as we wont reach anything afterwards.
9823
9824         (Switch.SwitchGoverningType): Track the expression that matched
9825         the conversion.
9826
9827         * driver.cs: Allow negative numbers as an error code to flag.
9828
9829         * cs-parser.jay: Handle 1551.
9830
9831         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
9832
9833 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
9834
9835         * cs-parser.jay: Report 1518 (type declaration can only contain
9836         class, struct, interface, enum or delegate)
9837
9838         (switch_label): Report 1523 (keywords `case' or `default' must
9839         preced code)
9840
9841         (opt_switch_sections): Report 1522 (empty switch)
9842
9843         * driver.cs: Report 1515 (response file specified multiple times)
9844         Report 1516 (Source file specified multiple times).
9845
9846         * expression.cs (Argument.Resolve): Signal 1510
9847
9848         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
9849         access not allowed in static code)
9850
9851 2002-01-11  Ravi Pratap  <ravi@ximian.com>
9852
9853         * typemanager.cs (IsPointerType): Utility method which we are going
9854         to need a lot.
9855
9856         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
9857         the object type, so we take care of that.
9858
9859         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
9860         
9861         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
9862         added to non-params parameters :-)
9863
9864         * typemanager.cs (CSharpName): Include 'void' type too. 
9865
9866         (void_ptr_type): Include in the set of core types.
9867
9868         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
9869         duplicating code.
9870
9871         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
9872         an unsafe context.
9873
9874         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
9875         completely forgotten about it.
9876
9877 2002-01-10  Ravi Pratap  <ravi@ximian.com>
9878
9879         * cs-parser.jay (pointer_type): Add. This begins our implementation
9880         of parsing rules for unsafe code.
9881
9882         (unsafe_statement): Implement.
9883
9884         (embedded_statement): Modify to include the above.
9885
9886         * statement.cs (Unsafe): Implement new class for unsafe blocks.
9887
9888         * codegen.cs (EmitContext.InUnsafe): Add. This determines
9889         if the current context is an unsafe one.
9890
9891         * cs-parser.jay (local_variable_pointer_type): Since local variable types
9892         are handled differently, we need separate rules for them.
9893
9894         (local_variable_declaration): Update to use local_variable_pointer_type
9895         to allow variable declarations of unmanaged pointer types.
9896
9897         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
9898         in unsafe contexts.
9899
9900         * ../errors/cs0214.cs : Add.
9901
9902 2002-01-16  Nick Drochak  <ndrochak@gol.com>
9903
9904         * makefile: remove 'response' file when cleaning.
9905
9906 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
9907
9908         * cs-parser.jay: Report 1524.
9909
9910 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
9911
9912         * typemanager.cs (RegisterMethod): drop checking if we have
9913         registered this from here
9914
9915 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
9916
9917         * class.cs (Method.EmitDestructor): Implement calling our base
9918         destructor. 
9919
9920         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
9921         value of InFinally.
9922
9923         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
9924         this routine and will wrap the call in a try/catch block.  Deal
9925         with the case.
9926
9927 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
9928
9929         * ecore.cs (Expression.MemberLookup): instead of taking a
9930         parameter `same_type' that was used to tell whether we could
9931         access private members we compute our containing type from the
9932         EmitContext.
9933
9934         (FieldExpr): Added partial support for volatile fields.  This does
9935         not work for volatile fields exposed from assemblies, as I can not
9936         figure out how to extract the modreq from it.
9937
9938         Updated all the source files to use this.
9939
9940         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
9941         because it is referenced by MemberLookup very often. 
9942
9943 2002-01-09  Ravi Pratap  <ravi@ximian.com>
9944
9945         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
9946         TypeBuilder.GetCustomAttributes to retrieve what we need.
9947
9948         Get rid of redundant default_member_attr_type as this is the same as
9949         default_member_type which already exists.
9950
9951         * interface.cs, attribute.cs : Update accordingly.
9952         
9953 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
9954
9955         * typemanager.cs: Enable IndexerPropertyName again.  It does not
9956         work for TYpeBuilders though.  Ravi, can you please fix this?
9957
9958         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
9959
9960         * expression.cs (Argument.Emit): Handle the case of ref objects
9961         being passed to ref functions;  
9962
9963         (ParameterReference.EmitLoad): Loads the content of the pointer
9964         without dereferencing.
9965
9966 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
9967
9968         * cs-tokenizer.cs: Implemented the pre-processing expressions.
9969
9970 2002-01-08  Ravi Pratap  <ravi@ximian.com>
9971
9972         * class.cs (Indexer.DefineMethod): Incorporate the interface
9973         type in the name of the method if we are doing explicit interface
9974         implementation.
9975
9976         * expression.cs (ConversionExists): Remove as it is completely obsolete.
9977
9978         (BetterConversion): Fix extremely trivial bug where we were referring to
9979         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
9980         again !
9981
9982         * ../errors/bug16.cs : Add although we have fixed it.
9983
9984 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
9985
9986         * expression.cs (BaseIndexer): Begin implementation.
9987
9988         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
9989
9990         * cs-parser.jay (indexer_declarator): Use qualified_identifier
9991         production directly to remove a shift/reduce, and implement
9992         explicit interface implementation.
9993
9994         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
9995         after a floating point suffix.
9996
9997         * expression.cs (DoNumericPromotions): Improved the conversion for
9998         uint/uint.  If we have a constant, we avoid doing a typecast to a
9999         larger type.
10000
10001         * class.cs (Indexer): Implement explicit interface implementation
10002         for indexers.
10003         
10004 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
10005
10006         * class.cs: make the default instance constructor public and hidebysig.
10007
10008 2001-01-03  Ravi Pratap  <ravi@ximian.com>
10009
10010         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
10011         so we can call it from elsewhere.
10012
10013         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
10014         we emit it internally if the class has a defined indexer; otherwise the user
10015         emits it by decorating the class definition with the DefaultMemberAttribute.
10016
10017         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
10018         attribute is not used on a type which defines an indexer.
10019
10020         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
10021         character when we skip whitespace.
10022
10023         * ../errors/cs0646.cs : Add.
10024
10025 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
10026
10027         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
10028         again. 
10029
10030         * makefile: Add practical target `mcs3.exe' which builds the third
10031         generation compiler. 
10032
10033         * expression.cs (New): Fix structures constructor calling.
10034
10035         * class.cs (Property, Method, Indexer): Emit Final flag on the
10036         method if we are an interface implementation and we are not
10037         abstract. 
10038
10039         * ecore.cs (PropertyExpr): New public field `IsBase', tells
10040         whether this property is referencing a `base' method.
10041
10042         * expression.cs (Invocation.EmitCall): take an extra argument:
10043         is_base, this is used to determine whether the `call' or
10044         `callvirt' opcode should be used.
10045
10046         
10047         * delegate.cs: update EmitCall.
10048
10049         * class.cs (Method.Define): Set NewSlot for the cases where we are
10050         not implementing an interface method.
10051
10052         (Property.Define): ditto.
10053
10054 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
10055
10056         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
10057         'r'.  Allows mcs to parse itself fully.
10058
10059 2002-01-02  Ravi Pratap  <ravi@ximian.com>
10060
10061         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
10062         of the number of initializers that require the InitializeArray method.
10063
10064         (CheckIndices): Store the Expression in all cases - not the plain value. Also
10065         update the above field where necessary.
10066
10067         (MakeByteBlob): Update accordingly.
10068
10069         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
10070         greater than 2.
10071
10072         (EmitDynamicInitializers): Update in accordance with the new optimization.
10073
10074         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
10075         same OpCode applies.
10076
10077         * cs-parser.jay : Fix some glaring errors I introduced.
10078
10079 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
10080
10081         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
10082         so that we can check for name clashes there too.
10083
10084         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
10085         for interface indexers.
10086
10087         * interfaces.cs (Define): Emit the default member attribute.
10088
10089         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
10090         variable was being referred to while setting the value ;-)
10091
10092 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
10093
10094         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
10095         byte-by-byte information when we know the data is zero.
10096
10097         Make the block always a multiple of 4, because
10098         DefineInitializedData has a bug.
10099
10100         * assign.cs: Fix, we should assign from the temporary, not from
10101         the source. 
10102
10103         * expression.cs (MakeByteBlob): Fix my incorrect code.
10104
10105 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
10106
10107         * typemanager.cs (EnumToUnderlying): This function is used to get
10108         the underlying type from an enumeration, because it does not
10109         always work. 
10110
10111         * constant.cs: Use the I4_S form for values between -128 and 127.
10112
10113         * statement.cs (Block.LookupLabel): Looks up a label.
10114         (Block): Drop support for labeled blocks.
10115
10116         (LabeledStatement): New kind of statement that represents a label
10117         only.
10118
10119         (Goto): Finally implement this bad boy.
10120         
10121         * cs-parser.jay: Update to reflect new mechanism to implement
10122         labels.
10123
10124 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
10125
10126         * codegen.cs (EmitContext.This): a codegen property that keeps the
10127         a single instance of this instead of creating many different this
10128         instances. 
10129
10130         * delegate.cs (Delegate.DoResolve): Update to use the property;
10131
10132         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
10133
10134         * expression.cs (BaseAccess.DoResolve): Ditto.
10135
10136 2001-12-29  Ravi Pratap  <ravi@ximian.com>
10137
10138         * typemanager.cs (methodimpl_attr_type): Add to hold the type
10139         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
10140
10141         (InitCoreTypes): Update accordingly.
10142
10143         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
10144         so we can quickly store the state.
10145
10146         (ApplyAttributes): Set the correct implementation flags
10147         for InternalCall methods.
10148
10149 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
10150
10151         * expression.cs (EmitCall): if a method is not virtual, then do
10152         not use callvirt on it.
10153
10154         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
10155         user defined stuff) requires the use of stobj, which takes an
10156         address on the stack instead of an array and an index.  So emit
10157         the Ldelema operation for it.
10158
10159         (EmitStoreOpcode): Use stobj for valuetypes.
10160
10161         (UnaryMutator.EmitCode): Use the right 1 value depending on
10162         whether we are dealing with int64/uint64, float or doubles.
10163
10164         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
10165         constructors that I implemented last night.
10166
10167         (Constructor.IsDefault): Fix to work properly for static
10168         constructors.
10169
10170         * cs-parser.jay (CheckDef): report method signature errors.
10171         Update error number 103 to be 132.
10172
10173         * decl.cs: New AdditionResult enumeration value: MethodExists.
10174         Although we do this check for methods later on in the semantic
10175         analysis, catching repeated default constructors is so easy that
10176         we catch these here. 
10177         
10178         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
10179         promotions code.
10180
10181         (ParameterReference.EmitAssign, Emit): handle
10182         bools as bytes.
10183
10184         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
10185         (ArrayAccess.EmitStoreOpcode): ditto.
10186
10187         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
10188
10189         * expression.cs (MakeByteBlob): Complete all the missing types
10190         (uint, short, ushort, byte, sbyte)
10191
10192         * class.cs: Only init instance field initializers on instance
10193         constructors. 
10194
10195         Rename `constructors' to instance_constructors. 
10196
10197         (TypeContainer.AddConstructor): Only add constructors to the list
10198         if it is not static.
10199
10200         Make sure that we handle default_static_constructor independently
10201         everywhere where we handle instance_constructors
10202
10203 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
10204
10205         * class.cs: Do not lookup or create a base initializer for a
10206         static constructor.
10207
10208         (ConstructorInitializer.Resolve): use the proper type to lookup
10209         for constructors.
10210
10211         * cs-parser.jay: Report error 1585 (modifiers between type and name).
10212
10213         * enum.cs, interface.cs: Remove CloseType, this is taken care by
10214         in DeclSpace. 
10215
10216         * decl.cs: CloseType is now an virtual method, the default
10217         implementation just closes this type.
10218         
10219 2001-12-28  Ravi Pratap  <ravi@ximian.com>
10220
10221         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
10222         to PreserveSig by default. Also emit HideBySig on such methods.
10223
10224         Basically, set the defaults to standard values.
10225
10226         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
10227         argument, if candidate is better, it can't be worse than the best !
10228
10229         (Invocation): Re-write bits to differentiate between methods being
10230         applicable in their expanded form and their normal form - for params
10231         methods of course.
10232
10233         Get rid of use_standard everywhere as only standard conversions are allowed
10234         in overload resolution. 
10235
10236         More spec conformance.
10237         
10238 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
10239
10240         * driver.cs: Add --timestamp, to see where the compiler spends
10241         most of its time.
10242
10243         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
10244         `this' in static code.
10245
10246         (SimpleName.DoResolve): Implement in terms of a helper function
10247         that allows static-references to be passed upstream to
10248         MemberAccess.
10249
10250         (Expression.ResolveWithSimpleName): Resolve specially simple
10251         names when called by MemberAccess to implement the special
10252         semantics. 
10253
10254         (Expression.ImplicitReferenceConversion): Handle conversions from
10255         Null to reference types before others, as Null's type is
10256         System.Object. 
10257
10258         * expression.cs (Invocation.EmitCall): Handle the special case of
10259         calling methods declared on a reference type from a ValueType
10260         (Base classes System.Object and System.Enum)
10261
10262         (MemberAccess.Resolve): Only perform lookups on Enumerations if
10263         the left hand side is a TypeExpr, not on every enumeration. 
10264
10265         (Binary.Resolve): If types are reference types, then do a cast to
10266         object on operators != and == of both arguments.
10267         
10268         * typemanager.cs (FindMembers): Extract instance and static
10269         members if requested.
10270
10271         * interface.cs (PopulateProperty): Use void_type instead of null
10272         as the return type for the setter method.
10273
10274         (PopulateIndexer): ditto.
10275
10276 2001-12-27  Ravi Pratap  <ravi@ximian.com>
10277
10278         * support.cs (ReflectionParameters): Fix minor bug where we
10279         were examining the wrong parameter for the ParamArray attribute.
10280
10281         Cope with requests for the type of the parameter at position
10282         greater than the params parameter's. We now return the element
10283         type of the params array as that makes more sense.
10284
10285         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
10286         accordingly as we no longer have to extract the element type
10287         ourselves.
10288
10289         (Invocation.OverloadResolve): Update.
10290
10291 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
10292
10293         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
10294         against IEnumerator, test whether the return value is a descendant
10295         of the IEnumerator interface.
10296
10297         * class.cs (Indexer.Define): Use an auxiliary method to implement
10298         the other bits of the method definition.  Begin support for
10299         explicit interface implementation.
10300
10301         (Property.DefineMethod): Use TypeManager.void_type instead of null
10302         for an empty return value.
10303
10304 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
10305
10306         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
10307         dealing with a FieldExpr which is composed of a FieldBuilder, in
10308         the code path we did extract the constant, but we should have
10309         obtained the underlying value to be able to cast it (otherwise we
10310         end up in an infinite loop, this is what Ravi was running into).
10311
10312         (ArrayCreation.UpdateIndices): Arrays might be empty.
10313
10314         (MemberAccess.ResolveMemberAccess): Add support for section
10315         14.5.4.1 that deals with the special case of E.I when E is a type
10316         and something else, that I can be a reference to a static member.
10317
10318         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
10319         handle a particular array type to create byte blobs, it is just
10320         something we dont generate byteblobs for.
10321
10322         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
10323         arguments. 
10324
10325         * location.cs (Push): remove the key from the hashtable that we
10326         are about to add.   This happens for empty files.
10327
10328         * driver.cs: Dispose files after we have parsed them.
10329
10330         (tokenize): new function that only runs the tokenizer on its
10331         input, for speed testing.
10332
10333 2001-12-26  Ravi Pratap  <ravi@ximian.com>
10334
10335         * class.cs (Event.Define): Define the private field only if there
10336         are no accessors defined.
10337
10338         * expression.cs (ResolveMemberAccess): If there is no associated
10339         field with the event, that means we have an event defined with its
10340         own accessors and we should flag error cs0070 since transforming
10341         ourselves into a field is not valid in that case.
10342
10343         * ecore.cs (SimpleName.DoResolve): Same as above.
10344
10345         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
10346         and charset to sane values.
10347
10348 2001-12-25  Ravi Pratap  <ravi@ximian.com>
10349
10350         * assign.cs (DoResolve): Perform check on events only if they 
10351         are being accessed outside the declaring type.
10352
10353         * cs-parser.jay (event_declarations): Update rules to correctly
10354         set the type of the implicit parameter etc.
10355
10356         (add_accessor, remove_accessor): Set current local parameters.
10357
10358         * expression.cs (Binary): For delegate addition and subtraction,
10359         cast the return value from the method into the appropriate delegate
10360         type.
10361
10362 2001-12-24  Ravi Pratap  <ravi@ximian.com>
10363
10364         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
10365         of these as the workaround is unnecessary.
10366
10367         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
10368         delegate data - none of that is needed at all.
10369
10370         Re-write bits to extract the instance expression and the delegate method
10371         correctly.
10372
10373         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
10374         on delegates too.
10375
10376         * attribute.cs (ApplyAttributes): New method to take care of common tasks
10377         of attaching attributes instead of duplicating code everywhere.
10378
10379         * everywhere : Update code to do attribute emission using the above method.
10380
10381 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
10382
10383         * expression.cs (IsParamsMethodApplicable): if there are not
10384         parameters, return immediately.
10385
10386         * ecore.cs: The 0 literal can be implicity converted to an enum
10387         type. 
10388
10389         (SimpleName.DoResolve): First lookup the type, then lookup the
10390         members. 
10391
10392         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
10393         want to get its address.  If the InstanceExpression is not
10394         addressable, store the result in a temporary variable, then get
10395         the address of it.
10396
10397         * codegen.cs: Only display 219 errors on warning level or above. 
10398
10399         * expression.cs (ArrayAccess): Make it implement the
10400         IMemoryLocation interface.
10401
10402         (Binary.DoResolve): handle the operator == (object a, object b)
10403         and operator != (object a, object b) without incurring into a
10404         BoxedCast (because 5 != o should never be performed).
10405
10406         Handle binary enumerator operators.
10407
10408         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
10409         value type, otherwise use Ldelem_ref.
10410
10411         Use precomputed names;
10412
10413         (AddressOf): Implement address of
10414
10415         * cs-parser.jay (labeled_statement): Fix recursive block
10416         addition by reworking the production.
10417
10418         * expression.cs (New.DoEmit): New has a special case:
10419                 
10420                  If we are dealing with a ValueType, we have a few
10421                  situations to deal with:
10422                 
10423                     * The target of New is a ValueType variable, that is
10424                       easy, we just pass this as the variable reference
10425                 
10426                     * The target of New is being passed as an argument,
10427                       to a boxing operation or a function that takes a
10428                       ValueType.
10429                 
10430                       In this case, we need to create a temporary variable
10431                       that is the argument of New.
10432
10433
10434 2001-12-23  Ravi Pratap  <ravi@ximian.com>
10435
10436         * rootcontext.cs (LookupType): Check that current_type is not null before
10437         going about looking at nested types.
10438
10439         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
10440         not implement the IAssignMethod interface any more.
10441
10442         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
10443         where we tranform them into FieldExprs if they are being resolved from within
10444         the declaring type.
10445
10446         * ecore.cs (SimpleName.DoResolve): Do the same here.
10447
10448         * assign.cs (DoResolve, Emit): Clean up code considerably. 
10449
10450         * ../errors/bug10.cs : Add.
10451
10452         * ../errors/cs0070.cs : Add.
10453
10454         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
10455
10456         * assign.cs : Get rid of EventIsLocal everywhere.
10457         
10458 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
10459
10460         * ecore.cs (ConvertIntLiteral): finished the implementation.
10461
10462         * statement.cs (SwitchLabel): Convert the value we are using as a
10463         key before looking up the table.
10464
10465 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
10466
10467         * codegen.cs (EmitTopBlock): Require a Location argument now.
10468
10469         * cs-parser.jay (constructor_declarator): We need to setup
10470         current_local_parameters before we parse the
10471         opt_constructor_initializer, to allow the variables to be bound
10472         to the constructor arguments.
10473
10474         * rootcontext.cs (LookupType): First lookup nested classes in our
10475         class and our parents before we go looking outside our class.
10476
10477         * expression.cs (ConstantFold): Extract/debox the values at the
10478         beginnning. 
10479
10480         * rootcontext.cs (EmitCode): Resolve the constants first before we
10481         resolve the types.  This is not really needed, but it helps debugging.
10482
10483         * statement.cs: report location.
10484         
10485         * cs-parser.jay: pass location to throw statement.
10486
10487         * driver.cs: Small bug fix.
10488
10489         * report.cs: Updated format to be 4-zero filled digits.
10490
10491 2001-12-22  Ravi Pratap  <ravi@ximian.com>
10492
10493         * expression.cs (CheckIndices): Fix minor bug where the wrong
10494         variable was being referred to ;-)
10495
10496         (DoEmit): Do not call EmitStaticInitializers when the 
10497         underlying type is System.Object.
10498
10499 2001-12-21  Ravi Pratap  <ravi@ximian.com>
10500
10501         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
10502         and do the usual workaround for SRE.
10503
10504         * class.cs (MyEventBuilder.EventType): New member to get at the type
10505         of the event, quickly.
10506
10507         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
10508
10509         * assign.cs (Assign.DoResolve): Handle the case when the target
10510         is an EventExpr and perform the necessary checks.
10511
10512         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
10513         interface.
10514
10515         (SimpleName.MemberStaticCheck): Include check for EventExpr.
10516
10517         (EventExpr): Set the type in the constructor itself since we 
10518         are meant to be born fully resolved.
10519
10520         (EventExpr.Define): Revert code I wrote earlier.
10521                 
10522         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
10523         instance expression is null. The instance expression is a This in that case
10524         or a null, depending on whether it is a static method or not.
10525
10526         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
10527         refers to more than one method.
10528
10529         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
10530         and accordingly flag errors.
10531
10532 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
10533
10534         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
10535
10536 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
10537
10538         * location.cs (ToString): Provide useful rutine.
10539
10540 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
10541
10542         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
10543         objects, return the actual integral boxed.
10544
10545         * statement.cs (SwitchLabel): define an ILLabel for each
10546         SwitchLabel. 
10547         
10548         (Switch.CheckSwitch): If the value is a Literal, extract
10549         the underlying literal.
10550         
10551         Also in the unused hashtable we had, add the SwitchLabel so we can
10552         quickly look this value up.
10553
10554         * constant.cs: Implement a bunch of new constants.  Rewrite
10555         Literal based on this.  Made changes everywhere to adapt to this.
10556         
10557         * expression.cs (Expression.MakeByteBlob): Optimize routine by
10558         dereferencing array only once, and also copes with enumrations.
10559
10560         bytes are two bytes wide, not one.
10561
10562         (Cast): Perform constant conversions.
10563         
10564         * ecore.cs (TryImplicitIntConversion): Return literals instead of
10565         wrappers to the literals here.
10566
10567         * expression.cs (DoNumericPromotions): long literals can converted
10568         to ulong implicity (this is taken care of elsewhere, but I was
10569         missing this spot).
10570
10571         * ecore.cs (Expression.Literalize): Make the return type Literal,
10572         to improve type checking.
10573
10574         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
10575
10576 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
10577
10578         * literal.cs: Revert code from ravi that checked the bounds.  The
10579         bounds are sane by the definition of the type itself. 
10580
10581         * typemanager.cs: Fix implementation of ImplementsInterface.  We
10582         need to actually look up in our parent hierarchy for interfaces
10583         implemented. 
10584
10585         * const.cs: Use the underlying type for enumerations
10586
10587         * delegate.cs: Compute the basename for the delegate creation,
10588         that should fix the delegate test case, and restore the correct
10589         Type Lookup semantics in rootcontext
10590
10591         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
10592         referencing a nested type with the Reflection API is using the "+"
10593         sign. 
10594
10595         * cs-parser.jay: Do not require EOF token at the end.
10596
10597 2001-12-20  Ravi Pratap  <ravi@ximian.com>
10598
10599         * rootcontext.cs (LookupType): Concatenate type names with
10600         a '.' instead of a '+' The test suite passes again.
10601
10602         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
10603         field of the enumeration.
10604
10605         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
10606         the case when the member is an EventExpr.
10607
10608         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
10609         static has an associated instance expression.
10610
10611         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
10612
10613         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
10614
10615         * class.cs (Event.Define): Register event and perform appropriate checks
10616         for error #111.
10617
10618         We define the Add and Remove methods even if the use provides none because
10619         in that case, we provide default implementations ourselves.
10620
10621         Define a private field of the type of the event. This is done by the CSC compiler
10622         and we should be doing it too ;-)
10623
10624         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
10625         More methods we use in code we generate.
10626
10627         (multicast_delegate_type, delegate_type): Two separate types since the distinction
10628         is important.
10629
10630         (InitCoreTypes): Update accordingly for the above.
10631
10632         * class.cs (Event.Emit): Generate code for default accessors that we provide
10633
10634         (EmitDefaultMethod): Do the job in the above.
10635
10636         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
10637         appropriate place.
10638
10639 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
10640
10641         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
10642         builders even if we were missing one.
10643
10644         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
10645         pass the Basename as our class name instead of the Name.  The
10646         basename will be correctly composed for us.
10647
10648         * parameter.cs (Paramters): Now takes a Location argument.
10649
10650         * decl.cs (DeclSpace.LookupType): Removed convenience function and
10651         make all the code call directly LookupType in RootContext and take
10652         this chance to pass the Location information everywhere.
10653
10654         * Everywhere: pass Location information.
10655
10656 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
10657
10658         * class.cs (Constructor.Define): Updated way of detecting the
10659         length of the parameters.
10660
10661         (TypeContainer.DefineType): Use basename as the type name for
10662         nested types.
10663
10664         (TypeContainer.Define): Do not recursively define types here, as
10665         definition is taken care in order by the RootContext.
10666
10667         * tree.cs: Keep track of namespaces in a per-file basis.
10668
10669         * parameter.cs (Parameter.ComputeSignature): Update to use
10670         DeclSpace. 
10671
10672         (Parameters.GetSignature): ditto.
10673
10674         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
10675         instead of a TypeContainer.
10676
10677         (Interface.SemanticAnalysis): Use `this' instead of our parent to
10678         resolve names.  Because we need to be resolve in our context, not
10679         our parents.
10680         
10681         * driver.cs: Implement response files.
10682
10683         * class.cs (TypeContainer.DefineType): If we are defined, do not
10684         redefine ourselves.
10685         
10686         (Event.Emit): Emit the code for add/remove handlers.
10687         (Event.Define): Save the MethodBuilders for add/remove.
10688
10689         * typemanager.cs: Use pair here too.
10690
10691         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
10692         DictionaryEntry requires the first argument to be non-null.  
10693         
10694         (enum_declaration): Compute full name for registering the
10695         enumeration.
10696         
10697         (delegate_declaration): Instead of using
10698         formal_parameter_list, use opt_formal_parameter_list as the list
10699         can be empty.
10700
10701         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
10702         (EventParsing): New property that controls whether `add' and
10703         `remove' are returned as tokens or identifiers (for events);
10704
10705 2001-12-19  Ravi Pratap  <ravi@ximian.com>
10706
10707         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
10708         use MyEventBuilder only and let it wrap the real builder for us.
10709
10710         (MyEventBuilder): Revamp constructor etc.
10711
10712         Implement all operations that we perform on EventBuilder in precisely the same
10713         way here too.
10714
10715         (FindMembers): Update to use the EventBuilder member.
10716
10717         (Event.Emit): Update accordingly.
10718
10719 2001-12-18  Ravi Pratap  <ravi@ximian.com>
10720
10721         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
10722         by calling the appropriate methods.
10723
10724         (GetCustomAttributes): Make stubs as they cannot possibly do anything
10725         useful.
10726
10727         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
10728
10729 2001-12-17  Ravi Pratap  <ravi@ximian.com>
10730
10731         * delegate.cs (Delegate.Populate): Check that the return type
10732         and various parameters types are indeed accessible.
10733
10734         * class.cs (Constructor.Define): Same here.
10735
10736         (Field.Define): Ditto.
10737
10738         (Event.Define): Ditto.
10739
10740         (Operator.Define): Check that the underlying Method defined itself
10741         correctly - so it's MethodBuilder should not be null.
10742
10743         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
10744         expression happens to be null.
10745
10746         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
10747         members but as of now we don't seem to be able to do anything really useful with it.
10748
10749         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
10750         not the EventBuilder.
10751
10752 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
10753
10754         * cs-tokenizer.cs: Add support for defines.
10755         Add support for #if, #elif, #else, #endif
10756         
10757         (eval_var): evaluates a variable.
10758         (eval): stubbed for evaluating functions.
10759
10760         * cs-parser.jay: Pass the defines information
10761
10762         * driver.cs: Add --define command line option.
10763
10764         * decl.cs: Move MemberCore here.
10765
10766         Make it the base class for DeclSpace.  This allows us to catch and
10767         report 108 and 109 for everything now.
10768
10769         * class.cs (TypeContainer.Define): Extract all the members
10770         before populating and emit the warning 108 (new keyword required
10771         to override) instead of having each member implement this.
10772
10773         (MemberCore.Define): New abstract method, we will be using this in
10774         the warning reporting engine in Populate.
10775         
10776         (Operator.Define): Adjust to new MemberCore protocol. 
10777
10778         * const.cs (Const): This does not derive from Expression, it is a
10779         temporary object we use to create fields, it is a MemberCore. 
10780
10781         * class.cs (Method.Define): Allow the entry point to be in a
10782         specific class.
10783
10784         * driver.cs: Rewrite the argument handler to clean it up a bit.
10785
10786         * rootcontext.cs: Made it just an auxiliary namespace feature by
10787         making everything static.
10788
10789         * driver.cs: Adapt code to use RootContext type name instead of
10790         instance variable.
10791
10792         * delegate.cs: Remove RootContext argument.
10793
10794         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
10795         argument. 
10796
10797         * class.cs (Event.Define): The lookup can fail.
10798         
10799         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
10800
10801         * expression.cs: Resolve the this instance before invoking the code.
10802
10803 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
10804
10805         * cs-parser.jay: Add a production in element_access that allows
10806         the thing to become a "type" reference.  This way we can parse
10807         things like "(string [])" as a type.
10808
10809         Note that this still does not handle the more complex rules of
10810         casts. 
10811         
10812
10813         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
10814
10815         * ecore.cs: (CopyNewMethods): new utility function used to
10816         assemble the list of methods from running FindMembers.
10817
10818         (MemberLookup): Rework FindMembers so that 
10819
10820 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
10821
10822         * class.cs (TypeContainer): Remove Delegates who fail to be
10823         defined.
10824
10825         * delegate.cs (Populate): Verify that we dont get null return
10826         values.   TODO: Check for AsAccessible.
10827
10828         * cs-parser.jay: Use basename to emit error 574 (destructor should
10829         have the same name as container class), not the full name.
10830
10831         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
10832         possible representation.  
10833
10834         Also implements integer type suffixes U and L.
10835
10836 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
10837
10838         * expression.cs (ArrayCreation.DoResolve): We need to do the
10839         argument resolution *always*.
10840
10841         * decl.cs: Make this hold the namespace.  Hold the root context as
10842         well.
10843         (LookupType): Move here.
10844
10845         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
10846
10847         * location.cs (Row, Name): Fixed the code, it was always returning
10848         references to the first file.
10849
10850         * interface.cs: Register properties defined through interfaces.
10851
10852         * driver.cs: Add support for globbing on the command line
10853
10854         * class.cs (Field): Make it derive from MemberCore as well.
10855         (Event): ditto.
10856
10857 2001-12-15  Ravi Pratap  <ravi@ximian.com>
10858
10859         * class.cs (Event::Define): Check that the type of the event is a delegate
10860         type else flag error #66.
10861
10862         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
10863         same.
10864
10865         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
10866         values of EntryPoint, CharSet etc etc.
10867
10868         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
10869
10870         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
10871         be null and we should ignore this. I am not sure if this is really clean. Apparently,
10872         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
10873         which needs this to do its work.
10874
10875         * ../errors/cs0066.cs : Add.
10876
10877 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
10878
10879         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
10880         helper functions.
10881
10882         * class.cs: (MethodSignature.MethodSignature): Removed hack that
10883         clears out the parameters field.
10884         (MemberSignatureCompare): Cleanup
10885
10886         (MemberCore): New base class used to share code between MethodCore
10887         and Property.
10888
10889         (RegisterRequiredImplementations) BindingFlags.Public requires
10890         either BindingFlags.Instace or Static.  Use instance here.
10891
10892         (Property): Refactored code to cope better with the full spec.
10893
10894         * parameter.cs (GetParameterInfo): Return an empty array instead
10895         of null on error.
10896
10897         * class.cs (Property): Abstract or extern properties have no bodies.
10898
10899         * parameter.cs (GetParameterInfo): return a zero-sized array.
10900
10901         * class.cs (TypeContainer.MethodModifiersValid): Move all the
10902         method modifier validation to the typecontainer so we can reuse
10903         this on properties.
10904
10905         (MethodCore.ParameterTypes): return an empty sized array of types.
10906
10907         (Property.Define): Test property modifier validity.
10908
10909         Add tests for sealed/override too.
10910
10911         (Method.Emit): abstract or extern methods have no bodies.
10912
10913 2001-12-14  Ravi Pratap  <ravi@ximian.com>
10914
10915         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
10916         thing.
10917
10918         (Method::Define, ::Emit): Modify accordingly.
10919
10920         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
10921
10922         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
10923
10924         * makefile: Pass in /unsafe.
10925
10926 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
10927
10928         * class.cs (MakeKey): Kill routine.
10929         
10930         * class.cs (TypeContainer.Define): Correctly define explicit
10931         method implementations (they require the full interface name plus
10932         the method name).
10933
10934         * typemanager.cs: Deply the PtrHashtable here and stop using the
10935         lame keys.  Things work so much better.
10936
10937         This of course broke everyone who depended on `RegisterMethod' to
10938         do the `test for existance' test.  This has to be done elsewhere.
10939
10940         * support.cs (PtrHashtable): A hashtable that avoid comparing with
10941         the object stupid Equals method (because, that like fails all over
10942         the place).  We still do not use it.
10943
10944         * class.cs (TypeContainer.SetRequiredInterface,
10945         TypeContainer.RequireMethods): Killed these two routines and moved
10946         all the functionality to RegisterRequiredImplementations.
10947
10948         (TypeContainer.RegisterRequiredImplementations): This routine now
10949         registers all the implementations required in an array for the
10950         interfaces and abstract methods.  We use an array of structures
10951         which can be computed ahead of time to reduce memory usage and we
10952         also assume that lookups are cheap as most classes will not
10953         implement too many interfaces.
10954
10955         We also avoid creating too many MethodSignatures.
10956
10957         (TypeContainer.IsInterfaceMethod): Update and optionally does not
10958         clear the "pending" bit if we find that there are problems with
10959         the declaration.
10960
10961         (TypeContainer.VerifyPendingMethods): Update to report errors of
10962         methods that look like implementations but are not.
10963
10964         (TypeContainer.Define): Add support for explicit interface method
10965         implementation. 
10966         
10967 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
10968
10969         * typemanager.cs: Keep track of the parameters here instead of
10970         being a feature of the TypeContainer.
10971
10972         * class.cs: Drop the registration of parameters here, as
10973         InterfaceMethods are also interface declarations.
10974
10975         * delegate.cs: Register methods with the TypeManager not only with
10976         the TypeContainer.  This code was buggy.
10977
10978         * interface.cs: Full registation here.
10979
10980 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
10981
10982         * expression.cs: Remove reducer for binary expressions, it can not
10983         be done this way.
10984
10985         * const.cs: Put here the code that used to go into constant.cs
10986
10987         * constant.cs: Put here the code for constants, this is a new base
10988         class for Literals.
10989
10990         * literal.cs: Make Literal derive from Constant.
10991
10992 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
10993
10994         * statement.cs (Return.Emit): Report error 157 if the user
10995         attempts to return from a finally block.
10996
10997         (Return.Emit): Instead of emitting a return, jump to the end of
10998         the function.
10999
11000         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
11001         LocalBuilder to store the result of the function.  ReturnLabel is
11002         the target where we jump.
11003         
11004
11005 2001-12-09  Radek Doulik  <rodo@ximian.com>
11006
11007         * cs-parser.jay: remember alias in current namespace
11008
11009         * ecore.cs (SimpleName::DoResolve): use aliases for types or
11010         namespaces
11011
11012         * class.cs (LookupAlias): lookup alias in my_namespace
11013
11014         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
11015         aliases hashtable
11016         (LookupAlias): lookup alias in this and if needed in parent
11017         namespaces
11018
11019 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
11020
11021         * support.cs: 
11022
11023         * rootcontext.cs: (ModuleBuilder) Made static, first step into
11024         making things static.  I need this to avoid passing the
11025         TypeContainer when calling ParameterType.
11026
11027         * support.cs (InternalParameters.ParameterType): Remove ugly hack
11028         that did string manipulation to compute the type and then call
11029         GetType.  Use Parameter.ParameterType instead.
11030
11031         * cs-tokenizer.cs: Consume the suffix for floating values.
11032
11033         * expression.cs (ParameterReference): figure out whether this is a
11034         reference parameter or not.  Kill an extra variable by computing
11035         the arg_idx during emission.
11036
11037         * parameter.cs (Parameters.GetParameterInfo): New overloaded
11038         function that returns whether a parameter is an out/ref value or not.
11039
11040         (Parameter.ParameterType): The type of the parameter (base,
11041         without ref/out applied).
11042         
11043         (Parameter.Resolve): Perform resolution here.
11044         (Parameter.ExternalType): The full type (with ref/out applied).
11045
11046         * statement.cs (Using.Emit, Using.EmitExpression): Implement
11047         support for expressions on the using statement.
11048
11049 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
11050
11051         * statement.cs (Using.EmitLocalVariableDecls): Split the
11052         localvariable handling of the using statement.
11053
11054         (Block.EmitMeta): Keep track of variable count across blocks.  We
11055         were reusing slots on separate branches of blocks.
11056
11057         (Try.Emit): Emit the general code block, we were not emitting it. 
11058
11059         Check the type of the declaration to be an IDisposable or
11060         something that can be implicity converted to it. 
11061
11062         Emit conversions if required.
11063
11064         * ecore.cs (EmptyExpression): New utility class.
11065         (Expression.ImplicitConversionExists): New utility function.
11066
11067 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
11068
11069         * statement.cs (Using): Implement.
11070
11071         * expression.cs (LocalVariableReference): Support read only variables.
11072
11073         * statement.cs: Remove the explicit emit for the Leave opcode.
11074         (VariableInfo): Add a readonly field.
11075
11076 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
11077
11078         * ecore.cs (ConvCast): new class used to encapsulate the various
11079         explicit integer conversions that works in both checked and
11080         unchecked contexts.
11081
11082         (Expression.ConvertNumericExplicit): Use new ConvCast class to
11083         properly generate the overflow opcodes.
11084
11085 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
11086
11087         * statement.cs: The correct type for the EmptyExpression is the
11088         element_type, not the variable type.  Ravi pointed this out.
11089
11090 2001-12-04  Ravi Pratap  <ravi@ximian.com>
11091
11092         * class.cs (Method::Define): Handle PInvoke methods specially
11093         by using DefinePInvokeMethod instead of the usual one.
11094
11095         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
11096         above to do the task of extracting information and defining the method.
11097         
11098 2001-12-04  Ravi Pratap  <ravi@ximian.com>
11099
11100         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
11101         of the condition for string type.
11102
11103         (Emit): Move that here. 
11104
11105         (ArrayCreation::CheckIndices): Keep string literals in their expression
11106         form.
11107
11108         (EmitDynamicInitializers): Handle strings appropriately.
11109
11110 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
11111
11112         * codegen.cs (EmitContext): Replace multiple variables with a
11113         single pointer to the current Switch statement.
11114
11115         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
11116         EmitContext.
11117
11118 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
11119
11120         * statement.cs 
11121
11122         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
11123         default'.
11124         
11125         (Foreach.Emit): Foreach on arrays was not setting
11126         up the loop variables (for break/continue).
11127
11128         (GotoCase): Semi-implented.
11129         
11130 2001-12-03  Ravi Pratap  <ravi@ximian.com>
11131
11132         * attribute.cs (CheckAttribute): Handle system attributes by using
11133         Attribute.GetAttributes to examine information we need.
11134
11135         (GetValidPlaces): Same here.
11136
11137         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
11138
11139         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
11140
11141         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
11142
11143         (Method::Define): Set appropriate flags if we have a DllImport attribute.
11144
11145         (Method::Emit): Handle the case when we are a PInvoke method.
11146
11147 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
11148
11149         * expression.cs: Use ResolveWithSimpleName on compound names.
11150
11151 2001-12-02  Ravi Pratap  <ravi@ximian.com>
11152
11153         * constant.cs (EmitConstant): Make sure we resolve the associated expression
11154         before trying to reduce it.
11155
11156         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
11157
11158         * constant.cs (LookupConstantValue): Implement.
11159
11160         (EmitConstant): Use the above in emitting the constant.
11161
11162         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
11163         that are user-defined by doing a LookupConstantValue on them.
11164
11165         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
11166         too, like above.
11167
11168 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
11169
11170         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
11171
11172         (BaseAccess.DoResolve): Implement.
11173
11174         (MemberAccess.DoResolve): Split this routine into a
11175         ResolveMemberAccess routine that can be used independently
11176
11177 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
11178
11179         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
11180         As that share bits of the implementation.  Is returns a boolean,
11181         while As returns the Type that is being probed.
11182
11183 2001-12-01  Ravi Pratap  <ravi@ximian.com>
11184
11185         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
11186         instead of a Literal - much easier.
11187
11188         (EnumInTransit): Remove - utterly useless :-)
11189
11190         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
11191
11192         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
11193
11194         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
11195         chain when we have no associated expression.
11196
11197 2001-11-30  Ravi Pratap  <ravi@ximian.com>
11198
11199         * constant.cs (Define): Use Location while reporting the errror.
11200
11201         Also emit a warning when 'new' is used and there is no inherited
11202         member to hide.
11203
11204         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
11205         populated.
11206
11207         (LookupEnumValue): Implement to lookup an enum member's value and define it
11208         if necessary.
11209
11210         (Populate): Re-write accordingly to use the above routine.
11211
11212 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
11213
11214         * expression.cs (This): Fix prototype for DoResolveLValue to
11215         override the base class DoResolveLValue.
11216
11217         * cs-parser.cs: Report errors cs574 and cs575 (destructor
11218         declarations) 
11219
11220         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
11221         (we need to load the address of the field here).  This fixes
11222         test-22. 
11223         
11224         (FieldExpr.DoResolveLValue): Call the DoResolve
11225         function to initialize the Instance expression.
11226         
11227         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
11228         correctly the GetEnumerator operation on a value type.
11229
11230         * cs-parser.jay: Add more simple parsing error catches.
11231
11232         * statement.cs (Switch): Add support for string switches.
11233         Handle null specially.
11234
11235         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
11236
11237 2001-11-28  Ravi Pratap  <ravi@ximian.com>
11238
11239         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
11240
11241         (declare_local_constant): New helper function.
11242
11243         * statement.cs (AddConstant): Keep a separate record of constants
11244
11245         (IsConstant): Implement to determine if a variable is a constant.
11246
11247         (GetConstantExpression): Implement.
11248
11249         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
11250
11251         * statement.cs (IsVariableDefined): Re-write.
11252
11253 2001-11-27  Ravi Pratap  <ravi@ximian.com>
11254
11255         * class.cs (TypeContainer::FindMembers): Look for constants
11256         in the case when we are looking for MemberTypes.Field
11257
11258         * expression.cs (MemberAccess::DoResolve): Check that in the
11259         case we are a FieldExpr and a Literal, we are not being accessed
11260         by an instance reference.
11261
11262         * cs-parser.jay (local_constant_declaration): Implement.
11263
11264         (declaration_statement): Implement for constant declarations.
11265
11266 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
11267
11268         * statement.cs (Switch): Catch double defaults.
11269
11270         (Switch): More work on the switch() statement
11271         implementation.  It works for integral values now, need to finish
11272         string support.
11273
11274
11275 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
11276
11277         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
11278         integer literals into other integer literals.  To be used by
11279         switch. 
11280
11281 2001-11-24  Ravi Pratap  <ravi@ximian.com>
11282
11283         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
11284         some memory.
11285
11286         (EmitDynamicInitializers): Cope with the above since we extract data
11287         directly from ArrayData now.
11288
11289         (ExpectInitializers): Keep track of whether initializers are mandatory
11290         or not.
11291
11292         (Bounds): Make it a hashtable to prevent the same dimension being 
11293         recorded for every element in that dimension.
11294
11295         (EmitDynamicInitializers): Fix bug which prevented the Set array method
11296         from being found.
11297
11298         Also fix bug which was causing the indices to be emitted in the reverse
11299         order.
11300
11301 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
11302
11303         * expression.cs (ArrayCreation): Implement the bits that Ravi left
11304         unfinished.  They do not work, because the underlying code is
11305         sloppy.
11306
11307 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11308
11309         * cs-parser.jay: Remove bogus fixme.
11310
11311         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
11312         on Switch statement.
11313         
11314 2001-11-23  Ravi Pratap  <ravi@ximian.com>
11315
11316         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
11317         the same. 
11318         
11319         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
11320         parameter. Apparently, any expression is allowed. 
11321
11322         (ValidateInitializers): Update accordingly.
11323
11324         (CheckIndices): Fix some tricky bugs thanks to recursion.
11325
11326         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
11327         I was being completely brain-dead.
11328
11329         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
11330         and re-write acordingly.
11331
11332         (DelegateInvocation): Re-write accordingly.
11333
11334         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
11335
11336         (MakeByteBlob): Handle types more correctly.
11337
11338         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
11339         initialization from expressions but it is incomplete because I am a complete
11340         Dodo :-|
11341
11342 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11343
11344         * statement.cs (If.Emit): Fix a bug that generated incorrect code
11345         on If.  Basically, we have to return `true' (ie, we do return to
11346         our caller) only if both branches of the if return.
11347
11348         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
11349         short-circuit operators, handle them as short circuit operators. 
11350
11351         (Cast.DoResolve): Resolve type.
11352         (Cast.Cast): Take an expression as the target type.
11353
11354         * cs-parser.jay (cast_expression): Remove old hack that only
11355         allowed a limited set of types to be handled.  Now we take a
11356         unary_expression and we resolve to a type during semantic
11357         analysis.
11358
11359         Use the grammar productions from Rhys to handle casts (this is
11360         not complete like Rhys syntax yet, we fail to handle that corner
11361         case that C# has regarding (-x), but we will get there.
11362         
11363 2001-11-22  Ravi Pratap  <ravi@ximian.com>
11364
11365         * class.cs (EmitFieldInitializer): Take care of the case when we have a
11366         field which is an array type.
11367
11368         * cs-parser.jay (declare_local_variables): Support array initialization too.
11369
11370         * typemanager.cs (MakeKey): Implement.
11371
11372         (everywhere): Use the above appropriately.
11373
11374         * cs-parser.jay (for_statement): Update for array initialization while
11375         declaring variables.
11376
11377         * ecore.cs : The error message was correct, it's the variable's names that
11378         were misleading ;-) Make the code more readable.
11379
11380         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
11381         the correct type etc.
11382
11383         (ConvertExplicit): Handle Enum types by examining the underlying type.
11384
11385 2001-11-21  Ravi Pratap  <ravi@ximian.com>
11386
11387         * parameter.cs (GetCallingConvention): Always return
11388         CallingConventions.Standard for now.
11389
11390 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11391
11392         * expression.cs (Binary.ResolveOperator): Update the values of `l'
11393         and `r' after calling DoNumericPromotions.
11394
11395         * ecore.cs: Fix error message (the types were in the wrong order).
11396
11397         * statement.cs (Foreach.ProbeCollectionType): Need to pass
11398         BindingFlags.Instance as well 
11399
11400         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
11401         implicit int literal conversion in an empty cast so that we
11402         propagate the right type upstream.
11403
11404         (UnboxCast): new class used to unbox value types.
11405         (Expression.ConvertExplicit): Add explicit type conversions done
11406         by unboxing.
11407
11408         (Expression.ImplicitNumericConversion): Oops, forgot to test for
11409         the target type before applying the implicit LongLiterals to ULong
11410         literal cast.
11411
11412 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
11413
11414         * cs-parser.jay (for_statement): Reworked the way For works: now
11415         we declare manually any variables that are introduced in
11416         for_initializer to solve the problem of having out-of-band code
11417         emition (that is what got for broken).
11418
11419         (declaration_statement): Perform the actual variable declaration
11420         that used to be done in local_variable_declaration here.
11421
11422         (local_variable_declaration): Do not declare anything, just pass
11423         the information on a DictionaryEntry
11424
11425 2001-11-20  Ravi Pratap  <ravi@ximian.com>
11426
11427         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
11428         re-write of the logic to now make it recursive.
11429
11430         (UpdateIndices): Re-write accordingly.
11431
11432         Store element data in a separate ArrayData list in the above methods.
11433
11434         (MakeByteBlob): Implement to dump the array data into a byte array.
11435
11436 2001-11-19  Ravi Pratap  <ravi@ximian.com>
11437
11438         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
11439         into CheckIndices.
11440
11441         * constant.cs (Define): Implement.
11442
11443         (EmitConstant): Re-write fully.
11444
11445         Pass in location info.
11446
11447         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
11448         respectively.
11449
11450         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
11451         DictionaryEntry since we need location info too.
11452
11453         (constant_declaration): Update accordingly.
11454
11455         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
11456         code into another method : UpdateIndices.
11457
11458 2001-11-18  Ravi Pratap  <ravi@ximian.com>
11459
11460         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
11461         some type checking etc.
11462
11463 2001-11-17  Ravi Pratap  <ravi@ximian.com>
11464
11465         * expression.cs (ArrayCreation::ValidateInitializers): Implement
11466         bits to provide dimension info if the user skips doing that.
11467
11468         Update second constructor to store the rank correctly.
11469
11470 2001-11-16  Ravi Pratap  <ravi@ximian.com>
11471
11472         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
11473         and try to implement.
11474
11475         * ../errors/cs0150.cs : Add.
11476
11477         * ../errors/cs0178.cs : Add.
11478
11479 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
11480
11481         * statement.cs: Implement foreach on multi-dimensional arrays. 
11482
11483         * parameter.cs (Parameters.GetParameterByName): Also lookup the
11484         name of the params argument.
11485
11486         * expression.cs: Use EmitStoreOpcode to get the right opcode while
11487         initializing the array.
11488
11489         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
11490         we can use this elsewhere.
11491
11492         * statement.cs: Finish implementation of foreach for single
11493         dimension arrays.
11494
11495         * cs-parser.jay: Use an out-of-band stack to pass information
11496         around, I wonder why I need this.
11497
11498         foreach_block: Make the new foreach_block the current_block.
11499
11500         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
11501         function used to return a static Parameters structure.  Used for
11502         empty parameters, as those are created very frequently.
11503
11504         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
11505
11506 2001-11-15  Ravi Pratap  <ravi@ximian.com>
11507
11508         * interface.cs : Default modifier is private, not public. The
11509         make verify test passes again.
11510
11511 2001-11-15  Ravi Pratap  <ravi@ximian.com>
11512
11513         * support.cs (ReflectionParameters): Fix logic to determine
11514         whether the last parameter is a params one. Test 9 passes again.
11515
11516         * delegate.cs (Populate): Register the builders we define with
11517         RegisterParameterForBuilder. Test 19 passes again.
11518
11519         * cs-parser.jay (property_declaration): Reference $6 instead
11520         of $$ to get at the location.
11521
11522         (indexer_declaration): Similar stuff.
11523
11524         (attribute): Ditto.
11525
11526         * class.cs (Property): Register parameters for the Get and Set methods
11527         if they exist. Test 23 passes again.
11528
11529         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
11530         call to EmitArguments as we are sure there aren't any params arguments. 
11531         Test 32 passes again.
11532
11533         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
11534         IndexOutOfRangeException. 
11535
11536         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
11537         Test 33 now passes again.
11538         
11539 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
11540
11541         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
11542         broke a bunch of things.  Will have to come up with a better way
11543         of tracking locations.
11544
11545         * statement.cs: Implemented foreach for single dimension arrays.
11546
11547 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
11548
11549         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
11550         an error.  This removes the lookup from the critical path.
11551
11552         * cs-parser.jay: Removed use of temporary_loc, which is completely
11553         broken. 
11554
11555 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
11556
11557         * support.cs (ReflectionParameters.ParameterModifier): Report
11558         whether the argument is a PARAMS argument or not.
11559
11560         * class.cs: Set the attribute `ParamArrayAttribute' on the
11561         parameter argument.
11562
11563         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
11564         and cons_param_array_attribute (ConstructorInfo for
11565         ParamArrayAttribute)., 
11566
11567         * codegen.cs: Emit the return using the `Return' statement, that
11568         way we can report the error correctly for missing return values. 
11569
11570         * class.cs (Method.Emit): Clean up.
11571
11572         * expression.cs (Argument.Resolve): Take another argument: the
11573         location where this argument is used.  Notice that this is not
11574         part of the "Argument" class as to reduce the size of the
11575         structure (we know the approximate location anyways).
11576
11577         Test if the argument is a variable-reference, if not, then
11578         complain with a 206.
11579
11580         (Argument.Emit): Emit addresses of variables.
11581
11582         (Argument.FullDesc): Simplify.
11583
11584         (Invocation.DoResolve): Update for Argument.Resolve.
11585
11586         (ElementAccess.DoResolve): ditto.
11587
11588         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
11589         method should be virtual, as this method is always virtual.
11590
11591         (NewDelegate.DoResolve): Update for Argument.Resolve.
11592
11593         * class.cs (ConstructorInitializer.DoResolve): ditto.
11594         
11595         * attribute.cs (Attribute.Resolve): ditto.
11596
11597 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
11598
11599         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
11600
11601         * expression.cs (ParameterReference): Drop IStackStorage and implement
11602         IAssignMethod instead. 
11603
11604         (LocalVariableReference): ditto.
11605         
11606         * ecore.cs (FieldExpr): Drop IStackStorage and implement
11607         IAssignMethod instead. 
11608
11609 2001-11-13  Miguel de Icaza <miguel@ximian.com>
11610
11611         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
11612         enumerations that are used in heavily used structures derive from
11613         byte in a laughable and pathetic attempt to reduce memory usage.
11614         This is the kind of pre-optimzations that you should not do at
11615         home without adult supervision.
11616
11617         * expression.cs (UnaryMutator): New class, used to handle ++ and
11618         -- separatedly from the other unary operators.  Cleans up the
11619         code, and kills the ExpressionStatement dependency in Unary.
11620
11621         (Unary): Removed `method' and `Arguments' from this class, making
11622         it smaller, and moving it all to SimpleCall, so I can reuse this
11623         code in other locations and avoid creating a lot of transient data
11624         strucutres when not required.
11625
11626         * cs-parser.jay: Adjust for new changes.
11627
11628 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
11629
11630         * enum.cs (Enum.Populate): If there is a failure during
11631         definition, return
11632
11633         * cs-parser.jay (opt_enum_base): we used to catch type errors
11634         here, but this is really incorrect.  The type error should be
11635         catched during semantic analysis.
11636
11637 2001-12-11  Ravi Pratap  <ravi@ximian.com>
11638
11639         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
11640         current_local_parameters as expected since I, in my stupidity, had forgotten
11641         to do this :-)
11642
11643         * attribute.cs (GetValidPlaces): Fix stupid bug.
11644
11645         * class.cs (Method::Emit): Perform check on applicability of attributes.
11646
11647         (Constructor::Emit): Ditto.
11648
11649         (Field::Emit): Ditto.
11650
11651         (Field.Location): Store location information.
11652
11653         (Property, Event, Indexer, Operator): Ditto.
11654
11655         * cs-parser.jay (field_declaration): Pass in location for each field.
11656
11657         * ../errors/cs0592.cs : Add.
11658
11659 2001-11-12  Ravi Pratap  <ravi@ximian.com>
11660
11661         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
11662
11663         (InitCoreTypes): Update accordingly.
11664
11665         (RegisterAttrType, LookupAttr): Implement.
11666
11667         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
11668         info about the same.
11669
11670         (Resolve): Update to populate the above as necessary.
11671
11672         (Error592): Helper.
11673
11674         (GetValidPlaces): Helper to the above.
11675
11676         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
11677
11678         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
11679
11680 2001-11-12  Ravi Pratap  <ravi@ximian.com>
11681
11682         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
11683
11684         * ../errors/cs0617.cs : Add.
11685
11686 2001-11-11  Ravi Pratap  <ravi@ximian.com>
11687
11688         * enum.cs (Emit): Rename to Populate to be more consistent with what
11689         we expect it to do and when exactly it is called.
11690
11691         * class.cs, rootcontext.cs : Update accordingly.
11692
11693         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
11694         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
11695
11696         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
11697
11698         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
11699         of a fieldinfo using the above, when dealing with a FieldBuilder.
11700
11701 2001-11-10  Ravi Pratap  <ravi@ximian.com>
11702
11703         * ../errors/cs0031.cs : Add.
11704
11705         * ../errors/cs1008.cs : Add.
11706
11707         * ../errrors/cs0543.cs : Add.
11708
11709         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
11710         enum type.
11711
11712         (FindMembers): Implement.
11713
11714         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
11715         enums and delegates too.
11716
11717         (enum_types): Rename to builder_to_enum.
11718
11719         (delegate_types): Rename to builder_to_delegate.
11720
11721         * delegate.cs (FindMembers): Implement.
11722
11723 2001-11-09  Ravi Pratap  <ravi@ximian.com>
11724
11725         * typemanager.cs (IsEnumType): Implement.
11726
11727         * enum.cs (Emit): Re-write parts to account for the underlying type
11728         better and perform checking etc.
11729
11730         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
11731         of the underlying type.
11732
11733         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
11734         value
11735
11736         * enum.cs (error31): Helper to report error #31.
11737
11738         * cs-parser.jay (enum_declaration): Store location of each member too.
11739
11740         * enum.cs (member_to_location): New hashtable. 
11741
11742         (AddEnumMember): Update location hashtable.
11743
11744         (Emit): Use the location of each member while reporting errors.
11745
11746 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
11747
11748         * cs-parser.jay: A for_initializer if is a
11749         local_variable_declaration really ammount to have an implicit
11750         block with the variable declaration and no initializer for for.
11751
11752         * statement.cs (For.Emit): Cope with null initializers.
11753
11754         This fixes the infinite loop on for initializers.
11755
11756 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
11757
11758         * enum.cs: More cleanup.
11759
11760         * ecore.cs: Remove dead code.
11761
11762         * class.cs (Property.Emit): More simplification.
11763         (Event.Emit): ditto.
11764
11765         Reworked to have less levels of indentation.
11766         
11767 2001-11-08  Ravi Pratap  <ravi@ximian.com>
11768
11769         * class.cs (Property): Emit attributes.
11770
11771         (Field): Ditto.
11772         
11773         (Event): Ditto.
11774
11775         (Indexer): Ditto.
11776
11777         (Operator): Ditto.
11778
11779         * enum.cs (Emit): Ditto.
11780
11781         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
11782         Enums too.
11783
11784         * class.cs (Field, Event, etc.): Move attribute generation into the
11785         Emit method everywhere.
11786
11787         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
11788         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
11789         as we had no way of defining nested enums !
11790
11791         * rootcontext.cs : Adjust code accordingly.
11792
11793         * typemanager.cs (AddEnumType): To keep track of enum types separately.
11794
11795 2001-11-07  Ravi Pratap  <ravi@ximian.com>
11796
11797         * expression.cs (EvalConstantExpression): Move into ecore.cs
11798         
11799         * enum.cs (Enum): Rename some members and make them public and readonly
11800         according to our convention.
11801
11802         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
11803         nothing else.
11804
11805         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
11806
11807         (Enum::Emit): Write a simple version for now which doesn't try to compute
11808         expressions. I shall modify this to be more robust in just a while.
11809
11810         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
11811
11812         (TypeContainer::CloseType): Create the Enum types too.
11813
11814         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
11815
11816         * expression.cs (EvalConstantExpression): Get rid of completely.
11817
11818         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
11819         user-defined values and other cases.
11820
11821         (IsValidEnumLiteral): Helper function.
11822
11823         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
11824         out there in the case we had a literal FieldExpr.
11825
11826         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
11827
11828         (Literalize): Revamp a bit to take two arguments.
11829         
11830         (EnumLiteral): New class which derives from Literal to wrap enum literals.
11831         
11832 2001-11-06  Ravi Pratap  <ravi@ximian.com>
11833
11834         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
11835
11836         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
11837
11838         (Resolve): Use the above to ensure we have proper initializers.
11839
11840 2001-11-05  Ravi Pratap  <ravi@ximian.com>
11841
11842         * expression.cs (Expression::EvalConstantExpression): New method to 
11843         evaluate constant expressions.
11844
11845         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
11846
11847 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
11848
11849         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
11850         in an array.
11851
11852         (Binary.ResolveOperator): Handle operator != (object a, object b)
11853         and operator == (object a, object b);
11854
11855         (Binary.DoNumericPromotions): Indicate whether the numeric
11856         promotion was possible.
11857
11858         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
11859         Implement.  
11860
11861         Made the ArrayAccess implement interface IAssignMethod instead of
11862         IStackStore as the order in which arguments are passed reflects
11863         this.
11864
11865         * assign.cs: Instead of using expr.ExprClass to select the way of
11866         assinging, probe for the IStackStore/IAssignMethod interfaces.
11867
11868         * typemanager.cs: Load InitializeArray definition.
11869
11870         * rootcontext.cs (RootContext.MakeStaticData): Used to define
11871         static data that can be used to initialize arrays. 
11872
11873 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
11874
11875         * expression.cs: Handle operator== and operator!= for booleans.
11876
11877         (Conditioal.Reduce): Implement reducer for the ?: operator.
11878
11879         (Conditional.Resolve): Implement dead code elimination.
11880
11881         (Binary.Resolve): Catch string literals and return a new
11882         concatenated string.
11883
11884         (Unary.Reduce): Implement reduction of unary expressions.
11885
11886         * ecore.cs: Split out the expression core handling here.
11887
11888         (Expression.Reduce): New method used to perform constant folding
11889         and CSE.  This is needed to support constant-expressions. 
11890         
11891         * statement.cs (Statement.EmitBoolExpression): Pass true and false
11892         targets, and optimize for !x.
11893
11894 2001-11-04  Ravi Pratap  <ravi@ximian.com>
11895
11896         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
11897         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
11898         set custom atttributes.
11899
11900         * literal.cs (Literal::GetValue): New abstract method to return the actual
11901         value of the literal, cast as an object.
11902
11903         (*Literal): Implement GetValue method.
11904
11905         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
11906         expressions to the arraylist but objects of type Argument.
11907
11908         * class.cs (TypeContainer::Emit): Emit our attributes too.
11909
11910         (Method::Emit, Constructor::Emit): Ditto.
11911
11912         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
11913         to be ignoring earlier.
11914
11915 2001-11-03  Ravi Pratap  <ravi@ximian.com>
11916
11917         * attribute.cs (AttributeSection::Define): Implement to do the business
11918         of constructing a CustomAttributeBuilder.
11919
11920         (Attribute): New trivial class. Increases readability of code.  
11921
11922         * cs-parser.jay : Update accordingly.
11923
11924         (positional_argument_list, named_argument_list, named_argument): New rules
11925
11926         (attribute_arguments): Use the above so that we are more correct.
11927         
11928 2001-11-02  Ravi Pratap  <ravi@ximian.com>
11929         
11930         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
11931         to perform all checks for a method with a params parameter.
11932
11933         (Invocation::OverloadResolve): Update to use the above method and therefore
11934         cope correctly with params method invocations.
11935
11936         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
11937         params too.
11938
11939         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
11940         constructors in our parent too because we can't afford to miss out on 
11941         protected ones ;-)
11942
11943         * attribute.cs (AttributeSection): New name for the class Attribute
11944
11945         Other trivial changes to improve readability.
11946
11947         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
11948         use the new class names.
11949         
11950 2001-11-01  Ravi Pratap  <ravi@ximian.com>
11951
11952         * class.cs (Method::Define): Complete definition for params types too
11953
11954         (Indexer::Define): Ditto.
11955
11956         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
11957         Cope everywhere with a request for info about the array parameter.
11958
11959 2001-11-01  Ravi Pratap  <ravi@ximian.com>
11960
11961         * tree.cs (RecordNamespace): Fix up to check for the correct key.
11962
11963         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
11964         local_variable_type to extract the string corresponding to the type.
11965
11966         (local_variable_type): Fixup the action to use the new helper method.
11967
11968         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
11969         go.
11970
11971         * expression.cs : Clean out code which uses the above.
11972
11973 2001-10-31  Ravi Pratap  <ravi@ximian.com>
11974         
11975         * typemanager.cs (RegisterMethod): Check if we already have an existing key
11976         and bale out if necessary by returning a false.
11977
11978         (RegisterProperty): Ditto.
11979
11980         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
11981         and print out appropriate error messages.
11982
11983         * interface.cs (everywhere): Ditto.
11984
11985         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
11986         location to constructor.
11987
11988         * class.cs (Property, Event, Indexer): Update accordingly.
11989
11990         * ../errors/cs111.cs : Added.
11991
11992         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
11993         of a method, as laid down by the spec.
11994
11995         (Invocation::OverloadResolve): Use the above method.
11996
11997 2001-10-31  Ravi Pratap  <ravi@ximian.com>
11998
11999         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
12000         now take a TypeContainer and a Parameters object.
12001
12002         (ParameterData): Modify return type of ParameterModifier method to be 
12003         Parameter.Modifier and not a string.
12004
12005         (ReflectionParameters, InternalParameters): Update accordingly.
12006
12007         * expression.cs (Argument::GetParameterModifier): Same here.
12008
12009         * support.cs (InternalParameters::ParameterType): Find a better way of determining
12010         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
12011         symbol in it at all so maybe this is only for now.
12012
12013 2001-10-30  Ravi Pratap  <ravi@ximian.com>
12014
12015         * support.cs (InternalParameters): Constructor now takes an extra argument 
12016         which is the actual Parameters class.
12017
12018         (ParameterDesc): Update to provide info on ref/out modifiers.
12019
12020         * class.cs (everywhere): Update call to InternalParameters to pass in
12021         the second argument too.
12022
12023         * support.cs (ParameterData): Add ParameterModifier, which is a method 
12024         to return the modifier info [ref/out etc]
12025
12026         (InternalParameters, ReflectionParameters): Implement the above.
12027
12028         * expression.cs (Argument::ParameterModifier): Similar function to return
12029         info about the argument's modifiers.
12030
12031         (Invocation::OverloadResolve): Update to take into account matching modifiers 
12032         too.
12033
12034         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
12035         a new SetFormalParameters object which we pass to InternalParameters.
12036
12037 2001-10-30  Ravi Pratap  <ravi@ximian.com>
12038
12039         * expression.cs (NewArray): Merge into the ArrayCreation class.
12040
12041 2001-10-29  Ravi Pratap  <ravi@ximian.com>
12042
12043         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
12044         NewUserdefinedArray into one as there wasn't much of a use in having
12045         two separate ones.
12046
12047         * expression.cs (Argument): Change field's name to ArgType from Type.
12048
12049         (Type): New readonly property which returns the proper type, taking into 
12050         account ref/out modifiers.
12051
12052         (everywhere): Adjust code accordingly for the above.
12053
12054         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
12055         whether we are emitting for a ref or out parameter.
12056
12057         * expression.cs (Argument::Emit): Use the above field to set the state.
12058
12059         (LocalVariableReference::Emit): Update to honour the flag and emit the
12060         right stuff.
12061
12062         * parameter.cs (Attributes): Set the correct flags for ref parameters.
12063
12064         * expression.cs (Argument::FullDesc): New function to provide a full desc.
12065
12066         * support.cs (ParameterData): Add method ParameterDesc to the interface.
12067
12068         (ReflectionParameters, InternalParameters): Implement the above method.
12069
12070         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
12071         reporting errors.
12072
12073         (Invocation::FullMethodDesc): Ditto. 
12074
12075 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
12076
12077         * cs-parser.jay: Add extra production for the second form of array
12078         creation. 
12079
12080         * expression.cs (ArrayCreation): Update to reflect the above
12081         change. 
12082
12083         * Small changes to prepare for Array initialization.
12084
12085 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
12086
12087         * typemanager.cs (ImplementsInterface): interface might be null;
12088         Deal with this problem;
12089
12090         Also, we do store negative hits on the cache (null values), so use
12091         this instead of calling t.GetInterfaces on the type everytime.
12092
12093 2001-10-28  Ravi Pratap  <ravi@ximian.com>
12094
12095         * typemanager.cs (IsBuiltinType): New method to help determine the same.
12096
12097         * expression.cs (New::DoResolve): Get rid of array creation code and instead
12098         split functionality out into different classes.
12099
12100         (New::FormArrayType): Move into NewBuiltinArray.
12101
12102         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
12103         quite useless.
12104
12105         (NewBuiltinArray): New class to handle creation of built-in arrays.
12106
12107         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
12108         account creation of one-dimensional arrays.
12109
12110         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
12111
12112         (NewUserdefinedArray::DoResolve): Implement.
12113
12114         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
12115
12116         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
12117         we maintain inside the TypeManager. This is necessary to perform lookups on the
12118         module builder.
12119
12120         (LookupType): Update to perform GetType on the module builders too.     
12121
12122         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
12123
12124         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
12125
12126 2001-10-23  Ravi Pratap  <ravi@ximian.com>
12127
12128         * expression.cs (New::DoResolve): Implement guts of array creation.
12129
12130         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
12131         
12132 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
12133
12134         * expression.cs: Fix bug I introduced lsat night that broke
12135         Delegates. 
12136
12137         (Expression.Resolve): Report a 246 error (can not resolve name)
12138         if we find a SimpleName in the stream.
12139         
12140         (Expression.ResolveLValue): Ditto.
12141         
12142         (Expression.ResolveWithSimpleName): This function is a variant of
12143         ResolveName, this one allows SimpleNames to be returned without a
12144         warning.  The only consumer of SimpleNames is MemberAccess
12145
12146 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
12147
12148         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
12149         might arrive here.  I have my doubts that this is correct.
12150
12151         * statement.cs (Lock): Implement lock statement.
12152
12153         * cs-parser.jay: Small fixes to support `lock' and `using'
12154
12155         * cs-tokenizer.cs: Remove extra space
12156
12157         * driver.cs: New flag --checked, allows to turn on integer math
12158         checking. 
12159
12160         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
12161         Threading.Monitor.Exit 
12162         
12163 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
12164
12165         * expression.cs (IndexerAccess::DoResolveLValue): Set the
12166         Expression Class to be IndexerAccess.
12167
12168         Notice that Indexer::DoResolve sets the eclass to Value.
12169
12170 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
12171
12172         * class.cs (TypeContainer::Emit): Emit code for indexers.
12173
12174         * assign.cs (IAssignMethod): New interface implemented by Indexers
12175         and Properties for handling assignment.
12176
12177         (Assign::Emit): Simplify and reuse code. 
12178         
12179         * expression.cs (IndexerAccess, PropertyExpr): Implement
12180         IAssignMethod, clean up old code. 
12181
12182 2001-10-22  Ravi Pratap  <ravi@ximian.com>
12183
12184         * typemanager.cs (ImplementsInterface): New method to determine if a type
12185         implements a given interface. Provides a nice cache too.
12186
12187         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
12188         method.
12189
12190         (ConvertReferenceExplicit): Ditto.
12191
12192         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
12193         various methods, with correct names etc.
12194
12195         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
12196         Operator.UnaryNegation.
12197
12198         * cs-parser.jay (operator_declarator): Be a little clever in the case where
12199         we have a unary plus or minus operator.
12200
12201         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
12202         UnaryMinus.
12203
12204         * everywhere : update accordingly.
12205
12206         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
12207         respectively.
12208
12209         * class.cs (Method::Define): For the case where we are implementing a method
12210         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
12211         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
12212         
12213 2001-10-21  Ravi Pratap  <ravi@ximian.com>
12214
12215         * interface.cs (FindMembers): Implement to work around S.R.E
12216         lameness.
12217
12218         * typemanager.cs (IsInterfaceType): Implement.
12219
12220         (FindMembers): Update to handle interface types too.
12221
12222         * expression.cs (ImplicitReferenceConversion): Re-write bits which
12223         use IsAssignableFrom as that is not correct - it doesn't work.
12224
12225         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
12226         and accordingly override EmitStatement.
12227
12228         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
12229         using the correct logic :-)
12230
12231 2001-10-19  Ravi Pratap  <ravi@ximian.com>
12232
12233         * ../errors/cs-11.cs : Add to demonstrate error -11 
12234
12235 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
12236
12237         * assign.cs (Assign::Resolve): Resolve right hand side first, and
12238         then pass this as a hint to ResolveLValue.
12239         
12240         * expression.cs (FieldExpr): Add Location information
12241
12242         (FieldExpr::LValueResolve): Report assignment to readonly
12243         variable. 
12244         
12245         (Expression::ExprClassFromMemberInfo): Pass location information.
12246
12247         (Expression::ResolveLValue): Add new method that resolves an
12248         LValue. 
12249
12250         (Expression::DoResolveLValue): Default invocation calls
12251         DoResolve. 
12252
12253         (Indexers): New class used to keep track of indexers in a given
12254         Type. 
12255
12256         (IStackStore): Renamed from LValue, as it did not really describe
12257         what this did.  Also ResolveLValue is gone from this interface and
12258         now is part of Expression.
12259
12260         (ElementAccess): Depending on the element access type
12261         
12262         * typemanager.cs: Add `indexer_name_type' as a Core type
12263         (System.Runtime.CompilerServices.IndexerNameAttribute)
12264
12265         * statement.cs (Goto): Take a location.
12266         
12267 2001-10-18  Ravi Pratap  <ravi@ximian.com>
12268
12269         * delegate.cs (Delegate::VerifyDelegate): New method to verify
12270         if two delegates are compatible.
12271
12272         (NewDelegate::DoResolve): Update to take care of the case when
12273         we instantiate a delegate from another delegate.
12274
12275         * typemanager.cs (FindMembers): Don't even try to look up members
12276         of Delegate types for now.
12277
12278 2001-10-18  Ravi Pratap  <ravi@ximian.com>
12279
12280         * delegate.cs (NewDelegate): New class to take care of delegate
12281         instantiation.
12282
12283         * expression.cs (New): Split the delegate related code out into 
12284         the NewDelegate class.
12285
12286         * delegate.cs (DelegateInvocation): New class to handle delegate 
12287         invocation.
12288
12289         * expression.cs (Invocation): Split out delegate related code into
12290         the DelegateInvocation class.
12291
12292 2001-10-17  Ravi Pratap  <ravi@ximian.com>
12293
12294         * expression.cs (New::DoResolve): Implement delegate creation fully
12295         and according to the spec.
12296
12297         (New::DoEmit): Update to handle delegates differently.
12298
12299         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
12300         because of which we were printing out arguments in reverse order !
12301
12302         * delegate.cs (VerifyMethod): Implement to check if the given method
12303         matches the delegate.
12304
12305         (FullDelegateDesc): Implement.
12306
12307         (VerifyApplicability): Implement.
12308
12309         * expression.cs (Invocation::DoResolve): Update to accordingly handle
12310         delegate invocations too.
12311
12312         (Invocation::Emit): Ditto.
12313
12314         * ../errors/cs1593.cs : Added.
12315
12316         * ../errors/cs1594.cs : Added.
12317
12318         * delegate.cs (InstanceExpression, TargetMethod): New properties.
12319
12320 2001-10-16  Ravi Pratap  <ravi@ximian.com>
12321
12322         * typemanager.cs (intptr_type): Core type for System.IntPtr
12323
12324         (InitCoreTypes): Update for the same.
12325
12326         (iasyncresult_type, asynccallback_type): Ditto.
12327
12328         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
12329         correct.
12330
12331         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
12332         too.
12333
12334         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
12335         the builders for the 4 members of a delegate type :-)
12336
12337         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
12338         type.
12339
12340         * expression.cs (New::DoResolve): Implement guts for delegate creation.
12341
12342         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
12343
12344 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
12345
12346         * statement.cs (Break::Emit): Implement.   
12347         (Continue::Emit): Implement.
12348
12349         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12350         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12351         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12352         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
12353         end loop
12354         
12355         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
12356         properties that track the label for the current loop (begin of the
12357         loop and end of the loop).
12358
12359 2001-10-15  Ravi Pratap  <ravi@ximian.com>
12360
12361         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
12362         use of emitting anything at all.
12363
12364         * class.cs, rootcontext.cs : Get rid of calls to the same.
12365
12366         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
12367
12368         (Populate): Define the constructor correctly and set the implementation
12369         attributes.
12370
12371         * typemanager.cs (delegate_types): New hashtable to hold delegates that
12372         have been defined.
12373
12374         (AddDelegateType): Implement.
12375
12376         (IsDelegateType): Implement helper method.
12377
12378         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
12379
12380         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
12381         and accordingly handle it.
12382
12383         * delegate.cs (Populate): Take TypeContainer argument.
12384         Implement bits to define the Invoke method. However, I still haven't figured out
12385         how to take care of the native int bit :-(
12386
12387         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
12388         Qualify the name of the delegate, not its return type !
12389
12390         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
12391         conversion.
12392
12393         (StandardConversionExists): Checking for array types turns out to be recursive.
12394
12395         (ConvertReferenceExplicit): Implement array conversion.
12396
12397         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
12398         
12399 2001-10-12  Ravi Pratap  <ravi@ximian.com>
12400
12401         * cs-parser.jay (delegate_declaration): Store the fully qualified
12402         name as it is a type declaration.
12403
12404         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
12405         readonly.
12406
12407         (DefineDelegate): Renamed from Define. Does the same thing essentially,
12408         as TypeContainer::DefineType.
12409
12410         (Populate): Method in which all the definition of the various methods (Invoke)
12411         etc is done.
12412
12413         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
12414         see.
12415         
12416         (CloseDelegate): Finally creates the delegate.
12417
12418         * class.cs (TypeContainer::DefineType): Update to define delegates.
12419         (Populate, Emit and CloseType): Do the same thing here too.
12420
12421         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
12422         delegates in all these operations.
12423
12424 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
12425
12426         * expression.cs: LocalTemporary: a new expression used to
12427         reference a temporary that has been created.
12428
12429         * assign.cs: Handle PropertyAccess back here, so that we can
12430         provide the proper semantic access to properties.
12431
12432         * expression.cs (Expression::ConvertReferenceExplicit): Implement
12433         a few more explicit conversions. 
12434
12435         * modifiers.cs: `NEW' modifier maps to HideBySig.
12436
12437         * expression.cs (PropertyExpr): Make this into an
12438         ExpressionStatement, and support the EmitStatement code path. 
12439
12440         Perform get/set error checking, clean up the interface.
12441
12442         * assign.cs: recognize PropertyExprs as targets, and if so, turn
12443         them into toplevel access objects.
12444
12445 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
12446
12447         * expression.cs: PropertyExpr::PropertyExpr: use work around the
12448         SRE.
12449
12450         * typemanager.cs: Keep track here of our PropertyBuilders again to
12451         work around lameness in SRE.
12452
12453 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
12454
12455         * expression.cs (LValue::LValueResolve): New method in the
12456         interface, used to perform a second resolution pass for LValues. 
12457         
12458         (This::DoResolve): Catch the use of this in static methods.
12459
12460         (This::LValueResolve): Implement.
12461
12462         (This::Store): Remove warning, assigning to `this' in structures
12463         is 
12464
12465         (Invocation::Emit): Deal with invocation of
12466         methods on value types.  We need to pass the address to structure
12467         methods rather than the object itself.  (The equivalent code to
12468         emit "this" for structures leaves the entire structure on the
12469         stack instead of a pointer to it). 
12470
12471         (ParameterReference::DoResolve): Compute the real index for the
12472         argument based on whether the method takes or not a `this' pointer
12473         (ie, the method is static).
12474
12475         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
12476         value types returned from functions when we need to invoke a
12477         method on the sturcture.
12478         
12479
12480 2001-10-11  Ravi Pratap  <ravi@ximian.com>
12481
12482         * class.cs (TypeContainer::DefineType): Method to actually do the business of
12483         defining the type in the Modulebuilder or Typebuilder. This is to take
12484         care of nested types which need to be defined on the TypeBuilder using
12485         DefineNestedMethod.
12486
12487         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
12488         methods in RootContext, only ported to be part of TypeContainer.
12489
12490         (TypeContainer::GetInterfaceOrClass): Ditto.
12491
12492         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
12493
12494         * interface.cs (Interface::DefineInterface): New method. Does exactly
12495         what RootContext.CreateInterface did earlier, only it takes care of nested types 
12496         too.
12497
12498         (Interface::GetInterfaces): Move from RootContext here and port.
12499
12500         (Interface::GetInterfaceByName): Same here.
12501
12502         * rootcontext.cs (ResolveTree): Re-write.
12503
12504         (PopulateTypes): Re-write.
12505
12506         * class.cs (TypeContainer::Populate): Populate nested types too.
12507         (TypeContainer::Emit): Emit nested members too.
12508
12509         * typemanager.cs (AddUserType): Do not make use of the FullName property,
12510         instead just use the name argument passed in as it is already fully
12511         qualified.
12512
12513         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
12514         to TypeContainer mapping to see if a type is user-defined.
12515
12516         * class.cs (TypeContainer::CloseType): Implement. 
12517
12518         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
12519         the default constructor.
12520         
12521         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
12522         twice.
12523
12524         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
12525
12526         * interface.cs (CloseType): Create the type here.
12527         
12528         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
12529         the hierarchy.
12530
12531         Remove all the methods which are now in TypeContainer.
12532
12533 2001-10-10  Ravi Pratap  <ravi@ximian.com>
12534
12535         * delegate.cs (Define): Re-write bits to define the delegate
12536         correctly.
12537
12538 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
12539
12540         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
12541
12542         * expression.cs (ImplicitReferenceConversion): handle null as well
12543         as a source to convert to any reference type.
12544
12545         * statement.cs (Return): Perform any implicit conversions to
12546         expected return type.  
12547
12548         Validate use of return statement.  
12549
12550         * codegen.cs (EmitContext): Pass the expected return type here.
12551
12552         * class.cs (Method, Constructor, Property): Pass expected return
12553         type to EmitContext.
12554
12555 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
12556
12557         * expression.cs: Make DoResolve take an EmitContext instead of a
12558         TypeContainer.
12559
12560         Replaced `l' and `location' for `loc', for consistency.
12561         
12562         (Error, Warning): Remove unneeded Tc argument.
12563
12564         * assign.cs, literal.cs, constant.cs: Update to new calling
12565         convention. 
12566         
12567         * codegen.cs: EmitContext now contains a flag indicating whether
12568         code is being generated in a static method or not.
12569
12570         * cs-parser.jay: DecomposeQI, new function that replaces the old
12571         QualifiedIdentifier.  Now we always decompose the assembled
12572         strings from qualified_identifier productions into a group of
12573         memberaccesses.
12574
12575 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
12576
12577         * rootcontext.cs: Deal with field-less struct types correctly now
12578         by passing the size option to Define Type.
12579
12580         * class.cs: Removed hack that created one static field. 
12581
12582 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
12583
12584         * statement.cs: Moved most of the code generation here. 
12585
12586 2001-10-09  Ravi Pratap  <ravi@ximian.com>
12587
12588         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
12589         seem very right.
12590
12591         (ElementAccess): Remove useless bits for now - keep checks as the spec
12592         says.
12593
12594 2001-10-08  Ravi Pratap  <ravi@ximian.com>
12595
12596         * expression.cs (ElementAccess::DoResolve): Remove my crap code
12597         and start performing checks according to the spec.
12598
12599 2001-10-07  Ravi Pratap  <ravi@ximian.com>
12600
12601         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
12602         rank_specifiers instead.
12603
12604         (rank_specifiers): Change the order in which the rank specifiers are stored
12605
12606         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
12607
12608         * expression.cs (ElementAccess): Implement the LValue interface too.
12609         
12610 2001-10-06  Ravi Pratap  <ravi@ximian.com>
12611         
12612         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
12613         except that user defined conversions are not included.
12614
12615         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
12616         perform the conversion of the return type, if necessary.
12617
12618         (New::DoResolve): Check whether we are creating an array or an object
12619         and accordingly do the needful.
12620
12621         (New::Emit): Same here.
12622
12623         (New::DoResolve): Implement guts of array creation.
12624
12625         (New::FormLookupType): Helper function.
12626
12627 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
12628
12629         * codegen.cs: Removed most of the code generation here, and move the
12630         corresponding code generation bits to the statement classes. 
12631
12632         Added support for try/catch/finalize and throw.
12633         
12634         * cs-parser.jay: Added support for try/catch/finalize.
12635
12636         * class.cs: Catch static methods having the flags override,
12637         virtual or abstract.
12638
12639         * expression.cs (UserCast): This user cast was not really doing
12640         what it was supposed to do.  Which is to be born in fully resolved
12641         state.  Parts of the resolution were being performed at Emit time! 
12642
12643         Fixed this code.
12644
12645 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
12646
12647         * expression.cs: Implicity convert the result from UserCast.
12648
12649 2001-10-05  Ravi Pratap  <ravi@ximian.com>
12650
12651         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
12652         prevented it from working correctly. 
12653
12654         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
12655         merely ConvertImplicit.
12656
12657 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
12658
12659         * typemanager.cs: Make the LookupTypeContainer function static,
12660         and not per-instance.  
12661
12662         * class.cs: Make static FindMembers (the one that takes a Type
12663         argument). 
12664
12665         * codegen.cs: Add EmitForeach here.
12666
12667         * cs-parser.jay: Make foreach a toplevel object instead of the
12668         inline expansion, as we need to perform semantic analysis on it. 
12669
12670 2001-10-05  Ravi Pratap  <ravi@ximian.com>
12671
12672         * expression.cs (Expression::ImplicitUserConversion): Rename to
12673         UserDefinedConversion.
12674
12675         (Expression::UserDefinedConversion): Take an extra argument specifying 
12676         whether we look for explicit user conversions too.
12677
12678         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
12679
12680         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
12681
12682         (ExplicitUserConversion): Make it a call to UserDefinedConversion
12683         with the appropriate arguments.
12684
12685         * cs-parser.jay (cast_expression): Record location too.
12686
12687         * expression.cs (Cast): Record location info.
12688
12689         (Expression::ConvertExplicit): Take location argument.
12690
12691         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
12692         to determine if we are doing explicit conversions.
12693
12694         (UserCast::Emit): Update accordingly.
12695
12696         (Expression::ConvertExplicit): Report an error if everything fails.
12697
12698         * ../errors/cs0030.cs : Add.
12699
12700 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
12701
12702         * modifiers.cs: If the ABSTRACT keyword is present, also set the
12703         virtual and newslot bits. 
12704
12705         * class.cs (TypeContainer::RegisterRequiredImplementations):
12706         Record methods we need.
12707
12708         (TypeContainer::MakeKey): Helper function to make keys for
12709         MethodBases, since the Methodbase key is useless.
12710
12711         (TypeContainer::Populate): Call RegisterRequiredImplementations
12712         before defining the methods.   
12713
12714         Create a mapping for method_builders_to_methods ahead of time
12715         instead of inside a tight loop.
12716
12717         (::RequireMethods):  Accept an object as the data to set into the
12718         hashtable so we can report interface vs abstract method mismatch.
12719
12720 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
12721
12722         * report.cs: Make all of it static.
12723
12724         * rootcontext.cs: Drop object_type and value_type computations, as
12725         we have those in the TypeManager anyways.
12726
12727         Drop report instance variable too, now it is a global.
12728
12729         * driver.cs: Use try/catch on command line handling.
12730
12731         Add --probe option to debug the error reporting system with a test
12732         suite. 
12733
12734         * report.cs: Add support for exiting program when a probe
12735         condition is reached.
12736
12737 2001-10-03  Ravi Pratap  <ravi@ximian.com>
12738
12739         * expression.cs (Binary::DoNumericPromotions): Fix the case when
12740         we do a forcible conversion regardless of type, to check if 
12741         ForceConversion returns a null.
12742
12743         (Binary::error19): Use location to report error.
12744
12745         (Unary::error23): Use location here too.
12746
12747         * ../errors/cs0019.cs : Check in.
12748
12749         * ../errors/cs0023.cs : Check in.
12750
12751         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
12752         case of a non-null MethodInfo object with a length of 0 !
12753
12754         (Binary::ResolveOperator): Flag error if overload resolution fails to find
12755         an applicable member - according to the spec :-)
12756         Also fix logic to find members in base types.
12757
12758         (Unary::ResolveOperator): Same here.
12759
12760         (Unary::report23): Change name to error23 and make first argument a TypeContainer
12761         as I was getting thoroughly confused between this and error19 :-)
12762         
12763         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
12764         (::FindMostEncompassedType): Implement.
12765         (::FindMostEncompassingType): Implement.
12766         (::StandardConversionExists): Implement.
12767
12768         (UserImplicitCast): Re-vamp. We now need info about most specific
12769         source and target types so that we can do the necessary conversions.
12770
12771         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
12772         mathematical union with no duplicates.
12773
12774 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
12775
12776         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
12777         in order from base classes to child classes, so that we can in
12778         child classes look up in our parent for method names and
12779         attributes (required for handling abstract, virtual, new, override
12780         constructs: we need to instrospect our base class, and if we dont
12781         populate the classes in order, the introspection might be
12782         incorrect.  For example, a method could query its parent before
12783         the parent has any methods and would determine that the parent has
12784         no abstract methods (while it could have had them)).
12785
12786         (RootContext::CreateType): Record the order in which we define the
12787         classes.
12788
12789 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
12790
12791         * class.cs (TypeContainer::Populate): Also method definitions can
12792         fail now, keep track of this.
12793
12794         (TypeContainer::FindMembers): Implement support for
12795         DeclaredOnly/noDeclaredOnly flag.
12796
12797         (Constructor::Emit) Return the ConstructorBuilder.
12798
12799         (Method::Emit) Return the MethodBuilder. 
12800         Check for abstract or virtual methods to be public.
12801
12802         * rootcontext.cs (RootContext::CreateType): Register all the
12803         abstract methods required for the class to be complete and the
12804         interface methods that must be implemented. 
12805
12806         * cs-parser.jay: Report error 501 (method requires body if it is
12807         not marked abstract or extern).
12808
12809         * expression.cs (TypeOf::Emit): Implement.
12810
12811         * typemanager.cs: runtime_handle_type, new global type.
12812
12813         * class.cs (Property::Emit): Generate code for properties.
12814
12815 2001-10-02  Ravi Pratap  <ravi@ximian.com>
12816
12817         * expression.cs (Unary::ResolveOperator): Find operators on base type
12818         too - we now conform exactly to the spec.
12819
12820         (Binary::ResolveOperator): Same here.
12821
12822         * class.cs (Operator::Define): Fix minor quirk in the tests.
12823
12824         * ../errors/cs0215.cs : Added.
12825
12826         * ../errors/cs0556.cs : Added.
12827
12828         * ../errors/cs0555.cs : Added.
12829
12830 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
12831
12832         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
12833         single integer which is really efficient
12834
12835 2001-10-01  Ravi Pratap  <ravi@ximian.com>
12836
12837         *  expression.cs (Expression::ImplicitUserConversion): Use location
12838         even in the case when we are examining True operators.
12839  
12840         * class.cs (Operator::Define): Perform extensive checks to conform
12841         with the rules for operator overloading in the spec.
12842
12843         * expression.cs (Expression::ImplicitReferenceConversion): Implement
12844         some of the other conversions mentioned in the spec.
12845
12846         * typemanager.cs (array_type): New static member for the System.Array built-in
12847         type.
12848
12849         (cloneable_interface): For System.ICloneable interface.
12850
12851         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
12852         we start resolving the tree and populating types.
12853
12854         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
12855  
12856 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
12857
12858         * expression.cs (Expression::ExprClassFromMemberInfo,
12859         Expression::Literalize): Create literal expressions from
12860         FieldInfos which are literals.
12861
12862         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
12863         type casts, because they were wrong.  The test suite in tests
12864         caught these ones.
12865
12866         (ImplicitNumericConversion): ushort to ulong requires a widening
12867         cast. 
12868
12869         Int32 constant to long requires widening cast as well.
12870
12871         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
12872         for integers because the type on the stack is not i4.
12873
12874 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
12875
12876         * expression.cs (report118): require location argument. 
12877
12878         * parameter.cs: Do not dereference potential null value.
12879
12880         * class.cs: Catch methods that lack the `new' keyword when
12881         overriding a name.  Report warnings when `new' is used without
12882         anything being there to override.
12883
12884         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
12885
12886         * class.cs: Only add constructor to hashtable if it is non-null
12887         (as now constructors can fail on define).
12888
12889         (TypeManager, Class, Struct): Take location arguments.
12890
12891         Catch field instance initialization in structs as errors.
12892
12893         accepting_filter: a new filter for FindMembers that is static so
12894         that we dont create an instance per invocation.
12895
12896         (Constructor::Define): Catch errors where a struct constructor is
12897         parameterless 
12898
12899         * cs-parser.jay: Pass location information for various new
12900         constructs. 
12901         
12902         * delegate.cs (Delegate): take a location argument.
12903
12904         * driver.cs: Do not call EmitCode if there were problesm in the
12905         Definition of the types, as many Builders wont be there. 
12906
12907         * decl.cs (Decl::Decl): Require a location argument.
12908
12909         * cs-tokenizer.cs: Handle properly hex constants that can not fit
12910         into integers, and find the most appropiate integer for it.
12911
12912         * literal.cs: Implement ULongLiteral.
12913
12914         * rootcontext.cs: Provide better information about the location of
12915         failure when CreateType fails.
12916         
12917 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
12918
12919         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
12920         as well.
12921
12922         * expression.cs (Binary::CheckShiftArguments): Add missing type
12923         computation.
12924         (Binary::ResolveOperator): Add type to the logical and and logical
12925         or, Bitwise And/Or and Exclusive Or code paths, it was missing
12926         before.
12927
12928         (Binary::DoNumericPromotions): In the case where either argument
12929         is ulong (and most signed types combined with ulong cause an
12930         error) perform implicit integer constant conversions as well.
12931
12932 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
12933
12934         * expression.cs (UserImplicitCast): Method should always be
12935         non-null. 
12936         (Invocation::BetterConversion): Simplified test for IntLiteral.
12937
12938         (Expression::ImplicitNumericConversion): Split this routine out.
12939         Put the code that performs implicit constant integer conversions
12940         here. 
12941
12942         (Expression::Resolve): Become a wrapper around DoResolve so we can
12943         check eclass and type being set after resolve.
12944
12945         (Invocation::Badness): Remove this dead function
12946
12947         (Binary::ResolveOperator): Do not compute the expensive argumnets
12948         unless we have a union for it.
12949
12950         (Probe::Emit): Is needs to do an isinst and then
12951         compare against null.
12952
12953         (::CanConvert): Added Location argument.  If the Location argument
12954         is null (Location.Null), then we do not report errors.  This is
12955         used by the `probe' mechanism of the Explicit conversion.  We do
12956         not want to generate an error for something that the user
12957         explicitly requested to be casted.  But the pipeline for an
12958         explicit cast first tests for potential implicit casts.
12959
12960         So for now, if the Location is null, it means `Probe only' to
12961         avoid adding another argument.   Might have to revise this
12962         strategy later.
12963
12964         (ClassCast): New class used to type cast objects into arbitrary
12965         classes (used in Explicit Reference Conversions).
12966
12967         Implement `as' as well.
12968
12969         Reverted all the patches from Ravi below: they were broken:
12970
12971                 * The use of `level' as a mechanism to stop recursive
12972                   invocations is wrong.  That was there just to catch the
12973                   bug with a strack trace but not as a way of addressing
12974                   the problem.
12975
12976                   To fix the problem we have to *understand* what is going
12977                   on and the interactions and come up with a plan, not
12978                   just get things going.
12979
12980                 * The use of the type conversion cache that I proposed
12981                   last night had an open topic: How does this work across
12982                   protection domains.  A user defined conversion might not
12983                   be public in the location where we are applying the
12984                   conversion, a different conversion might be selected
12985                   (ie, private A->B (better) but public B->A (worse),
12986                   inside A, A->B applies, but outside it, B->A will
12987                   apply).
12988
12989                 * On top of that (ie, even if the above is solved),
12990                   conversions in a cache need to be abstract.  Ie, `To
12991                   convert from an Int to a Short use an OpcodeCast', not
12992                   `To convert from an Int to a Short use the OpcodeCast on
12993                   the variable 5' (which is what this patch was doing).
12994         
12995 2001-09-28  Ravi Pratap  <ravi@ximian.com>
12996
12997         * expression.cs (Invocation::ConversionExists): Re-write to use
12998         the conversion cache
12999         
13000         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
13001         cache all conversions done, not just user-defined ones.
13002
13003         (Invocation::BetterConversion): The real culprit. Use ConversionExists
13004         to determine if a conversion exists instead of acutually trying to 
13005         perform the conversion. It's faster too.
13006
13007         (Expression::ConvertExplicit): Modify to use ConversionExists to check
13008         and only then attempt the implicit conversion.
13009
13010 2001-09-28  Ravi Pratap  <ravi@ximian.com>
13011
13012         * expression.cs (ConvertImplicit): Use a cache for conversions
13013         already found. Check level of recursion and bail out if necessary.
13014         
13015 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
13016
13017         * typemanager.cs (string_concat_string_string, string_concat_object_object):
13018         Export standard methods that we expect for string operations.
13019         
13020         * statement.cs (Block::UsageWarning): Track usage of variables and
13021         report the errors for not used variables.
13022
13023         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
13024         operator. 
13025
13026 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
13027
13028         * codegen.cs: remove unnneded code 
13029
13030         * expression.cs: Removed BuiltinTypeAccess class
13031
13032         Fix the order in which implicit conversions are
13033         done.  
13034
13035         The previous fixed dropped support for boxed conversions (adding a
13036         test to the test suite now)
13037
13038         (UserImplicitCast::CanConvert): Remove test for source being null,
13039         that code is broken.  We should not feed a null to begin with, if
13040         we do, then we should track the bug where the problem originates
13041         and not try to cover it up here.
13042
13043         Return a resolved expression of type UserImplicitCast on success
13044         rather than true/false.  Ravi: this is what I was talking about,
13045         the pattern is to use a static method as a "constructor" for
13046         objects. 
13047
13048         Also, do not create arguments until the very last minute,
13049         otherwise we always create the arguments even for lookups that
13050         will never be performed. 
13051
13052         (UserImplicitCast::Resolve): Eliminate, objects of type
13053         UserImplicitCast are born in a fully resolved state. 
13054         
13055         * typemanager.cs (InitCoreTypes): Init also value_type
13056         (System.ValueType). 
13057
13058         * expression.cs (Cast::Resolve): First resolve the child expression.
13059
13060         (LValue): Add new method AddressOf to be used by
13061         the `&' operator.  
13062
13063         Change the argument of Store to take an EmitContext instead of an
13064         ILGenerator, because things like FieldExpr need to be able to call
13065         their children expression to generate the instance code. 
13066
13067         (Expression::Error, Expression::Warning): Sugar functions for
13068         reporting errors.
13069
13070         (Expression::MemberLookup): Accept a TypeContainer instead of a
13071         Report as the first argument.
13072
13073         (Expression::ResolvePrimary): Killed.  I still want to improve
13074         this as currently the code is just not right.
13075
13076         (Expression::ResolveMemberAccess): Simplify, but it is still
13077         wrong. 
13078
13079         (Unary::Resolve): Catch errors in AddressOf operators.
13080
13081         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
13082         index to a byte for the short-version, or the compiler will choose
13083         the wrong Emit call, which generates the wrong data.
13084
13085         (ParameterReference::Emit, ::Store): same.
13086
13087         (FieldExpr::AddressOf): Implement.
13088         
13089         * typemanager.cs: TypeManager: made public variable instead of
13090         property.
13091         
13092         * driver.cs: document --fatal.
13093
13094         * report.cs (ErrorMessage, WarningMessage): new names for the old
13095         Error and Warning classes.
13096
13097         * cs-parser.jay (member_access): Turn built-in access to types
13098         into a normal simplename
13099
13100 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13101
13102         * expression.cs (Invocation::BetterConversion): Fix to cope
13103         with q being null, since this was introducing a bug.
13104
13105         * expression.cs (ConvertImplicit): Do built-in conversions first.
13106
13107 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13108
13109         * expression.cs (UserImplicitCast::Resolve): Fix bug.
13110
13111 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13112
13113         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
13114         I had introduced long ago (what's new ?).
13115
13116         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
13117         the work of all the checking. 
13118         (ConvertImplicit): Call CanConvert and only then create object if necessary.
13119         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
13120
13121         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
13122         that is the right way. 
13123
13124         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
13125         overloading resolution. Use everywhere instead of cutting and pasting code.
13126
13127         (Binary::ResolveOperator): Use MakeUnionSet.
13128
13129         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
13130         we have to convert to bool types. Not complete yet.
13131         
13132 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
13133
13134         * typemanager.cs (TypeManager::CSharpName): support ushort.
13135
13136         * expression.cs (Expression::TryImplicitIntConversion): Attempts
13137         to provide an expression that performsn an implicit constant int
13138         conversion (section 6.1.6).
13139         (Expression::ConvertImplicitRequired): Reworked to include
13140         implicit constant expression conversions.
13141
13142         (Expression::ConvertNumericExplicit): Finished.
13143
13144         (Invocation::Emit): If InstanceExpression is null, then it means
13145         that we perform a call on this.
13146         
13147 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
13148
13149         * expression.cs (Unary::Emit): Remove some dead code.
13150         (Probe): Implement Resolve and Emit for `is'.
13151         (Expression::ConvertImplicitRequired): Attempt to do constant
13152         expression conversions here.  Maybe should be moved to
13153         ConvertImplicit, but I am not sure.
13154         (Expression::ImplicitLongConstantConversionPossible,
13155         Expression::ImplicitIntConstantConversionPossible): New functions
13156         that tell whether is it possible to apply an implicit constant
13157         expression conversion.
13158
13159         (ConvertNumericExplicit): Started work on explicit numeric
13160         conversions.
13161
13162         * cs-parser.jay: Update operator constants.
13163
13164         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
13165         (Parameters::GetSignature): Hook up VerifyArgs here.
13166         (Parameters::VerifyArgs): Verifies that no two arguments have the
13167         same name. 
13168
13169         * class.cs (Operator): Update the operator names to reflect the
13170         ones that the spec expects (as we are just stringizing the
13171         operator names).
13172         
13173         * expression.cs (Unary::ResolveOperator): Fix bug: Use
13174         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
13175         previous usage did only work for our methods.
13176         (Expression::ConvertImplicit): Handle decimal implicit numeric
13177         conversions as well.
13178         (Expression::InternalTypeConstructor): Used to invoke constructors
13179         on internal types for default promotions.
13180
13181         (Unary::Emit): Implement special handling for the pre/post
13182         increment/decrement for overloaded operators, as they need to have
13183         the same semantics as the other operators.
13184
13185         (Binary::ResolveOperator): ditto.
13186         (Invocation::ConversionExists): ditto.
13187         (UserImplicitCast::Resolve): ditto.
13188         
13189 2001-09-26  Ravi Pratap  <ravi@ximian.com>
13190
13191         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
13192         operator, return after emitting body. Regression tests pass again !
13193
13194         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
13195         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
13196         (Invocation::OverloadResolve): Ditto.
13197         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
13198
13199         * everywhere : update calls to the above methods accordingly.
13200
13201 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
13202
13203         * assign.cs (Assign): Make it inherit from ExpressionStatement.
13204
13205         * expression.cs (ExpressionStatement): New base class used for
13206         expressions that can appear in statements, so that we can provide
13207         an alternate path to generate expression that do not leave a value
13208         on the stack.
13209
13210         (Expression::Emit, and all the derivatives): We no longer return
13211         whether a value is left on the stack or not.  Every expression
13212         after being emitted leaves a single value on the stack.
13213
13214         * codegen.cs (EmitContext::EmitStatementExpression): Use the
13215         facilties of ExpressionStatement if possible.
13216
13217         * cs-parser.jay: Update statement_expression.
13218
13219 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
13220
13221         * driver.cs: Change the wording of message
13222
13223 2001-09-25  Ravi Pratap  <ravi@ximian.com>
13224
13225         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
13226         the type of the expression to the return type of the method if
13227         we have an overloaded operator match ! The regression tests pass again !
13228         (Unary::ResolveOperator): Ditto.
13229
13230         * expression.cs (Invocation::ConversionExists): Correct the member lookup
13231         to find "op_Implicit", not "implicit" ;-)
13232         (UserImplicitCast): New class to take care of user-defined implicit conversions.
13233         (ConvertImplicit, ForceConversion): Take TypeContainer argument
13234
13235         * everywhere : Correct calls to the above accordingly.
13236
13237         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
13238         (ConvertImplicit): Do user-defined conversion if it exists.
13239
13240 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
13241
13242         * assign.cs: track location.
13243         (Resolve): Use implicit conversions on assignment.
13244
13245         * literal.cs: Oops.  Not good, Emit of short access values should
13246         pass (Bytes) or the wrong argument will be selected.
13247
13248         * expression.cs (Unary::Emit): Emit code for -expr.
13249         
13250         (Unary::ResolveOperator): Handle `Substract' for non-constants
13251         (substract from zero from the non-constants).
13252         Deal with Doubles as well. 
13253         
13254         (Expression::ConvertImplicitRequired): New routine that reports an
13255         error if no implicit conversion exists. 
13256
13257         (Invocation::OverloadResolve): Store the converted implicit
13258         expressions if we make them
13259         
13260 2001-09-24  Ravi Pratap  <ravi@ximian.com>
13261
13262         * class.cs (ConstructorInitializer): Take a Location argument.
13263         (ConstructorBaseInitializer): Same here.
13264         (ConstructorThisInitializer): Same here.
13265
13266         * cs-parser.jay : Update all calls accordingly.
13267
13268         * expression.cs (Unary, Binary, New): Take location argument.
13269         Update accordingly everywhere.
13270
13271         * cs-parser.jay : Update all calls to the above to take a location
13272         argument.
13273
13274         * class.cs : Ditto.
13275
13276 2001-09-24  Ravi Pratap  <ravi@ximian.com>
13277
13278         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
13279         (Invocation::BetterConversion): Same here
13280         (Invocation::ConversionExists): Ditto.
13281
13282         (Invocation::ConversionExists): Implement.
13283
13284 2001-09-22  Ravi Pratap  <ravi@ximian.com>
13285
13286         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
13287         Also take an additional TypeContainer argument.
13288
13289         * All over : Pass in TypeContainer as argument to OverloadResolve.
13290
13291         * typemanager.cs (CSharpName): Update to check for the string type and return
13292         that too.
13293
13294         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
13295         a given method.
13296         
13297 2001-09-21  Ravi Pratap  <ravi@ximian.com>
13298
13299         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
13300         (Invocation::BetterFunction): Implement.
13301         (Invocation::BetterConversion): Implement.
13302         (Invocation::ConversionExists): Skeleton, no implementation yet.
13303
13304         Okay, things work fine !
13305
13306 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
13307
13308         * typemanager.cs: declare and load enum_type, delegate_type and
13309         void_type. 
13310
13311         * expression.cs (Expression::Emit): Now emit returns a value that
13312         tells whether a value is left on the stack or not.  This strategy
13313         might be reveted tomorrow with a mechanism that would address
13314         multiple assignments.
13315         (Expression::report118): Utility routine to report mismatches on
13316         the ExprClass.
13317
13318         (Unary::Report23): Report impossible type/operator combination
13319         utility function.
13320
13321         (Unary::IsIncrementableNumber): Whether the type can be
13322         incremented or decremented with add.
13323         (Unary::ResolveOperator): Also allow enumerations to be bitwise
13324         complemented. 
13325         (Unary::ResolveOperator): Implement ++, !, ~,
13326
13327         (Invocation::Emit): Deal with new Emit convetion.
13328         
13329         * All Expression derivatives: Updated their Emit method to return
13330         whether they leave values on the stack or not.
13331         
13332         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
13333         stack for expressions that are statements. 
13334
13335 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
13336
13337         * expression.cs (LValue): New interface.  Must be implemented by
13338         LValue objects.
13339         (LocalVariableReference, ParameterReference, FieldExpr): Implement
13340         LValue interface.
13341         
13342         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
13343         interface for generating code, simplifies the code.
13344
13345 2001-09-20  Ravi Pratap  <ravi@ximian.com>
13346
13347         * expression.cs (everywhere): Comment out return statements in ::Resolve
13348         methods to avoid the warnings.
13349
13350 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
13351
13352         * driver.cs (parse): Report error 2001 if we can not open the
13353         source file.
13354
13355         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
13356         not resolve it.
13357
13358         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
13359         object. 
13360
13361         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
13362         otherwise nested blocks end up with the same index.
13363
13364         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
13365
13366         * expression.cs:  Instead of having FIXMEs in the Resolve
13367         functions, throw exceptions so it is obvious that we are facing a
13368         bug. 
13369
13370         * cs-parser.jay (invocation_expression): Pass Location information.
13371
13372         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
13373         Use a basename for those routines because .NET does not like paths
13374         on them. 
13375
13376         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
13377         already defined.
13378
13379 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
13380
13381         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
13382         are loading the correct data types (throws an exception if not).
13383         (TypeManager::InitCoreTypes): Use CoreLookupType
13384
13385         * expression.cs (Unary::ResolveOperator): return the child
13386         expression for expressions which are just +expr.
13387         (Unary::ResolveOperator): Return negative literals for -LITERAL
13388         expressions (otherwise they are Unary {Literal}).
13389         (Invocation::Badness): Take into account `Implicit constant
13390         expression conversions'.
13391
13392         * literal.cs (LongLiteral): Implement long literal class.
13393         (IntLiteral): export the `Value' of the intliteral. 
13394
13395 2001-09-19  Ravi Pratap  <ravi@ximian.com>
13396
13397         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
13398
13399         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
13400         instead of 'Operator'
13401
13402         * expression.cs (Binary::ResolveOperator): Update accordingly.
13403         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
13404         and 'Minus'
13405
13406         * cs-parser.jay (unary_expression): Update to use the new names.
13407
13408         * gen-treedump.cs (GetUnary): Same here.
13409
13410         * expression.cs (Unary::Resolve): Implement.
13411         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
13412         operators are found instead of making noise ;-)
13413         (Unary::ResolveOperator): New method to do precisely the same thing which
13414         Binary::ResolveOperator does for Binary expressions.
13415         (Unary.method, .Arguments): Add.
13416         (Unary::OperName): Implement.   
13417         (Unary::ForceConversion): Copy and Paste !
13418
13419         * class.cs (Operator::Define): Fix a small bug for the case when we have 
13420         a unary operator.
13421
13422         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
13423         for the inbuilt operators. Only overloading works for now ;-)
13424
13425 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
13426
13427         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
13428         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
13429
13430         * expression.cs (This::Emit): Implement. 
13431         (This::Resolve): Implement.
13432         (TypeOf:Resolve): Implement.
13433         (Expression::ResolveSimpleName): Add an implicit this to instance
13434         field references. 
13435         (MemberAccess::Resolve): Deal with Parameters and Fields. 
13436         Bind instance variable to Field expressions.
13437         (FieldExpr::Instance): New field used to track the expression that
13438         represents the object instance.
13439         (FieldExpr::Resolve): Track potential errors from MemberLookup not
13440         binding 
13441         (FieldExpr::Emit): Implement.
13442
13443         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
13444         the last instruction contains a return opcode to avoid generating
13445         the last `ret' instruction (this generates correct code, and it is
13446         nice to pass the peverify output).
13447
13448         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
13449         initializer for static and instance variables.
13450         (Constructor::Emit): Allow initializer to be null in the case of
13451         static constructors.  Only emit initializer for instance
13452         constructors. 
13453
13454         (TypeContainer::FindMembers): Return a null array if there are no
13455         matches.
13456
13457         Also fix the code for the MemberTypes.Method branch, as it was not
13458         scanning that for operators (or tried to access null variables before).
13459
13460         * assign.cs (Assign::Emit): Handle instance and static fields. 
13461
13462         * TODO: Updated.
13463
13464         * driver.cs: Stop compilation if there are parse errors.
13465
13466         * cs-parser.jay (constructor_declaration): Provide default base
13467         initializer for non-static constructors.
13468         (constructor_declarator): Do not provide a default base
13469         initializers if none was specified.
13470         Catch the fact that constructors should not have parameters.
13471
13472         * class.cs: Do not emit parent class initializers for static
13473         constructors, that should be flagged as an error.
13474
13475 2001-09-18  Ravi Pratap  <ravi@ximian.com>
13476
13477         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
13478         Move back code into TypeContainer::Populate.
13479
13480 2001-09-18  Ravi Pratap  <ravi@ximian.com>
13481
13482         * class.cs (TypeContainer::AddConstructor): Fix the check to
13483         compare against Name, not Basename. 
13484         (Operator::OpType): Change Plus and Minus to Add and Subtract.
13485
13486         * cs-parser.jay : Update accordingly.
13487
13488         * class.cs (TypeContainer::FindMembers): For the case where we are searching
13489         for methods, don't forget to look into the operators too.
13490         (RegisterMethodBuilder): Helper method to take care of this for
13491         methods, constructors and operators.
13492         (Operator::Define): Completely revamp.
13493         (Operator.OperatorMethod, MethodName): New fields.
13494         (TypeContainer::Populate): Move the registering of builders into
13495         RegisterMethodBuilder.
13496         (Operator::Emit): Re-write.
13497
13498         * expression.cs (Binary::Emit): Comment out code path to emit method
13499         invocation stuff for the case when we have a user defined operator. I am
13500         just not able to get it right !
13501         
13502 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
13503
13504         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
13505         argument. 
13506
13507         (Expression::MemberLookup): Provide a version that allows to
13508         specify the MemberTypes and BindingFlags. 
13509
13510         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
13511         so it was not fetching variable information from outer blocks.
13512
13513         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
13514         Beforefieldinit as it was buggy.
13515
13516         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
13517         that Ravi put here.  
13518
13519         * class.cs (Constructor::Emit): Only emit if block is not null.
13520         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
13521         deal with this by semantically definining it as if the user had
13522         done it.
13523
13524         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
13525         constructors as we now "emit" them at a higher level.
13526
13527         (TypeContainer::DefineDefaultConstructor): Used to define the
13528         default constructors if none was provided.
13529
13530         (ConstructorInitializer): Add methods Resolve and Emit. 
13531         
13532         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
13533
13534 2001-09-17  Ravi Pratap  <ravi@ximian.com>
13535
13536         * class.cs (TypeContainer::EmitDefaultConstructor): Register
13537         the default constructor builder with our hashtable for methodbuilders
13538         to methodcores.
13539
13540         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
13541         and argument_count is 0 in which case we have a match.
13542         (Binary::ResolveOperator): More null checking and miscellaneous coding
13543         style cleanup.
13544
13545 2001-09-17  Ravi Pratap  <ravi@ximian.com>
13546
13547         * rootcontext.cs (IsNameSpace): Compare against null.
13548
13549         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
13550
13551         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
13552         and Unary::Operator.
13553
13554         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
13555         accordingly.
13556
13557         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
13558         we have overloaded operators.
13559         (Binary::ResolveOperator): Implement the part which does the operator overload
13560         resolution.
13561
13562         * class.cs (Operator::Emit): Implement.
13563         (TypeContainer::Emit): Emit the operators we have too.
13564
13565         * expression.cs (Binary::Emit): Update to emit the appropriate code for
13566         the case when we have a user-defined operator.
13567         
13568 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
13569
13570         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
13571
13572 2001-09-16  Ravi Pratap  <ravi@ximian.com>
13573
13574         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
13575         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
13576         (Constructor::Emit): Implement.
13577         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
13578         if we have no work to do. 
13579         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
13580         Emit method.
13581
13582         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
13583         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
13584
13585         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
13586         of parent.parent.
13587
13588 2001-09-15  Ravi Pratap  <ravi@ximian.com>
13589
13590         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
13591         in the source.
13592         (Tree::RecordNamespace): Method to do what the name says ;-)
13593         (Tree::Namespaces): Property to get at the namespaces hashtable.
13594
13595         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
13596         keep track.
13597
13598         * rootcontext.cs (IsNamespace): Fixed it :-)
13599
13600 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
13601
13602         * class.cs (TypeContainer::FindMembers): Add support for
13603         constructors. 
13604         (MethodCore): New class that encapsulates both the shared aspects
13605         of a Constructor and a Method.  
13606         (Method, Constructor): Factored pieces into MethodCore.
13607
13608         * driver.cs: Added --fatal which makes errors throw exceptions.
13609         Load System assembly as well as part of the standard library.
13610
13611         * report.cs: Allow throwing exceptions on errors for debugging.
13612
13613         * modifiers.cs: Do not use `parent', instead use the real type
13614         container to evaluate permission settings.
13615
13616         * class.cs: Put Ravi's patch back in.  He is right, and we will
13617         have to cope with the
13618
13619 2001-09-14  Ravi Pratap  <ravi@ximian.com>
13620
13621         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
13622         FamORAssem, not FamANDAssem.
13623         
13624 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
13625
13626         * driver.cs: Added --parse option that only parses its input files
13627         and terminates.
13628
13629         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
13630         incorrect.  IsTopLevel is not used to tell whether an object is
13631         root_types or not (that can be achieved by testing this ==
13632         root_types).  But to see if this is a top-level *class* (not
13633         necessarly our "toplevel" container). 
13634
13635 2001-09-14  Ravi Pratap  <ravi@ximian.com>
13636
13637         * enum.cs (Enum::Define): Modify to call the Lookup method on the
13638         parent instead of a direct call to GetType.
13639
13640 2001-09-14  Ravi Pratap  <ravi@ximian.com>
13641
13642         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
13643         Modifiers.TypeAttr. This should just be a call to that method.
13644
13645         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
13646         object so that we can determine if we are top-level or not.
13647
13648         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
13649         TypeContainer too.
13650
13651         * enum.cs (Enum::Define): Ditto.
13652
13653         * modifiers.cs (FieldAttr): Re-write.
13654
13655         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
13656         (TypeContainer::HaveStaticConstructor): New property to provide access
13657         to precisely that info.
13658
13659         * modifiers.cs (MethodAttr): Re-write.
13660         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
13661
13662         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
13663         of top-level types as claimed.
13664         
13665 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
13666
13667         * expression.cs (MemberLookup): Fruitless attempt to lookup
13668         constructors.  Maybe I need to emit default constructors?  That
13669         might be it (currently .NET emits this for me automatically).
13670         (Invocation::OverloadResolve): Cope with Arguments == null.
13671         (Invocation::EmitArguments): new function, shared by the new
13672         constructor and us.
13673         (Invocation::Emit): Handle static and instance methods.  Emit
13674         proper call instruction for virtual or non-virtual invocations.
13675         (New::Emit): Implement.
13676         (New::Resolve): Implement.
13677         (MemberAccess:Resolve): Implement.
13678         (MethodGroupExpr::InstanceExpression): used conforming to the spec
13679         to track instances.
13680         (FieldExpr::Resolve): Set type.
13681
13682         * support.cs: Handle empty arguments.
13683                 
13684         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
13685         SimpleLookup): Auxiliary routines to help parse a qualifier
13686         identifier.  
13687
13688         Update qualifier_identifier rule.
13689
13690         * codegen.cs: Removed debugging messages.
13691
13692         * class.cs: Make this a global thing, this acts just as a "key" to
13693         objects that we might have around.
13694
13695         (Populate): Only initialize method_builders_to_methods once.
13696
13697         * expression.cs (PropertyExpr): Initialize type from the
13698         PropertyType. 
13699
13700         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
13701         Resolve pattern.  Attempt to implicitly convert value to boolean.
13702         Emit code.
13703
13704         * expression.cs: Set the type for the int32/int32 argument case.
13705         (Binary::ResolveOperator): Set the return type to boolean for
13706         comparission operators
13707
13708         * typemanager.cs: Remove debugging print code.
13709
13710         (Invocation::Resolve): resolve type.
13711
13712         * class.cs: Allocate a MemberInfo of the correct size, as the code
13713         elsewhere depends on the test to reflect the correct contents.
13714
13715         (Method::) Keep track of parameters, due to System.Reflection holes
13716
13717         (TypeContainer::Populate): Keep track of MethodBuilders to Method
13718         mapping here.
13719
13720         (TypeContainer::FindMembers): Use ArrayList and then copy an array
13721         of the exact size and return that.
13722
13723         (Class::LookupMethodByBuilder): New function that maps
13724         MethodBuilders to its methods.  Required to locate the information
13725         on methods because System.Reflection bit us again.
13726
13727         * support.cs: New file, contains an interface ParameterData and
13728         two implementations: ReflectionParameters and InternalParameters
13729         used to access Parameter information.  We will need to grow this
13730         as required.
13731
13732         * expression.cs (Invocation::GetParameterData): implement a cache
13733         and a wrapper around the ParameterData creation for methods. 
13734         (Invocation::OverloadResolve): Use new code.
13735
13736 2001-09-13  Ravi Pratap  <ravi@ximian.com>
13737
13738         * class.cs (TypeContainer::EmitField): Remove and move into 
13739         (Field::Define): here and modify accordingly.
13740         (Field.FieldBuilder): New member.
13741         (TypeContainer::Populate): Update accordingly.
13742         (TypeContainer::FindMembers): Implement.
13743
13744 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
13745
13746         * statement.cs: (VariableInfo::VariableType): New field to be
13747         initialized with the full type once it is resolved. 
13748
13749 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
13750
13751         * parameter.cs (GetParameterInfo): Use a type cache to compute
13752         things only once, and to reuse this information
13753
13754         * expression.cs (LocalVariableReference::Emit): Implement.
13755         (OpcodeCast::Emit): fix.
13756
13757         (ParameterReference::Resolve): Implement.
13758         (ParameterReference::Emit): Implement.
13759
13760         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
13761         that are expressions need to stay as Expressions.
13762
13763         * typemanager.cs (CSharpName): Returns the C# name of a type if
13764         possible. 
13765
13766         * expression.cs (Expression::ConvertImplicit): New function that
13767         implements implicit type conversions.
13768
13769         (Expression::ImplicitReferenceConversion): Implements implicit
13770         reference conversions.
13771
13772         (EmptyCast): New type for transparent casts.
13773
13774         (OpcodeCast): New type for casts of types that are performed with
13775         a sequence of bytecodes.
13776         
13777         (BoxedCast): New type used for casting value types into reference
13778         types.  Emits a box opcode.
13779
13780         (Binary::DoNumericPromotions): Implements numeric promotions of
13781         and computation of the Binary::Type.
13782
13783         (Binary::EmitBranchable): Optimization.
13784
13785         (Binary::Emit): Implement code emission for expressions.
13786         
13787         * typemanager.cs (TypeManager): Added two new core types: sbyte
13788         and byte.
13789
13790 2001-09-12  Ravi Pratap  <ravi@ximian.com>
13791
13792         * class.cs (TypeContainer::FindMembers): Method which does exactly
13793         what Type.FindMembers does, only we don't have to use reflection. No
13794         implementation yet.
13795
13796         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
13797         typecontainer objects as we need to get at them.
13798         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
13799
13800         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
13801         typecontainer object.
13802
13803         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
13804         of just a Report object.
13805
13806 2001-09-11  Ravi Pratap  <ravi@ximian.com>
13807
13808         * class.cs (Event::Define): Go back to using the prefixes "add_" and
13809         "remove_"
13810         (TypeContainer::Populate): Now define the delegates of the type too.
13811         (TypeContainer.Delegates): Property to access the list of delegates defined
13812         in the type.
13813
13814         * delegates.cs (Delegate::Define): Implement partially.
13815
13816         * modifiers.cs (TypeAttr): Handle more flags.
13817
13818 2001-09-11  Ravi Pratap  <ravi@ximian.com>
13819
13820         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
13821         and not <=
13822         (Operator::Define): Re-write logic to get types by using the LookupType method
13823         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
13824         (Indexer::Define): Ditto.
13825         (Event::Define): Ditto.
13826         (Property::Define): Ditto.
13827         
13828 2001-09-10  Ravi Pratap  <ravi@ximian.com>
13829
13830         * class.cs (TypeContainer::Populate): Now define operators too. 
13831         (TypeContainer.Operators): New property to access the list of operators
13832         in a type.
13833         (Operator.OperatorMethodBuilder): New member to hold the method builder
13834         for the operator we are defining.
13835         (Operator::Define): Implement.
13836
13837 2001-09-10  Ravi Pratap  <ravi@ximian.com>
13838
13839         * class.cs (Event::Define): Make the prefixes of the accessor methods
13840         addOn_ and removeOn_ 
13841
13842         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
13843         of the location being passed in too. Ideally, this should go later since all
13844         error reporting should be done through the Report object.
13845
13846         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
13847         (Populate): Iterate thru the indexers we have and define them too.
13848         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
13849         for the get and set accessors.
13850         (Indexer::Define): Implement.
13851         
13852 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
13853
13854         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
13855         my previous implementation, did not work.
13856
13857         * typemanager.cs: Add a couple of missing types (the longs).
13858
13859         * literal.cs: Use TypeManager.bool_type instead of getting it.
13860
13861         * expression.cs (EventExpr): New kind of expressions.
13862         (Expressio::ExprClassFromMemberInfo): finish
13863
13864 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
13865
13866         * assign.cs: Emit stores to static fields differently.
13867
13868 2001-09-08  Ravi Pratap  <ravi@ximian.com>
13869
13870         * Merge in changes and adjust code to tackle conflicts. Backed out my
13871         code in Assign::Resolve ;-) 
13872
13873 2001-09-08  Ravi Pratap  <ravi@ximian.com>
13874
13875         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
13876         instead Report.Error and also pass in the location.
13877         (CSharpParser::Lexer): New readonly property to return the reference
13878         to the Tokenizer object.
13879         (declare_local_variables): Use Report.Error with location instead of plain 
13880         old error.
13881         (CheckDef): Ditto.
13882
13883         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
13884         (Operator.CheckBinaryOperator): Ditto.
13885
13886         * cs-parser.jay (operator_declarator): Update accordingly.
13887
13888         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
13889         (CheckBinaryOperator): Same here.
13890
13891         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
13892         on the name without any prefixes of namespace names etc. This is because we
13893         already might have something already fully qualified like 
13894         'System.Console.WriteLine'
13895
13896         * assign.cs (Resolve): Begin implementation. Stuck ;-)
13897
13898 2001-09-07  Ravi Pratap  <ravi@ximian.com>
13899
13900         * cs-tokenizer.cs (location): Return a string which also contains
13901         the file name.
13902
13903         * expression.cs (ElementAccess): New class for expressions of the
13904         type 'element access.'
13905         (BaseAccess): New class for expressions of the type 'base access.'
13906         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
13907         respectively.
13908         
13909         * cs-parser.jay (element_access): Implement action.
13910         (base_access): Implement actions.
13911         (checked_expression, unchecked_expression): Implement.
13912
13913         * cs-parser.jay (local_variable_type): Correct and implement.
13914         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
13915
13916         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
13917
13918         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
13919         name and the specifiers.
13920
13921         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
13922         
13923         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
13924         making them all public ;-)
13925
13926         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
13927         class anyways.
13928         
13929 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
13930
13931         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
13932         PropertyExprs.
13933         (FieldExpr, PropertyExprs): New resolved expressions.
13934         (SimpleName::MemberStaticCheck): Perform static checks for access
13935         to non-static fields on static methods. Maybe this should be
13936         generalized for MemberAccesses. 
13937         (SimpleName::ResolveSimpleName): More work on simple name
13938         resolution. 
13939
13940         * cs-parser.jay (primary_expression/qualified_identifier): track
13941         the parameter index.
13942
13943         * codegen.cs (CodeGen::Save): Catch save exception, report error.
13944         (EmitContext::EmitBoolExpression): Chain to expression generation
13945         instead of temporary hack.
13946         (::EmitStatementExpression): Put generic expression code generation.
13947
13948         * assign.cs (Assign::Emit): Implement variable assignments to
13949         local variables, parameters and fields.
13950
13951 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
13952
13953         * statement.cs (Block::GetVariableInfo): New method, returns the
13954         VariableInfo for a variable name in a block.
13955         (Block::GetVariableType): Implement in terms of GetVariableInfo
13956
13957         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
13958         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
13959
13960 2001-09-06  Ravi Pratap  <ravi@ximian.com>
13961
13962         * cs-parser.jay (operator_declaration): Continue on my quest : update
13963         to take attributes argument.
13964         (event_declaration): Ditto.
13965         (enum_declaration): Ditto.
13966         (indexer_declaration): Ditto.
13967         
13968         * class.cs (Operator::Operator): Update constructor accordingly.
13969         (Event::Event): Ditto.
13970
13971         * delegate.cs (Delegate::Delegate): Same here.
13972
13973         * enum.cs (Enum::Enum): Same here.
13974         
13975 2001-09-05  Ravi Pratap  <ravi@ximian.com>
13976
13977         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
13978
13979         * ../tests/cs0658.cs : New file to demonstrate error 0658.
13980
13981         * attribute.cs (Attributes): New class to encapsulate all attributes which were
13982         being passed around as an arraylist.
13983         (Attributes::AddAttribute): Method to add attribute sections.
13984
13985         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
13986         (struct_declaration): Update accordingly.
13987         (constant_declaration): Update.
13988         (field_declaration): Update.
13989         (method_header): Update.
13990         (fixed_parameter): Update.
13991         (parameter_array): Ditto.
13992         (property_declaration): Ditto.
13993         (destructor_declaration): Ditto.
13994         
13995         * class.cs (Struct::Struct): Update constructors accordingly.
13996         (Class::Class): Ditto.
13997         (Field::Field): Ditto.
13998         (Method::Method): Ditto.
13999         (Property::Property): Ditto.
14000         (TypeContainer::OptAttribute): update property's return type.
14001         
14002         * interface.cs (Interface.opt_attributes): New member.
14003         (Interface::Interface): Update to take the extra Attributes argument.
14004
14005         * parameter.cs (Parameter::Parameter): Ditto.
14006
14007         * constant.cs (Constant::Constant): Ditto.
14008
14009         * interface.cs (InterfaceMemberBase): New OptAttributes field.
14010         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
14011         the attributes as a parameter.
14012         (InterfaceProperty): Update constructor call.
14013         (InterfaceEvent): Ditto.
14014         (InterfaceMethod): Ditto.
14015         (InterfaceIndexer): Ditto.
14016
14017         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
14018         pass the attributes too.
14019         (interface_event_declaration): Ditto.
14020         (interface_property_declaration): Ditto.
14021         (interface_method_declaration): Ditto.
14022         (interface_declaration): Ditto.
14023
14024 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
14025
14026         * class.cs (Method::Define): Track the "static Main" definition to
14027         create an entry point. 
14028
14029         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
14030         EntryPoint if we find it. 
14031
14032         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
14033         (EmitContext::ig): Make this variable public.
14034
14035         * driver.cs: Make the default output file be the first file name
14036         with the .exe extension.  
14037
14038         Detect empty compilations
14039
14040         Handle various kinds of output targets.  Handle --target and
14041         rename -t to --dumper.
14042
14043         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
14044         methods inherited from Expression return now an Expression.  This
14045         will is used during the tree rewriting as we resolve them during
14046         semantic analysis.
14047
14048         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
14049         the spec.  Missing entirely is the information about
14050         accessability of elements of it.
14051
14052         (Expression::ExprClassFromMemberInfo): New constructor for
14053         Expressions that creates a fully initialized Expression based on
14054         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
14055         a Type.
14056
14057         (Invocation::Resolve): Begin implementing resolution of invocations.
14058         
14059         * literal.cs (StringLiteral):  Implement Emit.
14060
14061 2001-09-05  Ravi Pratap  <ravi@ximian.com>
14062
14063         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
14064         member.
14065         
14066 2001-09-04  Ravi Pratap  <ravi@ximian.com>
14067
14068         * cs-parser.jay (attribute_arguments): Implement actions.
14069         (attribute): Fix bug in production. Implement action.
14070         (attribute_list): Implement.
14071         (attribute_target): Implement.
14072         (attribute_target_specifier, opt_target_specifier): Implement
14073         (CheckAttributeTarget): New method to check if the attribute target
14074         is valid.
14075         (attribute_section): Implement.
14076         (opt_attributes): Implement.
14077
14078         * attribute.cs : New file to handle attributes.
14079         (Attribute): Class to hold attribute info.
14080
14081         * cs-parser.jay (opt_attribute_target_specifier): Remove production
14082         (attribute_section): Modify production to use 2 different rules to 
14083         achieve the same thing. 1 s/r conflict down !
14084         Clean out commented, useless, non-reducing dimension_separator rules.
14085         
14086         * class.cs (TypeContainer.attributes): New member to hold list
14087         of attributes for a type.
14088         (Struct::Struct): Modify to take one more argument, the attribute list.
14089         (Class::Class): Ditto.
14090         (Field::Field): Ditto.
14091         (Method::Method): Ditto.
14092         (Property::Property): Ditto.
14093         
14094         * cs-parser.jay (struct_declaration): Update constructor call to
14095         pass in the attributes too.
14096         (class_declaration): Ditto.
14097         (constant_declaration): Ditto.
14098         (field_declaration): Ditto.
14099         (method_header): Ditto.
14100         (fixed_parameter): Ditto.
14101         (parameter_array): Ditto.
14102         (property_declaration): Ditto.
14103
14104         * constant.cs (Constant::Constant): Update constructor similarly.
14105         Use System.Collections.
14106
14107         * parameter.cs (Parameter::Parameter): Update as above.
14108
14109 2001-09-02  Ravi Pratap  <ravi@ximian.com>
14110
14111         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
14112         (TypeContainer.delegates): New member to hold list of delegates.
14113
14114         * cs-parser.jay (delegate_declaration): Implement the action correctly 
14115         this time as I seem to be on crack ;-)
14116
14117 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
14118
14119         * rootcontext.cs (RootContext::IsNamespace): new function, used to
14120         tell whether an identifier represents a namespace.
14121
14122         * expression.cs (NamespaceExpr): A namespace expression, used only
14123         temporarly during expression resolution.
14124         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
14125         utility functions to resolve names on expressions.
14126
14127 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
14128
14129         * codegen.cs: Add hook for StatementExpressions. 
14130
14131         * class.cs: Fix inverted test for static flag in methods.
14132
14133 2001-09-02  Ravi Pratap  <ravi@ximian.com>
14134
14135         * class.cs (Operator::CheckUnaryOperator): Correct error number used
14136         to make it coincide with MS' number.
14137         (Operator::CheckBinaryOperator): Ditto.
14138
14139         * ../errors/errors.txt : Remove error numbers added earlier.
14140
14141         * ../errors/cs1019.cs : Test case for error # 1019
14142
14143         * ../errros/cs1020.cs : Test case for error # 1020
14144
14145         * cs-parser.jay : Clean out commented cruft.
14146         (dimension_separators, dimension_separator): Comment out. Ostensibly not
14147         used anywhere - non-reducing rule.
14148         (namespace_declarations): Non-reducing rule - comment out.
14149
14150         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
14151         with TypeContainer::AddEnum.
14152
14153         * delegate.cs : New file for delegate handling classes.
14154         (Delegate): Class for declaring delegates.
14155
14156         * makefile : Update.
14157
14158         * cs-parser.jay (delegate_declaration): Implement.
14159
14160 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
14161
14162         * class.cs (Event::Define): Implement.
14163         (Event.EventBuilder): New member.
14164
14165         * class.cs (TypeContainer::Populate): Update to define all enums and events
14166         we have.
14167         (Events): New property for the events arraylist we hold. Shouldn't we move to using
14168         readonly fields for all these cases ?
14169
14170 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
14171
14172         * class.cs (Property): Revamp to use the convention of making fields readonly.
14173         Accordingly modify code elsewhere.
14174
14175         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
14176         the Define method of the Property class.
14177
14178         * class.cs : Clean up applied patch and update references to variables etc. Fix 
14179         trivial bug.
14180         (TypeContainer::Populate): Update to define all the properties we have. Also
14181         define all enumerations.
14182
14183         * enum.cs (Define): Implement.
14184         
14185 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
14186
14187         * cs-parser.jay (overloadable_operator): The semantic value is an
14188         enum of the Operator class.
14189         (operator_declarator): Implement actions.
14190         (operator_declaration): Implement.
14191
14192         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
14193         validity of definitions.
14194         (Operator::CheckBinaryOperator): Static method to check for binary operators
14195         (TypeContainer::AddOperator): New method to add an operator to a type.
14196
14197         * cs-parser.jay (indexer_declaration): Added line to actually call the
14198         AddIndexer method so it gets added ;-)
14199
14200         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
14201         already taken care of by the MS compiler ?  
14202
14203 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
14204
14205         * class.cs (Operator): New class for operator declarations.
14206         (Operator::OpType): Enum for the various operators.
14207
14208 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
14209
14210         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
14211         ostensibly handle this in semantic analysis.
14212
14213         * cs-parser.jay (general_catch_clause): Comment out
14214         (specific_catch_clauses, specific_catch_clause): Ditto.
14215         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
14216         (catch_args, opt_catch_args): New productions.
14217         (catch_clause): Rewrite to use the new productions above
14218         (catch_clauses): Modify accordingly.
14219         (opt_catch_clauses): New production to use in try_statement
14220         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
14221         and re-write the code in the actions to extract the specific and
14222         general catch clauses by being a little smart ;-)
14223
14224         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
14225         Hooray, try and catch statements parse fine !
14226         
14227 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14228
14229         * statement.cs (Block::GetVariableType): Fix logic to extract the type
14230         string from the hashtable of variables.
14231
14232         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
14233         I end up making that mistake ;-)
14234         (catch_clauses): Fixed gross error which made Key and Value of the 
14235         DictionaryEntry the same : $1 !!
14236
14237 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14238
14239         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
14240
14241         * cs-parser.jay (event_declaration): Correct to remove the semicolon
14242         when the add and remove accessors are specified. 
14243
14244 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14245
14246         * cs-parser.jay (IndexerDeclaration): New helper class to hold
14247         information about indexer_declarator.
14248         (indexer_declarator): Implement actions.
14249         (parsing_indexer): New local boolean used to keep track of whether
14250         we are parsing indexers or properties. This is necessary because 
14251         implicit_parameters come into picture even for the get accessor in the 
14252         case of an indexer.
14253         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
14254
14255         * class.cs (Indexer): New class for indexer declarations.
14256         (TypeContainer::AddIndexer): New method to add an indexer to a type.
14257         (TypeContainer::indexers): New member to hold list of indexers for the
14258         type.
14259
14260 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
14261
14262         * cs-parser.jay (add_accessor_declaration): Implement action.
14263         (remove_accessor_declaration): Implement action.
14264         (event_accessors_declaration): Implement
14265         (variable_declarators): swap statements for first rule - trivial.
14266
14267         * class.cs (Event): New class to hold information about event
14268         declarations.
14269         (TypeContainer::AddEvent): New method to add an event to a type
14270         (TypeContainer::events): New member to hold list of events.
14271
14272         * cs-parser.jay (event_declaration): Implement actions.
14273
14274 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
14275
14276         * cs-parser.jay (dim_separators): Implement. Make it a string
14277         concatenating all the commas together, just as they appear.
14278         (opt_dim_separators): Modify accordingly
14279         (rank_specifiers): Update accordingly. Basically do the same
14280         thing - instead, collect the brackets here.
14281         (opt_rank_sepcifiers): Modify accordingly.
14282         (array_type): Modify to actually return the complete type string
14283         instead of ignoring the rank_specifiers.
14284         (expression_list): Implement to collect the expressions
14285         (variable_initializer): Implement. We make it a list of expressions
14286         essentially so that we can handle the array_initializer case neatly too.
14287         (variable_initializer_list): Implement.
14288         (array_initializer): Make it a list of variable_initializers
14289         (opt_array_initializer): Modify accordingly.
14290
14291         * expression.cs (New::NType): Add enumeration to help us
14292         keep track of whether we have an object/delegate creation
14293         or an array creation.
14294         (New:NewType, New::Rank, New::Indices, New::Initializers): New
14295         members to hold data about array creation.
14296         (New:New): Modify to update NewType
14297         (New:New): New Overloaded contructor for the array creation
14298         case.
14299
14300         * cs-parser.jay (array_creation_expression): Implement to call
14301         the overloaded New constructor.
14302         
14303 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
14304
14305         * class.cs (TypeContainer::Constructors): Return member
14306         constructors instead of returning null.
14307
14308 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
14309
14310         * typemanager.cs (InitCoreTypes): Initialize the various core
14311         types after we have populated the type manager with the user
14312         defined types (this distinction will be important later while
14313         compiling corlib.dll)
14314
14315         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
14316         on Expression Classification.  Now all expressions have a method
14317         `Resolve' and a method `Emit'.
14318
14319         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
14320         generation from working.     Also add some temporary debugging
14321         code. 
14322         
14323 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
14324
14325         * codegen.cs: Lots of code generation pieces.  This is only the
14326         beginning, will continue tomorrow with more touches of polish.  We
14327         handle the fundamentals of if, while, do, for, return.  Others are
14328         trickier and I need to start working on invocations soon.
14329         
14330         * gen-treedump.cs: Bug fix, use s.Increment here instead of
14331         s.InitStatement. 
14332
14333         * codegen.cs (EmitContext): New struct, used during code
14334         emission to keep a context.   Most of the code generation will be
14335         here. 
14336
14337         * cs-parser.jay: Add embedded blocks to the list of statements of
14338         this block.  So code generation proceeds in a top down fashion.
14339
14340 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
14341
14342         * statement.cs: Add support for multiple child blocks.
14343
14344 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
14345
14346         * codegen.cs (EmitCode): New function, will emit the code for a
14347         Block of code given a TypeContainer and its ILGenerator. 
14348
14349         * statement.cs (Block): Standard public readonly optimization.
14350         (Block::Block constructors): Link children. 
14351         (Block::Child): Child Linker.
14352         (Block::EmitVariables): Emits IL variable declarations.
14353
14354         * class.cs: Drop support for MethodGroups here, delay until
14355         Semantic Analysis.
14356         (Method::): Applied the same simplification that I did before, and
14357         move from Properties to public readonly fields.
14358         (Method::ParameterTypes): Returns the parameter types for the
14359         function, and implements a cache that will be useful later when I
14360         do error checking and the semantic analysis on the methods is
14361         performed.
14362         (Constructor::GetCallingConvention): Renamed from CallingConvetion
14363         and made a method, optional argument tells whether this is a class
14364         or a structure to apply the `has-this' bit.
14365         (Method::GetCallingConvention): Implement, returns the calling
14366         convention. 
14367         (Method::Define): Defines the type, a second pass is performed
14368         later to populate the methods.
14369
14370         (Constructor::ParameterTypes): implement a cache similar to the
14371         one on Method::ParameterTypes, useful later when we do semantic
14372         analysis. 
14373
14374         (TypeContainer::EmitMethod):  New method.  Emits methods.
14375
14376         * expression.cs: Removed MethodGroup class from here.
14377         
14378         * parameter.cs (Parameters::GetCallingConvention): new method.
14379
14380 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
14381
14382         * class.cs (TypeContainer::Populate): Drop RootContext from the
14383         argument. 
14384
14385         (Constructor::CallingConvention): Returns the calling convention.
14386         (Constructor::ParameterTypes): Returns the constructor parameter
14387         types. 
14388         
14389         (TypeContainer::AddConstructor): Keep track of default constructor
14390         and the default static constructor.
14391
14392         (Constructor::) Another class that starts using `public readonly'
14393         instead of properties. 
14394
14395         (Constructor::IsDefault): Whether this is a default constructor. 
14396
14397         (Field::) use readonly public fields instead of properties also.
14398
14399         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
14400         track of static constructors;  If none is used, turn on
14401         BeforeFieldInit in the TypeAttributes. 
14402
14403         * cs-parser.jay (opt_argument_list): now the return can be null
14404         for the cases where there are no arguments. 
14405
14406         (constructor_declarator): If there is no implicit `base' or
14407         `this', then invoke the default parent constructor. 
14408         
14409         * modifiers.cs (MethodAttr): New static function maps a set of
14410         modifiers flags into a MethodAttributes enum
14411         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
14412         MethodAttr, TypeAttr to represent the various mappings where the
14413         modifiers are used.
14414         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
14415
14416 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
14417
14418         * parameter.cs (GetParameterInfo): Fix bug where there would be no
14419         method arguments.
14420
14421         * interface.cs (PopulateIndexer): Implemented the code generator
14422         for interface indexers.
14423
14424 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
14425
14426         * interface.cs (InterfaceMemberBase): Now we track the new status
14427         here.  
14428
14429         (PopulateProperty): Implement property population.  Woohoo!  Got
14430         Methods and Properties going today. 
14431
14432         Removed all the properties for interfaces, and replaced them with
14433         `public readonly' fields. 
14434
14435 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
14436
14437         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
14438         initialize their hashtables/arraylists only when they are needed
14439         instead of doing this always.
14440
14441         * parameter.cs: Handle refs and out parameters.
14442
14443         * cs-parser.jay: Use an ArrayList to construct the arguments
14444         instead of the ParameterCollection, and then cast that to a
14445         Parameter[] array.
14446
14447         * parameter.cs: Drop the use of ParameterCollection and use
14448         instead arrays of Parameters.
14449
14450         (GetParameterInfo): Use the Type, not the Name when resolving
14451         types. 
14452
14453 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
14454
14455         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
14456         and instead use public readonly fields.
14457
14458         * class.cs: Put back walking code for type containers.
14459
14460 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
14461
14462         * class.cs (MakeConstant): Code to define constants.
14463
14464         * rootcontext.cs (LookupType): New function.  Used to locate types 
14465
14466         
14467 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
14468
14469         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
14470         this System.Reflection code is.  Kudos to Microsoft
14471         
14472         * typemanager.cs: Implement a type cache and avoid loading all
14473         types at boot time.  Wrap in LookupType the internals.  This made
14474         the compiler so much faster.  Wow.  I rule!
14475         
14476         * driver.cs: Make sure we always load mscorlib first (for
14477         debugging purposes, nothing really important).
14478
14479         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
14480         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
14481
14482         * rootcontext.cs: Lookup types on their namespace;  Lookup types
14483         on namespaces that have been imported using the `using' keyword.
14484
14485         * class.cs (TypeContainer::TypeAttr): Virtualize.
14486         (Class::TypeAttr): Return attributes suitable for this bad boy.
14487         (Struct::TypeAttr): ditto.
14488         Handle nested classes.
14489         (TypeContainer::) Remove all the type visiting code, it is now
14490         replaced with the rootcontext.cs code
14491
14492         * rootcontext.cs (GetClassBases): Added support for structs. 
14493
14494 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
14495
14496         * interface.cs, statement.cs, class.cs, parameter.cs,
14497         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
14498         Drop use of TypeRefs, and use strings instead.
14499
14500 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
14501
14502         * rootcontext.cs: 
14503
14504         * class.cs (Struct::Struct): set the SEALED flags after
14505         checking the modifiers.
14506         (TypeContainer::TypeAttr): new property, returns the
14507         TypeAttributes for a class.  
14508
14509         * cs-parser.jay (type_list): Oops, list production was creating a
14510         new list of base types.
14511
14512         * rootcontext.cs (StdLib): New property.
14513         (GetInterfaceTypeByName): returns an interface by type name, and
14514         encapsulates error handling here.
14515         (GetInterfaces): simplified.
14516         (ResolveTree): Encapsulated all the tree resolution here.
14517         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
14518         types. 
14519         
14520         * driver.cs: Add support for --nostdlib, to avoid loading the
14521         default assemblies.
14522         (Main): Do not put tree resolution here. 
14523
14524         * rootcontext.cs: Beginning of the class resolution.
14525
14526 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
14527
14528         * rootcontext.cs: Provide better error reporting. 
14529
14530         * cs-parser.jay (interface_base): set our $$ to be interfaces.
14531
14532         * rootcontext.cs (CreateInterface): Handle the case where there
14533         are no parent interfaces.
14534         
14535         (CloseTypes): Routine to flush types at the end.
14536         (CreateInterface): Track types.
14537         (GetInterfaces): Returns an array of Types from the list of
14538         defined interfaces.
14539
14540         * typemanager.c (AddUserType): Mechanism to track user types (puts
14541         the type on the global type hash, and allows us to close it at the
14542         end). 
14543         
14544 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
14545
14546         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
14547         RecordInterface instead.
14548
14549         * cs-parser.jay: Updated to reflect changes above.
14550
14551         * decl.cs (Definition): Keep track of the TypeBuilder type that
14552         represents this type here.  Not sure we will use it in the long
14553         run, but wont hurt for now.
14554
14555         * driver.cs: Smaller changes to accomodate the new code.
14556
14557         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
14558         when done. 
14559
14560         * rootcontext.cs (CreateInterface):  New method, used to create
14561         the System.TypeBuilder type for interfaces.
14562         (ResolveInterfaces): new entry point to resolve the interface
14563         hierarchy. 
14564         (CodeGen): Property, used to keep track of the code generator.
14565
14566 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
14567
14568         * cs-parser.jay: Add a second production for delegate_declaration
14569         with `VOID'.
14570
14571         (enum_body): Put an opt_comma here instead of putting it on
14572         enum_body or enum_member_declarations so we can handle trailing
14573         commas on enumeration members.  Gets rid of a shift/reduce.
14574         
14575         (type_list): Need a COMMA in the middle.
14576
14577         (indexer_declaration): Tell tokenizer to recognize get/set
14578
14579         * Remove old targets.
14580
14581         * Re-add the parser target.
14582
14583 2001-07-13  Simon Cozens <simon@simon-cozens.org>
14584
14585         * cs-parser.jay: Add precendence rules for a number of operators
14586         ot reduce the number of shift/reduce conflicts in the grammar.
14587         
14588 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
14589
14590         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
14591         and put it here.
14592
14593         Get rid of old crufty code.
14594
14595         * rootcontext.cs: Use this to keep track of the parsed
14596         representation and the defined types available to the program. 
14597
14598         * gen-treedump.cs: adjust for new convention.
14599
14600         * type.cs: Split out the type manager, and the assembly builder
14601         from here. 
14602
14603         * typemanager.cs: the type manager will live here now.
14604
14605         * cil-codegen.cs: And the code generator here. 
14606
14607 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
14608
14609         * makefile: Fixed up for easy making.
14610
14611 2001-07-13  Simon Cozens <simon@simon-cozens.org>
14612
14613         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
14614         the 
14615
14616         (unary_expression): Expand pre_increment_expression and
14617         post_decrement_expression to reduce a shift/reduce.
14618
14619 2001-07-11  Simon Cozens
14620
14621         * cs-tokenizer.cs: Hex numbers should begin with a 0.
14622
14623         Improve allow_keyword_as_indent name.
14624
14625 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
14626
14627         * Adjustments for Beta2. 
14628
14629 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
14630
14631         * decl.cs: Added `Define' abstract method.
14632         (InTransit): new property, used to catch recursive definitions. 
14633
14634         * interface.cs: Implement `Define'. 
14635
14636         * modifiers.cs: Map Modifiers.constants to
14637         System.Reflection.TypeAttribute flags.
14638
14639         * class.cs: Keep track of types and user-defined types.
14640         (BuilderInit): New method for creating an assembly
14641         (ResolveType): New function to launch the resolution process, only
14642         used by interfaces for now.
14643
14644         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
14645         that are inserted into the name space. 
14646
14647 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
14648
14649         * ARGH.  I have screwed up my tree so many times due to the use of
14650         rsync rather than using CVS.  Going to fix this at once. 
14651
14652         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
14653         load types.
14654
14655 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
14656
14657         * Experiment successful: Use System.Type rather that our own
14658         version of Type.  
14659
14660 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
14661
14662         * cs-parser.jay: Removed nsAliases from here.
14663
14664         Use new namespaces, handle `using XXX;' 
14665
14666         * namespace.cs: Reimplemented namespace handling, use a recursive
14667         definition of the class.  Now we can keep track of using clauses
14668         and catch invalid using clauses.
14669
14670 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
14671
14672         * gen-treedump.cs: Adapted for all the renaming.
14673
14674         * expression.cs (Expression): this class now has a Type property
14675         which returns an expression Type.
14676
14677         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
14678         `Type', as this has a different meaning now in the base
14679
14680 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
14681
14682         * interface.cs, class.cs: Removed from all the sources the
14683         references to signature computation, as we can not do method
14684         signature computation during the parsing time, as we are not
14685         trying to solve at that point distinguishing:
14686
14687         class X {
14688                 void a (Blah x) {}
14689                 void a (NS.Blah x) {}
14690         }
14691
14692         Which depending on the context might be valid or not, as we do not
14693         know if Blah is the same thing as NS.Blah at that point.
14694
14695         * Redid everything so the code uses TypeRefs now instead of
14696         Types.  TypeRefs are just temporary type placeholders, that need
14697         to be resolved.  They initially have a pointer to a string and the
14698         current scope in which they are used.  This is used later by the
14699         compiler to resolve the reference to an actual Type. 
14700
14701         * DeclSpace is no longer a CIR.Type, and neither are
14702         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
14703         are all DeclSpaces, but no Types. 
14704
14705         * type.cs (TypeRefManager): This implements the TypeRef manager,
14706         which keeps track of all the types that need to be resolved after
14707         the parsing has finished. 
14708
14709 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
14710
14711         * ARGH.  We are going to have to store `foreach' as a class rather
14712         than resolving it, as we need to verify error 1579 after name
14713         resolution.   *OR* we could keep a flag that says `This request to
14714         IEnumerator comes from a foreach statement' which we can then use
14715         to generate the error.
14716
14717 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
14718
14719         * class.cs (TypeContainer.AddMethod): we now add methods to the
14720         MethodGroup instead of the method hashtable.  
14721
14722         * expression.cs: Add MethodGroup abstraction, which gets us one
14723         step closer to the specification in the way we handle method
14724         declarations.  
14725
14726         * cs-parser.jay (primary_expression): qualified_identifier now
14727         tried to match up an identifier to a local variable reference or
14728         to a parameter reference.
14729
14730         current_local_parameters is now a parser global variable that
14731         points to the current parameters for the block, used during name
14732         lookup.
14733
14734         (property_declaration): Now creates an implicit `value' argument to
14735         the set accessor.
14736
14737 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
14738
14739         * parameter.cs: Do not use `param' arguments as part of the
14740         signature, per the spec.
14741
14742 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
14743
14744         * decl.cs: Base class for classes, structs and interfaces.  This
14745         is the "Declaration Space" 
14746
14747         * cs-parser.jay: Use CheckDef for checking declaration errors
14748         instead of having one on each function.
14749
14750         * class.cs: Factor out some code for handling error handling in
14751         accordance to the "Declarations" section in the "Basic Concepts"
14752         chapter in the ECMA C# spec.
14753
14754         * interface.cs: Make all interface member classes derive from
14755         InterfaceMemberBase.
14756
14757 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
14758
14759         * Many things: all interfaces are parsed and generated in
14760         gen-treedump.  Support for member variables, constructors,
14761         destructors, properties, constants is there.
14762
14763         Beginning of the IL backend, but very little done, just there for
14764         testing purposes. 
14765
14766 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
14767
14768         * cs-parser.jay: Fix labeled statement.
14769
14770         * cs-tokenizer.cs (escape): Escape " and ' always.
14771         ref_line, ref_name: keep track of the line/filename as instructed
14772         by #line by the compiler.
14773         Parse #line.
14774
14775 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
14776
14777         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
14778         to match the values in System.CodeDOM.
14779
14780         Divid renamed to Divide.
14781
14782         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
14783         statements. 
14784         (Statements.set): remove.
14785
14786         * System.CodeDOM/CodeCatchClause.cs: always have a valid
14787         statements. 
14788
14789         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
14790         falseStatements always have valid values. 
14791
14792         * cs-parser.jay: Use System.CodeDOM now.
14793