2004-03-30 Martin Baulig <martin@ximian.com>
[mono.git] / mcs / gmcs / ChangeLog
1 2004-03-30  Martin Baulig  <martin@ximian.com>
2
3         * generic.cs (TypeParameter.DefineType): Return a boolean and use
4         the new API to actually define the constructor constraint.
5
6         * typemanager.cs
7         (TypeManager.new_constraint_attr_type): New static field.
8         (TypeManager.InitCoreTypes): Initialize it.
9
10 2004-03-30  Martin Baulig  <martin@ximian.com>
11
12         * generic.cs (Constraints): Completed error checking, use correct
13         error numbers.
14
15 2004-03-29  Martin Baulig  <martin@ximian.com>
16
17         * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
18
19         * expression.cs (Invocation.InferTypeArguments): Added overloaded
20         public version which takes a `ParameterData pd' instead of an
21         `ArrayList args'.
22
23 2004-03-29  Martin Baulig  <martin@ximian.com>
24
25         * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
26         not a MethodInfo.       
27
28 2004-03-29  Martin Baulig  <martin@ximian.com>
29
30         * expression.cs (Argument.ResolveMethodGroup): If we're a
31         ConstructedType, call GetMemberAccess() on it.  
32
33 2004-03-29  Martin Baulig  <martin@ximian.com>
34
35         * class.cs (MethodBase.CheckGenericOverride): New abstract method.
36         (MethodCore.CheckGenericOverride): When overriding a generic
37         method, check whether the constraints match.
38
39         * support.cs (GenericConstraints): New public interface.
40         (ParameterData.GenericConstraints): New public method.
41
42         * parameter.cs (Parameter.Resolve): Check whether we're a generic
43         method parameter and compute our constraints if appropriate.
44         (Parameter.GenericConstraints): New public property.
45
46         * generic.cs (Constraints): Implement GenericConstraints.
47
48 2004-03-29  Martin Baulig  <martin@ximian.com>
49
50         * decl.cs (MemberCache.FindMemberToOverride): Use
51         `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
52
53 2004-03-29  Martin Baulig  <martin@ximian.com>
54
55         * generic.cs (GenericMethod.Define): Resolve our type parameters.
56
57 2004-03-29  Martin Baulig  <martin@ximian.com>
58
59         * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
60         not allowed on non-generic declarations").
61
62 2004-03-29  Martin Baulig  <martin@ximian.com>
63
64         * expression.cs (Invocation.InferTypeArguments): Added overloaded
65         public version of this method.
66
67         * class.cs (MethodCore.IsDuplicateImplementation): Use
68         Invocation.InferTypeArguments() to check this.
69
70 2004-03-29  Martin Baulig  <martin@ximian.com>
71
72         * convert.cs: Use TypeManager.IsDelegateType() instead of
73         comparing types correctly.
74
75 2004-03-29  Martin Baulig  <martin@ximian.com>
76
77         * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
78         types directly to make it work for generic instances.
79
80         * typemanager.cs (TypeManager.IsSubclassOf): New static method.
81
82 2004-03-29  Martin Baulig  <martin@ximian.com>
83
84         * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
85         support for arrays.     
86
87 2004-03-24  Martin Baulig  <martin@ximian.com>
88
89         * decl.cs (DeclSpace.FindType): Also use
90         TypeManager.CheckGeneric() for types from the using clauses.
91
92 2004-03-23  Martin Baulig  <martin@ximian.com>
93
94         * expression.cs (Invocation.OverloadResolve): Added `bool
95         may_fail' argument and use it instead of the Location.IsNull() hack.
96
97 2004-03-23  Martin Baulig  <martin@ximian.com>
98
99         * expression.cs (Invocation.InferType): Use correct type inference
100         rules here.     
101
102 2004-03-23  Martin Baulig  <martin@ximian.com>
103
104         * ecore.cs (MethodGroupExpr.Name): Use
105         TypeManager.CSharpSignature() instead of just the name.
106
107         * expression.cs (Invocation.OverloadResolve): Provide better error
108         reporting.
109         (Invocation.DoResolve): OverloadResolve() never returns null
110         without reporting an error, so removed the error -6 reporting here.
111
112 2004-03-23  Martin Baulig  <martin@ximian.com>
113
114         * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
115         generic methods.
116
117         * cs-parser.jay (delegate_declaration): Support generic delegates.
118
119         * delegate.cs: Support generic delegates.
120
121 2004-03-22  Martin Baulig  <martin@ximian.com>
122
123         * expression.cs (Invocation.InferParamsTypeArguments): New static
124         method; does type inference for params arguments.
125
126 2004-03-21  Martin Baulig  <martin@ximian.com>
127
128         * typemanager.cs (TypeManager.IsGenericMethod): New public static
129         method; checks whether a method is a generic method.    
130
131         * expression.cs (Invocation.InferTypeArguments): New static method;
132         infer type arguments for generic method invocation.
133
134         * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
135         property; we set this to true if we're resolving a generic method
136         invocation and the user specified type arguments, ie. we're not
137         doing type inference.
138
139 2004-03-20  Martin Baulig  <martin@ximian.com>
140
141         * class.cs (MethodData.DeclaringType): New public property.
142         (MethodData.Define): Set DeclaringType here.
143         (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
144         instead of OperatorMethodBuilder.DeclaringType.
145
146 2004-03-20  Martin Baulig  <martin@ximian.com>
147
148         * cs-tokenizer.cs (xtoken): Return a special
149         Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
150
151         * cs-parser.jay (default_value_expression): Switch to the new
152         syntax (14.5.13).
153
154 2004-03-19  Martin Baulig  <martin@ximian.com>
155
156         * decl.cs (MemberName): New class.  We use this to "construct"
157         namespace_or_type_name's.
158
159         * generics.cs (TypeArguments.GetDeclarations): New public method;
160         returns the type arguments as a string[] and reports a CS0081 if
161         one of them is not an identifier.
162
163         * class.cs (MemberBase): The .ctor now takes the name as a
164         MemberName instead of a string.
165         (MemberBase.ExplicitInterfaceName): Changed type from string to
166         Expression.
167         (MemberBase.DoDefine): If we're an explicit implementation, the
168         InterfaceType may be a generic instance.
169
170         * cs-parser.jay (namespace_or_type_name): Return a MemberName.
171         (namespace_name): Call MemberName.GetName () to transform the
172         MemberName into a string and ensure we don't have any type
173         arguments.
174         (type_name): Call MemberName.GetTypeExpression() to transfrom the
175         MemberName into an expression.
176         (method_header): Use namespace_or_type_name instead of member_name.     
177
178 2004-03-19  Martin Baulig  <martin@ximian.com>
179
180         * class.cs (MemberCore.IsDuplicateImplementation): Check whether
181         two overloads may unify for some type parameter substitutions and
182         report a CS0408 if appropriate.
183
184 2004-03-19  Martin Baulig  <martin@ximian.com>
185
186         * class.cs (MemberCore.IsDuplicateImplementation): Report the
187         error here and not in our caller.
188
189 2004-03-19  Martin Baulig  <martin@ximian.com>
190
191         * interface.cs: Completely killed this file.
192         (Interface): We're now a TypeContainer and live in class.cs.
193
194         * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
195         argument; we're now also called for interfaces.
196         (TypeContainer.DefineMembers): Allow this method being called
197         multiple times.
198         (TypeContainer.GetMethods): New public method; formerly known as
199         Interface.GetMethod().  This is used by PendingImplementation.
200         (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
201         it's now private and non-static.
202         (Interface): Moved this here; it's now implemented similar to
203         Class and Struct.
204         (Method, Property, Event, Indexer): Added `bool is_interface'
205         argument to their .ctor's.
206         (MemberBase.IsInterface): New public field.
207
208         * cs-parser.jay: Create normal Method, Property, Event, Indexer
209         instances instead of InterfaceMethod, InterfaceProperty, etc.
210         (opt_interface_base): Removed; we now use `opt_class_base' instead.
211         (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
212
213 2004-03-19  Martin Baulig  <martin@ximian.com>
214
215         * class.cs (MethodCore.IsDuplicateImplementation): New private
216         method which does the CS0111 checking.
217         (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
218         Use IsDuplicateImplementation().
219
220 2004-03-17 Ben Maurer  <bmaurer@users.sourceforge.net>
221
222         * decl.cs (FindMemberToOverride): New method to find the correct
223         method or property to override in the base class.
224         * class.cs
225             - Make Method/Property use the above method to find the
226               version in the base class.
227             - Remove the InheritableMemberSignatureCompare as it is now
228               dead code.
229
230         This patch makes large code bases much faster to compile, as it is
231         O(n) rather than O(n^2) to do this validation.
232
233         Also, it fixes bug 52458 which is that nested classes are not
234         taken into account when finding the base class member.
235         
236         Reviewed/Approved by Martin.
237
238 2004-03-17  Martin Baulig  <martin@ximian.com>
239
240         * expression.cs (MemberAccess.DoResolve): Take the parent's number
241         of type arguments into account; use the `real_num_type_args'
242         approach like in DoResolveAsTypeStep().
243
244         * generic.cs (GenericMemberAccess.DoResolve): Make this work for
245         nested types.
246
247 2004-03-17  Marek Safar  <marek.safar@seznam.cz>
248
249         * interface.cs: In all interface classes removed redundant
250         member initialization.
251
252 2004-03-16  Martin Baulig  <martin@ximian.com>
253
254         * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
255
256 2004-03-15  Miguel de Icaza  <miguel@ximian.com>
257
258         * decl.cs (DefineTypeAndParents): New helper method to define a
259         type's containers before the type itself is defined;  This is a
260         bug exposed by the recent changes to Windows.Forms when an
261         implemented interface was defined inside a class that had not been
262         built yet.   
263
264         * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
265
266         (Check): Loop correctly to report errors modifiers
267         (UNSAFE was not in the loop, since it was the same as TOP).
268
269         * interface.cs: Every interface member now takes a ModFlags,
270         instead of a "is_new" bool, which we set on the base MemberCore. 
271
272         Every place where we called "UnsafeOk" in the interface, now we
273         call the proper member (InterfaceMethod.UnsafeOK) instead to get
274         the unsafe settings from the member declaration instead of the
275         container interface. 
276
277         * cs-parser.jay (opt_new): Allow unsafe here per the spec. 
278
279         * pending.cs (TypeAndMethods): Add `get_indexer_name' and
280         `set_indexer_name' to the pending bits (one per type).
281
282         We fixed a bug today that was picking the wrong method to
283         override, since for properties the existing InterfaceMethod code
284         basically ignored the method name.  Now we make sure that the
285         method name is one of the valid indexer names.
286
287 2004-03-14  Gustavo Giráldez  <gustavo.giraldez@gmx.net>
288  
289         * support.cs (SeekableStreamReader): Keep track of stream byte
290         positions and don't mix them with character offsets to the buffer.
291
292         Patch from Gustavo Giráldez
293         
294 2004-03-15  Marek Safar  <marek.safar@seznam.cz>
295
296         * interface.cs (InterfaceSetGetBase): Removed double member
297         initialization, base class does it as well.
298
299 2004-03-13  Martin Baulig  <martin@ximian.com>
300
301         * class.cs: Reverted Miguel's latest commit; it makes mcs crash
302         when compiling corlib.
303
304 2004-03-13  Miguel de Icaza  <miguel@ximian.com>
305
306         * convert.cs (ExplicitConversion): We were reporting an error on
307         certain conversions (object_type source to a value type, when the
308         expression was `null') before we had a chance to pass it through
309         the user defined conversions.
310
311         * driver.cs: Replace / and \ in resource specifications to dots.
312         Fixes 50752
313
314         * class.cs: Add check for duplicate operators.  Fixes 52477
315
316 2004-03-11  Miguel de Icaza  <miguel@ximian.com>
317
318         * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
319         that are in the middle of the statements, not only at the end.
320         Fixes #54987
321
322         * class.cs (TypeContainer.AddField): No longer set the
323         `HaveStaticConstructor' flag, now we call it
324         `UserDefineStaticConstructor' to diferentiate the slightly
325         semantic difference.
326
327         The situation is that we were not adding BeforeFieldInit (from
328         Modifiers.TypeAttr) to classes that could have it.
329         BeforeFieldInit should be set to classes that have no static
330         constructor. 
331
332         See:
333
334         http://www.yoda.arachsys.com/csharp/beforefieldinit.html
335
336         And most importantly Zoltan's comment:
337
338         http://bugzilla.ximian.com/show_bug.cgi?id=44229
339
340         "I think beforefieldinit means 'it's ok to initialize the type sometime 
341          before its static fields are used', i.e. initialization does not need
342          to be triggered by the first access to the type. Setting this flag
343          helps the JIT to compile better code, since it can run the static
344          constructor at JIT time, and does not need to generate code to call it
345          (possibly lots of times) at runtime. Unfortunately, mcs does not set
346          this flag for lots of classes like String. 
347          
348          csc sets this flag if the type does not have an explicit static 
349          constructor. The reasoning seems to be that if there are only static
350          initalizers for a type, and no static constructor, then the programmer
351          does not care when this initialization happens, so beforefieldinit
352          can be used.
353          
354          This bug prevents the AOT compiler from being usable, since it 
355          generates so many calls to mono_runtime_class_init that the AOT code
356          is much slower than the JITted code. The JITted code is faster, 
357          because it does not generate these calls if the vtable is type is
358          already initialized, which is true in the majority of cases. But the
359          AOT compiler can't do this."
360
361 2004-03-10  Miguel de Icaza  <miguel@ximian.com>
362
363         * class.cs (MethodData.Emit): Refactor the code so symbolic
364         information is generated for destructors;  For some reasons we
365         were taking a code path that did not generate symbolic information
366         before. 
367
368 2004-03-11 Ben Maurer  <bmaurer@users.sourceforge.net>
369
370         * class.cs: Create a Constructor.CheckBase method that
371         takes care of all validation type code. The method
372         contains some code that was moved from Define.
373
374         It also includes new code that checks for duplicate ctors.
375         This fixes bug #55148.
376
377 2004-03-09  Joshua Tauberer <tauberer@for.net>
378
379         * expression.cs (ArrayCreation): Fix: More than 6 nulls in
380         a { ... }-style array creation invokes EmitStaticInitializers
381         which is not good for reference-type arrays.  String, decimal
382         and now null constants (NullCast) are not counted toward
383         static initializers.
384
385 2004-03-05  Martin Baulig  <martin@ximian.com>
386
387         * location.cs (SourceFile.HasLineDirective): New public field;
388         specifies whether the file contains or is referenced by a "#line"
389         directive.
390         (Location.DefineSymbolDocuments): Ignore source files which
391         either contain or are referenced by a "#line" directive.        
392
393 2004-02-29  Ben Maurer <bmaurer@users.sourceforge.net>
394
395         * class.cs (Method.CheckBase): Avoid using FindMembers, we have
396         direct access to our parent, so check the method inline there.
397
398 2004-02-27 Ben Maurer  <bmaurer@users.sourceforge.net>
399
400         * expression.cs (Invocation.EmitCall): Miguel's last commit
401         caused a regression. If you had:
402         
403             T t = null;
404             t.Foo ();
405
406         In Foo the implict this would be null.
407         
408 2004-02-27  Miguel de Icaza  <miguel@ximian.com>
409
410         * expression.cs (Invocation.EmitCall): If the method is not
411         virtual, do not emit a CallVirt to it, use Call.
412
413         * typemanager.cs (GetFullNameSignature): Improve the method to
414         cope with ".ctor" and replace it with the type name.
415
416         * class.cs (ConstructorInitializer.Resolve): Now the method takes
417         as an argument the ConstructorBuilder where it is being defined,
418         to catch the recursive constructor invocations.
419
420 2004-03-16  Martin Baulig  <martin@ximian.com>
421
422         * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
423         ConstructedType, call ResolveType() on it to get the type rather
424         than just using `expr.Type'.
425
426 2004-03-16  Martin Baulig  <martin@ximian.com>
427
428         * generics.cs (ConstructedType.GetMemberAccess): Take the
429         EmitContext instead on the TypeExpr and use
430         ec.TypeContainer.CurrentType/ec.ContainerType.
431
432 2004-03-16  Martin Baulig  <martin@ximian.com>
433
434         * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
435         parameters before aliases.
436
437 2004-03-16  Martin Baulig  <martin@ximian.com>
438
439         * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
440         New oublic function; checks whether two generic instances may become
441         equal under some instantiations (26.3.1).
442
443         * class.cs (TypeContainer.Define): Call
444         TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
445         error.
446
447 2004-03-16  Martin Baulig  <martin@ximian.com>
448
449         * class.cs (TypeContainer.GetClassBases): Moved
450         Error_TypeParameterAsBase() here and also check whether the base
451         class is not an attribute.
452
453 2004-03-16  Martin Baulig  <martin@ximian.com>
454
455         * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
456
457 2004-03-16  Martin Baulig  <martin@ximian.com>
458
459         * class.cs (Error_TypeParameterAsBase): Use correct error number
460         here (CS0689).  
461
462 2004-03-16  Martin Baulig  <martin@ximian.com>
463
464         * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
465         for generics.
466
467         * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
468         error reporting.
469
470 2004-03-15  Martin Baulig  <martin@ximian.com>
471
472         * typemanager.cs (TypeManager.GetFullName): New public method.
473         (TypeManager.MemberLookup): Added `int_num_type_arguments'
474         argument; only return members with the correct number of type
475         arguments.
476         (TypeManager.CheckGeneric): Allow -1 to bypass the check.
477         (TypeManager.FilterWithClosure): Call CheckGeneric() to check
478         whether the number of type arguments matches.
479
480         * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
481         not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
482
483         * expression.cs (MemberAccess): Added public `NumTypeArguments'
484         field; it's set by the protected .ctor when we're actually a
485         GenericMemberAccess.
486         (MemberAccess.ResolveAsTypeStep): Compute the total number of type
487         arguments and pass it to MemberLookupFinal ().
488
489         * ecore.cs (Expression.MemberLookup): Added `int
490         num_type_arguments' argument; only return members with the correct
491         number of type arguments.
492         (Expression.MemberLookupFailed): Check whether the MemberLookup
493         failed because we did not have the correct number of type
494         arguments; report CS0305 in this case.
495
496         * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
497         `e.ResolveAsTypeTerminal()' already did so.
498
499 2004-03-15  Martin Baulig  <martin@ximian.com>
500
501         * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
502         we're a ConstructedType; in this case, the caller must report an
503         error (for instance CS0131).
504
505         * generic.cs (TypeArguments): Added Location argument to the .ctor.
506         (TypeArguments.Resolve): Actually report errors here.
507
508 2004-03-15  Miguel de Icaza  <miguel@ximian.com>
509
510         * pending.cs (TypeAndMethods): Add `get_indexer_name' and
511         `set_indexer_name' to the pending bits (one per type).
512
513         We fixed a bug today that was picking the wrong method to
514         override, since for properties the existing InterfaceMethod code
515         basically ignored the method name.  Now we make sure that the
516         method name is one of the valid indexer names.
517
518 2004-03-15  Martin Baulig  <martin@ximian.com>
519
520         * typemanager.cs (TypeManager.IndexerPropertyName): Added support
521         for generic instances.
522
523 2004-03-13  Martin Baulig  <martin@ximian.com>
524
525         * class.cs (TypeContainer.DefineType): Call
526         TypeManager.AddUserType() immediately after creating the
527         TypeBuilder; pass all type parameters when creating the
528         CurrentType.
529
530         * decl.cs (DeclSpace.FindNestedType): New public method.
531         (DeclSpace.FindType): Added `int num_type_args' argument; only
532         return types with the correct number of type parameters.
533         (DeclSpace.CountTypeParams): New public property.
534
535         * ecore.cs (SimpleName.ctor): Added overloaded version which takes
536         the number of type parameters; defaults to zero.
537
538         * generic.cs (TypeArguments.Count): New public property.
539         (ConstructedType.DoResolveAsTypeStep): First call
540         ds.FindNestedType() to find out whether we're nested in the
541         current generic type; in this case, we inherit all type parameters
542         from the current class.
543
544         * rootcontext.cs (RootContext.NamespaceLookup): Added `int
545         num_type_args' argument.
546         (RootContext.LookupType): Added overloaded version which takes the
547         number of type arguments; only return types with the correct
548         number of type arguments.
549
550         * typemanager.cs (TypeManager.CheckGeneric): New public function;
551         checks whether `Type t' has `int num_type_args'.
552
553 2004-03-13  Martin Baulig  <martin@ximian.com>
554
555         * generic.cs (GenericMethod.DefineType): New method; calls
556         DefineType() on all the type parameters.
557
558         * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
559         (MethodData.Define): If we're a generic method, call
560         GenericMethod.DefineType() to define the type parameters.       
561
562 2004-03-10  Martin Baulig  <martin@ximian.com>
563
564         * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
565         instead of IsAssignableFrom.    
566
567 2004-03-10  Martin Baulig  <martin@ximian.com>
568
569         * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
570
571         * support.cs (ParameterData.HasArrayParameter): New property.
572         (ReflectionParameters.ctor): Take a MethodBase instead of a
573         ParameterInfo[].  If we have any type parameters, get the generic
574         method definition and ask it whether we have variable arguments.
575
576 2004-02-26  Miguel de Icaza  <miguel@ximian.com>
577
578         * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
579         routines to check if a type is an enumerable/enumerator allow
580         classes that implement the IEnumerable or IEnumerator interfaces.
581
582         * class.cs (Property, Operator): Implement IIteratorContainer, and
583         implement SetYields.
584
585         (Property.Define): Do the block swapping for get_methods in the
586         context of iterators.   We need to check if Properties also
587         include indexers or not.
588
589         (Operator): Assign the Block before invoking the
590         OperatorMethod.Define, so we can trigger the Iterator code
591         replacement. 
592
593         * cs-parser.jay (SimpleIteratorContainer): new helper class.  Both
594         Property and Operator classes are not created when we parse the
595         declarator but until we have the block completed, so we use a
596         singleton SimpleIteratorContainer.Simple to flag whether the
597         SetYields has been invoked.
598
599         We propagate this setting then to the Property or the Operator to
600         allow the `yield' to function.
601
602 2004-02-25  Marek Safar  <marek.safar@seznam.cz>
603
604         * codegen.cs: Implemented attribute support for modules.
605         New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
606         Assembly/Module functionality.
607         
608         * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
609         interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
610         Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
611
612 2004-02-16  Marek Safar  <marek.safar@seznam.cz>
613
614         * interface.cs (FindMembers): The operation is performed on all base
615         interfaces and not only on the first. It is required for future CLS Compliance patch.
616
617 2004-02-12 Ben Maurer  <bmaurer@users.sourceforge.net>
618
619         * statement.cs, codegen.cs:
620         This patch deals with patterns such as:
621
622         public class List : IEnumerable {
623
624                 public MyEnumerator GetEnumerator () {
625                         return new MyEnumerator(this);
626                 }
627         
628                 IEnumerator IEnumerable.GetEnumerator () {
629                         ...
630                 }
631                 
632                 public struct MyEnumerator : IEnumerator {
633                         ...
634                 }
635         }
636
637         Before, there were a few things we did wrong:
638         1) we would emit callvirt on a struct, which is illegal
639         2) we emited ldarg when we needed to emit ldarga
640         3) we would mistakenly call the interface methods on an enumerator
641         type that derived from IEnumerator and was in another assembly. For example:
642
643         public class MyEnumerator : IEnumerator
644
645         Would have the interface methods called, even if there were public impls of the
646         method. In a struct, this lead to invalid IL code.
647         
648 2004-02-11  Marek Safar  <marek.safar@seznam.cz>
649
650         * const.cs: Const is now derived from FieldBase. Method EmitConstant name
651           renamed to Emit.
652
653         * delegate.cs (Define): Fixed crash when delegate type is undefined.
654         
655 2004-02-11  Miguel de Icaza  <miguel@ximian.com>
656
657         * cs-parser.jay: Fix small regression: we were not testing V2
658         compiler features correctly.
659
660         * interface.cs: If the emit context is null, then create one
661
662 2004-02-09  Marek Safar  <marek.safar@seznam.cz>
663
664         * decl.cs (GetSignatureForError): New virtual method to get full name
665           for error messages.
666         
667         * attribute.cs (IAttributeSupport): New interface for attribute setting.
668           Now it is possible to rewrite ApplyAttributes method to be less if/else.
669
670         * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
671           Duplicated members and code in these classes has been removed.
672           Better encapsulation in these classes.
673
674 2004-02-07  Miguel de Icaza  <miguel@ximian.com>
675
676         * assign.cs (Assign.DoResolve): When dealing with compound
677         assignments, there is a new rule in ECMA C# 2.4 (might have been
678         there before, but it is documented here) that states that in:
679
680         a op= b;
681
682         If b is of type int, and the `op' is a shift-operator, then the
683         above is evaluated as:
684
685         a = (int) a op b 
686
687         * expression.cs (Binary.ResolveOperator): Instead of testing for
688         int/uint/long/ulong, try to implicitly convert to any of those
689         types and use that in pointer arithmetic.
690
691         * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
692         method to print information for from the type, not from the
693         null-method we were given.
694
695 2004-02-01  Duncan Mak  <duncan@ximian.com>
696
697         * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
698         parsing for cmd, fixes bug #53694.
699
700 2004-02-04  Marek Safar  <marek.safar@seznam.cz>
701
702         * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
703         in the member name duplication tests. Property and operator name duplication
704         was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
705
706 2004-02-03  Marek Safar  <marek.safar@seznam.cz>
707
708         * interface.cs (PopulateMethod): Fixed crash when interface method
709         returns not existing type (error test cs0246-3.cs).
710
711 2004-02-02  Ravi Pratap M <ravi@ximian.com>
712
713         * cs-parser.jay (interface_accessors): Re-write actions to also
714         store attributes attached to get and set methods. Fix spelling
715         while at it.
716
717         (inteface_property_declaration): Modify accordingly.
718
719         (InterfaceAccessorInfo): New helper class to store information to pass
720         around between rules that use interface_accessors.
721
722         * interface.cs (Emit): Apply attributes on the get and set
723         accessors of properties and indexers too.
724         
725         * attribute.cs (ApplyAttributes): Modify accordingly to use the
726         right MethodBuilder when applying attributes to the get and set accessors.
727
728 2004-01-31  Miguel de Icaza  <miguel@ximian.com>
729
730         * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
731
732 2004-01-26  Miguel de Icaza  <miguel@ximian.com>
733
734         * cs-tokenizer.cs: Handle #line hidden from PDC bits.
735
736 2004-01-25  Miguel de Icaza  <miguel@ximian.com>
737
738         * cs-parser.jay: Remove YIELD token, instead use the new grammar
739         changes that treat `yield' specially when present before `break'
740         or `return' tokens.
741
742         * cs-tokenizer.cs: yield is no longer a keyword.
743
744 2004-01-23  Marek Safar  <marek.safar@seznam.cz>
745
746         * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
747         setting for default constructors.
748         For default constructors are almost every time set wrong Modifier. The
749         generated IL code has been alright. But inside mcs this values was
750         wrong and this was reason why several of my CLS Compliance tests
751         failed.
752
753 2004-02-27  Martin Baulig  <martin@ximian.com>
754
755         * generics.cs (ConstructedType.ResolveType): Make the nested type
756         stuff actually work.
757
758 2004-02-25  Martin Baulig  <martin@ximian.com>
759
760         * decl.cs (DeclSpace.CurrentTypeParameters): New protected
761         property; returns the type parameters just from the current type,
762         ie. with the ones from outer classes.
763         (DeclSpace.LookupGeneric): First search in the current class, then
764         in outer classes.
765         (DeclSpace.initialize_type_params): When hiding a type parameter
766         from an outer class, put it into the `type_param_list' anyways.
767
768         * expression.cs (MemberAccess.expr): Made this field protected.
769
770         * class.cs (TypeContainer.Define): The `CurrentType' just contains
771         the type parameters from the current class.
772
773         * generic.cs (ConstructedType.ResolveType): Support nested generic
774         types by taking the type parameters which we inherit from outer
775         classes into account.
776         (GenericMemberAccess.ResolveAsTypeStep): Override this and added
777         support for nested generic types.
778
779 2004-02-23  Martin Baulig  <martin@ximian.com>
780
781         * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
782         field and check whether we're nested inside a generic type.
783         (DeclSpace.ResolveType): If we're resolving to a generic type
784         definition, create a ConstructedType and return its resolved type.
785         (DeclSpace.initialize_type_params): New private method;
786         initializes the `type_param_list' field from the type parameters
787         from this and all enclosing classes.
788         (DeclSpace.TypeParameters): Call initialize_type_params() unless
789         we're already initialized.
790
791 2004-02-23  Martin Baulig  <martin@ximian.com>
792
793         * class.cs (Method.Define): Create the generic method before
794         calling DoDefine().
795         (Memberbase.DoDefine): Added DeclSpace argument (in addition to
796         the TypeContainer one); we use this for generic methods.
797
798         * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
799         parent's TypeBuilder.
800
801 2004-02-18  Martin Baulig  <martin@ximian.com>
802
803         * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
804         to check for equality.
805
806 2004-02-05  Martin Baulig  <martin@ximian.com>
807
808         * ecore.cs (FieldExpr.DoResolveLValue): If we have an
809         `ec.TypeContainer.CurrentType', use it instead of
810         `ec.ContainerType' to check whether we're in the type's ctor.
811
812 2004-01-29  Martin Baulig  <martin@ximian.com>
813
814         * expression.cs (Invocation.DoResolve): If we're a
815         `ConstructedType', then we're actually a generic method, so
816         rewrite the expr as a GenericMemberAccess.
817
818         * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
819         here; manually parse it into a string.
820
821 2004-01-28  Martin Baulig  <martin@ximian.com>
822
823         * typemanager.cs (TypeManager.IsEqual): New static method.
824         (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
825         check for equality instead of using `=='.
826
827 2004-01-26  Martin Baulig  <martin@ximian.com>
828
829         * decl.cs (DeclSpace.CurrentType): New public field.
830
831         * expression.cs (This.ResolveBase): If we have an
832         `ec.TypeContainer.CurrentType', use it instead of
833         `ec.ContainerType'.
834
835         * class.cs (TypeContainer.DefineType): If we're a generic type,
836         create the `CurrentType' (unresolved).
837         (TypeContainer.GenericType): New private field.
838         (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
839         it and store it in `GenericType' before creating the MemberCache.
840         (TypeContainer.GetMembers): If we have a `GenericType', call
841         TypeManager.FindMembers() on it.
842
843         * interface.cs (Interface.GenericType): New private field.
844         (Interface.DefineType): If we're a generic type, create the
845         `CurrentType' (unresolved).
846         (Interface.DefineMembers): If we have a `CurrentType', resolve it
847         and store it in `GenericType' before creating the MemberCache.
848         (Interface.GetMembers): If we have a `GenericType', call
849         TypeManager.FindMembers() on it.
850
851 2004-01-22  Martin Baulig  <martin@ximian.com>
852
853         * cs-parser.jay (namespace_or_type_name): Return an Expression,
854         not a QualifiedIdentifier.  This is what `type_name_expression'
855         was previously doing.
856         (type_name_expression): Removed; the code is now in
857         `namespace_or_type_name'.
858         (qualified_identifier): Removed, use `namespace_or_type_name'
859         instead.
860         (QualifiedIdentifier): Removed this class.      
861
862 2004-01-22  Martin Baulig  <martin@ximian.com>
863
864         * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
865         not a string as alias name.
866
867 2004-01-21  Miguel de Icaza  <miguel@ximian.com>
868
869         * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
870         #52730 bug, and instead compute correctly the need to use a
871         temporary variable when requesting an address based on the
872         static/instace modified of the field and the constructor.
873  
874 2004-01-21  Martin Baulig  <martin@ximian.com>
875
876         * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
877         class and namespace before looking up aliases.  Fixes #52517.
878
879 2004-01-21  Martin Baulig  <martin@ximian.com>
880
881         * flowanalysis.cs (UsageVector.Merge): Allow variables being
882         assinged in a 'try'; fixes exception4.cs.
883
884 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
885         * class.cs : Implemented parameter-less constructor for TypeContainer
886         
887         * decl.cs: Attributes are now stored here. New property OptAttributes
888         
889         * delegate.cs, enum.cs, interface.cs: Removed attribute member.
890         
891         * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
892
893 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
894
895         * typemanager.cs (CSharpSignature): Now reports also inner class name.
896           (CSharpSignature): New method for indexer and property signature.
897
898 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
899
900         * pending.cs (IsVirtualFilter): Faster implementation.
901
902 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
903
904         * typemanager.cs: Avoid inclusion of same assembly more than once.
905
906 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
907
908         * cs-parser.jay: Fixed problem where the last assembly attribute
909           has been applied also to following declaration (class, struct, etc.)
910           
911 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
912
913         * class.cs: Added error CS0538, CS0539 reporting.
914         Fixed crash on Microsoft runtime when field type is void.
915
916         * cs-parser.jay: Added error CS0537 reporting.
917
918         * pending.cs: Added error CS0535 reporting.
919         Improved error report for errors CS0536, CS0534.
920
921 2004-01-20  Miguel de Icaza  <miguel@ximian.com>
922
923         Merge a few bits from the Anonymous Method MCS tree.
924         
925         * statement.cs (ToplevelBlock): New class for toplevel methods,
926         will hold anonymous methods, lifted variables.
927
928         * cs-parser.jay: Create toplevel blocks for delegates and for
929         regular blocks of code. 
930
931 2004-01-20  Martin Baulig  <martin@ximian.com>
932
933         * codegen.cs (EmitContext): Removed `InTry', `InCatch',
934         `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
935         and `NeedExplicitReturn'; added `IsLastStatement'.
936         (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
937         have a `ReturnLabel' or we're not unreachable.
938
939         * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
940         child's reachability; don't just override ours with it.  Fixes
941         #58058 (lluis's example).
942         (FlowBranching): Added public InTryOrCatch(), InCatch(),
943         InFinally(), InLoop(), InSwitch() and
944         BreakCrossesTryCatchBoundary() methods.
945
946         * statement.cs (Return): Do all error checking in Resolve().
947         Unless we are the last statement in a top-level block, always
948         create a return label and jump to it.
949         (Break, Continue): Do all error checking in Resolve(); also make
950         sure we aren't leaving a `finally'.
951         (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
952         statement in a top-level block.
953         (Block.Flags): Added `IsDestructor'.
954         (Block.IsDestructor): New public property.
955
956 2004-01-20  Martin Baulig  <martin@ximian.com>
957
958         * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
959
960 2004-01-20  Martin Baulig  <martin@ximian.com>
961
962         * statement.cs (Statement.ResolveUnreachable): New public method.
963         (If, While): Do the dead-code elimination in Resolve(), not in Emit().
964         (Block.Resolve): Resolve unreachable statements.
965
966 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
967
968         * expression.cs: We need to fix the case where we do
969         not have a temp variable here.
970
971         * assign.cs: Only expression compound assignments need
972         temporary variables.
973
974 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
975
976         * flowanalysis.cs: Reduce memory allocation in a few ways:
977           - A block with no variables should not allocate a bit
978             vector for itself.
979           - A method with no out parameters does not need any tracking
980             for assignment of the parameters, so we need not allocate
981             any data for it.
982           - The arrays:
983                 public readonly Type[] VariableTypes;
984                 public readonly string[] VariableNames;
985             Are redundant. The data is already stored in the variable
986             map, so we need not allocate another array for it.
987           - We need to add alot of checks for if (params | locals) == null
988             due to the first two changes.
989
990 2004-01-18  Miguel de Icaza  <miguel@ximian.com>
991
992         * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
993         implement IMemoryLocation, we store a copy on a local variable and
994         take the address of it.  Patch from Benjamin Jemlich
995
996         * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
997         to use a special "type_name_expression" rule which reduces the
998         number of "QualifiedIdentifier" classes created, and instead
999         directly creates MemberAccess expressions.
1000
1001 2004-01-17  Miguel de Icaza  <miguel@ximian.com>
1002
1003         * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
1004         that fixes #52853.  Null literal assignment to ValueType
1005
1006         * class.cs (MethodData.Emit): Instead of checking the name of the
1007         method to determine if its a destructor, create a new derived
1008         class from Method called Destructor, and test for that.  
1009
1010         * cs-parser.jay: Create a Destructor object instead of a Method.  
1011
1012         Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
1013
1014         Fixes: 52933
1015         
1016 2004-01-16  Miguel de Icaza  <miguel@ximian.com>
1017
1018         * expression.cs (Binary.ResolveOperator): Perform an implicit
1019         conversion from MethodGroups to their delegate types on the
1020         Addition operation.
1021
1022         * delegate.cs: Introduce a new class DelegateCreation that is the
1023         base class for `NewDelegate' and `ImplicitDelegateCreation',
1024         factor some code in here.
1025
1026         * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
1027         conversion from MethodGroups to compatible delegate types. 
1028
1029         * ecore.cs (Expression.Resolve): Do not flag error 654
1030         (Methodgroupd needs parenthesis) if running on the V2 compiler, as
1031         we allow conversions from MethodGroups to delegate types now.
1032         
1033         * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
1034         assignments in v2 either.
1035
1036 2004-01-10  Miguel de Icaza  <miguel@ximian.com>
1037
1038         * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
1039         static read-only fields in ctors.
1040
1041         Applied patch from Benjamin Jemlich 
1042
1043         * expression.cs (UnaryMutator): Avoid leaking local variables. 
1044         
1045 2004-01-09  Miguel de Icaza  <miguel@ximian.com>
1046
1047         * cs-tokenizer.cs (IsCastToken): Allow the various native types
1048         here to return true, as they can be used like this:
1049
1050                 (XXX) int.MEMBER ()
1051
1052         Fixed 49836 and all the other dups
1053         
1054 2004-01-09  Zoltan Varga  <vargaz@freemail.hu>
1055
1056         * driver.cs: Implement /win32res and /win32icon.
1057
1058 2004-01-08  Miguel de Icaza  <miguel@ximian.com>
1059
1060         * cs-parser.jay: Add a rule to improve error handling for the
1061         common mistake of placing modifiers after the type.
1062
1063 2004-01-07  Miguel de Icaza  <miguel@ximian.com>
1064
1065         * cs-parser.jay (interface_event_declaration): Catch
1066         initialization of events on interfaces, and report cs0068
1067
1068         * cs-parser.jay (interface_event_declaration): Catch
1069         initialization of events. 
1070
1071         * ecore.cs: Better report missing constructors.
1072         
1073         * expression.cs (Binary.ResolveOperator): My previous bug fix had
1074         the error reporting done in the wrong place.  Fix.
1075
1076         * expression.cs (Binary.ResolveOperator): Catch the 
1077         operator + (E x, E y) error earlier, and later allow for implicit
1078         conversions in operator +/- (E e, U x) from U to the underlying
1079         type of E.
1080
1081         * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
1082         52596, if the container class is abstract, the default constructor
1083         is protected otherwise its public (before, we were always public).
1084
1085         * statement.cs (Fixed.Resolve): Catch a couple more errors in the
1086         fixed statement.
1087
1088         (Using.EmitLocalVariableDecls): Applied patch from Benjamin
1089         Jemlich that fixes bug #52597, MCS was generating invalid code for
1090         idisposable structs.   Thanks to Ben for following up with this
1091         bug as well.
1092         
1093 2004-01-06  Miguel de Icaza  <miguel@ximian.com>
1094
1095         * driver.cs: Allow assemblies without code to be generated, fixes
1096         52230.
1097
1098 2004-01-07  Nick Drochak <ndrochak@gol.com>
1099
1100         * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
1101
1102 2004-01-05  Miguel de Icaza  <miguel@ximian.com>
1103
1104         * cs-parser.jay: Add rules to improve error reporting if fields or
1105         methods are declared at the namespace level (error 116)
1106
1107         * Add rules to catch event add/remove
1108
1109 2004-01-04  David Sheldon <dave-mono@earth.li>
1110
1111   * expression.cs: Added matching ")" to error message for 
1112   CS0077
1113
1114 2004-01-03 Todd Berman <tberman@gentoo.org>
1115         
1116         * ecore.cs, attribute.cs:
1117         Applying fix from #52429.
1118
1119 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1120
1121         * ecore.cs, expression.cs, statement.cs:
1122         Total rewrite of how we handle branching. We
1123         now handle complex boolean expressions with fewer
1124         jumps. As well if (x == 0) no longer emits a ceq.
1125
1126         if (x is Foo) is much faster now, because we generate
1127         better code.
1128
1129         Overall, we get a pretty big improvement on our benchmark
1130         tests. The code we generate is smaller and more readable.
1131
1132         I did a full two-stage bootstrap. The patch was reviewed
1133         by Martin and Miguel.
1134
1135 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1136
1137         * cs-parser.jay: Make primary_expression not take a QI.
1138         we dont need this because the member_access rule covers
1139         us here. So we replace the rule with just IDENTIFIER.
1140
1141         This has two good effects. First, we remove a s/r conflict.
1142         Second, we allocate many fewer QualifiedIdentifier objects.
1143
1144 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1145
1146         * attribute.cs: Handle MarshalAs attributes as pseudo, and
1147         set the correct information via SRE. This prevents
1148         hanging on the MS runtime. Fixes #29374.
1149
1150 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1151
1152         * convert.cs: correctly handle conversions to value types
1153         from Enum and ValueType as unboxing conversions.
1154
1155         Fixes bug #52569. Patch by Benjamin Jemlich.
1156
1157 2004-01-02  Ravi Pratap  <ravi@ximian.com>
1158
1159         * expression.cs (BetterConversion): Prefer int -> uint
1160         over int -> ulong (csc's behaviour). This fixed bug #52046.
1161
1162 2004-01-02 Ben Maurer  <bmaurer@users.sourceforge.net>
1163
1164         * decl.cs (MemberCache.FindMembers): now returns a
1165         MemberInfo [].
1166
1167         * typemanager.cs: In general, go with with ^^.
1168         (CopyNewMethods): take an IList.
1169         (RealMemberLookup): Only allocate an arraylist
1170         if we copy from two sets of methods.
1171
1172         This change basically does two things:
1173         1) Fewer array lists allocated due to CopyNewMethods.
1174         2) the explicit cast in MemberList costed ALOT.
1175
1176 2004-01-02  Zoltan Varga  <vargaz@freemail.hu>
1177
1178         * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
1179         a hashtable to avoid needless string allocations when an identifier is
1180         used more than once (the common case).
1181
1182 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
1183
1184         * pending.cs: MS's TypeBuilder.GetInterfaces ()
1185         is broken, it will not return anything. So, we
1186         have to use the information we have in mcs to
1187         do the task.
1188
1189         * typemanager.cs: Add a cache for GetInterfaces,
1190         since this will now be used more often (due to ^^)
1191
1192         (GetExplicitInterfaces) New method that gets the
1193         declared, not effective, interfaces on a type
1194         builder (eg, if you have interface IFoo, interface
1195         IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
1196         { IBar }.
1197
1198         This patch makes MCS able to bootstrap itself on
1199         Windows again.
1200
1201 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
1202
1203         * expression.cs: Remove the Nop's that Miguel put
1204         in by mistake.
1205
1206 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
1207
1208         * report.cs, codegen.cs: Give the real stack trace to
1209         the error when an exception is thrown.
1210
1211 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
1212
1213         * decl.cs: only allocate hashtables for ifaces if 
1214         it is an iface!
1215
1216 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
1217
1218         * expression.cs: fix the error from cs0121-2.cs
1219         (a parent interface has two child interfaces that
1220         have a function with the same name and 0 params
1221         and the function is called through the parent).
1222
1223 2003-12-30 Ben Maurer  <bmaurer@users.sourceforge.net>
1224
1225         * class.cs, rootcontext.cs, typmanager.cs: do not
1226         leak pointers.
1227
1228 2003-12-28 Ben Maurer  <bmaurer@users.sourceforge.net>
1229
1230         * codegen.cs: remove stack for the ec flow branching.
1231         It is already a linked list, so no need.
1232
1233 2003-12-27 Ben Maurer  <bmaurer@users.sourceforge.net>
1234
1235         * Makefile: Allow custom profiler here.
1236
1237 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
1238
1239         * typemanager.cs (LookupType):
1240           - Use a static char [], because split takes
1241             a param array for args, so it was allocating
1242             every time.
1243           - Do not store true in a hashtable, it boxes.
1244
1245 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
1246
1247         * flowanalysis.cs: bytify common enums.
1248
1249 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
1250
1251         * modifiers.cs: Add a new set of flags for the
1252         flags allowed on explicit interface impls.
1253         * cs-parser.jay: catch the use of modifiers in
1254         interfaces correctly.
1255         * class.cs: catch private void IFoo.Blah ().
1256
1257         All related to bug #50572.
1258
1259 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
1260
1261         * decl.cs: Rewrite the consistant accessability checking.
1262         Accessability is not linear, it must be implemented in
1263         a tableish way. Fixes #49704.
1264
1265 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
1266
1267         * expression.cs: Handle negation in a checked context.
1268         We must use subtraction from zero. Fixes #38674.
1269
1270 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1271
1272         * class.cs: Ignore static void main in DLLs.
1273         * rootcontext.cs: Handle the target type here,
1274         since we are have to access it from class.cs
1275         * driver.cs: account for the above.
1276
1277 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1278
1279         * report.cs: Give line numbers and files if available.
1280
1281 2003-12-20  Zoltan Varga  <vargaz@freemail.hu>
1282
1283         * driver.cs: Implement /addmodule.
1284
1285         * typemanager.cs:  Change 'modules' field so it now contains Modules not
1286         ModuleBuilders.
1287
1288 2003-12-20  Martin Baulig  <martin@ximian.com>
1289
1290         * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
1291         (FieldBase.IsAssigned): Removed this field.
1292         (FieldBase.SetAssigned): New public method.
1293         (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
1294
1295 2003-12-20  Martin Baulig  <martin@ximian.com>
1296
1297         * expression.cs (LocalVariableReference.DoResolve): Don't set
1298         `vi.Used' if we're called from DoResolveLValue().
1299
1300         * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
1301         returns the usage vector it just merged into the current one -
1302         pass this one to UsageWarning().
1303         (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
1304         of the `EmitContext', don't call this recursively on our children.
1305
1306 2003-12-19  Zoltan Varga  <vargaz@freemail.hu>
1307
1308         * driver.cs: Implement /target:module.
1309
1310 2003-12-18  Zoltan Varga  <vargaz@freemail.hu>
1311
1312         * support.cs (CharArrayHashtable): New helper class.
1313
1314         * cs-tokenizer.cs: Store keywords in a hashtable indexed by 
1315         char arrays, not strings, so we can avoid creating a string in
1316         consume_identifier if the identifier is a keyword.
1317
1318 2003-12-16  Martin Baulig  <martin@ximian.com>
1319
1320         * statement.cs (LocalInfo.Assigned): Removed this property.
1321         (LocalInfo.Flags): Removed `Assigned'.
1322         (LocalInfo.IsAssigned): New public method; takes the EmitContext
1323         and uses flow analysis.
1324         (Block.UsageWarning): Made this method private.
1325         (Block.Resolve): Call UsageWarning() if appropriate.
1326
1327         * expression.cs (LocalVariableReference.DoResolve): Always set
1328         LocalInfo.Used here.
1329
1330 2003-12-13  Martin Baulig  <martin@ximian.com>
1331
1332         * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
1333         any value here; we're now using flow analysis to figure out
1334         whether a statement/block returns a value.
1335
1336 2003-12-13  Martin Baulig  <martin@ximian.com>
1337
1338         * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
1339         working again.
1340         (FlowBranching.MergeFinally): Don't call
1341         `branching.CheckOutParameters()' here, this is called in
1342         MergeTopBlock().
1343         (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
1344         when adding the `finally' vector.       
1345
1346 2003-12-13  Martin Baulig  <martin@ximian.com>
1347
1348         * flowanalysis.cs
1349         (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
1350         actually work and also fix #48962.
1351
1352 2003-12-12 Ben Maurer  <bmaurer@users.sourceforge.net>
1353
1354         * decl.cs: Do not check System.Object for nested types,
1355         since we know it does not have any. Big bang for buck:
1356
1357         BEFORE:
1358            Run 1:   8.35 seconds
1359            Run 2:   8.32 seconds
1360            corlib:  17.99 seconds
1361         AFTER:
1362            Run 1:   8.17 seconds
1363            Run 2:   8.17 seconds
1364            corlib:  17.39 seconds
1365
1366 2003-12-11 Ben Maurer  <bmaurer@users.sourceforge.net>
1367
1368         * class.cs (FindMembers): Allocate arraylists on demand. Most of the
1369         time we are returning 0 members, so we save alot here.
1370
1371 2003-12-11  Martin Baulig  <martin@ximian.com>
1372
1373         * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
1374         `MergeChild()', also just take the `FlowBranching' as argument;
1375         call Merge() on it and return the result.
1376         (FlowBranching.Merge): We don't need to do anything if we just
1377         have one sibling.
1378
1379 2003-12-11  Martin Baulig  <martin@ximian.com>
1380
1381         * flowanalysis.cs: Use a list of `UsageVector's instead of storing
1382         them in an `ArrayList' to reduce memory usage.  Thanks to Ben
1383         Maurer for this idea.
1384
1385 2003-12-11  Martin Baulig  <martin@ximian.com>
1386
1387         * flowanalysis.cs (MergeResult): This class is now gone; we now
1388         use the `UsageVector' for this.  The reason for this is that if a
1389         branching just has one sibling, we don't need to "merge" them at
1390         all - that's the next step to do.
1391         (FlowBranching.Merge): We now return a `UsageVector' instead of a
1392         `MergeResult'.
1393
1394 2003-12-11  Martin Baulig  <martin@ximian.com>
1395
1396         Reworked flow analyis and made it more precise and bug-free.  The
1397         most important change is that we're now using a special `Reachability'
1398         class instead of having "magic" meanings of `FlowReturns'.  I'll
1399         do some more cleanups and optimizations and also add some more
1400         documentation this week.
1401
1402         * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
1403         largely reworked this class.
1404         (FlowReturns): Removed `Unreachable' and `Exception'; we now use
1405         the new `Reachability' class instead of having "magic" values here.
1406         (FlowBranching): We're now using an instance of `Reachability'
1407         instead of having separate `Returns', `Breaks' etc. fields.
1408
1409         * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
1410         based on flow analysis; ignore the return value of block.Emit ().
1411
1412 2003-12-10  Zoltan Varga  <vargaz@freemail.hu>
1413
1414         * driver.cs typemanager.cs: Find the mono extensions to corlib even
1415         if they are private.
1416
1417 2003-12-09  Martin Baulig  <martin@ximian.com>
1418
1419         * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
1420         call them directly on the UsageVector.
1421
1422 2003-12-09  Martin Baulig  <martin@ximian.com>
1423
1424         * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
1425         Changed return type from `FlowReturns' to `Reachability'.
1426
1427 2003-12-09  Martin Baulig  <martin@ximian.com>
1428
1429         * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
1430         (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
1431         `Reachable' fields with a single `Reachability' one.
1432
1433 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1434
1435         * class.cs (FindMembers): Remove foreach's.
1436
1437         Bootstrap times:
1438         
1439         BEFORE
1440                 Run 1:   8.74 seconds
1441                 Run 2:   8.71 seconds
1442         
1443         AFTER
1444                 Run 1:   8.64 seconds
1445                 Run 2:   8.58 seconds
1446         
1447
1448 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1449
1450         * cs-parser.jay:
1451         * gen-treedump.cs:
1452         * statement.cs:
1453         This patch does a few things:
1454                 1. EmptyStatement is now a singleton, so it is never reallocated.
1455                 2. All blah is EmptyStatement constructs have been changed to
1456                    blah == EmptyStatement.Value, which is much faster and valid
1457                    now that EmptyStatement is a singleton.
1458                 3. When resolving a block, rather than allocating a new array for
1459                    the non-empty statements, empty statements are replaced with
1460                    EmptyStatement.Value
1461                 4. Some recursive functions have been made non-recursive.
1462         Mainly the performance impact is from (3), however (1) and (2) are needed for
1463         this to work. (4) does not make a big difference in normal situations, however
1464         it makes the profile look saner.
1465
1466         Bootstrap times:
1467
1468         BEFORE
1469         9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
1470         9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
1471         Total memory allocated: 56397 KB
1472         
1473         AFTER
1474         9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
1475         8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
1476         Total memory allocated: 55666 KB
1477
1478 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1479
1480         * support.cs: Rewrite DoubleHash to use its own impl. Is faster
1481         than the hashtable in a hashtable version
1482
1483         * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
1484         we always end up concating a string. This results in a huge perf
1485         loss, because many strings have to be tracked by the GC. In this
1486         patch, we first use a hashtable that works with two keys, so that
1487         the strings do not need to be concat'ed.
1488
1489         Bootstrap times:
1490         BEFORE
1491                 Run 1:   8.74 seconds
1492                 Run 2:   8.71 seconds
1493         
1494         AFTER
1495                 Run 1:   8.65 seconds
1496                 Run 2:   8.56 seconds
1497         
1498 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1499
1500         * Makefile: Add a new target `do-time' that does a quick and simple
1501         profile, leaving easy to parse output.
1502
1503 2003-12-08  Zoltan Varga  <vargaz@freemail.hu>
1504
1505         * codegen.cs (Init): Create the dynamic assembly with 
1506         AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
1507
1508 2003-12-02 Ben Maurer  <bmaurer@users.sourceforge.net>
1509
1510         * support.cs: Make the PtrHashtable use only one
1511         instance of its comparer.
1512
1513 2003-11-30  Zoltan Varga  <vargaz@freemail.hu>
1514
1515         * typemanager.cs: Fix lookup of GetNamespaces.
1516
1517 2003-11-29  Miguel de Icaza  <miguel@ximian.com>
1518
1519         * expression.cs: Removed redundant line.
1520
1521         * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
1522         ArrayLists, use for loops with bounds.  
1523
1524         * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
1525         arraylist.
1526
1527         * expression.cs (Invocation.OverloadResolve): Avoid foreach on
1528         arraylists, use for loop with bounds.
1529
1530         The above three changes give us a 0.071 second performance
1531         improvement out of 3.294 seconds down to 3.223.  On my machine
1532         the above changes reduced the memory usage by 1,387 KB during
1533         compiler bootstrap.
1534
1535         * cs-parser.jay (QualifiedIdentifier): New class used to represent
1536         QualifiedIdentifiers.  Before we created a new string through
1537         concatenation, and mostly later on, the result would be
1538         manipulated by DecomposeQI through string manipulation.
1539
1540         This reduced the compiler memory usage for bootstrapping from
1541         59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
1542         compile times in 0.05 seconds.
1543
1544 2003-11-28  Dick Porter  <dick@ximian.com>
1545
1546         * support.cs: Do string compares with the Invariant culture.
1547
1548         * rootcontext.cs: 
1549         * gen-treedump.cs: 
1550         * expression.cs: 
1551         * driver.cs: 
1552         * decl.cs: 
1553         * codegen.cs: 
1554         * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
1555         the comparison is done with the Invariant culture.
1556
1557 2003-11-27  Miguel de Icaza  <miguel@ximian.com>
1558
1559         * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
1560         GetEnumerator method.
1561
1562         (ProbeCollectionType): Iterate starting at the most specific type
1563         upwards looking for a GetEnumerator
1564
1565         * expression.cs: Shift count can be up to 31 for int/uint and 63
1566         for long/ulong.
1567
1568 2003-11-26  Miguel de Icaza  <miguel@ximian.com>
1569
1570         * statement.cs (Block.LookupLabel): Also look for the label on the
1571         children blocks.  Use a hash table to keep track of visited
1572         nodes. 
1573
1574         * cfold.cs (IntConstant to UIntConstant mapping): Only return if
1575         we actually did transform the other operand, otherwise fall back
1576         to the common codepath that casts to long.
1577
1578         * cs-tokenizer.cs: Use the same code pattern as the int case.
1579         Maybe I should do the parsing myself, and avoid depending on the
1580         Parse routines to get this done.
1581
1582 2003-11-25  Miguel de Icaza  <miguel@ximian.com>
1583
1584         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
1585         which fixes bug 51347.  This time test it.
1586         
1587         * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
1588         attributes for example can not tell the difference between these.
1589         The difference was only a syntax feature of the language. 
1590
1591         * attribute.cs: Apply attributes to delegates.
1592
1593         * delegate.cs: Call the apply attributes method.
1594
1595 2003-11-24  Miguel de Icaza  <miguel@ximian.com>
1596
1597         * convert.cs (TryImplicitIntConversion): One line bug fix: we were
1598         comparing 0 vs Byte.MinValue, not the value
1599
1600         (ImplicitConversionRequired): When reporting a conversion error,
1601         use error 31 to print out the constant error instead of the
1602         simpler 29.
1603
1604         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
1605         which fixes bug 51347.
1606         
1607 2003-11-22  Miguel de Icaza  <miguel@ximian.com>
1608
1609         * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen) 
1610         which fixes the -warnaserror command line option.
1611         
1612 2003-11-21  Miguel de Icaza  <miguel@ximian.com>
1613
1614         * cfold.cs (DoNumericPromotions): During constant folding of
1615         additions on UIntConstant, special case intconstants with
1616         IntConstants like we do on the expression binary operator. 
1617
1618 2003-11-12  Miguel de Icaza  <miguel@ximian.com>
1619
1620         * convert.cs (ImplicitReferenceConversion): We were missing a case
1621         (System.Enum are not value types or class types, so we need to
1622         classify them separatedly).
1623
1624         * driver.cs: We do not support error 2007.
1625
1626 2003-11-12 Jackson Harper <jackson@ximian.com>
1627
1628         * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
1629         system directory. Also use the full file name so users can
1630         libraries names mscorlib-o-tron.dll in a non system dir.
1631         
1632 2004-01-04  David Sheldon <dave-mono@earth.li>
1633
1634         * expression.cs: Added matching ")" to error message for CS0077.
1635
1636 2003-12-19  Martin Baulig  <martin@ximian.com>
1637
1638         * typemanager.cs (TypeManager.IsEqualGenericType): New public
1639         static method; see documentation in the method.
1640         (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
1641
1642         * convert.cs (Convert.ImplicitReferenceConversion,
1643         Convert.ImplicitReferenceConversionExists): Add support for
1644         generic type declarations; see gen-36.cs.
1645
1646 2003-12-19  Martin Baulig  <martin@ximian.com>
1647
1648         * pending.cs (Pending.InterfaceMethod): Use
1649         `Type.IsAssignableFrom()' instead of `=='.
1650
1651 2003-12-18  Martin Baulig  <martin@ximian.com>
1652
1653         * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
1654         byref types first.
1655
1656         * convert.cs (Convert.ImplicitStandardConversionExists): Use
1657         `expr_type.Equals (target_type)' instead of `=='.
1658
1659 2003-12-08  Martin Baulig  <martin@ximian.com>
1660
1661         * generics.cs (Constraints.Types): Removed.
1662         (Constraints.Resolve): Just resolve everything to TypeExpr's, not
1663         to Type's.
1664         (Constraints.ResolveTypes): New public method; resolves the
1665         TypeExpr's to Type's.
1666         (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
1667         longer takes the constraints.
1668         (TypeParameter.DefineMethod): Likewise.
1669         (TypeParameter.DefineType): New public method.  Calls
1670         `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
1671         the constraints.
1672
1673 2003-12-08  Martin Baulig  <martin@ximian.com>
1674
1675         * convert.cs (Convert.ImplicitConversionStandard): Use
1676         `expr_type.Equals (target_type)' instead of `=='.
1677
1678 2003-12-08  Martin Baulig  <martin@ximian.com>
1679
1680         * typemanager.cs (TypeManager.GetReferenceType): Call
1681         `Type.MakeByRefType ()'.
1682
1683 2003-12-08  Martin Baulig  <martin@ximian.com>
1684
1685         * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
1686         just has some special meaning in some situations.  For instance,
1687         it is allowed to use `where' as the name of a variable etc.
1688
1689 2003-12-04  Martin Baulig  <martin@ximian.com>
1690
1691         * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
1692         `Type.MakeArrayType()' for array types.
1693
1694 2003-11-18  Miguel de Icaza  <miguel@ximian.com>
1695
1696         * expression.cs (Invocation.VerifyArgumentsCompat): Remove
1697         debugging message.
1698
1699         (SizeOf.DoResolve): assign the `type_queried' field.  This gets
1700         corlib to compile.
1701
1702 2003-11-16  Martin Baulig  <martin@ximian.com>
1703
1704         * codegen.cs (EmitContext.IsGeneric): Removed.
1705
1706         * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
1707         ResolveGeneric() on the DeclSpace.
1708
1709 2003-11-16  Martin Baulig  <martin@ximian.com>
1710
1711         * generic.cs (TypeArguments.Resolve):
1712         `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
1713         `ResolveType()' on it to get the Type.
1714
1715 2003-11-15  Martin Baulig  <martin@ximian.com>
1716
1717         * generic.cs (ConstructedType.GetInterfaces): Override this.
1718
1719 2003-11-14  Martin Baulig  <martin@ximian.com>
1720
1721         * interface.cs (Interface.DefineType): Define all type parameters
1722         before adding the interfaces we inherit.
1723
1724 2003-11-11  Martin Baulig  <martin@ximian.com>
1725
1726         * generic.cs (ConstructedType.ResolveType): Always call
1727         `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
1728
1729 2003-11-10  Martin Baulig  <martin@ximian.com>
1730
1731         * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
1732         (TypeManager.InitCoreTypes): Initialize them here, but instead of
1733         calling `ResolveType()' on them, directly assign their `Type'.
1734
1735 2003-11-08  Martin Baulig  <martin@ximian.com>
1736
1737         * generic.cs (ConstructedType): Override `IsClass' etc.
1738
1739 2003-11-08  Martin Baulig  <martin@ximian.com>
1740
1741         * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
1742         return value and the `out parent' parameter.
1743         (TypeContainer.DefineType): Moved the CS0644 check into
1744         GetClassBases().  Don't pass the interface types to the
1745         `builder.DefineType()'/`builder.DefineNestedType()', but resolve
1746         them later and then call `TypeBuilder.AddInterfaceImplementation()'.
1747
1748         * ecore.cs (TypeExpr.IsAttribute): New property.
1749         (TypeExpr.GetInterfaces): New method.
1750
1751         * interface.cs (Interface.GetInterfaceTypeByName): Return a
1752         TypeExpr instead of a Type.
1753         (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
1754         (Interface.DefineType): Don't pass the interface types to the
1755         `builder.Definetype()'/`builder.DefineNestedType()', but resolve
1756         them later and then call `TypeBulider.AddInterfaceImplementation()'.
1757
1758         * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
1759         instead of a `Type[]'.
1760         (TypeManager.RegisterBuilder): Likewise.
1761         (TypeManager.AddUserInterface): Likewise.
1762         (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
1763         `Type[]' and also return a `TypeExpr[]'.
1764         (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
1765
1766 2003-11-08  Martin Baulig  <martin@ximian.com>
1767
1768         * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
1769         Expression.     
1770
1771 2003-11-08  Martin Baulig  <martin@ximian.com>
1772
1773         * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
1774         TypeManager.ResolveExpressionTypes().
1775
1776         * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
1777         instead of an Expression.
1778         (TypeExpr): This is now an abstract base class for `TypeExpression'.
1779         (TypeExpression): New public class; formerly known as `TypeExpr'.
1780
1781         * expression.cs (ComposedCast): Derive from TypeExpr.
1782
1783         * typemanager.cs (TypeManager.system_*_expr): These are now
1784         TypExpr's instead of Expression's.
1785         (TypeManager.ResolveExpressionTypes): New public static function;
1786         called from DeclSpace.GetTypeResolveEmitContext() to resolve all
1787         of them.        
1788
1789 2003-11-06  Miguel de Icaza  <miguel@ximian.com>
1790
1791         * expression.cs (New.DoResolve): Do not dereference value that
1792         might be a null return.
1793
1794         * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
1795         sure that the constant value has the right type.  Fixes an
1796         unreported bug, similar to 50425.
1797
1798         * const.cs (Const.LookupConstantValue): Call
1799         ImplicitStandardConversionExists before doing a conversion to
1800         avoid havng the TypeManager.ChangeType do conversions.
1801
1802         Reduced the number of casts used
1803
1804         (Const.ChangeType): New routine to enable reuse of the constant
1805         type changing code from statement.
1806
1807         * typemanager.cs (ChangeType): Move common initialization to
1808         static global variables.
1809
1810         Fixes #50425.
1811
1812         * convert.cs (ImplicitReferenceConversion): Somehow we allowed
1813         every value type to go through, even if it was void.  Fix that. 
1814
1815         * cs-tokenizer.cs: Use is_identifier_start_character on the start
1816         character of the define, and the is_identifier_part_character for
1817         the rest of the string.
1818
1819 2003-11-05  Miguel de Icaza  <miguel@ximian.com>
1820
1821         * expression.cs (UnaryMutator.EmitCode): When I updated
1822         LocalVariableReference.DoResolve, I overdid it, and dropped an
1823         optimization done on local variable references.
1824
1825 2003-11-04  Miguel de Icaza  <miguel@ximian.com>
1826
1827         * ecore.cs: Convert the return from Ldlen into an int.
1828
1829 2003-10-20  Miguel de Icaza  <miguel@ximian.com>
1830
1831         * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
1832         the accessibility, this is a special case for toplevel non-public
1833         classes (internal for instance).
1834
1835 2003-10-20  Nick Drochak <ndrochak@gol.com>
1836
1837         * ecore.cs: Fix typo and build.  Needed another right paren.
1838
1839 2003-10-19  Miguel de Icaza  <miguel@ximian.com>
1840
1841         * ecore.cs: Applied fix from Ben Maurer.   We were handling in the
1842         `internal' case regular and protected, but not allowing protected
1843         to be evaluated later.  Bug 49840
1844
1845 2003-10-15  Miguel de Icaza  <miguel@ximian.com>
1846
1847         * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
1848         to kb.Nlast, and not the kb.nFirst to isolate the switch
1849         statement.
1850
1851         Extract the underlying type, so enumerations of long/ulong are
1852         treated like long/ulong.
1853
1854 2003-10-14  Miguel de Icaza  <miguel@ximian.com>
1855
1856         * expression.cs (New): Overload the meaning of RequestedType to
1857         track the possible creation of the NewDelegate type, since
1858         DoResolve is invoked more than once for new constructors on field
1859         initialization.
1860
1861         See bugs: #48800 and #37014
1862
1863         * cs-parser.jay (declare_local_constants): Take an arraylist
1864         instead of a single constant.
1865
1866         (local_constant_declaration): It should take a
1867         constant_declarators, not a constant_declarator.  Fixes 49487
1868
1869         * convert.cs: Fix error report.
1870
1871 2003-10-13 Jackson Harper <jackson@ximian.com>
1872
1873         * typemanager.cs (TypeToCoreType): Add float and double this fixes
1874         bug #49611
1875         
1876 2003-11-03  Martin Baulig  <martin@ximian.com>
1877
1878         * expression.cs (ArrayAccess.GetStoreOpcode): Added
1879         `out bool has_type_arg'; if set, we need to pass the type to
1880         ig.Emit().
1881         (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
1882         Stelem_Any/Ldelem_Any for generic parameters.   
1883
1884 2003-11-02  Martin Baulig  <martin@ximian.com>
1885
1886         * expression.cs (Invocation.EmitCall): Use
1887         `TypeManager.IsValueType()' to check whether it's a value type.
1888         Don't set `struct_call' when calling a method on a type parameter.
1889
1890 2003-11-02  Martin Baulig  <martin@ximian.com>
1891
1892         * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
1893         and removed the TypeBuilder argument.
1894
1895         * typemanager.cs (TypeManager.IsValueType): Return
1896         `t.IsGenericParameter || t.IsValueType'.
1897
1898 2003-10-25  Martin Baulig  <martin@ximian.com>
1899
1900         * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
1901         call ConstructedType.Resolve() on it.
1902
1903         * generic.cs (ConstructedType.Resolve): Set `type' on success.
1904
1905 2003-10-25  Martin Baulig  <martin@ximian.com>
1906
1907         * class.cs (TypeContainer.GetClassBases): Changed
1908         `out Type parent' into `out TypeExpr parent'.  Moved CS0644 and
1909         CS8214 reporting here.
1910         (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
1911         instead of a `Type' for our parent.  In case of a recursive
1912         declaration (see tests/gen-23.cs for an example), our parent is a
1913         ConstructedType and it doesn't have its type set.  So, first
1914         create our own TypeBuilder, then call constructed.Resolve() to get
1915         the parent's type and finally TypeBuilder.SetParent() it.
1916
1917         * ecore.cs (TypeExpr.Name): New public virtual property.
1918
1919         * generic.cs
1920         (ConstructedType): We're now a TypeExpr and not just an Expression.
1921         (ConstructedType.ResolveAsTypeStep): Don't resolve our type
1922         arguments here; this is done later.
1923         (ConstructedType.Resolve): New public method to resolve the type
1924         arguments and bind them.
1925
1926 2003-10-21  Martin Baulig  <martin@ximian.com>
1927
1928         * convert.cs: Use `TypeManager.IsValueType' instead of
1929         'type.IsValueType' everywhere.
1930
1931         * typemanager.cs (TypeManager.IsValueType): Return true for type
1932         parameters.  The reason for this is that we need to box a type
1933         parameter when converting it to a reference type.
1934
1935         * cs-parser.jay: Added support for default value expressions.
1936
1937         * generics.cs (DefaultValueExpression): New public class.       
1938
1939 2003-10-17  Martin Baulig  <martin@ximian.com>
1940
1941         * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
1942         TypeContainer so we can also use this for Interfaces.
1943         (TypeParameter.Resolve): Likewise.
1944
1945         * interface.cs (Interface.DefineType): Added support for generic
1946         interfaces.
1947
1948         * cs-parser.jay: Added support for generic structs and interfaces.
1949
1950 2003-10-17  Martin Baulig  <martin@ximian.com>
1951
1952         * generic.cs (GenericMemberAccess.DoResolve): We can now actually
1953         call generic methods :-)
1954
1955 2003-10-16  Martin Baulig  <martin@ximian.com>
1956
1957         * cs-parser.jay (namespace_or_type_name): Only create a
1958         GenericMemberAccess if we actually have type arguments.
1959
1960 2003-10-13  Martin Baulig  <martin@ximian.com>
1961
1962         * class.cs (Method.Define): If we're a generic method, call
1963         TypeBuilder.DefineGenericMethod () before resolving
1964         the parameters.
1965         (MethodData): Added .ctor which takes an additional MethodBuilder
1966         argument; this is used for generic methods.
1967         (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
1968         we already have a MethodBuilder.
1969
1970 2003-10-10  Martin Baulig  <martin@ximian.com>
1971
1972         * class.cs (Method): Added .ctor which takes a `GenericMethod'
1973         instead of a `DeclSpace'.  This is used for generic methods.
1974
1975         * cs-parser.jay (method_header): Added support for generic
1976         methods; create a `GenericMethod' instance and pass it to the
1977         `Method's .ctor; it'll be used as the `DeclSpace' to lookup
1978         parameters and locals.
1979
1980         * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
1981         since we already have the location.  Check whether we're a generic
1982         type declaration or a generic method and create the correct type
1983         parameter.
1984
1985         * generic.cs (TypeParameter.DefineMethod): New public method.
1986         (GenericMethod): New public class; derives from DeclSpace and is
1987         used for generic methods.       
1988
1989 2003-10-09  Martin Baulig  <martin@ximian.com>
1990
1991         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
1992         to the .ctor.
1993         (MethodCore.DoDefineParameters): Removed the TypeContainer
1994         argument; use the DeclSpace which was passed to the .ctor instead.
1995         (MethodCore.CheckParameter): Take a DeclSpace instead of a
1996         TypeContainer; we only need a DeclSpace here.
1997
1998 2003-10-09  Martin Baulig  <martin@ximian.com>
1999
2000         * class.cs (MethodData): Added additional `DeclSpace ds' argument
2001         to the .ctor.
2002         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
2003         EmitContext's .ctor.    
2004
2005 2003-10-09  Martin Baulig  <martin@ximian.com>
2006
2007         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
2008         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
2009         AsAccessible(), moved them as well.
2010
2011         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
2012
2013 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
2014
2015         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
2016         generation for >=, as spotted by Paolo, bug 48679.  
2017         Patch from David Waite.
2018
2019         * cs-tokenizer.cs: Add handling for #pragma.
2020
2021         * cs-parser.jay: Allow for both yield and yield return in the
2022         syntax.  The anti-cobolization of C# fight will go on!
2023
2024         * class.cs (TypeBuilder.DefineType): Catch error condition here
2025         (Parent.DefineType erroring out and returning null).
2026
2027         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
2028         coping with enumerations variables, we were mistakenly processing
2029         them as a regular value type instead of built-in types.  Fixes the
2030         bug #48063
2031
2032         * typemanager.cs (IsBuiltinOrEnum): New method.
2033
2034 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
2035
2036         * cs-parser.jay: Upgrade: yield now needs the return clause.
2037
2038 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
2039
2040         * cs-parser.jay : Renamed yyName to yyNames related to jay.
2041
2042 2003-09-29  Martin Baulig  <martin@ximian.com>
2043
2044         * typemanager.cs (TypeManager.GetMethodFlags): Added support for
2045         inflated generic methods.
2046
2047         * generics.cs (ConstructedType): Distinguish between open and
2048         closed constructed types; correctly resolve the arguments.
2049
2050 2003-09-22  Martin Baulig  <martin@ximian.com>
2051
2052         * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
2053         all type arguments meet their constraints.
2054
2055 2003-09-19  Martin Baulig  <martin@ximian.com>
2056
2057         * decl.cs (MemberCache.SetupCacheForInterface): Take a
2058         `MemberCache parent' argument.  Normally, an interface doesn't
2059         have a parent type except System.Object, but we use this in gmcs
2060         for generic type parameters.
2061
2062 2003-09-18  Martin Baulig  <martin@ximian.com>
2063
2064         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
2065         on `type.IsInterface'; don't check whether the type has a parent
2066         to determine whether it's an interface.
2067
2068 2003-09-17  Martin Baulig  <martin@ximian.com>
2069
2070         * generic.cs (ConstructedType.ToString): Always use `name' as the
2071         type name.
2072
2073 2003-09-15  Martin Baulig  <martin@ximian.com>
2074
2075         * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
2076
2077         * generic.cs (Constraints.Resolve): New public method; this is
2078         called to resolve the constraint types and to check whether all
2079         the constraints are correct.
2080         (Constraints.Types): New public property.
2081         (TypeParameter.Resolve): New public method; resolves all the
2082         type's constraints.
2083
2084         * class.cs (TypeContainer.DefineType): Call
2085         TypeParameter.Resolve() before actually defining the type.
2086
2087 2003-09-15  Martin Baulig  <martin@ximian.com>
2088
2089         * class.cs (TypeContainer.DefineType): Added an error flag to
2090         avoid reporting duplicate CS0146's ("class definition is
2091         circular.").
2092
2093         * driver.cs (Driver.MainDriver): Abort if
2094         RootContext.ResolveTree() reported any errors.
2095
2096 2003-09-07  Martin Baulig  <martin@ximian.com>
2097
2098         * report.cs (Error, Warning): Added overloaded versions which take
2099         a `params object[] args' and call String.Format().
2100
2101 2003-09-07  Martin Baulig  <martin@ximian.com>
2102
2103         * decl.cs (DeclSpace..ctor): Don't call
2104         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
2105         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
2106         (DeclSpace.RecordDecl): New method.
2107
2108         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
2109
2110 2003-09-02  Ravi Pratap  <ravi@ximian.com>
2111
2112         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
2113         value attributes to be applied to ParameterBuilders.
2114
2115         * class.cs (MethodCore.LabelParameters): Make static and more
2116         generic so that it can be used from other places - like interface
2117         methods, for instance.
2118
2119         * interface.cs (Interface.Emit): Call LabelParameters before
2120         emitting attributes on the InterfaceMethod.
2121
2122 2003-09-07  Martin Baulig  <martin@ximian.com>
2123
2124         * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
2125         if the number of type parameters doesn't match.
2126
2127 2003-09-04  Martin Baulig  <martin@ximian.com>
2128
2129         * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
2130         for arrays of generic type params (ie. `!0[]').
2131
2132 2003-09-04  Martin Baulig  <martin@ximian.com>
2133
2134         * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
2135         for the moment.
2136
2137 2003-09-04  Martin Baulig  <martin@ximian.com>
2138
2139         * decl.cs (DeclSpace.LookupGeneric): New method.
2140         (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
2141         moment.
2142
2143         * generic.cs (TypeParameterExpr): Take a TypeParameter as
2144         argument, not just a string.
2145         (TypeParameter.Define): New public method; this is called to
2146         actually define the generic parameter; after this, you can use the
2147         new `Type' property to get the type.
2148
2149 2003-09-04  Martin Baulig  <martin@ximian.com>
2150
2151         * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
2152         is now an ArrayList; initialize the result of the `TypeParameters'
2153         property here.
2154         (DeclSpace.GetGenericData): Removed.
2155         (DeclSpace.LookupGeneric): Temporarily removed; we need to
2156         implement this in a different way.
2157         (DeclSpace.GetTypeParameters): Removed; there's now a
2158         `TypeParameters' property.
2159         (DeclSpace.TypeParameters): New public property.
2160
2161         * generic.cs (Constraints): Make this class public.
2162         (TypeParameter): New public class.
2163
2164 2003-09-04  Martin Baulig  <martin@ximian.com>
2165
2166         * decl.cs (DeclSpace.GetTypeParameters): New method to return the
2167         generic parameters.
2168
2169         * class.cs (TypeContainer.DefineType): Call
2170         TypeBuilder.DefineGenericParameter () on all generic parameters if
2171         this is a generic type.
2172
2173 2003-08-28  Martin Baulig  <martin@ximian.com>
2174
2175         * sample-stack.il: Compile this with ilasm: "ilasm /dll
2176         sample-stack.il".
2177
2178         * sample-hello.cs: Compile this with gmcs: "gmcs
2179         /r:sample-stack.dll sample-hello.cs".
2180
2181 2003-08-28  Martin Baulig  <martin@ximian.com>
2182
2183         * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
2184         the parameters to the generic type.
2185
2186 2003-08-28  Martin Baulig  <martin@ximian.com>
2187
2188         * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
2189
2190 2003-08-28  Martin Baulig  <martin@ximian.com>
2191
2192         * cs-parser.jay (opt_type_argument_list): Use
2193         `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
2194         (primary_expression): Replace `qualified_identifier' with `type_name'.
2195         (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
2196
2197         * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
2198         parser to check whether it is syntactically a type parameter list;
2199         return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
2200         this case.
2201
2202 2003-08-26  Martin Baulig  <martin@ximian.com>
2203
2204         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
2205         resolving aliases; fixes #47927.
2206
2207 2003-08-26  Martin Baulig  <martin@ximian.com>
2208
2209         * statement.cs (Using.DoResolve): This is internally emitting a
2210         try/finally clause, so we need to set ec.NeedExplicitReturn if we
2211         do not always return.  Fixes #47681.
2212
2213 2003-08-26  Martin Baulig  <martin@ximian.com>
2214
2215         * decl.cs (MemberCore): Moved WarningNotHiding(),
2216         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
2217         into MemberBase.
2218         (AdditionResult): Make this nested in DeclSpace.
2219         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
2220         argument; call NamespaceEntry.Define() unless we're nested in a
2221         class or struct.
2222
2223         * namespace.cs (Namespace.DefineName): New public function.  This
2224         is called from DeclSpace's .ctor to add 
2225         (Namespace.Lookup): Include DeclSpaces in the lookup.
2226
2227         * class.cs (Operator): Derive from MemberBase, not MemberCore.
2228
2229         * const.cs (Const): Derive from MemberBase, not MemberCore.     
2230
2231 2003-08-25  Martin Baulig  <martin@ximian.com>
2232
2233         * convert.cs (Convert.ExplicitReferenceConversion): When
2234         converting from an interface type to a class, unbox if the target
2235         type is a struct type.  Fixes #47822.
2236
2237 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2238
2239         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
2240         #47854.
2241
2242 2003-08-22  Martin Baulig  <martin@ximian.com>
2243
2244         * class.cs (TypeManager.DefineType): When defining a nested type,
2245         call DefineType() on our parent; fixes #47801.
2246
2247 2003-08-22  Martin Baulig  <martin@ximian.com>
2248
2249         * class.cs (MethodData.Define): While checking if a method is an
2250         interface implementation, improve the test a bit more to fix #47654.
2251
2252 2003-08-22  Martin Baulig  <martin@ximian.com>
2253
2254         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
2255         correctly; fixes #47722.
2256
2257 2003-08-22  Martin Baulig  <martin@ximian.com>
2258
2259         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
2260         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
2261
2262         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
2263
2264 2003-08-22  Martin Baulig  <martin@ximian.com>
2265
2266         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
2267         can only be assigned in static constructors.  Fixes #47161.
2268
2269 2003-08-22  Martin Baulig  <martin@ximian.com>
2270
2271         Rewrote and improved the flow analysis code.
2272
2273         * flowbranching.cs (FlowBranching): Make this class abstract.
2274         (FlowBranching.CreateBranching): New static function to create a
2275         new flow branching.
2276         (FlowBranchingBlock, FlowBranchingException): New classes.
2277         (FlowBranching.UsageVector.Type): New public readonly field.
2278         (FlowBranching.UsageVector.Breaks): Removed the setter.
2279         (FlowBranching.UsageVector.Returns): Removed the setter.
2280         (FlowBranching.UsageVector): Added Break(), Return(),
2281         NeverReachable() and Throw() methods to modify the reachability.
2282         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
2283         done by FlowBranching.Merge().
2284         (FlowBranching.UsageVector.MergeChild): New method; merges the
2285         merge result into the current vector.
2286         (FlowBranching.Merge): New abstract method to merge a branching.
2287
2288 2003-08-12  Martin Baulig  <martin@ximian.com>
2289
2290         * expression.cs (Indirection.CacheTemporaries): Create the
2291         LocalTemporary with the pointer type, not its element type.
2292
2293 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
2294
2295         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
2296         token was a keyword or not.
2297
2298         Add `error' options where an IDENTIFIER was expected;  Provide
2299         CheckToken and CheckIdentifierToken convenience error reporting
2300         functions. 
2301
2302         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
2303
2304         * decl.cs: Rename `NamespaceEntry Namespace' public field into
2305         NameSpaceEntry NameSpaceEntry.
2306
2307         (LookupInterfaceOrClass): Avoid creating a full qualified name
2308         from namespace and name: avoid doing lookups when we know the
2309         namespace is non-existant.   Use new Tree.LookupByNamespace which
2310         looks up DeclSpaces based on their namespace, name pair.
2311
2312         * driver.cs: Provide a new `parser verbose' to display the
2313         exception thrown during parsing.  This is turned off by default
2314         now, so the output of a failure from mcs is more graceful.
2315
2316         * namespace.cs: Track all the namespaces defined in a hashtable
2317         for quick lookup.
2318         
2319         (IsNamespace): New method
2320
2321 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
2322
2323         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
2324         we know that we need to concatenate (full typename can never be
2325         null). 
2326
2327         * class.cs: ditto.
2328
2329         * statement.cs: Use a bitfield;  Do not initialize to null things
2330         which are done by the constructor by default.
2331
2332         * cs-parser.jay: bug fix, parameter was 4, not 3.
2333
2334         * expression.cs: Just use the property;
2335
2336         * statement.cs: No need for GetVariableInfo method.
2337
2338 2003-08-08  Martin Baulig  <martin@ximian.com>
2339
2340         * flowanalysis.cs (FlowReturns): This is now nested in the
2341         `FlowBranching' class.
2342         (MyBitVector): Moved this here from statement.cs.
2343         (FlowBranching.SiblingType): New enum type.
2344         (FlowBranching.CreateSibling): Added `SiblingType' argument.
2345
2346 2003-08-07  Martin Baulig  <martin@ximian.com>
2347
2348         * flowanalysis.cs (FlowBranchingType): This is now nested in the
2349         `FlowBranching' class and called `BranchingType'.
2350
2351 2003-08-07  Martin Baulig  <martin@ximian.com>
2352
2353         * flowanalysis.cs: Moved all the control flow analysis code into
2354         its own file.
2355
2356 2003-08-07  Martin Baulig  <martin@ximian.com>
2357
2358         * assign.cs (Assign.DoResolve): `target' must either be an
2359         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
2360         #37319.
2361
2362 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
2363
2364         * expression.cs (BinaryMethod): This kind of expression is created by the
2365         Binary class if it determines that the operator has to be handled
2366         by a method.
2367
2368         (BinaryDelegate): This kind of expression is created if we are
2369         dealing with a + or - operator on delegates.
2370
2371         (Binary): remove method, argumetns, and DelegateOperator: when
2372         dealing with methods, 
2373         
2374         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
2375
2376         * statement.cs (Block): use bitfields for the three extra booleans
2377         we had in use.   Remove unused topblock parameter.
2378
2379         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
2380
2381         * assign.cs: Drop extra unneeded tests.
2382
2383 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
2384
2385         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
2386
2387         * statement.cs (Foreach): Use VariableStorage instead of
2388         LocalBuilders.   
2389
2390         * codegen.cs (VariableStorage): New class used by clients that
2391         require a variable stored: locals or fields for variables that
2392         need to live across yield.
2393
2394         Maybe provide a convenience api for EmitThis+EmitLoad?
2395
2396         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
2397         these bad boys.
2398
2399 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
2400
2401         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
2402         RemapParameterLValue): New methods that are used to turn a
2403         precomputed FieldInfo into an expression like this:
2404
2405                 instance.FieldInfo
2406
2407         The idea is to use this instead of making LocalVariableReference
2408         have more than one meaning.
2409
2410         * cs-parser.jay: Add error production to BASE.
2411
2412         * ecore.cs: Deal with TypeManager.GetField returning null, which
2413         is now a valid return value.
2414
2415         (FieldExprNoAddress): New expression for Fields whose address can
2416         not be taken.
2417
2418         * expression.cs (LocalVariableReference): During the resolve
2419         phases, create new expressions if we are in a remapping context.
2420         Remove code that dealt with remapping here.
2421
2422         (ParameterReference): same.
2423
2424         (ProxyInstance): New expression, like the `This' expression, but
2425         it is born fully resolved.  We know what we are doing, so remove
2426         the errors that are targeted to user-provided uses of `this'.
2427
2428         * statement.cs (Foreach): our variable is now stored as an
2429         Expression;  During resolution, follow the protocol, dont just
2430         assume it will return this.
2431         
2432 2003-08-06  Martin Baulig  <martin@ximian.com>
2433
2434         * support.cs (SeekableStreamReader.cs): New public class.
2435
2436         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
2437         SeekableStreamReader instead of the normal StreamReader.
2438
2439 2003-08-04  Martin Baulig  <martin@ximian.com>
2440
2441         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
2442         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
2443         deambiguate casts and delegate invocations.
2444         (parenthesized_expression): Use the new tokens to ensure this is
2445         not a cast of method invocation.
2446
2447         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
2448         when reading a `)' and Deambiguate_CloseParens () was previously
2449         called.
2450
2451         * expression.cs (ParenthesizedExpression): New class.  This is
2452         just used for the CS0075 test.
2453         (Binary.DoResolve): Check for CS0075.   
2454
2455 2003-07-29  Ravi Pratap  <ravi@ximian.com>
2456
2457         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
2458         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
2459         reference comparison.
2460
2461         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
2462         examine the ReturnType for equality - this is necessary in the
2463         cases of implicit and explicit operators whose signature also
2464         includes the return type.
2465
2466 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
2467
2468         * namespace.cs: Cache the result of the namespace computation,
2469         instead of computing it every time.
2470
2471 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
2472
2473         * decl.cs: Use a global arraylist that we reuse over invocations
2474         to avoid excesive memory consumption.  Reduces memory usage on an
2475         mcs compile by one meg (45 average).
2476
2477         * typemanager.cs (LookupTypeReflection): In .NET pointers are
2478         private, work around that.
2479
2480 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
2481
2482         * literal.cs (IntLiteral): Define Zero and One static literals. 
2483
2484         * cs-parser.jay (integer_literal): use static literals to reduce
2485         memory usage for the most used literals (0, 1 and -1).  211kb
2486         reduced in memory usage.
2487
2488         Replace all calls to `new ArrayList' with `new
2489         ArrayList(4)' which is a good average number for most allocations,
2490         and also requires only 16 bytes of memory for its buffer by
2491         default. 
2492
2493         This reduced MCS memory usage in seven megabytes for the RSS after
2494         bootstrapping.
2495
2496 2003-07-28  Ravi Pratap  <ravi@ximian.com>
2497
2498         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
2499         handle params methods the correct way by forming only one
2500         applicable set with params and normal methods in them. Earlier we
2501         were looking at params methods only if we found no normal methods
2502         which was not the correct thing to do.
2503
2504         (Invocation.BetterFunction): Take separate arguments indicating
2505         when candidate and the best method are params methods in their
2506         expanded form.
2507
2508         This fixes bugs #43367 and #46199.
2509
2510         * attribute.cs: Documentation updates.
2511
2512         (CheckAttribute): Rename to CheckAttributeTarget.
2513         (GetValidPlaces): Rename to GetValidTargets.
2514
2515         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
2516         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
2517
2518         Fixes bug #44468.
2519
2520 2003-07-28  Miguel de Icaza  <miguel@ximian.com>
2521
2522         * codegen.cs: Compute IsGeneric correctly.
2523
2524         * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
2525         resolution. 
2526
2527         Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
2528         OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN.  There were too many
2529         regressions, and I was chasing more bugs than I required.
2530
2531         * interface.cs: Use expressions for base type names (like classes
2532         and structs have been doing for a while now), and resolve that.
2533         This patch should probably go into head as well.
2534
2535         This makes it one less user of FindType.
2536
2537 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
2538
2539         This compiler can not self host currently.  Need to fix that.
2540         
2541         * Makefile: compile to `gmcs.exe'
2542
2543         * driver.cs: Turn on v2 by default on gmcs.
2544
2545         * generic.cs (ConstructedType): Does no longer take a container
2546         type argument;  That will be taken care of later.
2547
2548         (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
2549         Use SimpleName to resolve for now, so we can continue the work on
2550         the parser, until we get Type.GetType that understands generics.
2551
2552         (ConstructedType.ToString): Implement
2553
2554         (TypeArguments.Resolve): Resolve the child expressions as types. 
2555         
2556         * cs-parser.jay: Rename interface_constraints to
2557         type_parameter_constraints
2558
2559         (namespace_or_type_name): Only use constructed types for the basic
2560         construction, we will deal with identifier<...> later.
2561
2562         (type/type_name): No longer call DecomposeQI, as
2563         namespace_or_type_name is always decoded now.
2564         
2565 2003-07-22  Ravi Pratap  <ravi@ximian.com>
2566
2567         * expression.cs (Invocation.OverloadResolve): Follow the spec more
2568         closely: we eliminate methods in base types when we have an
2569         applicable method in a top-level type.
2570
2571         Please see section 14.5.5.1 for an exact description of what goes
2572         on. 
2573
2574         This fixes bug #45127 and a host of other related to corlib compilation.
2575
2576         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
2577         array is the method corresponding to the top-level type (this is
2578         because of the changes made to icall.c) so we change this
2579         accordingly.
2580
2581         (MethodGroupExpr.Name): This too.
2582
2583         * typemanager.cs (GetElementType): New method which does the right
2584         thing when compiling corlib. 
2585
2586         * everywhere: Make use of the above in the relevant places.
2587
2588 2003-07-22  Martin Baulig  <martin@ximian.com>
2589
2590         * cs-parser.jay (invocation_expression): Moved
2591         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
2592         `cast_expression', but create a InvocationOrCast which later
2593         resolves to either an Invocation or a Cast.
2594
2595         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
2596         method; call this before EmitStatement() to make sure that this
2597         expression can be used as a statement.
2598
2599         * expression.cs (InvocationOrCast): New class; resolves to either
2600         an Invocation or a Cast.
2601
2602         * statement.cs (StatementExpression): Call ResolveStatement() on
2603         the ExpressionStatement before emitting it.
2604
2605 2003-07-21  Martin Baulig  <martin@ximian.com>
2606
2607         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
2608         `ref' and `out' attributes match; fixes #46220.
2609         (MemberAccess.ResolveMemberAccess): You can't reference a type
2610         through an expression; fixes #33180.
2611         (Indexers.GetIndexersForType): Don't return the indexers from
2612         interfaces the class implements; fixes #46502.
2613
2614 2003-07-21  Martin Baulig  <martin@ximian.com>
2615
2616         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
2617         CS0661 checks; fixes bug #30442.
2618
2619 2003-07-21  Martin Baulig  <martin@ximian.com>
2620
2621         * decl.cs (AdditionResult): Added `Error'.
2622
2623         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
2624
2625         * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
2626         cs0031.cs actually work.
2627
2628  2003-07-20  Miguel de Icaza  <miguel@ximian.com>
2629  
2630         * cs-parser.jay (namespace_name): do not use
2631         namespace_or_type_name, use qualified_identifier, because
2632         namespace_or_type_name will soon return a composed expression
2633         instead of a string.
2634  
2635         (namespace_or_type_name): Instead of returning a string, now this
2636         production returns an expression.
2637  
2638         * codegen.cs (EmitContext): Setup IsGeneric property based on
2639         whether our DeclSpace is generic, our the method is generic.
2640  
2641         * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
2642         the method is generic.
2643  
2644         * cs-parser.jay (type_arguments, opt_type_argument_list,
2645         type_parameters, type_parameter_list, opt_type_parameter_list,
2646         type_parameter,, opt_type_parameter_constraints_clauses,
2647         type_parameter_constraints_clauses,
2648         type_parameter_constraint_clause, type_parameter_constraint,
2649         interface_constraints): Add new production
2650  
2651         * decl.cs (DeclSpace): IsGeneric, flag to track whether this
2652         DeclSpace is generic or not.
2653  
2654         (DeclSpace.SetParameterInfo): New routine, used to set the
2655         parameter info for a type.
2656  
2657         (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
2658         returns a GenericTypeExpr
2659  
2660         * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
2661         generic, lookup the generic argument.
2662  
2663         * attribute.cs: Do not allow TypeParameterExpressions in
2664         Attributes.
2665  
2666         * class.cs: Do not allow the Main method to be defined in a
2667         Generic container.
2668  
2669         * expression.cs (SizeOf): Do not allow generic types to be used as
2670         arguments to sizeof.
2671  
2672         * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
2673         it: whether a type is generic or not.  Only works for types we are
2674         currently building for now.
2675         
2676 2003-07-20  Martin Baulig  <martin@ximian.com>
2677
2678         * namespace.cs: Fixed that bug which caused a crash when compiling
2679         the debugger's GUI.
2680
2681 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
2682
2683         * typemanager.cs (LookupTypeReflection): Never expose types which
2684         are NotPublic, NestedPrivate, NestedAssembly, or
2685         NestedFamANDAssem.  We used to return these, and later do a check
2686         that would report a meaningful error, but the problem is that we
2687         would not get the real match, if there was a name override.
2688
2689 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
2690
2691         * namespace.cs (Namespace, Name): Do not compute the namespace
2692         name dynamically, compute it in the constructor.  This reduced
2693         memory usage by 1697 KB.
2694
2695         * driver.cs: Use --pause to pause at the end.
2696
2697 2003-07-17  Peter Williams  <peter@newton.cx>
2698
2699         * Makefile: Change the name of the test target so that it doesn't
2700         conflict with the recursive test target.
2701
2702 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
2703
2704         * expression.cs (LocalVariableReference.Emit, EmitAssign,
2705         AddressOf): Do not use EmitThis, that was wrong, use the actual
2706         this pointer.
2707
2708 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
2709
2710         * class.cs (MethodData.Define): While checking if a method is an
2711         interface implementation, improve the test: If we are not public
2712         (use new test here: use the computed MethodAttributes directly,
2713         instead of the parsed modifier flags) check if the `implementing'
2714         method comes from an interface or not.
2715
2716         * pending.cs (VerifyPendingMethods): Slightly better error
2717         message.
2718
2719         * makefile: add test target that does the mcs bootstrap.
2720
2721 2003-07-16  Ravi Pratap  <ravi@ximian.com>
2722
2723         * interface.cs (Define): Do nothing here since there are no
2724         members to populate etc. Move the attribute emission out of here
2725         since this was just totally the wrong place to put it. Attribute
2726         application happens during the 'Emit' phase, not in the 'Define'
2727         phase.
2728
2729         (Emit): Add this method and move the attribute emission here
2730
2731         * rootcontext.cs (EmitCode): Call the Emit method on interface
2732         types too.
2733
2734 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
2735
2736         * expression.cs (OverloadResolve): Report error only if Location
2737         is not 'Null' which means that there was a probe going on.
2738
2739 2003-07-14  Martin Baulig  <martin@ximian.com>
2740
2741         * expression.cs (ConditionalLogicalOperator): New public class to
2742         implement user defined conditional logical operators.
2743         This is section 14.11.2 in the spec and bug #40505.
2744
2745 2003-07-14  Martin Baulig  <martin@ximian.com>
2746
2747         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
2748
2749 2003-07-14  Martin Baulig  <martin@ximian.com>
2750
2751         * codegen.cs (EmitContext.InFixedInitializer): New public field.
2752
2753         * ecore.cs (IVariable.VerifyFixed): New interface method.
2754
2755         * expression.cs (Unary.ResolveOperator): When resolving the `&'
2756         operator, check whether the variable is actually fixed.  Fixes bug
2757         #36055.  Set a variable definitely assigned when taking its
2758         address as required by the spec.
2759
2760         * statement.cs (LocalInfo.IsFixed): New field.
2761         (LocalInfo.MakePinned): Set `IsFixed' to true.
2762
2763 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
2764
2765         * attribute.cs (Attribute.Resolve): While doing a Member lookup
2766         for .ctors, ensure that we only ask for members declared in the
2767         attribute type (BindingFlags.DeclaredOnly).
2768
2769         Fixes bug #43632.
2770
2771         * expression.cs (Error_WrongNumArguments): Report error 1501
2772         correctly the way CSC does.
2773
2774 2003-07-13  Martin Baulig  <martin@ximian.com>
2775
2776         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
2777         lookup on the fully qualified name, to make things like "X.X" work
2778         where "X.X" is a fully qualified type name, but we also have a
2779         namespace "X" in the using list.  Fixes #41975.
2780
2781 2003-07-13  Martin Baulig  <martin@ximian.com>
2782
2783         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
2784         function. If we're a CompoundAssign, we need to create an embedded
2785         CompoundAssign, not an embedded Assign.
2786         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
2787         Fixes #45854.
2788
2789 2003-07-13  Martin Baulig  <martin@ximian.com>
2790
2791         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
2792         work to fix bug #46088.
2793
2794 2003-07-13  Ravi Pratap <ravi@ximian.com>
2795
2796         * class.cs (Operator.Emit): Do not emit attributes here - it is
2797         taken care of by the Method class that we delegate too. This takes
2798         care of bug #45876.
2799         
2800 2003-07-10  Martin Baulig  <martin@ximian.com>
2801
2802         * expression.cs (TypeOfVoid): New class.
2803         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
2804
2805 2003-07-10  Martin Baulig  <martin@ximian.com>
2806
2807         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
2808         bug #35957.
2809
2810 2003-07-10  Martin Baulig  <martin@ximian.com>
2811
2812         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
2813         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
2814
2815         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
2816
2817         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
2818
2819 2003-07-10  Martin Baulig  <martin@ximian.com>
2820
2821         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
2822         of decimal.  Fixes #42850.
2823
2824         NOTE: I also fixed the created byte blob, but this doesn't work on
2825         the MS runtime and csc never produces any byte blobs for decimal
2826         arrays.
2827
2828 2003-07-10  Martin Baulig  <martin@ximian.com>
2829
2830         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
2831         structs; fixes #32068.
2832         (Block.AddChildVariableNames): Fixed #44302.
2833
2834 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2835
2836         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
2837         
2838 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2839
2840         * attribute.cs: And this test is onger needed.
2841
2842 2003-07-08  Martin Baulig  <martin@ximian.com>
2843
2844         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
2845         inaccessible types.  Fixes #36313.
2846
2847         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
2848
2849         * namespace.cs (NamespaceEntry): Create implicit entries for all
2850         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
2851         implicit entries for N1.N2 and N1.
2852
2853 2003-07-08  Martin Baulig  <martin@ximian.com>
2854
2855         Rewrote the handling of namespaces to fix a lot of the issues
2856         wrt. `using' aliases etc.
2857
2858         * namespace.cs (Namespace): Splitted this class into a
2859         per-assembly `Namespace' and a per-file `NamespaceEntry'.
2860
2861         * typemanager.cs (TypeManager.IsNamespace): Removed.
2862         (TypeManager.ComputeNamespaces): Only compute namespaces from
2863         loaded assemblies here, not the namespaces from the assembly we're
2864         currently compiling.
2865
2866 2003-07-08  Martin Baulig  <martin@ximian.com>
2867
2868         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
2869
2870 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2871
2872         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
2873         already fixed it.  
2874
2875         I thought about the memory savings here, but LookupTypeReflection
2876         is used under already very constrained scenarios.  Compiling
2877         corlib or mcs only exposes one hit, so it would not really reduce
2878         any memory consumption.
2879
2880 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2881
2882         * typemanager.cs: fixes bug #45889 by only adding public types from
2883         other assemblies to the list of known types.
2884
2885 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2886
2887         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
2888         on the type we resolved.
2889
2890 2003-07-05  Martin Baulig  <martin@ximian.com>
2891
2892         * pending.cs (PendingImplementation.ParentImplements): Don't
2893         create the proxy if the parent is abstract.
2894
2895         * class.cs (TypeContainer.DefineIndexers): Process explicit
2896         interface implementations first.  Fixes #37714.
2897
2898 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
2899
2900         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
2901         defined recursively;  but since we modify the input parameters
2902         (left is set to `this' temporarily), we reset this value if the
2903         left_is_explicit is false, which gives the original semantics to
2904         the code.  
2905
2906         * literal.cs (NullPointer): new class used to represent a null
2907         literal in a pointer context.
2908
2909         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
2910         type is a pointer, use a NullPointer object instead of a
2911         NullLiteral.   Closes 43687
2912
2913         (ExplicitConversion): Convert pointer values using
2914         the conv opcode to the proper type.
2915
2916         * ecore.cs (New): change ValueTypeVariable property into a method,
2917         that returns whether the valuetype is suitable for being used.
2918
2919         * expression.cs (Binary.DoNumericPromotions): Only return if we
2920         the int constant was a valid uint, and we can return both left and
2921         right as uints.  If not, we continue processing, to trigger the
2922         type conversion.  This fixes 39018.
2923
2924         * statement.cs (Block.EmitMeta): During constant resolution, set
2925         the CurrentBlock property on the emitcontext, so that we resolve
2926         constants propertly.
2927
2928 2003-07-02  Martin Baulig  <martin@ximian.com>
2929
2930         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
2931         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
2932
2933         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
2934         than emitting it here.
2935
2936         * statement.cs: Fixed some more flow analysis bugs.
2937
2938 2003-07-02  Martin Baulig  <martin@ximian.com>
2939
2940         * class.cs (MethodData.Define): When implementing interface
2941         methods, set Final unless we're Virtual.
2942
2943         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
2944         check work for interface methods.
2945
2946 2003-07-01  Martin Baulig  <martin@ximian.com>
2947
2948         * ecore.cs (EmitContext.This): Replaced this property with a
2949         GetThis() method which takes a Location argument.  This ensures
2950         that we get the correct error location for a CS0188.
2951
2952 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
2953
2954         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
2955         ImplicitStandardConversion.
2956
2957         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
2958
2959 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
2960
2961         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
2962         optimization.
2963
2964 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
2965
2966         * class.cs (Constructor.Define): Turn off initlocals for unsafe
2967         constructors.
2968
2969         (MethodData.Define): Turn off initlocals for unsafe methods.
2970
2971 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
2972
2973         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
2974         complete;  Fixes #37521.
2975
2976         * delegate.cs: Use Modifiers.TypeAttr to compute the
2977         TypeAttributes, instead of rolling our own.  This makes the flags
2978         correct for the delegates.
2979
2980 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
2981
2982         * class.cs (Constructor.Define): Set the private flag for static
2983         constructors as well.
2984
2985         * cs-parser.jay (statement_expression): Set the return value to
2986         null, to avoid a crash when we catch an error.
2987
2988 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
2989
2990         * cs-parser.jay: Applied patch from Jackson that adds support for
2991         extern and unsafe modifiers to destructor declarations.
2992
2993         * expression.cs: Report error 21 if the user is trying to index a
2994         System.Array.
2995
2996         * driver.cs: Add an error message, suggested by the bug report.
2997
2998         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
2999         if we do not have a ": this ()" constructor initializer.  Fixes 45149
3000
3001 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
3002
3003         * namespace.cs: Add some information to reduce FAQs.
3004
3005 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
3006
3007         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
3008         underlying enumeration types.  Fixes #43915.
3009
3010         * expression.cs: Treat ushort/short as legal values to be used in
3011         bitwise operations.
3012
3013 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
3014
3015         * delegate.cs: transfer custom attributes for paramenters from
3016         the delegate declaration to Invoke and BeginInvoke.
3017
3018 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
3019
3020         * attribute.cs: handle custom marshalers and emit marshal info
3021         for fields, too.
3022
3023 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
3024
3025         * makefile.gnu: Added anonymous.cs to the compiler sources.
3026
3027 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
3028
3029         * iterators.cs: Change the name of the proxy class to include two
3030         underscores.
3031
3032         * cs-parser.jay: Update grammar to include anonymous methods.
3033         
3034         * anonymous.cs: new file.
3035
3036 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
3037
3038         * class.cs (Field.Define): Add missing test for pointers and
3039         safety. 
3040
3041 2003-05-27  Ravi Pratap  <ravi@ximian.com>
3042
3043         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
3044         we use the stobj opcode.
3045
3046         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
3047         since it wasn't the correct fix. 
3048
3049         It still is puzzling that we are required to use stobj for IntPtr
3050         which seems to be a ValueType.
3051
3052 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
3053
3054         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
3055         during regular simple name resolution.   Now, the trick is that
3056         instead of returning for processing the simplename, we do a
3057         TypeManager.LookupType (ie, a rooted lookup as opposed to a
3058         contextual lookup type).   If a match is found, return that, if
3059         not, return for further composition.
3060
3061         This fixes long-standing 30485.
3062
3063         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
3064         using the address to initialize an object, do an Stobj instead of
3065         using the regular Stelem.
3066
3067         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
3068         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
3069         Because if we are a BaseIndexerAccess that value will be true.
3070         Fixes 43643.
3071
3072         * statement.cs (GotoCase.Resolve): Return after reporting an
3073         error, do not attempt to continue. 
3074
3075         * expression.cs (PointerArithmetic.Emit): If our operand is a
3076         long, convert our constants to match the operand before
3077         multiplying.  Convert to I type before adding.   Fixes 43670.
3078         
3079 2003-05-14  Ravi Pratap  <ravi@ximian.com>
3080
3081         * enum.cs (ImplicitConversionExists) : Rename to
3082         ImplicitEnumConversionExists to remove ambiguity. 
3083
3084         * ecore.cs (NullCast): New type of cast expression class which
3085         basically is very similar to EmptyCast with the difference being
3086         it still is a constant since it is used only to cast a null to
3087         something else
3088         (eg. (string) null)
3089
3090         * convert.cs (ImplicitReferenceConversion): When casting a null
3091         literal, we return a NullCast.
3092
3093         * literal.cs (NullLiteralTyped): Remove - I don't see why this
3094         should be around anymore.
3095
3096         The renaming (reported was slightly wrong). Corrections:
3097
3098         ConvertImplicitStandard -> ImplicitConversionStandard
3099         ConvertExplicitStandard -> ExplicitConversionStandard
3100
3101         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
3102         before passing them in !
3103
3104         * convert.cs (ImplicitConversionStandard): When comparing for
3105         equal expr and target types, ensure that expr is not a
3106         NullLiteral.
3107
3108         In general, we must not be checking (expr_type ==
3109         target_type) in the top level conversion methods
3110         (ImplicitConversion, ExplicitConversion etc). This checking is
3111         done in the methods that they delegate to.
3112
3113 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
3114
3115         * convert.cs: Move Error_CannotConvertType,
3116         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
3117         ImplicitNumericConversion, ImplicitConversionExists,
3118         ImplicitUserConversionExists, StandardConversionExists,
3119         FindMostEncompassedType, FindMostSpecificSource,
3120         FindMostSpecificTarget, ImplicitUserConversion,
3121         ExplicitUserConversion, GetConversionOperators,
3122         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
3123         TryImplicitIntConversion, Error_CannotConvertImplicit,
3124         ConvertImplicitRequired, ConvertNumericExplicit,
3125         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
3126         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
3127         its own file.
3128
3129         Perform the following renames:
3130         
3131         StandardConversionExists -> ImplicitStandardConversionExists
3132         ConvertImplicit -> ImplicitConversion
3133         ConvertImplicitStandard -> ImplicitStandardConversion
3134         TryImplicitIntConversion -> ImplicitIntConversion
3135         ConvertImplicitRequired -> ImplicitConversionRequired
3136         ConvertNumericExplicit -> ExplicitNumericConversion
3137         ConvertReferenceExplicit -> ExplicitReferenceConversion
3138         ConvertExplicit -> ExplicitConversion
3139         ConvertExplicitStandard -> ExplicitStandardConversion
3140
3141 2003-05-19  Martin Baulig  <martin@ximian.com>
3142
3143         * statement.cs (TypeInfo.StructInfo): Made this type protected.
3144         (TypeInfo): Added support for structs having structs as fields.
3145
3146         * ecore.cs (FieldExpr): Implement IVariable.
3147         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
3148         VariableInfo for the field.
3149
3150 2003-05-18  Martin Baulig  <martin@ximian.com>
3151
3152         * expression.cs (This.DoResolve): Report a CS0027 if we're
3153         emitting a field initializer.
3154
3155 2003-05-18  Martin Baulig  <martin@ximian.com>
3156
3157         * expression.cs (This.ResolveBase): New public function.
3158         (This.DoResolve): Check for CS0188.
3159
3160         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
3161         This.Resolve().
3162
3163         * ecore.cs (MethodGroupExpr.DoResolve): Set the
3164         `instance_expression' to null if we don't have any non-static
3165         methods.
3166
3167 2003-05-18  Martin Baulig  <martin@ximian.com>
3168
3169         Reworked the way how local variables and parameters are handled by
3170         the flow analysis code.
3171
3172         * statement.cs (TypeInfo, VariableMap): New public classes.
3173         (VariableInfo): New public class.  This is now responsible for
3174         checking whether a variable has been assigned.  It is used for
3175         parameters and local variables.
3176         (Block.EmitMeta): Take the InternalParameters as argument; compute
3177         the layout of the flow vectors here.
3178         (Block.LocalMap, Block.ParameterMap): New public properties.
3179         (FlowBranching): The .ctor doesn't get the InternalParameters
3180         anymore since Block.EmitMeta() now computes the layout of the flow
3181         vector.
3182         (MyStructInfo): This class is now known as `StructInfo' and nested
3183         in `TypeInfo'; we don't access this directly anymore.
3184
3185         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
3186         property and removed IsAssigned(), IsFieldAssigned(),
3187         SetAssigned() and SetFieldAssigned(); we now call them on the
3188         VariableInfo so we don't need to duplicate this code everywhere.
3189
3190         * expression.cs (ParameterReference): Added `Block block' argument
3191         to the .ctor.
3192         (LocalVariableReference, ParameterReference, This): The new
3193         VariableInfo class is now responsible for all the definite
3194         assignment stuff.
3195
3196         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
3197         IsParameterAssigned, SetParameterAssigned): Removed.
3198
3199 2003-05-18  Martin Baulig  <martin@ximian.com>
3200
3201         * typemanager.cs (InitCoreTypes): Try calling
3202         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
3203         the 3-args-version.  Corlib now also needs our `void_type'.
3204         (GetMethod): Added overloaded version which takes an optional
3205         `bool report_errors' to allow lookups of optional methods.
3206
3207 2003-05-12  Martin Baulig  <martin@ximian.com>
3208
3209         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
3210         only used for locals and not for parameters.
3211
3212 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
3213
3214         * support.cs (InternalParameters.ParameterType): Return the
3215         ExternalType of the parameter.
3216
3217         * parameter.cs (Parameter.ExternalType): drop the two arguments,
3218         they were unused.
3219
3220 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
3221
3222         * class.cs (MethodData.Define): Do not set the `newslot' on
3223         interface members, if they are also flagged as "override".
3224
3225         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
3226         better code for ++i and i++.  This only works for static fields
3227         and local variables.
3228
3229         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
3230         want to pull the DeclSpace out of the builder_to_declspace instead
3231         of the TypeBuilder (like in TypeContainer.FindMembers).
3232
3233         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
3234         instead of LookupTypeContainer.  Fixes the crash on .NET for
3235         looking up interface members.
3236
3237         * const.cs: Create our own emit context during the Definition
3238         stage, so that constants are evaluated in the proper context, when
3239         a recursive definition happens.
3240
3241 2003-05-11  Martin Baulig  <martin@ximian.com>
3242
3243         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
3244         new block for a switch section.
3245         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
3246         the adding/lookup in the switch block.  Fixes #39828.
3247
3248 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
3249
3250         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
3251         functionality: I needed to convert the data after I had performed
3252         the add/sub operation into the operands type size.
3253
3254         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
3255         pass the type for the box operation, otherwise the resulting
3256         object would have been of type object.
3257
3258         (BoxedCast): Add constructor to specify the type to box as.
3259
3260 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
3261
3262         * iterators.cs: I was reusing the `count' variable inadvertently,
3263         take steps to not allow this to happen.
3264
3265 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
3266
3267         * attribute.cs (Attribute.Resolve): Params attributes are encoded
3268         by creating an array at the point where the params starts and
3269         putting all those arguments there, then adjusting the size of the
3270         array.
3271
3272 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
3273
3274         * expression.cs (New.AddressOf): Implement interface
3275         IMemoryLocation.  This is used when the `new' operator is used in
3276         the context of an invocation to a method on a value type.
3277
3278         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
3279         example. 
3280
3281         * namespace.cs: Also check the using aliases here.
3282
3283         * driver.cs: Move the test for using validity after the types have
3284         been entered, so we do a single pass that also includes the using
3285         aliases. 
3286
3287         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
3288         in the regular case.   CreateSiblingForFinally is doing extra
3289         error checking.
3290
3291         * attribute.cs (GetAttributeArgumentExpression): Store the result
3292         on an out value, and use the return value to indicate failure
3293         instead of using null (which is a valid return for Constant.GetValue).
3294
3295         * statement.cs: Perform the analysis flow for the increment
3296         portion after the statement, because this will be the real flow of
3297         execution.  Fixes #42385
3298
3299         * codegen.cs (EmitContext.EmitArgument,
3300         EmitContext.EmitStoreArgument): New helper functions when the
3301         RemapToProxy flag is set.
3302
3303         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
3304         function.
3305
3306         Add support for remapping parameters. 
3307
3308         * iterators.cs: Propagate parameter values;  Store parameter
3309         values in the proxy classes.
3310         
3311 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
3312
3313         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
3314         need a proxy reference;  I do not know what I was thinking
3315
3316         * cs-parser.jay (constructor_initializer): catch another error,
3317         and display nice message.
3318         
3319         (field_declaration): catch void field declaration
3320         to flag a better error. 
3321
3322         * class.cs (MemberBase.CheckBase): Report an error instead of a
3323         warning if a new protected member is declared in a struct. 
3324         (Field.Define): catch the error of readonly/volatile.
3325
3326         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
3327
3328         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
3329         volatile variable is taken
3330
3331 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
3332
3333         * statement.cs (Fixed.Resolve): Report an error if we are not in
3334         an unsafe context.
3335
3336 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
3337
3338         * typemanager.cs: reuse the code that handles type clashes for
3339         delegates and enumerations.
3340
3341         * class.cs (Report28): Always report.
3342
3343         * expression.cs (EncodeAsAttribute): Allow nulls here.
3344
3345 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
3346
3347         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
3348         the functionality for testing whether an expression is valid for
3349         an attribute here.  Also handle the case of arrays of elements
3350         being stored. 
3351
3352         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
3353         encoding a linear array into an array of objects that are suitable
3354         to be passed to an CustomAttributeBuilder.
3355
3356         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
3357
3358         * ecore.cs: (FieldExpr): Handle field remapping here.
3359
3360         * iteratators.cs: Pass the instance variable (if the method is an
3361         instance method) to the constructors, so we can access the field
3362         variables on the class.
3363
3364         TODO: Test this with structs.  I think the THIS variable on
3365         structs might have to be a pointer, and not a refenrece
3366
3367 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
3368
3369         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
3370         local variables to fields in a proxy class.
3371
3372         * iterators.cs (PopulateProxy): Rename our internal fields to
3373         <XXX>.  
3374         Create a <THIS> field if we are an instance method, so we can
3375         reference our parent container variables.
3376         (MapVariable): Called back from the EmitContext code to enter a
3377         new variable to field mapping into the proxy class (we just create
3378         a FieldBuilder).
3379
3380         * expression.cs
3381         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
3382         for using the remapped locals to fields.
3383
3384         I placed the code here, because that gives the same semantics to
3385         local variables, and only changes the Emit code.
3386
3387         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
3388         statements inside iterators.
3389         (VariableInfo): Add a FieldBuilder for the cases when we are
3390         remapping local variables to fields in a proxy class
3391
3392         * ecore.cs (SimpleNameResolve): Avoid testing two times for
3393         current_block != null.
3394
3395         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
3396         not cope with strings, as it has been moved to the
3397         TableSwitchEmit.  Fixed bug in switch generation.
3398
3399         * expression.cs (New.DoResolve): Provide more context for the user
3400         when reporting an error.
3401
3402         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
3403         pointers. 
3404
3405         * expression.cs (MemberAccess.DoResolve): When we get a type back,
3406         check the permissions for it.  Note than in a type-resolution
3407         context the check was already present in DeclSpace.ResolveType,
3408         but was missing from the MemberAccess.
3409
3410         (ArrayCreation.CheckIndices): warn if the user has
3411         more nested levels of expressions, but there are no more
3412         dimensions specified.  Avoids crash on bug 41906.
3413
3414 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
3415
3416         * statement.cs (Block): replace Implicit bool, for a generic
3417         flags.   
3418         New flag: `Unchecked'.  This is used during the EmitMeta phase
3419         (which is out-of-line with the regular Resolve/Emit process for a
3420         statement, as this is done ahead of time, but still gets a chance
3421         to call constant resolve).
3422         
3423         (Block.Flags): new enum for adding a new flag.
3424
3425         (Block.EmitMeta): track the state of unchecked.
3426         
3427         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
3428         to enable constant resolution to work there as well.
3429
3430 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
3431
3432         * typemanager.cs (ienumerable_type): Also look up
3433         System.Collections.IEnumerable. 
3434
3435 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
3436
3437         TODO: Test more than one conditional per method.
3438         
3439         * class.cs (Indexer.Define): Report the location where the user is
3440         referencing the unsupported feature.
3441
3442         (MethodData): Overload the use of `conditionals' to
3443         minimize the creation of needless ArrayLists.   This saves roughly
3444         212kb on my machine.
3445
3446         (Method): Implement the new IIteratorContainer interface.
3447         (Method.SetYields): Implement the method by setting the ModFlags
3448         to contain METHOD_YIELDS.
3449         
3450         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
3451         which just got set to null.
3452
3453         * iterators.cs: New file.
3454
3455         (Yield, YieldBreak): New statements.
3456
3457         * statement.cs (Return.Resolve): Flag an error if we are used in
3458         an iterator method.
3459
3460         * codegen.cs (InIterator): New flag set if the code is being
3461         compiled in an iterator method.
3462
3463         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
3464         internal modifier, and we just use it to avoid adding extra
3465         fields, as this is seldom used.  
3466
3467         * cs-parser.jay: Add yield_statement (yield and yield break).
3468
3469         * driver.cs: New flag -v2 to turn on version 2 features. 
3470
3471         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
3472         hashtable when v2 is enabled.
3473
3474 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
3475
3476         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
3477         there is already a namespace defined with this name.
3478
3479         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
3480         people upgraded their corlibs.
3481
3482         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
3483         always use fully qualified types, no need to use the compiler
3484         front end.
3485
3486         (TypeManager.IsNamespace): Use binarysearch.
3487         
3488         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
3489         AddDelegate): I did not quite use the new IsValid API properly: I
3490         have to pass the short-name and the fullname.  I was passing only
3491         the basename instead of the fullname sometimes. 
3492
3493         (TypeContainer.DefineType): call NamespaceClash.
3494
3495         * interface.cs (Interface.DefineType): use NamespaceClash before
3496         defining the type.
3497
3498         * delegate.cs (Delegate.DefineType): use NamespaceClash before
3499         defining the type.
3500
3501         * enum.cs: (Enum.DefineType): use NamespaceClash before
3502         defining the type.
3503
3504         * typemanager.cs (: 3-line patch that gives us some tasty 11%
3505         speed increase.  First, use the negative_hits cache when we get a
3506         negative.  Second, add the type with its full original name
3507         instead of the new . and + encoded name (reflection uses + to
3508         separate type from a nested type).  Use LookupTypeReflection
3509         directly which bypasses the type->name hashtable (that we already
3510         know does not contain the type.
3511         
3512         * decl.cs (DeclSpace.ResolveTypeExpr): track the
3513         location/container type. 
3514
3515         * driver.cs: When passing utf8, use directly the UTF8Encoding.
3516
3517 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
3518
3519         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
3520
3521         * delegate.cs (NewDelegate.Resolve): Test whether an instance
3522         method is being referenced in the method group from a static
3523         context, and report error 120 if so.
3524
3525         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
3526         Error118. 
3527
3528         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
3529         is created, we create the A namespace).
3530
3531         * cs-parser.jay: A namespace also introduces a DeclarationFound.
3532         Fixes #41591
3533
3534 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
3535
3536         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
3537         invocation to ModuleBuilder.GetType with the same values will
3538         return a new type instance, so we need to cache its return
3539         values. 
3540
3541         * expression.cs (Binary.ResolveOperator): Only allow the compare
3542         operators on enums if they are of the same type.
3543
3544         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
3545         types of ValueType on their own case.  Before we were giving them
3546         the same treatment as objects.
3547
3548         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
3549         fullname.  Short name is used to compare against container name.
3550         Fullname is used to check against defined namespace names.
3551         
3552         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
3553         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
3554
3555         (Method.CheckBase): Call parent.
3556         (MemberBase.CheckBase): Check for protected members on sealed
3557         classes.
3558         (PropertyBase.CheckBase): Call parent.
3559         (Field.Define): Call parent.
3560
3561         * report.cs: Negative error codes are now mapped to 8000 - code,
3562         so that the display is render more nicely.
3563
3564         * typemanager.cs: Do not use try/catch, instead report a regular
3565         error. 
3566
3567         (GetPointerType, GetReferenceType): These methods provide
3568         mechanisms to obtain the T* and T& from a T.  We had the code
3569         previously scattered around the code base, and it also used
3570         TypeManager.LookupType that would go through plenty of caches.
3571         This one goes directly to the type source.
3572
3573         In some places we did the Type.GetType followed by
3574         ModuleBuilder.GetType, but not in others, so this unifies the
3575         processing as well.
3576
3577         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
3578         statements now that we have namespace information.
3579
3580         * typemanager.cs (IsNamespace): New method, returns whether the
3581         string presented is a namespace or not.
3582
3583         (ComputeNamespaces): New public entry point, computes the list of
3584         available namespaces, using the GetNamespaces API call in Mono, or
3585         the slower version in MS.NET.   
3586
3587         Now before we start the semantic analysis phase, we have a
3588         complete list of namespaces including everything that the user has
3589         provided.
3590
3591         Deleted old code to cache namespaces in .nsc files.
3592
3593 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
3594
3595         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
3596         class/struct location definition Location for the implicit
3597         constructor location.
3598
3599         (Operator.Define): Use the location of the operator for the
3600         implicit Method definition.
3601
3602         (Constructor.Emit): use the constructor location for the implicit
3603         base initializer constructor.
3604
3605         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
3606         and the Expression class now contains two new methods:
3607
3608         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
3609         isolate type lookup from the rest of the resolution process.
3610
3611         Since we use Expressions to hold type definitions due to the way
3612         we parse the input we have historically overloaded Resolve to
3613         perform the Type lookups if a special flag is passed.  Now this is
3614         eliminated and two methods take their place. 
3615         
3616         The differences in the two methods between xStep and xTerminal is
3617         that xStep is involved in our current lookup system that uses
3618         SimpleNames to compose a name, while xTerminal is used just to
3619         catch the case where the simplename lookup failed.
3620         
3621 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
3622
3623         * expression.cs (ResolveMemberAccess): Remove redundant code.
3624         TypeExpr expressions are always born fully resolved.
3625
3626         * interface.cs (PopulateMethod): Do not lookup the types twice.
3627         We were doing it once during SemanticAnalysis and once during
3628         PopulateMethod.
3629
3630         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
3631         in local variable type definitions, were being returned as a
3632         SimpleName (we decomposed everything into a string), that is
3633         because primary_expression was being used instead of a type in the
3634         grammar (reduce/reduce conflicts).
3635
3636         The part that was wrong is that we converted the expression into a
3637         string (an oversimplification in one hand, compounded with primary
3638         expressions doing string concatenation).
3639
3640         So things like:
3641
3642         A.B.C [] x;
3643
3644         Would return "A.B.C[]" as a SimpleName.  This stopped things like
3645         using clauses from working on this particular context.  And a type
3646         was being matched directly against "A.B.C[]".
3647
3648         We now use the correct approach, and allow for ComposedCast to be
3649         part of the unary expression.  So the "A.B.C []" become a composed
3650         cast of "A.B.C" (as a nested group of MemberAccess with a
3651         SimpleName at the end) plus the rank composition "[]". 
3652
3653         Also fixes 35567
3654         
3655 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
3656
3657         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
3658         for the access level checking.
3659
3660         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
3661         `TypeContainer container', because I kept getting confused when I
3662         was debugging this code.
3663
3664         * expression.cs (Indexers): Instead of tracking getters/setters,
3665         we now track them in parallel.  We create one arraylist less, but
3666         most importantly it is possible now for the LValue code to find a
3667         matching get for a set.
3668
3669         (IndexerAccess.DoResolveLValue): Update the code.
3670         GetIndexersForType has been modified already to extract all the
3671         indexers from a type.  The code assumed it did not.
3672
3673         Also make the code set the correct return type for the indexer.
3674         This was fixed a long time ago for properties, but was missing for
3675         indexers.  It used to be void_type.
3676
3677         (Binary.Emit): Test first for doubles instead of
3678         floats, as they are more common.
3679
3680         (Binary.EmitBranchable): Use the .un version of the branch opcodes
3681         when dealing with floats and the <=, >= operators.  This fixes bug
3682         #39314 
3683
3684         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
3685         to load the array value by emitting a load on the foreach variable
3686         type.  This was incorrect.  
3687
3688         We now emit the code to load an element using the the array
3689         variable type, and then we emit the conversion operator.
3690
3691         Fixed #40176
3692
3693 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
3694
3695         * attribute.cs: Avoid allocation of ArrayLists in the common case.
3696
3697 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
3698
3699         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
3700         test for protection before we test for signatures. 
3701
3702         (MethodSignature.ToString): implement.
3703
3704         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
3705         to the case where we reduced into a LongConstant.
3706
3707         * decl.cs (CheckAccessLevel): If the type is an array, we can not
3708         depend on whether the information is acurrate, because the
3709         Microsoft runtime will always claim that the array type is public,
3710         regardless of the real state.
3711
3712         If the type is a pointer, another problem happens: the type is
3713         reported as non-public in Microsoft.  
3714
3715         In both cases we have to call CheckAccessLevel recursively with
3716         the underlying type as the argument to be tested.
3717
3718 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
3719
3720         * assign.cs (Assign.Emit): If we are dealing with a compound
3721         assignment expression, we should use the code path that stores the
3722         intermediate result in a temporary value.  This fixes #40903.
3723
3724         *expression.cs (Indirection.ToString): Provide ToString method for
3725         debugging. 
3726         
3727 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
3728
3729         * class.cs: Null out fields holding references to Block objects so
3730         they can be garbage collected.
3731
3732         * expression.cs (OverloadResolve): Remove unused local.
3733
3734 2003-04-07  Martin Baulig  <martin@ximian.com>
3735
3736         * codegen.cs (EmitContext.CurrentFile): New public field.
3737         (EmitContext.Mark): Use the CurrentFile to check whether the
3738         location is in the correct file.
3739         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
3740
3741 2003-04-07  Martin Baulig  <martin@ximian.com>
3742
3743         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
3744
3745         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
3746         location.  [FIXME: The location argument which gets passed to this
3747         method is sometimes wrong!]
3748
3749 2003-04-07  Nick Drochak <ndrochak@gol.com>
3750
3751         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
3752
3753 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
3754
3755         * expression.cs (Indirection.EmitAssign): We were using the
3756         temporary, but returning immediately instead of continuing the
3757         EmitAssing flow.
3758
3759 2003-04-06  Martin Baulig  <martin@ximian.com>
3760
3761         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
3762         if it's a nested child, but also deriving from the outer class.
3763         See test 190.cs.
3764
3765         * typemanager.cs (IsNestedChildOf): Make this work if it's a
3766         nested child, but also deriving from the outer class.  See
3767         test-190.cs.
3768         (FilterWithClosure): We may access private members of the outer
3769         class if we're a nested child and deriving from the outer class.
3770         (RealMemberLookup): Only set `closure_private_ok' if the
3771         `original_bf' contained BindingFlags.NonPublic.
3772
3773 2003-04-05  Martin Baulig  <martin@ximian.com>
3774
3775         * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
3776         probe if its a type parameter, and if so, flag an error.
3777
3778         * decl.cs: Move here the SetParameterInfo code from class.cs.
3779         Handle IsGeneric here.
3780
3781         Handle a variety of errors in the parameter info definition.
3782
3783         * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
3784         type parameters here.
3785
3786         * cs-parser.jay (class_declaration): report errors for parameters
3787         here as well.
3788
3789 2003-01-21  Miguel de Icaza  <miguel@ximian.com>
3790
3791         * generic.cs: New file, contains support code for generics.
3792
3793         * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
3794         OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
3795
3796         Update parser for the above removals.
3797
3798         * cs-tokenizer.cs: Do not handle <<= or >>= specially.  This is
3799         now taken care of in the parser.
3800
3801 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
3802
3803         * class.cs (Event.Define): Do not allow abstract events to have
3804         initializers. 
3805
3806 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
3807
3808         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
3809         block in event declarations.
3810
3811         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
3812         value type, get its address.
3813
3814         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
3815         leaving a class on the stack instead of a boolean value (int
3816         0/1).  Change the code so we compare against null, and then the
3817         result against zero.
3818
3819         * class.cs (TypeContainer.GetClassBases): We were checking for the
3820         parent class being sealed too late.
3821
3822         * expression.cs (Binary.Emit): For <= and >= when dealing with
3823         floating point values, use cgt.un and clt.un instead of cgt and
3824         clt alone.
3825
3826 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
3827
3828         * statement.cs: Apply the same optimization as MS: skip the 
3829         GetEnumerator returning an IEnumerator, and use the one returning a 
3830         CharEnumerator instead. This allows us to avoid the try-finally block 
3831         and the boxing.
3832
3833 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
3834
3835         * cs-parser.jay: Attributes cannot be applied to
3836                          namespaces. Fixes #40473
3837
3838 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3839
3840         * class.cs:
3841         (Add*): check if the name is valid using the full name for constants,
3842         fields, properties and events.
3843
3844 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
3845
3846         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
3847         char constants to be part of the enumeration.
3848
3849         * expression.cs (Conditional.DoResolve): Add support for operator
3850         true. Implements the missing functionality from 14.12
3851
3852         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
3853         operator true/false as required by the spec.
3854
3855         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
3856         implicit conversion to boolean.
3857
3858         * statement.cs (Statement.ResolveBoolean): A boolean expression is
3859         also one where the type implements `operator true'. 
3860
3861         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
3862         get an expression that will invoke operator true based on an
3863         expression.  
3864
3865         (GetConversionOperators): Removed the hack that called op_True
3866         here.  
3867
3868         (Expression.ResolveBoolean): Move this from Statement.
3869
3870 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
3871
3872         * ecore.cs (FieldExpr): do not allow initialization of initonly
3873         fields on derived classes
3874
3875 2003-03-13  Martin Baulig  <martin@ximian.com>
3876
3877         * statement.cs (Block.Emit): Call ig.BeginScope() and
3878         ig.EndScope() when compiling with debugging info; call
3879         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
3880
3881 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
3882
3883         * expression.cs (Indexers): Do not construct immediately, allow
3884         for new members to be appended as we go.  Fixes 38143
3885
3886 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3887
3888         * expression.cs: save/restore context when resolving an unchecked
3889         expression.
3890
3891 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
3892
3893         * cfold.cs: Catch division by zero in modulus operator during
3894         constant folding.
3895
3896 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
3897
3898         * interface.cs (Interface.DefineMembers): Avoid defining members
3899         twice. 
3900
3901 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
3902
3903         * driver.cs: handle the +/- options for -noconfig
3904
3905         * statement.cs (Unckeched.Resolve): Also track the state of
3906         unchecked in the Resolve phase.
3907
3908 2003-02-27  Martin Baulig  <martin@ximian.com>
3909
3910         * ecore.cs (Expression.MemberLookup): Don't create a
3911         MethodGroupExpr for something which is not a method.  Fixes #38291.
3912
3913 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
3914
3915         * class.cs (MemberBase.CheckParameters): Also check that the type
3916         is unmanaged if it is a pointer.
3917
3918         * expression.cs (SizeOf.Resolve): Add location information.
3919
3920         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
3921         a managed type is declared.
3922
3923         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
3924         parameter modifiers as well.  Fixes bug 38606
3925
3926         * class.cs: Very sad.  Am backing out the speed up changes
3927         introduced by the ArrayList -> Array in the TypeContainer, as they
3928         were not actually that much faster, and introduced a bug (no error
3929         reports on duplicated methods).
3930
3931         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
3932         source first, this will guarantee that we have a valid expression
3933         before calling in lower levels functions that will require a
3934         resolved object.  Then use this original_source in the
3935         target.ResolveLValue instead of the original source that was
3936         passed to us.
3937
3938         Another change.  Use target.Resolve instead of LValueResolve.
3939         Although we are resolving for LValues, we will let the Assign code
3940         take care of that (it will be called again from Resolve).  This
3941         basically allows code like this:
3942
3943         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
3944         class Y { void A (X x) { x [0] += o; }
3945
3946         The problem was that the indexer was trying to resolve for
3947         set_Item (idx, object o) and never finding one.  The real set_Item
3948         was set_Item (idx, X).  By delaying the process we get the right
3949         semantics. 
3950
3951         Fixes bug 36505
3952         
3953 2003-02-23  Martin Baulig  <martin@ximian.com>
3954
3955         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
3956         while calling DoEmit ().
3957
3958         * codegen.cs (EmitContext.Mark): Don't mark locations in other
3959         source files; if you use the #line directive inside a method, the
3960         compiler stops emitting line numbers for the debugger until it
3961         reaches the end of the method or another #line directive which
3962         restores the original file.
3963
3964 2003-02-23  Martin Baulig  <martin@ximian.com>
3965
3966         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
3967
3968 2003-02-23  Martin Baulig  <martin@ximian.com>
3969
3970         * statement.cs (Block.AddChildVariableNames): We need to call this
3971         recursively, not just for our immediate children.
3972
3973 2003-02-23  Martin Baulig  <martin@ximian.com>
3974
3975         * class.cs (Event.Define): Always make the field private, like csc does.
3976
3977         * typemanager.cs (TypeManager.RealMemberLookup): Make events
3978         actually work, fixes bug #37521.
3979
3980 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
3981
3982         * delegate.cs: When creating the various temporary "Parameters"
3983         classes, make sure that we call the ComputeAndDefineParameterTypes
3984         on those new parameters (just like we do with the formal ones), to
3985         allow them to be resolved in the context of the DeclSpace.
3986
3987         This fixes the bug that Dick observed in Bugzilla #38530.
3988
3989 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
3990
3991         * expression.cs (ResolveMemberAccess): When resolving a constant,
3992         do not attempt to pull a constant if the value was not able to
3993         generate a valid constant.
3994
3995         * const.cs (LookupConstantValue): Do not report more errors than required.
3996
3997 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3998
3999         * expression.cs: fixes bug #38328.
4000
4001 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
4002
4003         * class.cs: Changed all the various members that can be part of a
4004         class from being an ArrayList to be an Array of the right type.
4005         During the DefineType type_list, interface_list, delegate_list and
4006         enum_list are turned into types, interfaces, delegates and enums
4007         arrays.  
4008
4009         And during the member population, indexer_list, event_list,
4010         constant_list, field_list, instance_constructor_list, method_list,
4011         operator_list and property_list are turned into their real arrays.
4012
4013         Although we could probably perform this operation earlier, for
4014         good error reporting we need to keep the lists and remove the
4015         lists for longer than required.
4016
4017         This optimization was triggered by Paolo profiling the compiler
4018         speed on the output of `gen-sample-program.pl' perl script. 
4019
4020         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
4021         not crash in methods like MemberLookupFailed that use this field.  
4022
4023         This problem arises when the compiler fails to resolve a type
4024         during interface type definition for example.
4025
4026 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
4027
4028         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
4029         inherit from System.Object, so we have to stop at null, not only
4030         when reaching System.Object.
4031
4032 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
4033
4034         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
4035         DeclaredOnly because the parent indexer might have had a different
4036         name, but did not loop until the top of the hierarchy was reached.
4037
4038         The problem this one fixes is 35492: when a class implemented an
4039         indexer from an interface, we were getting the interface method
4040         (which was abstract) and we were flagging an error (can not invoke
4041         abstract method).
4042
4043         This also keeps bug 33089 functioning, and test-148 functioning.
4044
4045         * typemanager.cs (IsSpecialMethod): The correct way of figuring
4046         out if a method is special is to see if it is declared in a
4047         property or event, or whether it is one of the predefined operator
4048         names.   This should fix correctly #36804.
4049
4050 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
4051
4052         The goal here is to remove the dependency on EmptyCast.Peel ().
4053         Killing it completely.
4054         
4055         The problem is that currently in a number of places where
4056         constants are expected, we have to "probe" for an EmptyCast, and
4057         Peel, which is not the correct thing to do, as this will be
4058         repetitive and will likely lead to errors. 
4059
4060         The idea is to remove any EmptyCasts that are used in casts that
4061         can be reduced to constants, so we only have to cope with
4062         constants. 
4063
4064         This bug hunt was triggered by Bug 37363 and the desire to remove
4065         the duplicate pattern where we were "peeling" emptycasts to check
4066         whether they were constants.  Now constants will always be
4067         constants.
4068         
4069         * ecore.cs: Use an enumconstant here instead of wrapping with
4070         EmptyCast.  
4071
4072         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
4073         throwing me off.  By handling this we can get rid of a few hacks.
4074         
4075         * statement.cs (Switch): Removed Peel() code.
4076
4077 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
4078
4079         * class.cs: Location information for error 508
4080
4081         * expression.cs (New.DoResolve): Add a guard against double
4082         resolution of an expression.  
4083
4084         The New DoResolve might be called twice when initializing field
4085         expressions (see EmitFieldInitializers, the call to
4086         GetInitializerExpression will perform a resolve on the expression,
4087         and later the assign will trigger another resolution
4088
4089         This leads to bugs (#37014)
4090
4091         * delegate.cs: The signature for EndInvoke should contain any ref
4092         or out parameters as well.  We were not doing this in the past. 
4093
4094         * class.cs (Field.Define): Do not overwrite the type definition
4095         inside the `volatile' group.  Turns out that volatile enumerations
4096         were changing the type here to perform a validity test, which
4097         broke conversions. 
4098
4099 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
4100
4101         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
4102         and structs, we do not want to load the instance variable
4103
4104         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
4105         enum_type has to be handled like an object reference (implicit
4106         conversions exists from this to object), but the regular IsClass
4107         and IsValueType tests will never return true for this one.
4108
4109         Also we use TypeManager.IsValueType instead of type.IsValueType,
4110         just for consistency with the rest of the code (this is only
4111         needed if we ever use the construct exposed by test-180.cs inside
4112         corlib, which we dont today).
4113
4114 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
4115
4116         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
4117         just InternalCall.
4118
4119 2003-02-09  Martin Baulig  <martin@ximian.com>
4120
4121         * namespace.cs (Namespace..ctor): Added SourceFile argument.
4122         (Namespace.DefineNamespaces): New static public method; this is
4123         called when we're compiling with debugging to add all namespaces
4124         to the symbol file.
4125
4126         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
4127         pass it to the Namespace's .ctor.
4128
4129         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
4130         and MethodBase arguments; pass the namespace ID to the symwriter;
4131         pass the MethodBase instead of the token to the symwriter.
4132         (SymbolWriter.DefineNamespace): New method to add a namespace to
4133         the symbol file.
4134
4135 2003-02-09  Martin Baulig  <martin@ximian.com>
4136
4137         * symbolwriter.cs: New file.  This is a wrapper around
4138         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
4139         methods here in near future.
4140
4141 2003-02-09  Martin Baulig  <martin@ximian.com>
4142
4143         * codegen.cs (EmitContext.Mark): Just pass the arguments to
4144         ILGenerator.MarkSequencePoint() which are actually used by the
4145         symbol writer.
4146
4147 2003-02-09  Martin Baulig  <martin@ximian.com>
4148
4149         * location.cs (SourceFile): New public sealed class.  This
4150         contains the name and an index which is used in the location's token.
4151         (Location): Reserve an appropriate number of bits in the token for
4152         the source file instead of walking over that list, this gives us a
4153         really huge performance improvement when compiling with debugging.
4154
4155         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
4156         `SourceFile' argument instead of a string.
4157         (Driver.ProcessFile): Add all the files via Location.AddFile(),
4158         but don't parse/tokenize here, we need to generate the list of all
4159         source files before we do that.
4160         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
4161         the files.
4162
4163         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
4164         instead of a string.
4165
4166         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
4167         of a string.
4168
4169 2003-02-09  Martin Baulig  <martin@ximian.com>
4170
4171         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
4172         filename on `#line default'.
4173
4174 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
4175
4176         * statement.cs: don't clear the pinned var when the fixed statement
4177         returns from the method (fixes bug#37752).
4178
4179 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
4180
4181         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
4182         to IsValueType.
4183
4184 2003-02-07  Martin Baulig  <martin@ximian.com>
4185
4186         * driver.cs: Removed the `--debug-args' command line argument.
4187
4188         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
4189         automatically by the AsssemblyBuilder.
4190         (CodeGen.InitializeSymbolWriter): We don't need to call any
4191         initialization function on the symbol writer anymore.  This method
4192         doesn't take any arguments.
4193
4194 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
4195
4196         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
4197         from referenced assemblies as well.
4198
4199 2003-02-02  Martin Baulig  <martin@ximian.com>
4200
4201         * class.cs (MethodData.Emit): Generate debugging info for external methods.
4202
4203 2003-02-02  Martin Baulig  <martin@ximian.com>
4204
4205         * class.cs (Constructor.Emit): Open the symbol writer before
4206         emitting the constructor initializer.
4207         (ConstructorInitializer.Emit): Call ec.Mark() to allow
4208         single-stepping through constructor initializers.
4209
4210 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
4211
4212         * class.cs: Handle error 549: do not allow virtual methods in
4213         sealed classes. 
4214
4215 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
4216
4217         * decl.cs: Check access levels when resolving types
4218         
4219 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
4220
4221         * statement.cs: Add parameters and locals set in catch blocks that might 
4222         return to set vector
4223
4224 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
4225
4226         * class.cs (Operator): Set the SpecialName flags for operators.
4227         
4228         * expression.cs (Invocation.DoResolve): Only block calls to
4229         accessors and operators on SpecialName methods.
4230
4231         (Cast.TryReduce): Handle conversions from char constants.
4232
4233
4234 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
4235
4236         * statement.cs: small memory and time optimization in FlowBranching.
4237         
4238 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
4239
4240         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
4241         problem that the last fix but in the other sid (Set).
4242
4243         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
4244         access when there is no indexer in the hierarchy.
4245         
4246 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
4247
4248         * class.cs: Combine some if statements.
4249
4250 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4251
4252         * driver.cs: fixed bug #37187.
4253
4254 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
4255
4256         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
4257         any indexer, it's needed to build a list with all the indexers in the
4258         hierarchy (AllGetters), else we have problems. Fixes #35653.
4259
4260 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
4261
4262         * class.cs (MethodData.Define): It is wrong for an interface
4263         implementation to be static in both cases: explicit and implicit.
4264         We were only handling this in one case.
4265
4266         Improve the if situation there to not have negations.
4267         
4268         * class.cs (Field.Define): Turns out that we do not need to check
4269         the unsafe bit on field definition, only on usage.  Remove the test.
4270
4271 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4272
4273         * driver.cs: use assembly.Location instead of Codebase (the latest
4274         patch made mcs fail when using MS assemblies).
4275
4276 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
4277
4278         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
4279         get the path to *corlib.dll.
4280
4281 2003-01-21  Nick Drochak <ndrochak@gol.com>
4282
4283         * cs-tokenizer.cs:
4284         * pending.cs:
4285         * typemanager.cs: Remove compiler warnings
4286
4287 2003-01-20  Duncan Mak  <duncan@ximian.com>
4288
4289         * AssemblyInfo.cs: Bump the version number to 0.19.
4290         
4291 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4292
4293         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
4294
4295 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
4296
4297         * class.cs (Constructor::Emit): Emit debugging info for constructors.
4298
4299 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
4300
4301         * cs-parser.jay: Small fix: we were not comparing the constructor
4302         name correctly.   Thanks to Zoltan for the initial pointer.
4303
4304 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
4305
4306         * cs-tokenizer.cs: Set file name when specified with #line
4307
4308 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
4309
4310         * cs-parser.jay: Only perform the constructor checks here if we
4311         are named like the class;  This will help provider a better
4312         error.  The constructor path is taken when a type definition is
4313         not found, but most likely the user forgot to add the type, so
4314         report that rather than the constructor error.
4315
4316 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
4317
4318         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
4319         allocations.
4320
4321 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4322
4323         * cs-parser.jay: Add cleanup call.
4324
4325 2003-01-13  Duncan Mak  <duncan@ximian.com>
4326
4327         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
4328         consistent with other methods.
4329
4330 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4331
4332         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
4333         
4334 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
4335
4336         * attribute.cs: only set GuidAttr to true when we have a
4337         GuidAttribute.
4338
4339 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4340
4341         * ecore.cs:
4342         * expression.cs:
4343         * typemanager.cs: fixes to allow mcs compile corlib with the new
4344         Type.IsSubclassOf fix.
4345
4346 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
4347
4348         * expression.cs (LocalVariableReference.DoResolve): Classify a
4349         constant as a value, not as a variable.   Also, set the type for
4350         the variable.
4351
4352         * cs-parser.jay (fixed_statement): take a type instead of a
4353         pointer_type, so we can produce a better error message later.
4354         
4355         * statement.cs (Fixed.Resolve): Flag types that are not pointers
4356         as an error.  
4357         
4358         (For.DoEmit): Make inifinite loops have a
4359         non-conditional branch back.
4360
4361         (Fixed.DoEmit): First populate the pinned variables, then emit the
4362         statement, then clear the variables.  Before I was emitting the
4363         code once for each fixed piece.
4364
4365
4366 2003-01-08  Martin Baulig  <martin@ximian.com>
4367
4368         * statement.cs (FlowBranching.MergeChild): A break in a
4369         SWITCH_SECTION does not leave a loop.  Fixes #36155.
4370
4371 2003-01-08  Martin Baulig  <martin@ximian.com>
4372
4373         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
4374         lives in the same number space than `param_map'.  Fixes #36154.
4375
4376 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
4377
4378         * cs-parser.jay (constructor_declaration): Set the
4379         Constructor.ModFlags before probing for it.  This makes the
4380         compiler report 514, 515 and 132 (the code was there, but got
4381         broken). 
4382
4383         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
4384         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
4385         (GotoCase.Resolve): Set `Returns' to ALWAYS.
4386
4387 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
4388
4389         * enum.cs: create the enum static fields using the enum type.
4390
4391 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
4392
4393         * class.cs: don't try to create the ParamBuilder for the return
4394         type if it's not needed (and handle it breaking for the ms runtime
4395         anyway).
4396
4397 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
4398
4399         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
4400
4401 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
4402
4403         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
4404         the command.   This showed up while compiling the JANET source
4405         code, which used \r as its only newline separator.
4406
4407 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
4408
4409         * class.cs (Method.Define): If we are an operator (because it
4410         reuses our code), then set the SpecialName and HideBySig.  #36128
4411
4412 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
4413
4414         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
4415         exception, report error 120 `object reference required'.
4416
4417         * driver.cs: Add --pause option, used during to measure the size
4418         of the process as it goes with --timestamp.
4419
4420         * expression.cs (Invocation.DoResolve): Do not allow methods with
4421         SpecialName to be invoked.
4422
4423 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
4424
4425         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
4426         number before adding it.
4427
4428 2002-12-21  Ravi Pratap  <ravi@ximian.com>
4429
4430         * ecore.cs (StandardImplicitConversion): When in an unsafe
4431         context, we allow conversion between void * to any other pointer
4432         type. This fixes bug #35973.
4433
4434 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
4435
4436         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
4437         is not thrown when extensionless outputs are used 
4438
4439 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4440
4441         * rootcontext.cs: fixed compilation of corlib.
4442
4443 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
4444
4445         * attribute.cs (Attributes.Contains): Add new method.
4446
4447         * class.cs (MethodCore.LabelParameters): if the parameter is an
4448         `out' parameter, check that no attribute `[In]' has been passed.
4449
4450         * enum.cs: Handle the `value__' name in an enumeration.
4451
4452 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
4453
4454         * decl.cs: Added special case to allow overrides on "protected
4455         internal" methods
4456         
4457 2002-12-18  Ravi Pratap  <ravi@ximian.com>
4458
4459         * attribute.cs (Attributes.AddAttributeSection): Rename to this
4460         since it makes much more sense.
4461
4462         (Attributes.ctor): Don't require a Location parameter.
4463         
4464         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
4465
4466         * attribute.cs (ApplyAttributes): Remove extra Location parameters
4467         since we already have that information per attribute.
4468
4469         * everywhere : make appropriate changes.
4470
4471         * class.cs (LabelParameters): Write the code which actually
4472         applies attributes to the return type. We can't do this on the MS
4473         .NET runtime so we flag a warning in the case an exception is
4474         thrown.
4475
4476 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
4477
4478         * const.cs: Handle implicit null conversions here too.
4479
4480 2002-12-17  Ravi Pratap  <ravi@ximian.com>
4481
4482         * class.cs (MethodCore.LabelParameters): Remove the extra
4483         Type [] parameter since it is completely unnecessary. Instead
4484         pass in the method's attributes so that we can extract
4485         the "return" attribute.
4486
4487 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
4488
4489         * cs-parser.jay (parse): Use Report.Error to flag errors instead
4490         of ignoring it and letting the compile continue.
4491
4492         * typemanager.cs (ChangeType): use an extra argument to return an
4493         error condition instead of throwing an exception.
4494
4495 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
4496
4497         * expression.cs (Unary.TryReduce): mimic the code for the regular
4498         code path.  Perform an implicit cast in the cases where we can
4499         implicitly convert to one of the integral types, and then reduce
4500         based on that constant.   This fixes bug #35483.
4501
4502 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4503
4504         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
4505
4506 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4507
4508         * namespace.cs: fixed bug #35489.
4509
4510 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
4511
4512         * class.cs: Remove some dead code.
4513
4514         * cs-parser.jay: Estimate the number of methods needed
4515         (RootContext.MethodCount);
4516
4517         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
4518         numbers instead of StringBuilders.
4519
4520         * support.cs (PtrHashtable): Add constructor with initial size;
4521         We can now reduce reallocations of the method table.
4522
4523 2002-12-10  Ravi Pratap  <ravi@ximian.com>
4524
4525         * attribute.cs (ApplyAttributes): Keep track of the emitted
4526         attributes on a per-target basis. This fixes bug #35413.
4527
4528 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
4529
4530         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
4531         default to the Windows 1252 encoding.
4532
4533         (UnixParseOption): Support version, thanks to Alp for the missing
4534         pointer. 
4535
4536         * AssemblyInfo.cs: Add nice assembly information.
4537
4538         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
4539         (bug 35169).
4540
4541         * cs-parser.jay: Allow a trailing comma before the close bracked
4542         in the attribute_section production.
4543
4544         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
4545         address of the instance was being taken, I will take this out,
4546         because we take the address of the object immediately here.
4547
4548 2002-12-09  Ravi Pratap  <ravi@ximian.com>
4549
4550         * typemanager.cs (AreMultipleAllowed): Take care of the most
4551         obvious case where attribute type is not in the current assembly -
4552         stupid me ;-)
4553
4554 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
4555
4556         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
4557         definitions, instead of doing that afterwards.  
4558
4559         Also we use a nice little hack, depending on the constructor, we
4560         know if we are a "composed" name or a simple name.  Hence, we
4561         avoid the IndexOf test, and we avoid 
4562
4563         * codegen.cs: Add code to assist in a bug reporter to track down
4564         the source of a compiler crash. 
4565
4566 2002-12-07  Ravi Pratap  <ravi@ximian.com>
4567
4568         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
4569         types have been emitted for a given element and flag an error
4570         if something which does not have AllowMultiple set is used more
4571         than once.
4572
4573         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
4574         attribute types and their corresponding AllowMultiple properties
4575
4576         (AreMultipleAllowed): Check the property for a given type.
4577
4578         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
4579         property in the case we have a TypeContainer.
4580
4581         (Attributes.AddAttribute): Detect duplicates and just skip on
4582         adding them. This trivial fix catches a pretty gross error in our
4583         attribute emission - global attributes were being emitted twice!
4584
4585         Bugzilla bug #33187 is now fixed.
4586
4587 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
4588
4589         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
4590         instead of pp_and).
4591
4592         * expression.cs (Binary.ResolveOperator): I can only use the
4593         Concat (string, string, string) and Concat (string, string,
4594         string, string) if the child is actually a concatenation of
4595         strings. 
4596
4597 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
4598
4599         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
4600         context where we need a 2-character lookahead.
4601
4602         * pending.cs (PendingImplementation): Rework so we can keep track
4603         of interface types all the time, and flag those which were
4604         implemented by parents as optional.
4605
4606 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
4607
4608         * expression.cs (Binary.ResolveOperator): Use
4609         String.Concat(string,string,string) or
4610         String.Concat(string,string,string,string) when possible. 
4611
4612         * typemanager: More helper methods.
4613
4614
4615 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
4616
4617         * pending.cs: remove the bogus return from GetMissingInterfaces()
4618         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
4619
4620 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4621
4622         * namespace.cs: avoid duplicated 'using xxx' being added to
4623         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
4624         when we get more than one 'using' statement for the same namespace.
4625         Report a CS0105 warning for it.
4626
4627 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
4628
4629         * cs-tokenizer.cs (consume_identifier): use read directly, instead
4630         of calling getChar/putback, uses internal knowledge of it.    
4631
4632         (xtoken): Reorder tokenizer so most common patterns are checked
4633         first.  This reduces the compilation time in another 5% (from 8.11s
4634         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
4635
4636         The parsing time is 22% of the compilation in mcs, and from that
4637         64% is spent on the tokenization process.  
4638
4639         I tried using a binary search for keywords, but this is slower
4640         than the hashtable.  Another option would be to do a couple of
4641         things:
4642
4643                 * Not use a StringBuilder, instead use an array of chars,
4644                   with a set value.  Notice that this way we could catch
4645                   the 645 error without having to do it *afterwards*.
4646
4647                 * We could write a hand-parser to avoid the hashtable
4648                   compares altogether.
4649
4650         The identifier consumption process takes 37% of the tokenization
4651         time.  Another 15% is spent on is_number.  56% of the time spent
4652         on is_number is spent on Int64.Parse:
4653
4654                 * We could probably choose based on the string length to
4655                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
4656                   computations. 
4657
4658         Another 3% is spend on wrapping `xtoken' in the `token' function.
4659
4660         Handle 0xa0 as whitespace (#34752)
4661         
4662 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
4663
4664         * typemanager.cs (IsCLRType): New routine to tell whether a type
4665         is one of the builtin types.  
4666
4667         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
4668         typecode in more places instead of doing pointer comparissions.
4669         We could leverage some knowledge about the way the typecodes are
4670         laid out.
4671
4672         New code to cache namespaces in assemblies, it is currently not
4673         invoked, to be used soon.
4674
4675         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
4676
4677         * expression.cs (Binary.ResolveOperator): specially handle
4678         strings, and do not perform user-defined operator overloading for
4679         built-in types.
4680
4681 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
4682
4683         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
4684         internalcall as it is a pretty simple operation;  Avoid whenever
4685         possible to call Char.IsLetter.
4686
4687         (consume_identifier): Cut by half the number of
4688         hashtable calls by merging the is_keyword and GetKeyword behavior.
4689
4690         Do not short-circuit, because if we do, we
4691         report errors (ie, #if false && true would produce an invalid
4692         directive error);
4693         
4694
4695 2002-11-24  Martin Baulig  <martin@ximian.com>
4696
4697         * expression.cs (Cast.TryReduce): If we're in checked syntax,
4698         check constant ranges and report a CS0221.  Fixes #33186.
4699
4700 2002-11-24  Martin Baulig  <martin@ximian.com>
4701
4702         * cs-parser.jay: Make this work for uninitialized variable
4703         declarations in the `for' initializer.  Fixes #32416.
4704
4705 2002-11-24  Martin Baulig  <martin@ximian.com>
4706
4707         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
4708         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
4709
4710 2002-11-24  Martin Baulig  <martin@ximian.com>
4711
4712         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
4713         argument; if true, we also check for user-defined conversions.
4714         This is only needed if both arguments are of a user-defined type.
4715         Fixes #30443, added test-175.cs.
4716         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
4717
4718         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
4719
4720 2002-11-24  Martin Baulig  <martin@ximian.com>
4721
4722         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
4723         function to get the store opcode.
4724         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
4725         only emit the Ldelema if the store opcode is Stobj.  You must run
4726         both test-34 and test-167 to test this.  Fixes #34529.
4727
4728 2002-11-23  Martin Baulig  <martin@ximian.com>
4729
4730         * ecore.cs (Expression.MemberLookup): Added additional
4731         `qualifier_type' argument which is used when we're being called
4732         from MemberAccess.DoResolve() and null if we're called from a
4733         SimpleName lookup.
4734         (Expression.MemberLookupFailed): New method to report errors; this
4735         does the CS1540 check and reports the correct error message.
4736
4737         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
4738         argument for the CS1540 check and redone the way how we're dealing
4739         with private members.  See the comment in the source code for details.
4740         (FilterWithClosure): Reverted this back to revision 1.197; renamed
4741         `closure_start_type' to `closure_qualifier_type' and check whether
4742         it's not null.  It was not this filter being broken, it was just
4743         being called with the wrong arguments.
4744
4745         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
4746         and pass it the correct `qualifier_type'; this also does the error
4747         handling for us.
4748
4749 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
4750
4751         * expression.cs (Invocation.EmitParams): If the we are dealing
4752         with a non-built-in value type, load its address as well.
4753
4754         (ArrayCreation): Use a a pretty constant instead
4755         of the hardcoded value 2.   Use 6 instead of 2 for the number of
4756         static initializers.  
4757
4758         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
4759         because they are not really value types, just glorified integers. 
4760
4761         * driver.cs: Do not append .exe, the CSC compiler does not do it.
4762
4763         * ecore.cs: Remove redundant code for enumerations, make them use
4764         the same code path as everything else, fixes the casting issue
4765         with enumerations in Windows.Forms.
4766
4767         * attribute.cs: Do only cast to string if it is a string, the
4768         validation happens later.
4769
4770         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
4771         people upgrade their corlibs.
4772
4773         * ecore.cs: Oops, enumerations were not following the entire code path
4774
4775 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
4776
4777         * typemanager.cs (FilterWithClosure): Commented out the test for
4778         1540 in typemanager.cs, as it has problems when accessing
4779         protected methods from a parent class (see test-174.cs). 
4780
4781         * attribute.cs (Attribute.ValidateGuid): new method.
4782         (Attribute.Resolve): Use above.
4783
4784 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
4785
4786         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
4787
4788         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
4789         handling for enumerations, as we only needed the TypeContainer
4790         functionality to begin with (this is required for the fix below to
4791         work for enums that reference constants in a container class for
4792         example). 
4793
4794         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
4795
4796         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
4797         a valid TypeBuilder to perform lookups on.o
4798
4799         * class.cs (InheritableMemberSignatureCompare): Use true in the
4800         call to GetGetMethod and GetSetMethod, because we are comparing
4801         the signature, and we need to get the methods *even* if they are
4802         private. 
4803
4804         (PropertyBase.CheckBase): ditto.
4805
4806         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
4807         GotoCase.Resolve): Use Peel on EmpytCasts.
4808
4809         * ecore.cs (EmptyCast): drop child, add Peel method.
4810
4811 2002-11-17  Martin Baulig  <martin@ximian.com>
4812
4813         * ecore.cs (EmptyCast.Child): New public property.
4814
4815         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
4816         label resolved to an EmptyCast.  Fixes #34162.
4817         (GotoCase.Resolve): Likewise.
4818         (Block.EmitMeta): Likewise.
4819
4820 2002-11-17  Martin Baulig  <martin@ximian.com>
4821
4822         * expression.cs (Invocation.BetterConversion): Prefer int over
4823         uint; short over ushort; long over ulong for integer literals.
4824         Use ImplicitConversionExists instead of StandardConversionExists
4825         since we also need to check for user-defined implicit conversions.
4826         Fixes #34165.  Added test-173.cs.
4827
4828 2002-11-16  Martin Baulig  <martin@ximian.com>
4829
4830         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
4831         with the `true' and `false' literals.  Fixes #33151.
4832
4833 2002-11-16  Martin Baulig  <martin@ximian.com>
4834
4835         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
4836         October 22nd; don't do the cs1540 check for static members.
4837
4838         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
4839         now using our own filter here and doing the cs1540 check again.
4840
4841 2002-11-16  Martin Baulig  <martin@ximian.com>
4842
4843         * support.cs (InternalParameters): Don't crash if we don't have
4844         any fixed parameters.  Fixes #33532.
4845
4846 2002-11-16  Martin Baulig  <martin@ximian.com>
4847
4848         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
4849         when looking up static methods to make this work on Windows.
4850         Fixes #33773.
4851
4852 2002-11-16  Martin Baulig  <martin@ximian.com>
4853
4854         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
4855         a setter rather than using PropertyInfo.CanWrite.
4856
4857 2002-11-15  Nick Drochak  <ndrochak@gol.com>
4858
4859         * class.cs: Allow acces to block member by subclasses. Fixes build
4860         breaker.
4861
4862 2002-11-14  Martin Baulig  <martin@ximian.com>
4863
4864         * class.cs (Constructor.Emit): Added the extern/block check.
4865         Fixes bug #33678.
4866
4867 2002-11-14  Martin Baulig  <martin@ximian.com>
4868
4869         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
4870         iteration while looking for indexers, this is needed because the
4871         indexer may have a different name in our base classes.  Fixed the
4872         error reporting (no indexers at all, not get accessor, no
4873         overloaded match).  Fixes bug #33089.
4874         (IndexerAccess.DoResolveLValue): Likewise.
4875
4876 2002-11-14  Martin Baulig  <martin@ximian.com>
4877
4878         * class.cs (PropertyBase.CheckBase): Make this work for multiple
4879         indexers.  Fixes the first part of bug #33089.
4880         (MethodSignature.InheritableMemberSignatureCompare): Added support
4881         for properties.
4882
4883 2002-11-13  Ravi Pratap  <ravi@ximian.com>
4884
4885         * attribute.cs (Attribute.Resolve): Catch the
4886         NullReferenceException and report it since it isn't supposed to
4887         happen. 
4888         
4889 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
4890
4891         * expression.cs (Binary.EmitBranchable): Also handle the cases for
4892         LogicalOr and LogicalAnd that can benefit from recursively
4893         handling EmitBranchable.  The code now should be nice for Paolo.
4894
4895 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
4896
4897         * typemanager.cs (LookupType): Added a negative-hit hashtable for
4898         the Type lookups, as we perform quite a number of lookups on
4899         non-Types.  This can be removed once we can deterministically tell
4900         whether we have a type or a namespace in advance.
4901
4902         But this might require special hacks from our corlib.
4903
4904         * TODO: updated.
4905
4906         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
4907         and double which avoids a conversion from an integer to a double.
4908
4909         * expression.cs: tiny optimization, avoid calling IsConstant,
4910         because it effectively performs the lookup twice.
4911
4912 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
4913
4914         But a bogus return here to keep the semantics of the old code
4915         until the Mono runtime is fixed.
4916         
4917         * pending.cs (GetMissingInterfaces): New method used to remove all
4918         the interfaces that are already implemented by our parent
4919         classes from the list of pending methods. 
4920
4921         * interface.cs: Add checks for calls after ResolveTypeExpr.
4922
4923 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
4924
4925         * class.cs (Class.Emit): Report warning 67: event not used if the
4926         warning level is beyond 3.
4927
4928         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
4929         being a NullLiteral.
4930
4931         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
4932         specifiers. 
4933
4934         * class.cs (TypeContainer.GetClassBases): Cover a missing code
4935         path that might fail if a type can not be resolved.
4936
4937         * expression.cs (Binary.Emit): Emit unsigned versions of the
4938         operators. 
4939
4940         * driver.cs: use error 5.
4941         
4942 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
4943
4944         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
4945
4946 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
4947
4948         * cs-parser.jay (switch_section): A beautiful patch from Martin
4949         Baulig that fixed 33094.
4950
4951 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
4952
4953         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
4954         Check whether the base is abstract and report an error if so.
4955
4956         * expression.cs (IndexerAccess.DoResolveLValue,
4957         IndexerAccess.DoResolve): ditto. 
4958
4959         (Invocation.DoResolve): ditto.
4960         
4961         (Invocation.FullMethodDesc): Improve the report string.
4962
4963         * statement.cs (Block): Eliminate IsVariableDefined as it is
4964         basically just a wrapper for GetVariableInfo.
4965
4966         * ecore.cs (SimpleName): Use new 
4967
4968         * support.cs (ReflectionParamter.ParameterType): We unwrap the
4969         type, as we return the actual parameter ref/unref state on a
4970         different call.
4971
4972 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
4973
4974         * support.cs: Return proper flags REF/OUT fixing the previous
4975         commit.  
4976
4977         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
4978         not used to mean `ref' but `ref or out' in ParameterReference
4979         
4980         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
4981         full type signature instead of calling TypeManger.CSharpName
4982         ourselves. 
4983
4984         * support.cs (InternalParameters.ParameterDesc): Do not compare
4985         directly to the modflags, because REF/OUT will actually be bitsets
4986         if set. 
4987
4988         * delegate.cs (VerifyMethod): Check also the modifiers.
4989
4990         * cs-tokenizer.cs: Fix bug where floating point values with an
4991         exponent where a sign was missing was ignored.
4992
4993         * driver.cs: Allow multiple assemblies to be specified in a single
4994         /r: argument
4995
4996 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
4997
4998         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
4999         because identifiers after a parenthesis would end up in this kind
5000         of production, and we needed to desamiguate it for having casts
5001         like:
5002
5003                 (UserDefinedType *) xxx
5004
5005 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
5006
5007         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
5008         we should set on the Bindingflags.NonPublic, but not turn on
5009         private_ok.  private_ok controls whether a Private member is
5010         returned (this is chekced on the filter routine), while the
5011         BindingFlags.NonPublic just controls whether private/protected
5012         will be allowed.   This fixes the problem part of the problem of
5013         private properties being allowed to be used in derived classes.
5014
5015         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
5016         so we can call the children DoResolveLValue method (this will
5017         properly signal errors on lvalue assignments to base properties)
5018         
5019         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
5020         getter are null, and we have a property info, we know that this
5021         happened because the lookup failed, so we report an error 122 for
5022         protection level violation.
5023
5024         We also silently return if setter and getter are null in the
5025         resolve functions, this condition only happens if we have flagged
5026         the error before.  This is the other half of the problem. 
5027
5028         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
5029         not have accessibility information, that is why we were returning
5030         true in the filter function in typemanager.cs.
5031
5032         To properly report 122 (property is inaccessible because of its
5033         protection level) correctly, we report this error in ResolveAccess
5034         by failing if both the setter and the getter are lacking (ie, the
5035         lookup failed). 
5036
5037         DoResolve and DoLResolve have been modified to check for both
5038         setter/getter being null and returning silently, the reason being
5039         that I did not want to put the knowledge about this error in upper
5040         layers, like:
5041
5042         int old = Report.Errors;
5043         x = new PropertyExpr (...);
5044         if (old != Report.Errors)
5045                 return null;
5046         else
5047                 return x;
5048
5049         So the property expr is returned, but it is invalid, so the error
5050         will be flagged during the resolve process. 
5051
5052         * class.cs: Remove InheritablePropertySignatureCompare from the
5053         class, as we no longer depend on the property signature to compute
5054         whether it is possible to implement a method or not.
5055
5056         The reason is that calling PropertyInfo.GetGetMethod will return
5057         null (in .NET, in Mono it works, and we should change this), in
5058         cases where the Get Method does not exist in that particular
5059         class.
5060
5061         So this code:
5062
5063         class X { public virtual int A { get { return 1; } } }
5064         class Y : X { }
5065         class Z : Y { public override int A { get { return 2; } } }
5066
5067         Would fail in Z because the parent (Y) would not have the property
5068         defined.  So we avoid this completely now (because the alternative
5069         fix was ugly and slow), and we now depend exclusively on the
5070         method names.
5071
5072         (PropertyBase.CheckBase): Use a method-base mechanism to find our
5073         reference method, instead of using the property.
5074
5075         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
5076         routines are gone now.
5077
5078         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
5079         names, they were incorrectly named.
5080
5081         * cs-tokenizer.cs: Return are more gentle token on failure. 
5082
5083         * pending.cs (PendingImplementation.InterfaceMethod): This routine
5084         had an out-of-sync index variable, which caused it to remove from
5085         the list of pending methods the wrong method sometimes.
5086
5087 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
5088
5089         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
5090         CanWrite, because those refer to this particular instance of the
5091         property, and do not take into account the fact that we can
5092         override single members of a property.
5093
5094         Constructor requires an EmitContext.  The resolution process does
5095         not happen here, but we need to compute the accessors before,
5096         because the resolution does not always happen for properties.
5097         
5098         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
5099         subclass, before we did not update this flag, but we did update
5100         bindingflags. 
5101
5102         (GetAccessors): Drop this routine, as it did not work in the
5103         presence of partially overwritten set/get methods. 
5104
5105         Notice that this broke the cs1540 detection, but that will require
5106         more thinking. 
5107         
5108 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5109
5110         * class.cs:
5111         * codegen.cs:
5112         * driver.cs: issue a warning instead of an error if we don't support
5113         debugging for the platform. Also ignore a couple of errors that may
5114         arise when trying to write the symbols. Undo my previous patch.
5115
5116 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5117
5118         * driver.cs: ignore /debug switch except for Unix platforms.
5119
5120 2002-10-23  Nick Drochak  <ndrochak@gol.com>
5121
5122         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
5123
5124 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
5125
5126         * driver.cs: Do not make mcs-debug conditional, so we do not break
5127         builds that use it.
5128
5129         * statement.cs (UsageVector.MergeChildren): I would like Martin to
5130         review this patch.  But basically after all the children variables
5131         have been merged, the value of "Breaks" was not being set to
5132         new_breaks for Switch blocks.  I think that it should be set after
5133         it has executed.  Currently I set this to the value of new_breaks,
5134         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
5135         conservative, but I do not understand this code very well.
5136
5137         I did not break anything in the build, so that is good ;-)
5138
5139         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
5140
5141 2002-10-20  Mark Crichton  <crichton@gimp.org>
5142
5143         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
5144
5145 2002-10-20  Nick Drochak  <ndrochak@gol.com>
5146
5147         * cfold.cs: Fixed compile blocker.
5148
5149 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
5150
5151         * driver.cs: I was chekcing the key, not the file.
5152
5153 2002-10-19  Ravi Pratap  <ravi@ximian.com>
5154
5155         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
5156         message that we were generating - we just need to silently return
5157         a null.
5158
5159 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
5160
5161         * class.cs (Event.Define): Change my previous commit, as this
5162         breaks the debugger.  This is a temporary hack, as it seems like
5163         the compiler is generating events incorrectly to begin with.
5164
5165         * expression.cs (Binary.ResolveOperator): Added support for 
5166         "U operator - (E x, E y)"
5167
5168         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
5169         y)".
5170
5171         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
5172         init-only variables, but this path did not take into account that
5173         there might be also instance readonly variables.  Correct this
5174         problem. 
5175
5176         This fixes bug 32253
5177
5178         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
5179         delegates as well.
5180
5181         * driver.cs: Change the extension for modules to `netmodule'
5182
5183         * cs-parser.jay: Improved slightly the location tracking for
5184         the debugger symbols.
5185
5186         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
5187         modifiers that were specified instead of the hardcoded value
5188         (FamAndAssem).  This was basically ignoring the static modifier,
5189         and others.  Fixes 32429.
5190
5191         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
5192         fixed a bug in the process (32476)
5193
5194         * expression.cs (ArrayAccess.EmitAssign): Patch from
5195         hwang_rob@yahoo.ca that fixes bug 31834.3
5196
5197 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
5198
5199         * driver.cs: Make the module extension .netmodule.
5200
5201 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
5202
5203         * driver.cs: Report an error if the resource file is not found
5204         instead of crashing.
5205
5206         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
5207         false, like Emit does.
5208
5209 2002-10-16  Nick Drochak  <ndrochak@gol.com>
5210
5211         * typemanager.cs: Remove unused private member.  Also reported mcs
5212         bug to report this as a warning like csc.
5213
5214 2002-10-15  Martin Baulig  <martin@gnome.org>
5215
5216         * statement.cs (Statement.Emit): Made this a virtual method; emits
5217         the line number info and calls DoEmit().
5218         (Statement.DoEmit): New protected abstract method, formerly knows
5219         as Statement.Emit().
5220
5221         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
5222
5223 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
5224
5225         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
5226         have fixed a remaining problem: not every AddXXXX was adding a
5227         fully qualified name.  
5228
5229         Now everyone registers a fully qualified name in the DeclSpace as
5230         being defined instead of the partial name.  
5231
5232         Downsides: we are slower than we need to be due to the excess
5233         copies and the names being registered this way.  
5234
5235         The reason for this is that we currently depend (on the corlib
5236         bootstrap for instance) that types are fully qualified, because
5237         we dump all the types in the namespace, and we should really have
5238         types inserted into the proper namespace, so we can only store the
5239         basenames in the defined_names array.
5240
5241 2002-10-10  Martin Baulig  <martin@gnome.org>
5242
5243         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
5244         from bug #31834, see the bug report for a testcase which is
5245         miscompiled.
5246
5247 2002-10-10  Martin Baulig  <martin@gnome.org>
5248
5249         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
5250         flow analysis code for this.
5251
5252         * statement.cs (Do, While, For): Tell the flow analysis code about
5253         infinite loops.
5254         (FlowBranching.UsageVector): Added support for infinite loops.
5255         (Block.Resolve): Moved the dead code elimination here and use flow
5256         analysis to do it.
5257
5258 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
5259
5260         * class.cs (Field.Define): Catch cycles on struct type
5261         definitions. 
5262
5263         * typemanager.cs (IsUnmanagedtype): Do not recursively check
5264         fields if the fields are static.  We only need to check instance
5265         fields. 
5266
5267         * expression.cs (As.DoResolve): Test for reference type.
5268
5269         * statement.cs (Using.ResolveExpression): Use
5270         ConvertImplicitRequired, not ConvertImplicit which reports an
5271         error on failture
5272         (Using.ResolveLocalVariableDecls): ditto.
5273
5274         * expression.cs (Binary.ResolveOperator): Report errors in a few
5275         places where we had to.
5276
5277         * typemanager.cs (IsUnmanagedtype): Finish implementation.
5278
5279 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
5280
5281         * expression.cs: Use StoreFromPtr instead of extracting the type
5282         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
5283
5284         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
5285         an enumeration value to a System.Enum, but System.Enum is not a
5286         value type, but an class type, so we need to box.
5287
5288         (Expression.ConvertExplicit): One codepath could return
5289         errors but not flag them.  Fix this.  Fixes #31853
5290
5291         * parameter.cs (Resolve): Do not allow void as a parameter type.
5292
5293 2002-10-06  Martin Baulig  <martin@gnome.org>
5294
5295         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
5296         if it's a class type and not a struct.  Fixes #31815.
5297
5298 2002-10-06  Martin Baulig  <martin@gnome.org>
5299
5300         * statement.cs: Reworked the flow analysis code a bit to make it
5301         usable for dead code elimination.
5302
5303 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5304
5305         * cs-parser.jay: allow empty source files. Fixes bug #31781.
5306
5307 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
5308
5309         * expression.cs (ComposedCast.DoResolveType): A quick workaround
5310         to fix the test 165, will investigate deeper.
5311
5312 2002-10-04  Martin Baulig  <martin@gnome.org>
5313
5314         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
5315         finally blocks actually work.
5316         (Try.Resolve): We don't need to create a sibling for `finally' if
5317         there is no finally block.
5318
5319 2002-10-04  Martin Baulig  <martin@gnome.org>
5320
5321         * class.cs (Constructor.Define): The default accessibility for a
5322         non-default constructor is private, not public.
5323
5324 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
5325
5326         * class.cs (Constructor): Make AllowedModifiers public, add
5327         EXTERN.
5328
5329         * cs-parser.jay: Perform the modifiers test here, as the
5330         constructor for the Constructor class usually receives a zero
5331         because of the way we create it (first we create, later we
5332         customize, and we were never checking the modifiers).
5333
5334         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
5335         is a version of LookupTypeReflection that includes the type-name
5336         cache.  This can be used as a fast path for functions that know
5337         the fully qualified name and are only calling into *.GetType() to
5338         obtain a composed type.
5339
5340         This is also used by TypeManager.LookupType during its type
5341         composition.
5342
5343         (LookupType): We now also track the real type name, as sometimes
5344         we can get a quey for the real type name from things like
5345         ComposedCast.  This fixes bug 31422.
5346         
5347         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
5348         complete type fullname, it does not have to go through the type
5349         resolution system to obtain the composed version of the type (for
5350         obtaining arrays or pointers).
5351         
5352         (Conditional.Emit): Use the EmitBoolExpression to
5353         generate nicer code, as requested by Paolo.
5354
5355         (ArrayCreation.CheckIndices): Use the patch from
5356         hwang_rob@yahoo.ca to validate the array initializers. 
5357
5358 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
5359
5360         * class.cs (ConstructorInitializer.Emit): simplify code by using
5361         Invocation.EmitCall, and at the same time, fix the bugs in calling
5362         parent constructors that took variable arguments. 
5363
5364         * ecore.cs (Expression.ConvertNumericExplicit,
5365         Expression.ImplicitNumericConversion): Remove the code that
5366         manually wrapped decimal (InternalTypeConstructor call is now gone
5367         as well).
5368
5369         * expression.cs (Cast.TryReduce): Also handle decimal types when
5370         trying to perform a constant fold on the type.
5371
5372         * typemanager.cs (IsUnmanagedtype): Partially implemented.
5373
5374         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
5375         that only turned off an error report, and did nothing else. 
5376
5377 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
5378
5379         * driver.cs: Handle and ignore /fullpaths
5380
5381 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
5382
5383         * expression.cs (Binary.ResolveOperator): Catch the case where
5384         DoNumericPromotions returns true, 
5385
5386         (Binary.DoNumericPromotions): Simplify the code, and the tests.
5387
5388 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
5389
5390         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
5391         report error 70.
5392
5393 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
5394
5395         * ecore.cs (ConvertNumericExplicit): It is not enough that the
5396         conversion exists, but it is also required that the conversion be
5397         performed.  This manifested in "(Type64Enum) 2".  
5398
5399         * class.cs (TypeManager.AddMethod): The fix is not to change
5400         AddEnum, because that one was using a fully qualified name (every
5401         DeclSpace derivative does), but to change the AddMethod routine
5402         that was using an un-namespaced name.  This now correctly reports
5403         the duplicated name.
5404
5405         Revert patch until I can properly fix it.  The issue
5406         is that we have a shared Type space across all namespaces
5407         currently, which is wrong.
5408
5409         Options include making the Namespace a DeclSpace, and merge
5410         current_namespace/current_container in the parser.
5411
5412 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
5413
5414         * cs-parser.jay: Improve error reporting when we get a different
5415         kind of expression in local_variable_type and
5416         local_variable_pointer_type. 
5417
5418         Propagate this to avoid missleading errors being reported.
5419
5420         * ecore.cs (ImplicitReferenceConversion): treat
5421         TypeManager.value_type as a target just like object_type.   As
5422         code like this:
5423
5424         ValueType v = 1;
5425
5426         Is valid, and needs to result in the int 1 being boxed before it
5427         is assigned to the value type v.
5428
5429         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
5430         to validate the enumeration name.
5431
5432         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
5433         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
5434         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
5435
5436         * ecore.cs (TryImplicitIntConversion): When doing an
5437         implicit-enumeration-conversion, check if the type is 64-bits and
5438         perform a conversion before passing to EnumConstant.
5439
5440 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
5441
5442         * decl.cs (Error_AmbiguousTypeReference); New routine used to
5443         report ambiguous type references.  Unlike the MS version, we
5444         report what the ambiguity is.   Innovation at work ;-)
5445
5446         (DeclSpace.FindType): Require a location argument to
5447         display when we display an ambiguous error.
5448
5449         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
5450
5451         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
5452
5453         * expression.cs (EmitDynamicInitializers): Apply patch from
5454         hwang_rob@yahoo.ca that fixes the order in which we emit our
5455         initializers. 
5456
5457 2002-09-21  Martin Baulig  <martin@gnome.org>
5458
5459         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
5460         delegate takes no arguments.
5461
5462 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
5463
5464         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
5465         from integers.
5466
5467         * expression.cs: Extract the underlying type.
5468
5469         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
5470
5471         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
5472
5473 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
5474
5475         * class.cs (TypeContainer.DefineType): We can not use the nice
5476         PackingSize with the size set to 1 DefineType method, because it
5477         will not allow us to define the interfaces that the struct
5478         implements.
5479
5480         This completes the fixing of bug 27287
5481
5482         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
5483         means also structs.  This fixes part of the problem. 
5484         (Expresion.ImplicitReferenceConversionExists): ditto.
5485
5486         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
5487         error if there were no errors reported during the type lookup
5488         process, to avoid duplicates or redundant errors.  Without this
5489         you would get an ambiguous errors plus a type not found.  We have
5490         beaten the user enough with the first error.  
5491
5492         (DeclSparce.FindType): Emit a warning if we have an ambiguous
5493         reference. 
5494
5495         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
5496         during the resolution process, stop the lookup, this avoids
5497         repeated error reports (same error twice).
5498
5499         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
5500
5501         * typemanager.cs (LookupType): Redo the type lookup code to match
5502         the needs of System.Reflection.  
5503
5504         The issue is that System.Reflection requires references to nested
5505         types to begin with a "+" sign instead of a dot.  So toplevel
5506         types look like: "NameSpace.TopLevelClass", and nested ones look
5507         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
5508         levels. 
5509
5510 2002-09-19  Martin Baulig  <martin@gnome.org>
5511
5512         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
5513         says that a method always returns or always throws an exception,
5514         don't report the CS0161.
5515
5516         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
5517         set `Returns = new_returns'.
5518
5519 2002-09-19  Martin Baulig  <martin@gnome.org>
5520
5521         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
5522         to an enum constant, check for a CS0176.
5523
5524 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
5525
5526         * class.cs (TypeContainer.CheckPairedOperators): Now we check
5527         for operators that must be in pairs and report errors.
5528
5529         * ecore.cs (SimpleName.DoResolveType): During the initial type
5530         resolution process, when we define types recursively, we must
5531         check first for types in our current scope before we perform
5532         lookups in the enclosing scopes.
5533
5534         * expression.cs (MakeByteBlob): Handle Decimal blobs.
5535
5536         (Invocation.VerifyArgumentsCompat): Call
5537         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
5538         I thought we were supposed to always call this, but there are a
5539         few places in the code where we dont do it.
5540
5541 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
5542
5543         * driver.cs: Add support in -linkres and -resource to specify the
5544         name of the identifier.
5545
5546 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
5547
5548         * ecore.cs (StandardConversionExists): Sync with the conversion
5549         code: allow anything-* to void* conversions.
5550
5551         (FindMostSpecificSource): Use an Expression argument
5552         instead of a Type, because we might be handed over a Literal which
5553         gets a few more implicit conversions that plain types do not.  So
5554         this information was being lost.
5555
5556         Also, we drop the temporary type-holder expression when not
5557         required.
5558
5559 2002-09-17  Martin Baulig  <martin@gnome.org>
5560
5561         * class.cs (PropertyBase.CheckBase): Don't check the base class if
5562         this is an explicit interface implementation.
5563
5564 2002-09-17  Martin Baulig  <martin@gnome.org>
5565
5566         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
5567         different `IndexerName' attributes.
5568
5569         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
5570         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
5571         virtual CommonResolve().
5572
5573 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
5574
5575         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
5576         and convert that to the UnderlyingType.
5577
5578         * statement.cs (Foreach.Resolve): Indexers are just like variables
5579         or PropertyAccesses.
5580
5581         * cs-tokenizer.cs (consume_string): Track line numbers and columns
5582         inside quoted strings, we were not doing this before.
5583
5584 2002-09-16  Martin Baulig  <martin@gnome.org>
5585
5586         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
5587         resolve it.  This is needed for the definite assignment check of the
5588         instance expression, fixes bug #29846.
5589         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
5590
5591 2002-09-16  Nick Drochak  <ndrochak@gol.com>
5592
5593         * parameter.cs: Fix compile error.  Cannot reference static member
5594         from an instance object.  Is this an mcs bug?
5595
5596 2002-09-14  Martin Baulig  <martin@gnome.org>
5597
5598         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
5599         multiple times.  Fixes bug #30295, added test-166.cs.
5600
5601 2002-09-14  Martin Baulig  <martin@gnome.org>
5602
5603         * statement.cs (Block.Emit): Don't emit unreachable code.
5604         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
5605         `break' statements.
5606         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
5607
5608 2002-09-14  Martin Baulig  <martin@gnome.org>
5609
5610         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
5611         is set.
5612
5613 2002-09-14  Martin Baulig  <martin@gnome.org>
5614
5615         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
5616         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
5617         be false on the ms runtime.
5618
5619 2002-09-13  Martin Baulig  <martin@gnome.org>
5620
5621         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
5622         the CS0038 error message.
5623
5624 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
5625
5626         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
5627         constant inside, return it.
5628
5629 2002-09-12  Martin Baulig  <martin@gnome.org>
5630
5631         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
5632         implicit conversion can be done between enum types.
5633
5634         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
5635         check whether an implicit conversion to the current enum's UnderlyingType
5636         exists and report an error if not.
5637
5638         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
5639         without debugging support.
5640
5641         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
5642         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
5643
5644 2002-09-12  Martin Baulig  <martin@gnome.org>
5645
5646         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
5647
5648         * ecore.cs (IMemberExpr.DeclaringType): New property.
5649         (SimpleName.SimpleNameResolve): Check whether we're accessing a
5650         nonstatic member of an outer type (CS0038).
5651
5652 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
5653
5654         * driver.cs: Activate the using-error detector at warning level
5655         4 (at least for MS-compatible APIs).
5656
5657         * namespace.cs (VerifyUsing): Small buglett fix.
5658
5659         * pending.cs (PendingImplementation): pass the container pointer. 
5660
5661         * interface.cs (GetMethods): Allow for recursive definition.  Long
5662         term, I would like to move every type to support recursive
5663         definitions, not the current ordering mechanism that we have right
5664         now.
5665
5666         The situation is this: Attributes are handled before interfaces,
5667         so we can apply attributes to interfaces.  But some attributes
5668         implement interfaces, we will now handle the simple cases
5669         (recursive definitions will just get an error).  
5670
5671         * parameter.cs: Only invalidate types at the end if we fail to
5672         lookup all types.  
5673
5674 2002-09-09  Martin Baulig  <martin@gnome.org>
5675
5676         * ecore.cs (PropertyExpr.Emit): Also check for
5677         TypeManager.system_int_array_get_length so this'll also work when
5678         compiling corlib.  Fixes #30003.
5679
5680 2002-09-09  Martin Baulig  <martin@gnome.org>
5681
5682         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
5683         and throw an exception if we can't get the type's size.  Fixed #30040,
5684         added test-165.cs.
5685
5686 2002-09-09  Martin Baulig  <martin@gnome.org>
5687
5688         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
5689
5690         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
5691         context.  Fixes bug #30027.
5692
5693         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
5694         virtual functions.  Fixes bug #30043, added test-164.cs.
5695
5696 2002-09-08  Ravi Pratap  <ravi@ximian.com>
5697
5698         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
5699
5700 2002-09-08  Nick Drochak  <ndrochak@gol.com>
5701
5702         * driver.cs: Use an object to get the windows codepage since it's not a
5703         static property.
5704
5705 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
5706
5707         * statement.cs (For.Emit): for infinite loops (test == null)
5708         return whether there is a break inside, not always "true".
5709
5710         * namespace.cs (UsingEntry): New struct to hold the name of the
5711         using definition, the location where it is defined, and whether it
5712         has been used in a successful type lookup.
5713         
5714         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
5715         strings.
5716
5717         * decl.cs: ditto.
5718
5719 2002-09-06  Ravi Pratap  <ravi@ximian.com>
5720
5721         * attribute.cs : Fix incorrect code which relied on catching
5722         a NullReferenceException to detect a null being passed in
5723         where an object was expected.
5724
5725 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
5726
5727         * statement.cs (Try): flag the catch variable as assigned
5728
5729         * expression.cs (Cast): Simplified by using ResolveType instead of
5730         manually resolving.
5731
5732         * statement.cs (Catch): Fix bug by using ResolveType.
5733
5734 2002-09-06  Ravi Pratap  <ravi@ximian.com>
5735
5736         * expression.cs (BetterConversion): Special case for when we have
5737         a NullLiteral as the argument and we have to choose between string
5738         and object types - we choose string the way csc does.
5739
5740         * attribute.cs (Attribute.Resolve): Catch the
5741         NullReferenceException and report error #182 since the Mono
5742         runtime no more has the bug and having this exception raised means
5743         we tried to select a constructor which takes an object and is
5744         passed a null.
5745
5746 2002-09-05  Ravi Pratap  <ravi@ximian.com>
5747
5748         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
5749         message (1502, 1503) when we can't locate a method after overload
5750         resolution. This is much more informative and closes the bug
5751         Miguel reported.
5752
5753         * interface.cs (PopulateMethod): Return if there are no argument
5754         types. Fixes a NullReferenceException bug.
5755
5756         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
5757         expressions too. Previously we were checking only in one place for
5758         positional arguments leaving out named arguments.
5759
5760         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
5761         type to the enum type is not allowed. Remove code corresponding to
5762         that.
5763
5764         (ConvertNumericExplicit): Allow explicit conversions from
5765         the underlying type to enum type. This precisely follows the spec
5766         and closes a bug filed by Gonzalo.
5767         
5768 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5769
5770         * compiler.csproj:
5771         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
5772
5773 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
5774
5775         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
5776         it was important that we stored the right value after the
5777         reduction in `converted'.
5778
5779 2002-09-04  Martin Baulig  <martin@gnome.org>
5780
5781         * location.cs (Location.SymbolDocument): Use full pathnames for the
5782         source files.
5783
5784 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
5785
5786         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
5787         of the expression resolve mechanism, because that will catch the
5788         SimpleName error failures.
5789
5790         (Conditional): If we can not resolve the
5791         expression, return, do not crash.
5792
5793 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5794
5795         * cs-tokenizer.cs:
5796         (location): display token name instead of its number.
5797
5798 2002-08-28  Martin Baulig  <martin@gnome.org>
5799
5800         * expression.cs (Binary.ResolveOperator): Don't silently return
5801         but return an error if an operator cannot be applied between two
5802         enum types.
5803
5804 2002-08-28  Martin Baulig  <martin@gnome.org>
5805
5806         * class.cs (Constructor.Define): Set the permission attributes
5807         correctly instead of making all constructors public.
5808
5809 2002-08-28  Martin Baulig  <martin@gnome.org>
5810
5811         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
5812         for private members before reporting a CS0103; if we find anything,
5813         it's a CS0122.
5814
5815 2002-08-28  Martin Baulig  <martin@gnome.org>
5816
5817         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
5818         to check whether `closure_start_type == closure_invocation_type',
5819         we also need to check whether `m.DeclaringType == closure_invocation_type'
5820         before bypassing the permission checks.  We might be accessing
5821         protected/private members from the base class.
5822         (TypeManager.RealMemberLookup): Only set private_ok if private
5823         members were requested via BindingFlags.NonPublic.
5824
5825         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
5826
5827         * expression.cs (MemberAccess.ResolveMemberAccess): Set
5828         MethodGroupExpr.IsExplicitImpl if appropriate.
5829         (Invocation.DoResolve): Don't report the CS0120 for explicit
5830         interface implementations.
5831
5832 2002-08-27  Martin Baulig  <martin@gnome.org>
5833
5834         * expression.cs (Invocation.DoResolve): If this is a static
5835         method and we don't have an InstanceExpression, we must report
5836         a CS0120.
5837
5838 2002-08-25  Martin Baulig  <martin@gnome.org>
5839
5840         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
5841         `==' between a valuetype and an object.
5842
5843 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
5844
5845         * ecore.cs (TypeExpr): Provide a ToString method.
5846
5847 2002-08-24  Martin Baulig  <martin@gnome.org>
5848
5849         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
5850         now called proggie.dbg and it's a binary file.
5851
5852 2002-08-23  Martin Baulig  <martin@gnome.org>
5853
5854         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
5855
5856 2002-08-23  Martin Baulig  <martin@gnome.org>
5857
5858         * struct.cs (MyStructInfo.ctor): Make this work with empty
5859         structs; it's not allowed to use foreach() on null.
5860
5861 2002-08-23  Martin Baulig  <martin@gnome.org>
5862
5863         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
5864         writer the full pathname of the generated assembly.
5865
5866 2002-08-23  Martin Baulig  <martin@gnome.org>
5867
5868         * statements.cs (FlowBranching.UsageVector.MergeChildren):
5869         A `finally' block never returns or breaks; improved handling of
5870         unreachable code.
5871
5872 2002-08-23  Martin Baulig  <martin@gnome.org>
5873
5874         * statement.cs (Throw.Resolve): Allow `throw null'.
5875
5876 2002-08-23  Martin Baulig  <martin@gnome.org>
5877
5878         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
5879         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
5880         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
5881         MemberLookup would return a wrong event if this is an explicit
5882         interface implementation and the class has an event with the same
5883         name.
5884
5885 2002-08-23  Martin Baulig  <martin@gnome.org>
5886
5887         * statement.cs (Block.AddChildVariableNames): New public method.
5888         (Block.AddChildVariableName): Likewise.
5889         (Block.IsVariableNameUsedInChildBlock): Likewise.
5890         (Block.AddVariable): Check whether a variable name has already
5891         been used in a child block.
5892
5893         * cs-parser.jay (declare_local_variables): Mark all variable names
5894         from the current block as being used in a child block in the
5895         implicit block.
5896
5897 2002-08-23  Martin Baulig  <martin@gnome.org>
5898
5899         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
5900         find the symbol writer.
5901
5902         * driver.cs: csc also allows the arguments to /define being
5903         separated by commas, not only by semicolons.
5904
5905 2002-08-23  Martin Baulig  <martin@gnome.org>
5906
5907         * interface.cs (Interface.GetMembers): Added static check for events.
5908
5909 2002-08-15  Martin Baulig  <martin@gnome.org>
5910
5911         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
5912         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
5913
5914         * ecore.cs (Expression.MemberLookup): Added documentation and explained
5915         why the MethodData.EmitDestructor() change was necessary.
5916
5917 2002-08-20  Martin Baulig  <martin@gnome.org>
5918
5919         * class.cs (TypeContainer.FindMembers): Added static check for events.
5920
5921         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
5922
5923         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
5924         use Type.GetEvents(), not Type.FindMembers().
5925
5926 2002-08-20  Martin Baulig  <martin@gnome.org>
5927
5928         * decl.cs (MemberCache): Added a special method cache which will
5929         be used for method-only searched.  This ensures that a method
5930         search will return a MethodInfo with the correct ReflectedType for
5931         inherited methods.      
5932
5933 2002-08-20  Martin Baulig  <martin@gnome.org>
5934
5935         * decl.cs (DeclSpace.FindMembers): Made this public.
5936
5937 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5938
5939         * delegate.cs: fixed build on windows.
5940         [FIXME:  Filed as bug #29150: MCS must report these errors.]
5941
5942 2002-08-19  Ravi Pratap  <ravi@ximian.com>
5943
5944         * ecore.cs (StandardConversionExists): Return a false
5945         if we are trying to convert the void type to anything else
5946         since that is not allowed.
5947
5948         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
5949         we flag error 70 in the event an event is trying to be accessed
5950         directly from outside the declaring type.
5951
5952 2002-08-20  Martin Baulig  <martin@gnome.org>
5953
5954         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
5955         MemberCache from typemanager.cs to decl.cs.
5956
5957 2002-08-19  Martin Baulig  <martin@gnome.org>
5958
5959         * class.cs (TypeContainer): Implement IMemberContainer.
5960         (TypeContainer.DefineMembers): Create the MemberCache.
5961         (TypeContainer.FindMembers): Do better BindingFlags checking; only
5962         return public members if BindingFlags.Public was given, check
5963         whether members are static.
5964
5965 2002-08-16  Martin Baulig  <martin@gnome.org>
5966
5967         * decl.cs (DeclSpace.Define): Splitted this in Define and
5968         DefineMembers.  DefineMembers is called first and initializes the
5969         MemberCache.
5970
5971         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
5972         DefineMembers() on all our DeclSpaces.
5973
5974         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
5975         but call DefineMembers() on all nested interfaces.  We call their
5976         Define() in our new Define() function.
5977
5978         * interface.cs (Interface): Implement IMemberContainer.
5979         (Interface.Define): Moved all code except the attribute stuf to
5980         DefineMembers().
5981         (Interface.DefineMembers): Initialize the member cache.
5982
5983         * typemanager.cs (IMemberFinder): Removed this interface, we don't
5984         need this anymore since we can use MemberCache.FindMembers directly.
5985
5986 2002-08-19  Martin Baulig  <martin@gnome.org>
5987
5988         * typemanager.cs (MemberCache): When creating the cache for an
5989         interface type, add all inherited members.
5990         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
5991         to `out bool used_cache' and documented it.
5992         (TypeManager.MemberLookup): If we already used the cache in the first
5993         iteration, we don't need to do the interfaces check.
5994
5995 2002-08-19  Martin Baulig  <martin@gnome.org>
5996
5997         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
5998         here from IMemberFinder and don't implement this interface anymore.
5999         (DeclSpace.MemberCache): Moved here from IMemberFinder.
6000
6001         * typemanager.cs (IMemberFinder): This interface is now only used by
6002         classes which actually support the member cache.
6003         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
6004         since we only put DeclSpaces into this Hashtable.
6005         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
6006         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
6007
6008 2002-08-16  Martin Baulig  <martin@gnome.org>
6009
6010         * typemanager.cs (ICachingMemberFinder): Removed.
6011         (IMemberFinder.MemberCache): New property.
6012         (TypeManager.FindMembers): Merged this with RealFindMembers().
6013         This function will never be called from TypeManager.MemberLookup()
6014         so we can't use the cache here, just the IMemberFinder.
6015         (TypeManager.MemberLookup_FindMembers): Check whether the
6016         IMemberFinder has a MemberCache and call the cache's FindMembers
6017         function.
6018         (MemberCache): Rewrote larger parts of this yet another time and
6019         cleaned it up a bit.
6020
6021 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
6022
6023         * driver.cs (LoadArgs): Support quoting.
6024
6025         (Usage): Show the CSC-like command line arguments.
6026
6027         Improved a few error messages.
6028
6029 2002-08-15  Martin Baulig  <martin@gnome.org>
6030
6031         * typemanager.cs (IMemberContainer.Type): New property.
6032         (IMemberContainer.IsInterface): New property.
6033
6034         The following changes are conditional to BROKEN_RUNTIME, which is
6035         defined at the top of the file.
6036
6037         * typemanager.cs (MemberCache.MemberCache): Don't add the base
6038         class'es members, but add all members from TypeHandle.ObjectType
6039         if we're an interface.
6040         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
6041         is the current type.
6042         (MemberCache.CacheEntry.Container): Removed this field.
6043         (TypeHandle.GetMembers): Include inherited members.
6044
6045 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6046
6047         * typemanager.cs: fixed compilation and added a comment on a field that
6048         is never used.
6049
6050 2002-08-15  Martin Baulig  <martin@gnome.org>
6051
6052         * class.cs (ConstructorInitializer.Resolve): In the
6053         Expression.MemberLookup call, use the queried_type as
6054         invocation_type.
6055
6056         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
6057         declared' attribute, it's always true.
6058         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
6059         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
6060         temporary wrapper for FindMembers which tells MemberLookup whether
6061         members from the base classes are included in the return value.
6062         This will go away soon.
6063         (TypeManager.MemberLookup): Use this temporary hack here; once the
6064         new MemberCache is completed, we don't need to do the DeclaredOnly
6065         looping here anymore since the MemberCache will take care of this.
6066         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
6067         (MemberCache): When creating the MemberCache for a class, get
6068         members from the current class and all its base classes.
6069         (MemberCache.CacheEntry.Container): New field.  This is a
6070         temporary hack until the Mono runtime is fixed to distinguish
6071         between ReflectedType and DeclaringType.  It allows us to use MCS
6072         with both the MS runtime and the unfixed Mono runtime without
6073         problems and without accecting performance.
6074         (MemberCache.SearchMembers): The DeclaredOnly looping from
6075         TypeManager.MemberLookup is now done here.      
6076
6077 2002-08-14  Martin Baulig  <martin@gnome.org>
6078
6079         * statement.cs (MyStructInfo.MyStructInfo): Don't call
6080         Type.GetFields on dynamic types but get the fields from the
6081         corresponding TypeContainer.
6082         (MyStructInfo.GetStructInfo): Added check for enum types.
6083
6084         * typemanager.cs (MemberList.IsSynchronized): Implemented.
6085         (MemberList.SyncRoot): Implemented.
6086         (TypeManager.FilterWithClosure): No need to check permissions if
6087         closure_start_type == closure_invocation_type, don't crash if
6088         closure_invocation_type is null.
6089
6090 2002-08-13  Martin Baulig  <martin@gnome.org>
6091
6092         Rewrote TypeContainer.FindMembers to use a member cache.  This
6093         gives us a speed increase of about 35% for the self-hosting MCS
6094         build and of about 15-20% for the class libs (both on GNU/Linux).
6095
6096         * report.cs (Timer): New class to get enhanced profiling.  This
6097         whole class is "TIMER" conditional since it remarkably slows down
6098         compilation speed.
6099
6100         * class.cs (MemberList): New class.  This is an IList wrapper
6101         which we're now using instead of passing MemberInfo[]'s around to
6102         avoid copying this array unnecessarily.
6103         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
6104         (ICachingMemberFinder, IMemberContainer): New interface.
6105         (TypeManager.FilterWithClosure): If `criteria' is null, the name
6106         has already been checked, otherwise use it for the name comparision.
6107         (TypeManager.FindMembers): Renamed to RealMemberFinder and
6108         provided wrapper which tries to use ICachingMemberFinder.FindMembers
6109         if possible.  Returns a MemberList, not a MemberInfo [].
6110         (TypeHandle): New class, implements IMemberContainer.  We create
6111         one instance of this class per type, it contains a MemberCache
6112         which is used to do the member lookups.
6113         (MemberCache): New class.  Each instance of this class contains
6114         all members of a type and a name-based hash table.
6115         (MemberCache.FindMembers): This is our new member lookup
6116         function.  First, it looks up all members of the requested name in
6117         the hash table.  Then, it walks this list and sorts out all
6118         applicable members and returns them.
6119
6120 2002-08-13  Martin Baulig  <martin@gnome.org>
6121
6122         In addition to a nice code cleanup, this gives us a performance
6123         increase of about 1.4% on GNU/Linux - not much, but it's already
6124         half a second for the self-hosting MCS compilation.
6125
6126         * typemanager.cs (IMemberFinder): New interface.  It is used by
6127         TypeManager.FindMembers to call FindMembers on a TypeContainer,
6128         Enum, Delegate or Interface.
6129         (TypeManager.finder_to_member_finder): New PtrHashtable.
6130         (TypeManager.finder_to_container): Removed.
6131         (TypeManager.finder_to_delegate): Removed.
6132         (TypeManager.finder_to_interface): Removed.
6133         (TypeManager.finder_to_enum): Removed.
6134
6135         * interface.cs (Interface): Implement IMemberFinder.
6136
6137         * delegate.cs (Delegate): Implement IMemberFinder.
6138
6139         * enum.cs (Enum): Implement IMemberFinder.
6140
6141         * class.cs (TypeContainer): Implement IMemberFinder.
6142
6143 2002-08-12  Martin Baulig  <martin@gnome.org>
6144
6145         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
6146
6147 2002-08-12  Martin Baulig  <martin@gnome.org>
6148
6149         * ecore.cs (ITypeExpression): New interface for expressions which
6150         resolve to a type.
6151         (TypeExpression): Renamed to TypeLookupExpression.
6152         (Expression.DoResolve): If we're doing a types-only lookup, the
6153         expression must implement the ITypeExpression interface and we
6154         call DoResolveType() on it.
6155         (SimpleName): Implement the new ITypeExpression interface.
6156         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
6157         hack, the situation that we're only looking up types can't happen
6158         anymore when this method is called.  Moved the type lookup code to
6159         DoResolveType() and call it.
6160         (SimpleName.DoResolveType): This ITypeExpression interface method
6161         is now doing the types-only lookup.
6162         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
6163         (ResolveFlags): Added MaskExprClass.
6164
6165         * expression.cs (MemberAccess): Implement the ITypeExpression
6166         interface.
6167         (MemberAccess.DoResolve): Added support for a types-only lookup
6168         when we're called via ITypeExpression.DoResolveType().
6169         (ComposedCast): Implement the ITypeExpression interface.
6170
6171         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
6172         Expression.Resolve() with ResolveFlags.Type instead.
6173
6174 2002-08-12  Martin Baulig  <martin@gnome.org>
6175
6176         * interface.cs (Interface.Define): Apply attributes.
6177
6178         * attribute.cs (Attribute.ApplyAttributes): Added support for
6179         interface attributes.
6180
6181 2002-08-11  Martin Baulig  <martin@gnome.org>
6182
6183         * statement.cs (Block.Emit): Only check the "this" variable if we
6184         do not always throw an exception.
6185
6186         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
6187         whether the property has a set accessor.
6188
6189 2002-08-11  Martin Baulig  <martin@gnome.org>
6190
6191         Added control flow analysis support for structs.
6192
6193         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
6194         with control flow analysis turned off.
6195         (IVariable): New interface.
6196         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
6197         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
6198         (FieldExpr.DoResolve): Resolve the instance expression with flow
6199         analysis turned off and do the definite assignment check after the
6200         resolving when we know what the expression will resolve to.
6201
6202         * expression.cs (LocalVariableReference, ParameterReference):
6203         Implement the new IVariable interface, only call the flow analysis
6204         code if ec.DoFlowAnalysis is true.
6205         (This): Added constructor which takes a Block argument.  Implement
6206         the new IVariable interface.
6207         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
6208         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
6209         This does the definite assignment checks for struct members.
6210
6211         * class.cs (Constructor.Emit): If this is a non-static `struct'
6212         constructor which doesn't have any initializer, call
6213         Block.AddThisVariable() to tell the flow analysis code that all
6214         struct elements must be initialized before control returns from
6215         the constructor.
6216
6217         * statement.cs (MyStructInfo): New public class.
6218         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
6219         argument to this indexer.  If non-zero, check an individual struct
6220         member, not the whole struct.
6221         (FlowBranching.CheckOutParameters): Check struct members.
6222         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
6223         overloaded versions of these methods which take an additional
6224         `int field_idx' argument to check struct members.
6225         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
6226         overloaded versions of these methods which take an additional
6227         `string field_name' argument to check struct member.s
6228         (VariableInfo): Implement the IVariable interface.
6229         (VariableInfo.StructInfo): New public property.  Returns the
6230         MyStructInfo instance of the variable if it's a struct or null.
6231         (Block.AddThisVariable): New public method.  This is called from
6232         Constructor.Emit() for non-static `struct' constructor which do
6233         not have any initializer.  It creates a special variable for the
6234         "this" instance variable which will be checked by the flow
6235         analysis code to ensure that all of the struct's fields are
6236         initialized before control returns from the constructor.
6237         (UsageVector): Added support for struct members.  If a
6238         variable/parameter is a struct with N members, we reserve a slot
6239         in the usage vector for each member.  A struct is considered fully
6240         initialized if either the struct itself (slot 0) or all its
6241         members are initialized.
6242
6243 2002-08-08  Martin Baulig  <martin@gnome.org>
6244
6245         * driver.cs (Driver.MainDriver): Only report an error CS5001
6246         if there were no compilation errors.
6247
6248         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
6249         `UnsafeContext' property to determine whether the parent is in
6250         unsafe context rather than checking the parent's ModFlags:
6251         classes nested in an unsafe class are unsafe as well.
6252
6253 2002-08-08  Martin Baulig  <martin@gnome.org>
6254
6255         * statement.cs (UsageVector.MergeChildren): Distinguish between
6256         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
6257         we return.  Added test17() and test18() to test-154.cs.
6258
6259 2002-08-08  Martin Baulig  <martin@gnome.org>
6260
6261         * typemanager.cs (TypeManager.FilterWithClosure): If we have
6262         Family access, make sure the invoking type isn't a subclass of the
6263         queried type (that'd be a CS1540).
6264
6265         * ecore.cs (Expression.MemberLookup): Added overloaded version of
6266         this method which takes an additional `Type invocation_type'.
6267
6268         * expression.cs (BaseAccess.DoResolve): Use the base type as
6269         invocation and query type.
6270         (MemberAccess.DoResolve): If the lookup failed and we're about to
6271         report a CS0122, try a lookup with the ec.ContainerType - if this
6272         succeeds, we must report a CS1540.
6273
6274 2002-08-08  Martin Baulig  <martin@gnome.org>
6275
6276         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
6277         (MethodGroupExpr): Implement the IMemberExpr interface.
6278
6279         * expression (MemberAccess.ResolveMemberAccess): No need to have
6280         any special code for MethodGroupExprs anymore, they're now
6281         IMemberExprs.   
6282
6283 2002-08-08  Martin Baulig  <martin@gnome.org>
6284
6285         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
6286         Family, FamANDAssem and FamORAssem permissions.
6287         (TypeManager.IsSubclassOrNestedChildOf): New public method.
6288
6289 2002-08-08  Martin Baulig  <martin@gnome.org>
6290
6291         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
6292         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
6293         or loop block.
6294
6295 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
6296
6297         * driver.cs: implemented /resource option to embed managed resources.
6298
6299 2002-08-07  Martin Baulig  <martin@gnome.org>
6300
6301         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
6302         (FieldBase.HasFieldInitializer): New public property.
6303         (FieldBase.GetInitializerExpression): New public method.  Resolves and
6304         returns the field initializer and makes sure it is only resolved once.
6305         (TypeContainer.EmitFieldInitializers): Call
6306         FieldBase.GetInitializerExpression to get the initializer, this ensures
6307         that it isn't resolved multiple times.
6308
6309         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
6310         the resolving process (SimpleName/MemberLookup) that we're currently
6311         emitting a field initializer (which must not access any instance members,
6312         this is an error CS0236).
6313
6314         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
6315         argument, if the `IsFieldInitializer' flag is set, we must report and
6316         error CS0236 and not an error CS0120.   
6317
6318 2002-08-07  Martin Baulig  <martin@gnome.org>
6319
6320         * ecore.cs (IMemberExpr): New public interface.
6321         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
6322         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
6323         if the expression is an IMemberExpr.
6324
6325         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
6326         to be null, implicitly default to `this' if we're non-static in
6327         this case.  Simplified the code a lot by using the new IMemberExpr
6328         interface.  Also fixed bug #28176 here.
6329
6330 2002-08-06  Martin Baulig  <martin@gnome.org>
6331
6332         * cs-parser.jay (SimpleLookup): Removed.  We need to create
6333         ParameterReferences during semantic analysis so that we can do a
6334         type-only search when resolving Cast, TypeOf and SizeOf.
6335         (block): Pass the `current_local_parameters' to the Block's
6336         constructor.
6337
6338         * class.cs (ConstructorInitializer): Added `Parameters parameters'
6339         argument to the constructor.
6340         (ConstructorInitializer.Resolve): Create a temporary implicit
6341         block with the parameters.
6342
6343         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
6344         references here if we aren't doing a type-only search.
6345
6346         * statement.cs (Block): Added constructor which takes a
6347         `Parameters parameters' argument.
6348         (Block.Parameters): New public property.
6349
6350         * support.cs (InternalParameters.Parameters): Renamed `parameters'
6351         to `Parameters' and made it public readonly.
6352
6353 2002-08-06  Martin Baulig  <martin@gnome.org>
6354
6355         * ecore.cs (Expression.Warning): Made this public as well.
6356
6357         * report.cs (Report.Debug): Print the contents of collections.
6358
6359 2002-08-06  Martin Baulig  <martin@gnome.org>
6360
6361         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
6362         used to tell Resolve() which kinds of expressions it may return.
6363         (Expression.Resolve): Added overloaded version of this method which
6364         takes a `ResolveFlags flags' argument.  This can be used to tell
6365         Resolve() which kinds of expressions it may return.  Reports a
6366         CS0118 on error.
6367         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
6368         ResolveFlags.SimpleName.
6369         (Expression.Error118): Added overloaded version of this method which
6370         takes a `ResolveFlags flags' argument.  It uses the flags to determine
6371         which kinds of expressions are allowed.
6372
6373         * expression.cs (Argument.ResolveMethodGroup): New public method.
6374         Resolves an argument, but allows a MethodGroup to be returned.
6375         This is used when invoking a delegate.
6376
6377         * TODO: Updated a bit.
6378
6379 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6380
6381         Fixed compilation with csc.
6382
6383         * ecore.cs: Expression.Error made public. Is this correct? Should
6384         Warning be made public too?
6385
6386         * expression.cs: use ea.Location instead of ea.loc.
6387         [FIXME:  Filed as bug #28607: MCS must report these errors.]
6388
6389 2002-08-06  Martin Baulig  <martin@gnome.org>
6390
6391         * ecore.cs (Expression.loc): Moved the location here instead of
6392         duplicating it in all derived classes.
6393         (Expression.Location): New public property.
6394         (Expression.Error, Expression.Warning): Made them non-static and
6395         removed the location argument.
6396         (Expression.Warning): Added overloaded version which takes an
6397         `int level' argument.
6398         (Expression.Error118): Make this non-static and removed the
6399         expression and location arguments.
6400         (TypeExpr): Added location argument to the constructor.
6401
6402         * expression.cs (StaticCallExpr): Added location argument to
6403         the constructor.
6404         (Indirection, PointerArithmetic): Likewise.
6405         (CheckedExpr, UnCheckedExpr): Likewise.
6406         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
6407         (StringPtr): Likewise.
6408
6409
6410 2002-08-05  Martin Baulig  <martin@gnome.org>
6411
6412         * expression.cs (BaseAccess.DoResolve): Actually report errors.
6413
6414         * assign.cs (Assign.DoResolve): Check whether the source
6415         expression is a value or variable.
6416
6417         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
6418         while resolving the corresponding blocks.
6419
6420         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
6421         an error, don't silently return null.
6422
6423         * statement.cs (Block.AddVariable): Do the error reporting here
6424         and distinguish between CS0128 and CS0136.
6425         (Block.DoResolve): Report all unused labels (warning CS0164).
6426         (LabeledStatement): Pass the location to the constructor.
6427         (LabeledStatement.HasBeenReferenced): New property.
6428         (LabeledStatement.Resolve): Set it to true here.
6429
6430         * statement.cs (Return.Emit): Return success even after reporting
6431         a type mismatch error (CS0126 or CS0127), this is what csc does and
6432         it avoids confusing the users with any consecutive errors.
6433
6434 2002-08-05  Martin Baulig  <martin@gnome.org>
6435
6436         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
6437
6438         * const.cs (Const.LookupConstantValue): Catch circular definitions.
6439
6440         * expression.cs (MemberAccess.DoResolve): Silently return if an
6441         error has already been reported.
6442
6443         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
6444         error has already been reported.
6445
6446 2002-08-05  Martin Baulig  <martin@gnome.org>
6447
6448         * statement.cs (UsageVector): Only initialize the `parameters'
6449         vector if we actually have any "out" parameters.
6450
6451 2002-08-05  Martin Baulig  <martin@gnome.org>
6452
6453         * expression.cs (Binary.ResolveOperator): When combining delegates,
6454         they must have the same type.
6455
6456 2002-08-05  Martin Baulig  <martin@gnome.org>
6457
6458         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
6459         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
6460         work with the ms runtime and we also don't need it: if we're a
6461         PropertyBuilder and not in the `indexer_arguments' hash, then we
6462         are a property and not an indexer.
6463
6464         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
6465         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
6466         since the latter one doesn't work with the ms runtime.
6467
6468 2002-08-03  Martin Baulig  <martin@gnome.org>
6469
6470         Fixed bugs #27998 and #22735.
6471
6472         * class.cs (Method.IsOperator): New public field.
6473         (Method.CheckBase): Report CS0111 if there's already a method
6474         with the same parameters in the current class.  Report CS0508 when
6475         attempting to change the return type of an inherited method.
6476         (MethodData.Emit): Report CS0179 if a method doesn't have a body
6477         and it's not marked abstract or extern.
6478         (PropertyBase): New abstract base class for Property and Indexer.
6479         (PropertyBase.CheckBase): Moved here from Property and made it work
6480         for indexers.
6481         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
6482         the same so we can reuse it there.
6483         (Property, Indexer): Derive from PropertyBase.
6484         (MethodSignature.inheritable_property_signature_filter): New delegate
6485         to find properties and indexers.
6486
6487         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
6488         argument and improved error reporting.
6489
6490         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
6491         EmptyReadOnlyParameters and made it a property.
6492
6493         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
6494         version of this method which takes a `PropertyInfo indexer'.
6495         (TypeManager.RegisterIndexer): New method.
6496
6497         * class.cs: Added myself as author of this file :-)
6498
6499 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6500
6501         * class.cs: fixed compilation on windoze.
6502
6503 2002-08-03  Martin Baulig  <martin@gnome.org>
6504
6505         * interface.cs (Interface.GetInterfaceBases): Check whether all
6506         base interfaces are at least as accessible than the current one.
6507
6508         * class.cs (TypeContainer.GetClassBases): Check whether base types
6509         are at least as accessible than the current type.
6510         (TypeContainer.AsAccessible): Implemented and made non-static.
6511         (MemberBase.CheckParameters): Report errors if the accessibility
6512         checks fail.
6513
6514         * delegate.cs (Delegate.Delegate): The default visibility is
6515         internal for top-level types and private for nested types.
6516         (Delegate.Define): Report errors if the accessibility checks fail.
6517
6518         * enum.cs (Enum.Enum): The default visibility is internal for
6519         top-level types and private for nested types.
6520         (Enum.DefineType): Compute the correct visibility.
6521
6522         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
6523         function which takes a `bool is_toplevel' instead of a TypeContainer.
6524
6525         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
6526         builtin type.
6527
6528 2002-08-02  Martin Baulig  <martin@gnome.org>
6529
6530         * expression.cs (LocalVariableReferenc): Added constructor which
6531         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
6532         (LocalVariableReference.IsReadOnly): New property.
6533         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
6534         variable is readonly, use our own readonly flag to do this; you can
6535         use the new constructor to get a writable reference to a read-only
6536         variable.
6537
6538         * cs-parser.jay (foreach_statement, using_statement): Get a writable
6539         reference to the local variable.
6540
6541 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
6542
6543         * rootcontext.cs (ResolveCore): Also include System.Exception
6544
6545         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
6546         we reach an EmptyStatement.
6547
6548         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
6549         is also fine.
6550
6551         * expression.cs (Binary.ResolveOperator): Check error result in
6552         two places.
6553
6554         use brtrue/brfalse directly and avoid compares to null.
6555
6556 2002-08-02  Martin Baulig  <martin@gnome.org>
6557
6558         * class.cs (TypeContainer.Define): Define all nested interfaces here.
6559         Fixes bug #28407, added test-155.cs.
6560
6561 2002-08-01  Martin Baulig  <martin@gnome.org>
6562
6563         * class.cs (Event.EmitDefaultMethod): Make this work with static
6564         events.  Fixes #28311, added verify-3.cs.
6565
6566 2002-08-01  Martin Baulig  <martin@gnome.org>
6567
6568         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
6569         `is_disposable' fields.
6570         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
6571         `hm.is_disposable' if we're using the collection pattern.
6572         (Foreach.EmitCollectionForeach): Use the correct type for the
6573         enumerator's local variable, only emit the try/finally block if
6574         necessary (fixes #27713).
6575
6576 2002-08-01  Martin Baulig  <martin@gnome.org>
6577
6578         * ecore.cs (Expression.report118): Renamed to Error118 and made
6579         it public static.
6580
6581         * statement.cs (Throw.Resolve): Check whether the expression is of
6582         the correct type (CS0118) and whether the type derives from
6583         System.Exception (CS0155).
6584         (Catch.Resolve): New method.  Do the type lookup here and check
6585         whether it derives from System.Exception (CS0155).
6586         (Catch.CatchType, Catch.IsGeneral): New public properties.
6587
6588         * typemanager.cs (TypeManager.exception_type): Added.
6589
6590 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
6591
6592         * driver.cs: Updated About function.
6593
6594 2002-07-31  Martin Baulig  <martin@gnome.org>
6595
6596         Implemented Control Flow Analysis.
6597
6598         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
6599         (EmitContext.CurrentBranching): Added.
6600         (EmitContext.StartFlowBranching): Added.
6601         (EmitContext.EndFlowBranching): Added.
6602         (EmitContext.KillFlowBranching): Added.
6603         (EmitContext.IsVariableAssigned): Added.
6604         (EmitContext.SetVariableAssigned): Added.
6605         (EmitContext.IsParameterAssigned): Added.
6606         (EmitContext.SetParameterAssigned): Added.
6607         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
6608         Added control flow analysis stuff here.
6609
6610         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
6611         resolve the expression as lvalue.
6612         (LocalVariableReference.DoResolve): Check whether the variable has
6613         already been assigned.
6614         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
6615         the parameter as assigned here.
6616         (ParameterReference.DoResolve): Check whether the parameter has already
6617         been assigned.
6618         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
6619         expression as lvalue.
6620
6621         * statement.cs (FlowBranching): New class for the flow analysis code.
6622         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
6623         (LabeledStatement.IsDefined): New public property.
6624         (LabeledStatement.AddUsageVector): New public method to tell flow
6625         analyis that the label may be reached via a forward jump.
6626         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
6627         flow analysis.
6628         (VariableInfo.Number): New public field.  This is used by flow analysis
6629         to number all locals of a block.
6630         (Block.CountVariables): New public property.  This is the number of
6631         local variables in this block (including the locals from all parent
6632         blocks).
6633         (Block.EmitMeta): Number all the variables.
6634
6635         * statement.cs: Added flow analysis support to all classes.
6636
6637 2002-07-31  Martin Baulig  <martin@gnome.org>
6638
6639         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
6640         To get debugging messages, compile mcs with /define:MCS_DEBUG and
6641         then use this argument.
6642
6643         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
6644
6645         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
6646         use this to specify /define options.
6647
6648 2002-07-29  Martin Baulig  <martin@gnome.org>
6649
6650         * statement.cs (Fixed): Moved all code that does variable lookups
6651         and resolvings from Emit to Resolve.
6652
6653         * statement.cs (For): Moved all code that does variable lookups
6654         and resolvings from Emit to Resolve.
6655
6656         * statement.cs (Using): Moved all code that does variable lookups
6657         and resolvings from Emit to Resolve.
6658
6659 2002-07-29  Martin Baulig  <martin@gnome.org>
6660
6661         * attribute.cs (Attribute.Resolve): Explicitly catch a
6662         System.NullReferenceException when creating the
6663         CustromAttributeBuilder and report a different warning message.
6664
6665 2002-07-29  Martin Baulig  <martin@gnome.org>
6666
6667         * support.cs (ParameterData.ParameterName): Added method to
6668         get the name of a parameter.
6669
6670         * typemanager.cs (TypeManager.IsValueType): New public method.
6671
6672 2002-07-29  Martin Baulig  <martin@gnome.org>
6673
6674         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
6675         is a flag which specifies that it's either ref or out.
6676         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
6677         the out parameter to `out Parameter.Modifier mod', also set the
6678         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
6679
6680         * support.cs (InternalParameters.ParameterModifier): Distinguish
6681         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
6682         Parameter.Modifier.ISBYREF flag if it's either ref or out.
6683
6684         * expression.cs (Argument.GetParameterModifier): Distinguish
6685         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
6686         Parameter.Modifier.ISBYREF flag if it's either ref or out.
6687
6688 2002-07-29  Martin Baulig  <martin@gnome.org>
6689
6690         * expression.cs (ParameterReference.ParameterReference): Added
6691         `Location loc' argument to the constructor.
6692
6693         * cs-parser.jay: Pass location to ParameterReference.
6694
6695 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
6696
6697         * statement.cs (Try): Initialize the location.
6698
6699         * cs-parser.jay: pass location to Try.
6700
6701         * expression.cs (Unary.Reduce): Change the prototype to return
6702         whether a constant fold could be performed or not.  The result is
6703         returned in an out parameters.  In the case of Indirection and
6704         AddressOf, we want to perform the full tests.
6705
6706 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
6707
6708         * statement.cs (Statement.Emit): Flag dead code.
6709
6710 2002-07-27  Andrew Birkett  <andy@nobugs.org>
6711
6712         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
6713
6714 2002-07-27  Martin Baulig  <martin@gnome.org>
6715
6716         * class.cs (MethodData.Define): Put back call to
6717         TypeManager.AddMethod(), accidentally commented this out.
6718
6719         * report.cs (Debug): New public method to print debugging information,
6720         this is `[Conditional ("DEBUG")]'.
6721
6722 2002-07-26  Martin Baulig  <martin@gnome.org>
6723
6724         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
6725         (switch_statement): Push the current_block to the switch_stack and
6726         pop it again when we're done with the switch.
6727         (switch_section): The new block is a child of the current_block.
6728         Fixes bug #24007, added test-152.cs.
6729
6730 2002-07-27  Martin Baulig  <martin@gnome.org>
6731
6732         * expression.cs (Invocation.EmitArguments): When calling a varargs
6733         function with only its fixed arguments, we need to pass an empty
6734         array.
6735
6736 2002-07-27  Martin Baulig  <martin@gnome.org>
6737
6738         Mono 0.13 has been released.
6739
6740 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
6741
6742         * driver.cs: Rename --resource to --linkres, because that is what
6743         we do currently, we dont support --resource yet.
6744
6745         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
6746
6747 2002-07-25  Martin Baulig  <martin@gnome.org>
6748
6749         * class.cs (MethodData): New public class.  This is a `method builder'
6750         class for a method or one accessor of a Property/Indexer/Event.
6751         (MethodData.GetMethodFlags): Moved here from MemberBase.
6752         (MethodData.ApplyAttributes): Likewise.
6753         (MethodData.ApplyObsoleteAttribute): Likewise.
6754         (MethodData.ApplyConditionalAttribute): Likewise.
6755         (MethodData.ApplyDllImportAttribute): Likewise.
6756         (MethodData.CheckAbstractAndExternal): Likewise.
6757         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
6758         (MethodData.Emit): Formerly known as Method.Emit().
6759         (MemberBase): Moved everything which was specific to a single
6760         accessor/method to MethodData.
6761         (Method): Create a new MethodData and call Define() and Emit() on it.
6762         (Property, Indexer, Event): Create a new MethodData objects for each
6763         accessor and call Define() and Emit() on them.
6764
6765 2002-07-25  Martin Baulig  <martin@gnome.org>
6766
6767         Made MethodCore derive from MemberBase to reuse the code from there.
6768         MemberBase now also checks for attributes.
6769
6770         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
6771         (MemberBase.GetMethodFlags): Moved here from class Method and marked
6772         as virtual.
6773         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
6774         `CallingConventions cc' and `Attributes opt_attrs' arguments.
6775         (MemberBase.ApplyAttributes): New virtual method; applies the
6776         attributes to a method or accessor.
6777         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
6778         (MemberBase.ApplyConditionalAttribute): Likewise.
6779         (MemberBase.ApplyDllImportAttribute): Likewise.
6780         (MemberBase.CheckAbstractAndExternal): Likewise.
6781         (MethodCore.ParameterTypes): This is now a property instead of a
6782         method, it's initialized from DoDefineParameters().
6783         (MethodCore.ParameterInfo): Removed the set accessor.
6784         (MethodCore.DoDefineParameters): New protected virtual method to
6785         initialize ParameterTypes and ParameterInfo.
6786         (Method.GetReturnType): We can now simply return the MemberType.
6787         (Method.GetMethodFlags): Override the MemberBase version and add
6788         the conditional flags.
6789         (Method.CheckBase): Moved some code from Define() here, call
6790         DoDefineParameters() here.
6791         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
6792         here to avoid some larger code duplication.
6793         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
6794         ensure that abstract and external accessors don't declare a body.
6795
6796         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
6797         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
6798         lookup in the attribute's parent classes, so we need to abort as soon
6799         as we found the first match.
6800         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
6801         the attribute has no arguments.
6802
6803         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
6804         of a Method.
6805
6806 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6807
6808         * cs-parser.jay: reverted previous patch.
6809
6810 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6811
6812         * cs-parser.jay: fixed bug #22119.
6813
6814 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6815
6816         * attribute.cs: fixed compilation. The error was:
6817         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
6818         be assigned to before control leaves the current method."
6819         [FIXME:  Filed as bug #28186: MCS must report this error.]
6820
6821 2002-07-25  Martin Baulig  <martin@gnome.org>
6822
6823         * attribute.cs (Attribute.Conditional_GetConditionName): New static
6824         method to pull the condition name ouf of a Conditional attribute.
6825         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
6826         the obsolete message and error flag out of an Obsolete attribute.
6827
6828         * class.cs (Method.GetMethodFlags): New public method to get the
6829         TypeManager.MethodFlags for this method.
6830         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
6831         private methods.
6832         (Method.Define): Get and apply the Obsolete and Conditional attributes;
6833         if we're overriding a virtual function, set the new private variable
6834         `parent_method'; call the new TypeManager.AddMethod().
6835
6836         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
6837         the MethodBuilder and the Method in a PtrHashtable.
6838         (TypeManager.builder_to_method): Added for this purpose.
6839         (TypeManager.MethodFlags): Added IsObsoleteError.
6840         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
6841         Obsolete and Conditional arguments in MethodBuilders.  If we discover
6842         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
6843         the message from the attribute.
6844
6845 2002-07-24  Martin Baulig  <martin@gnome.org>
6846
6847         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
6848         preprocessor directives, ensure that the argument to #define/#undef is
6849         exactly one identifier and that it's actually an identifier.
6850
6851         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
6852         did not work ....
6853
6854 2002-07-24  Martin Baulig  <martin@gnome.org>
6855
6856         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
6857         initialize it to TypeManager.object_type in the constructor.
6858         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
6859         of the `hm.get_current' method if we're using the collection pattern.
6860         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
6861         for the explicit conversion to make it work when we're using the collection
6862         pattern and the `Current' property has a different return type than `object'.
6863         Fixes #27713.
6864
6865 2002-07-24  Martin Baulig  <martin@gnome.org>
6866
6867         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
6868         does not match, but don't report any errors.  This method is called in
6869         order for all methods in a MethodGroupExpr until a matching method is
6870         found, so we don't want to bail out if the first method doesn't match.
6871         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
6872         matches, report the 123.  Fixes #28070.
6873
6874 2002-07-24  Martin Baulig  <martin@gnome.org>
6875
6876         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
6877         TypeManager.TypeToCoreType() to the top of the method so the
6878         following equality checks will work.  Fixes #28107.
6879
6880 2002-07-24  Martin Baulig  <martin@gnome.org>
6881
6882         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
6883         operand is of type uint, and the other operand is of type sbyte,
6884         short or int, the operands are converted to type long." -
6885         Actually do what this comment already told us.  Fixes bug #28106,
6886         added test-150.cs.
6887
6888 2002-07-24  Martin Baulig  <martin@gnome.org>
6889
6890         * class.cs (MethodBase): New abstract class.  This is now a base
6891         class for Property, Indexer and Event to avoid some code duplication
6892         in their Define() and DefineMethods() methods.
6893         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
6894         generic methods for Define() and DefineMethods().
6895         (FieldBase): Derive from MemberBase, not MemberCore.
6896         (Property): Derive from MemberBase, not MemberCore.
6897         (Property.DefineMethod): Moved all the code from this method to the
6898         new MethodBase.DefineAccessor(), just call it with appropriate
6899         argumetnts.
6900         (Property.Define): Call the new Property.DoDefine(), this does some
6901         sanity checks and we don't need to duplicate the code everywhere.
6902         (Event): Derive from MemberBase, not MemberCore.
6903         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
6904         accessors, this will also make them work with interface events.
6905         (Indexer): Derive from MemberBase, not MemberCore.
6906         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
6907         (Indexer.Define): Use the new MethodBase functions.
6908
6909         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
6910         argument to the constructor.
6911         (Interface.FindMembers): Added support for interface events.
6912         (Interface.PopluateEvent): Implemented.
6913
6914         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
6915
6916 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
6917
6918         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
6919         but this is required to check for a method name being the same as
6920         the containing class.  
6921
6922         Handle this now.
6923
6924 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6925
6926         * interface.cs: initialize variable.
6927
6928 2002-07-23  Martin Baulig  <martin@gnome.org>
6929
6930         Implemented the IndexerName attribute in interfaces.
6931
6932         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
6933         name if this is an explicit interface implementation.
6934         (Indexer.InterfaceIndexerName): New public variable.  If we're
6935         implementing an interface indexer, this is the IndexerName in that
6936         interface.  Otherwise, it's the IndexerName.
6937         (Indexer.DefineMethod): If we're implementing interface indexer,
6938         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
6939         and Pending.ImplementIndexer methods.
6940         (Indexer.Define): Also define the PropertyBuilder if we're
6941         implementing an interface indexer and this is neither an explicit
6942         interface implementation nor do the IndexerName match the one in
6943         the interface.
6944
6945         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
6946         If a method is defined here, then we always need to create a proxy
6947         for it.  This is used when implementing interface indexers.
6948         (Pending.IsInterfaceIndexer): New public method.
6949         (Pending.ImplementIndexer): New public method.
6950         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
6951         This is used when implementing interface indexers to define a proxy
6952         if necessary.
6953         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
6954         define a proxy if necessary.
6955
6956         * interface.cs (Interface.IndexerName): New public variable.
6957         (Interface.PopulateIndexer): Set the IndexerName.
6958         (Interface.DefineIndexers): New private method.  Populate all the
6959         indexers and make sure their IndexerNames match.
6960
6961         * typemanager.cs (IndexerPropertyName): Added support for interface
6962         indexers.
6963
6964 2002-07-22  Martin Baulig  <martin@gnome.org>
6965
6966         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
6967         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
6968         ret if HasReturnLabel.
6969         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
6970         variables.
6971
6972         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
6973         and set the ec.LoopBeginTryCatchLevel.
6974         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
6975         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
6976         the current ec.TryCatchLevel, the branch goes out of an exception
6977         block.  In this case, we need to use Leave and not Br.
6978
6979 2002-07-22  Martin Baulig  <martin@gnome.org>
6980
6981         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
6982         block unless the block does not always return or it is contained in
6983         another try { ... } catch { ... } block.  Fixes bug #26506.
6984         Added verify-1.cs to the test suite.
6985
6986 2002-07-22  Martin Baulig  <martin@gnome.org>
6987
6988         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
6989         then we do not always return.  Fixes bug #24985.
6990
6991 2002-07-22  Martin Baulig  <martin@gnome.org>
6992
6993         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
6994         lookup on a per-class level; ie. walk up the class hierarchy until we
6995         found at least one applicable method, then choose the best among them.
6996         Fixes bug #24463 and test-29.cs.
6997
6998 2002-07-22  Martin Baulig  <martin@gnome.org>
6999
7000         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
7001         return types of the methods.  The return type is not part of the
7002         signature and we must not check it to make the `new' modifier work.
7003         Fixes bug #27999, also added test-147.cs.
7004         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
7005
7006         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
7007         on the method's return type.
7008
7009 2002-07-21  Martin Baulig  <martin@gnome.org>
7010
7011         * assign.cs: Make this work if the rightmost source is a constant and
7012         we need to do an implicit type conversion.  Also adding a few more tests
7013         to test-38.cs which should have caught this.
7014
7015         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
7016         target in the makefile for this.  The makefile.gnu is primarily intended
7017         for end-users who don't want to debug the compiler.
7018
7019 2002-07-21  Martin Baulig  <martin@gnome.org>
7020
7021         * assign.cs: Improved the Assign class so it can now handle embedded
7022         assignments (X = Y = Z = something).  As a side-effect this'll now also
7023         consume less local variables.  test-38.cs now passes with MCS, added
7024         a few new test cases to that test.
7025
7026 2002-07-20  Martin Baulig  <martin@gnome.org>
7027
7028         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
7029         instructions.  Fixes bug #27977, also added test-146.cs.
7030
7031 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7032
7033         * cs-tokenizer.cs: fixed getHex ().
7034
7035 2002-07-19  Martin Baulig  <martin@gnome.org>
7036
7037         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
7038         not Type.GetType() to lookup the array type.  This is needed when
7039         we're constructing an array of a user-defined type.
7040         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
7041         single-dimensional arrays, but also for single-dimensial arrays of
7042         type decimal.
7043
7044 2002-07-19  Martin Baulig  <martin@gnome.org>
7045
7046         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
7047         this function is called, it's not allowed to share LocalBuilders
7048         among ILGenerators.
7049
7050 2002-07-19  Martin Baulig  <martin@gnome.org>
7051
7052         * expression.cs (Argument.Resolve): Report an error 118 when trying
7053         to pass a type as argument.
7054
7055 2002-07-18  Martin Baulig  <martin@gnome.org>
7056
7057         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
7058         Conv_R_Un for the signed `long' type.
7059
7060 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
7061
7062         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
7063         `expr' for the temporary result, as that will fail if we do
7064         multiple resolves on the same expression.
7065
7066 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
7067
7068         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
7069         ec.TypeContainer for looking up aliases. 
7070
7071         * class.cs (TypeContainer): Remove LookupAlias from here.
7072
7073         * decl.cs (DeclSpace); Move here.
7074
7075 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
7076
7077         * class.cs (FindMembers): Only call filter if the constructor
7078         bulider is not null.
7079
7080         Also handle delegates in `NestedTypes' now.  Now we will perform
7081         type lookups using the standard resolution process.  This also
7082         fixes a bug.
7083
7084         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
7085         This uses Expressions (the limited kind that can be parsed by the
7086         tree) instead of strings.
7087
7088         * expression.cs (ComposedCast.ToString): Implement, used to flag
7089         errors since now we have to render expressions.
7090
7091         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
7092         FormArrayType. 
7093
7094         * ecore.cs (SimpleName.ToString): ditto.
7095
7096         * cs-parser.jay: Instead of using strings to assemble types, use
7097         Expressions to assemble the type (using SimpleName, ComposedCast,
7098         MemberAccess).  This should fix the type lookups in declarations,
7099         because we were using a different code path for this.
7100
7101         * statement.cs (Block.Resolve): Continue processing statements
7102         even when there is an error.
7103
7104 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
7105
7106         * class.cs (Event.Define): Also remove the `remove' method from
7107         the list of pending items.
7108
7109         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
7110         generate more compact code. 
7111
7112 2002-07-17  Martin Baulig  <martin@gnome.org>
7113
7114         * const.cs (Const.LookupConstantValue): Add support for constant
7115         `unchecked' and `checked' expressions.
7116         Also adding test case test-140.cs for this.
7117
7118 2002-07-17  Martin Baulig  <martin@gnome.org>
7119
7120         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
7121         check whether mi.ReturnType implements the IEnumerator interface; the
7122         `==' and the IsAssignableFrom() will fail in this situation.
7123
7124 2002-07-16  Ravi Pratap  <ravi@ximian.com>
7125
7126         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
7127         here too.
7128
7129 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7130
7131         * expression.cs: fixed bug #27811.
7132
7133 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
7134
7135         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
7136         Molaro: when we are a ref, the value already contains a pointer
7137         value, do not take the address of it.
7138
7139 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
7140         * removed mb-parser.jay and mb-tokenizer.cs
7141
7142 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7143
7144         * expression.cs: check against the building corlib void type.
7145
7146 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
7147
7148         * ecore.cs: fix for valuetype static readonly fields: when 
7149         initializing them, we need their address, not the address of a copy.
7150
7151 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
7152
7153         * typemanager.cs: register also enum_type in corlib.
7154
7155 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7156
7157         * class.cs: allow calling this (but not base) initializers in structs.
7158
7159 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
7160
7161         * ecore.cs: make sure we compare against the building base types
7162         in GetTypeSize ().
7163
7164 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
7165
7166         * typemanager.cs: fix TypeToCoreType() to handle void and object
7167         (corlib gets no more typerefs after this change).
7168
7169 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
7170
7171         * expression.cs (ArrayCreation.EmitArrayArguments): use
7172         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
7173
7174         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
7175         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
7176         array indexes, the runtime actually forbids them.
7177
7178         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
7179         for array arguments here.
7180
7181         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
7182         instead of the default for ValueTypes.
7183
7184         (New.DoEmit): Use IsValueType instead of
7185         IsSubclassOf (value_type)
7186         (New.DoResolve): ditto.
7187         (Invocation.EmitCall): ditto.
7188
7189         * assign.cs (Assign): ditto.
7190
7191         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
7192         Statements *are* currently doing part of their resolution during
7193         Emit.  
7194
7195         Expressions do always resolve during resolve, but statements are
7196         only required to propagate resolution to their children.
7197
7198 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
7199
7200         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
7201
7202         (LoadAssembly): Do not add the dll if it is already specified
7203         
7204         (MainDriver): Add the System directory to the link path at the end,
7205         after all the other -L arguments. 
7206
7207         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
7208         wrong opcode for loading bytes and bools (ldelem.i1 instead of
7209         ldelem.u1) and using the opposite for sbytes.
7210
7211         This fixes Digger, and we can finally run it.
7212
7213         * driver.cs (UnixParseOption): Move the option parsing here.  
7214         (CSCParseOption): Implement CSC-like parsing of options.
7215
7216         We now support both modes of operation, the old Unix way, and the
7217         new CSC-like way.  This should help those who wanted to make cross
7218         platform makefiles.
7219
7220         The only thing broken is that /r:, /reference: and /lib: are not
7221         implemented, because I want to make those have the same semantics
7222         as the CSC compiler has, and kill once and for all the confussion
7223         around this.   Will be doing this tomorrow.
7224
7225         * statement.cs (Unsafe.Resolve): The state is checked during
7226         resolve, not emit, so we have to set the flags for IsUnsfe here.
7227
7228 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
7229
7230         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
7231         not catch the Error_ObjectRefRequired in SimpleName (as it is
7232         possible to have a class/instance variable name that later gets
7233         deambiguated), we have to check this here.      
7234
7235 2002-07-10  Ravi Pratap  <ravi@ximian.com>
7236
7237         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
7238         make static and put into Expression.
7239
7240         (Event.Define): Register the private field of the event with the 
7241         TypeManager so that GetFieldFromEvent can get at it.
7242
7243         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
7244         keep track of the private field associated with an event which
7245         has no accessors.
7246
7247         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
7248         private field.
7249
7250         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
7251         
7252 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
7253
7254         * expression.cs (Binary.EmitBranchable): this routine emits the
7255         Binary expression in a branchable context.  This basically means:
7256         we need to branch somewhere, not just get the value on the stack.
7257
7258         This works together with Statement.EmitBoolExpression.
7259
7260         * statement.cs (Statement.EmitBoolExpression): Use
7261         EmitBranchable. 
7262
7263 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
7264
7265         * statement.cs (For): Reduce the number of jumps in loops.
7266
7267         (For): Implement loop inversion for the For statement.
7268
7269         (Break): We can be breaking out of a Try/Catch controlled section
7270         (foreach might have an implicit try/catch clause), so we need to
7271         use Leave instead of Br.
7272
7273         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
7274         now).  If the instace expression supports IMemoryLocation, we use
7275         the AddressOf method from the IMemoryLocation to extract the
7276         address instead of emitting the instance.
7277
7278         This showed up with `This', as we were emitting the instance
7279         always (Emit) instead of the Address of This.  Particularly
7280         interesting when This is a value type, as we dont want the Emit
7281         effect (which was to load the object).
7282         
7283 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
7284
7285         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
7286
7287         * statement.cs (Checked): Set the CheckedState during the resolve
7288         process too, as the ConvCast operations track the checked state on
7289         the resolve process, and not emit.
7290
7291         * cs-parser.jay (namespace_member_declaration): Flag that we have
7292         found a declaration when we do.  This is used to flag error 1529
7293
7294         * driver.cs: Report ok when we display the help only.
7295
7296 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
7297
7298         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
7299
7300 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
7301
7302         * cs-tokenizer.cs (define): We also have to track locally the
7303         defines.  AllDefines is just used for the Conditional Attribute,
7304         but we also need the local defines for the current source code. 
7305
7306 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
7307
7308         * statement.cs (While, For, Do): These loops can exit through a
7309         Break statement, use this information to tell whether the
7310         statement is the last piece of code.
7311
7312         (Break): Flag that we break.
7313
7314         * codegen.cs (EmitContexts): New `Breaks' state variable.
7315
7316 2002-07-03  Martin Baulig  <martin@gnome.org>
7317
7318         * class.cs (TypeContainer.MethodModifiersValid): Allow override
7319         modifiers in method declarations in structs.  Otherwise, you won't
7320         be able to override things like Object.Equals().
7321
7322 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
7323
7324         * class.cs (Method, Property, Indexer): Do not allow the public
7325         modifier to be used in explicit interface implementations.
7326
7327         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
7328         override modifiers in method declarations in structs
7329
7330 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
7331
7332         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
7333         integer or real overflow, report an error
7334
7335 2002-07-02  Martin Baulig  <martin@gnome.org>
7336
7337         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
7338         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
7339         to tell the runtime about our newly created System.Object and
7340         System.ValueType types.
7341
7342 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
7343
7344         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
7345         struct instead of Ldarg/Starg.
7346
7347 2002-07-02  Martin Baulig  <martin@gnome.org>
7348
7349         * expression.cs (Indirection.Indirection): Call
7350         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
7351
7352 2002-07-02  Martin Baulig  <martin@gnome.org>
7353
7354         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
7355         ValueType, call TypeManager.TypeToCoreType() on it.
7356         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
7357         the OpCodes.Newarr argument.
7358
7359 2002-07-02  Martin Baulig  <martin@gnome.org>
7360
7361         * expression.cs (Invocation.EmitCall): When compiling corlib,
7362         replace all calls to the system's System.Array type to calls to
7363         the newly created one.
7364
7365         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
7366         System.Array methods.
7367         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
7368         from the system's System.Array type which must be replaced.
7369
7370 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
7371
7372         * typemanager.cs: load unverifiable_code_ctor so we can build
7373         corlib using the correct type. Avoid using GetTypeCode() with
7374         TypeBuilders.
7375         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
7376         TypeManager.object_type to allow building corlib.
7377
7378 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
7379
7380         * ecore.cs: handle System.Enum separately in LoadFromPtr().
7381
7382 2002-07-01  Martin Baulig  <martin@gnome.org>
7383
7384         * class.cs: Make the last change actually work, we need to check
7385         whether `ifaces != null' to avoid a crash.
7386
7387 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7388
7389         * class.cs: when we build structs without fields that implement
7390         interfaces, we need to add the interfaces separately, since there is
7391         no API to both set the size and add the interfaces at type creation
7392         time.
7393
7394 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7395
7396         * expression.cs: the dimension arguments to the array constructors
7397         need to be converted if they are a long.
7398
7399 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
7400
7401         * class.cs: don't emit ldarg.0 if there is no parent constructor
7402         (fixes showstopper for corlib).
7403
7404 2002-06-29  Martin Baulig  <martin@gnome.org>
7405
7406         MCS now compiles corlib on GNU/Linux :-)
7407
7408         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
7409         ie. check for MethodImplOptions.InternalCall.
7410
7411         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
7412         and TypeManager.attribute_type are null, so we must explicitly check
7413         whether parent is not null to find out whether it's an attribute type.
7414         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
7415         and SetBuilder, not only if the property is neither abstract nor external.
7416         This is necessary to set the MethodImplOptions on the accessor methods.
7417         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
7418         SetBuilder, see Property.Emit().
7419
7420         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
7421         populate "System.Object", "System.ValueType" and "System.Attribute" since
7422         they've already been populated from BootCorlib_PopulateCoreTypes().
7423
7424 2002-06-29  Martin Baulig  <martin@gnome.org>
7425
7426         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
7427         is the NullLiteral, we also need to make sure that target_type is not
7428         an enum type.   
7429
7430 2002-06-29  Martin Baulig  <martin@gnome.org>
7431
7432         * rootcontext.cs (RootContext.ResolveCore): We must initialize
7433         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
7434         before calling BootstrapCorlib_ResolveDelegate ().
7435
7436 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7437
7438         * statement.cs: fixed build-breaker. All tests passed ok.
7439
7440 2002-06-27  Martin Baulig  <martin@gnome.org>
7441
7442         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
7443         for System.Decimal when compiling corlib.
7444
7445 2002-06-27  Martin Baulig  <martin@gnome.org>
7446
7447         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
7448         switch blocks which contain nothing but a default clause.
7449
7450 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
7451
7452        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
7453
7454 2002-06-27  Martin Baulig  <martin@gnome.org>
7455
7456         * ecore.cs (PropertyExpr.PropertyExpr): Call
7457         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
7458
7459         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
7460         is already a TypeBuilder.
7461
7462 2002-06-27  Martin Baulig  <martin@gnome.org>
7463
7464         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
7465         `target_type == TypeManager.array_type', not IsAssignableFrom() in
7466         the "from an array-type to System.Array" case.  This makes it work
7467         when compiling corlib.
7468
7469 2002-06-27  Martin Baulig  <martin@gnome.org>
7470
7471         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
7472         non-static PropertyExpr, set its InstanceExpression.  This makes
7473         the `ICollection.Count' property work in System/Array.cs.
7474
7475 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
7476
7477         * driver.cs: Made error handling more consistent.  Errors now
7478         tracked by Report class, so many methods which used to return int
7479         now return void.  Main() now prints success/failure and 
7480         errors/warnings message.
7481
7482         Renamed '--probe' compiler argument to '--expect-error'.  Removed
7483         the magic number return values (123 and 124).  Now, if the
7484         expected error occurs, the compiler exits with success (exit value
7485         0).  If the compilation completes without seeing that particular
7486         error, the compiler exits with failure (exit value 1).  The
7487         makefile in mcs/errors has been changed to handle the new behaviour.
7488
7489         * report.cs: Made 'expected error' number a property and renamed
7490         it from 'Probe' to 'ExpectedError'.
7491
7492         * genericparser.cs: Removed error handling support, since it is
7493         now all done by Report class.
7494
7495         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
7496         class, so parse() no longer returns an int.
7497
7498         * namespace.cs: Use Report.Error instead of GenericParser.error
7499
7500 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
7501
7502         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
7503         TypeContainer.AddOperator): At the front of the list put the
7504         explicit implementations, so they get resolved/defined first. 
7505
7506 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
7507
7508         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
7509         interface type is implemented by this TypeContainer.  Used during
7510         explicit interface implementation.
7511
7512         (Property.Define, Indexer.Define, Method.Define): Validate that
7513         the given interface in the explicit implementation is one of the
7514         base classes for the containing type.
7515
7516         Also if we are explicitly implementing an interface, but there is
7517         no match in the pending implementation table, report an error.
7518
7519         (Property.Define): Only define the property if we are
7520         not explicitly implementing a property from an interface.  Use the
7521         correct name also for those properties (the same CSC uses,
7522         although that is really not needed).
7523         
7524         (Property.Emit): Do not emit attributes for explicitly implemented
7525         properties, as there is no TypeBuilder.
7526
7527         (Indexer.Emit): ditto.
7528
7529         Hiding then means that we do not really *implement* a pending
7530         implementation, which makes code fail.
7531
7532 2002-06-22  Martin Baulig  <martin@gnome.org>
7533
7534         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
7535         the return value of Object.GetType().  [FIXME: we need to do this whenever
7536         we get a type back from the reflection library].
7537
7538 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
7539
7540         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
7541
7542 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
7543
7544         * attribute.cs: Return null if we can not look up the type.
7545
7546         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
7547         the interface types found.
7548
7549         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
7550         interface types found.
7551
7552         * typemanager.cs (GetInterfaces): Make this routine returns alll
7553         the interfaces and work around the lame differences between
7554         System.Type and System.Reflection.Emit.TypeBuilder in the results
7555         result for GetInterfaces.
7556         
7557         (ExpandInterfaces): Given an array of interface types, expand and
7558         eliminate repeated ocurrences of an interface.  This expands in
7559         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
7560         be IA, IB, IC.
7561         
7562 2002-06-21  Martin Baulig  <martin@gnome.org>
7563
7564         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
7565         on System.Enum.
7566
7567 2002-06-21  Martin Baulig  <martin@gnome.org>
7568
7569         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
7570         and called with one of the core types, return the corresponding typebuilder for
7571         that type.
7572
7573         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
7574         element type.
7575
7576 2002-06-21  Martin Baulig  <martin@gnome.org>
7577
7578         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
7579         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
7580         (Expression.ConvertReferenceExplicit): Likewise.
7581
7582         * expression.cs (ElementAccess.DoResolve): Likewise.
7583         (ElementAccess.DoResolveLValue): Likewise.
7584
7585 2002-06-10  Martin Baulig  <martin@gnome.org>
7586
7587         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
7588         add the "value" parameter to the parameter list.
7589
7590         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
7591         to our caller.
7592
7593 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
7594
7595         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
7596         the argument to an int, uint, long or ulong, per the spec.  Also
7597         catch negative constants in array creation.
7598
7599 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
7600
7601         * class.cs: do not allow the same interface to appear twice in
7602         the definition list.
7603
7604 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
7605
7606         * ecore.cs: don't use ldlen with System.Array.
7607
7608 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
7609
7610         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
7611
7612 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
7613
7614         * modifiers.cs: produce correct field attributes for protected
7615         internal. Easy fix so miguel can work on ther harder stuff:-)
7616
7617 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
7618
7619         * pending.cs: New file.  Move the code from class.cs here.
7620         Support clearning the pending flag for all methods (when not doing
7621         explicit interface implementation).
7622
7623 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
7624
7625         * rootcontext.cs: added a couple more types needed to bootstrap.
7626
7627 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
7628
7629         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
7630         constructor in the type, instead of any constructor in the type
7631         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
7632         a bug in the Mono runtime when applying the params attribute). 
7633
7634 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
7635         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
7636
7637 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
7638
7639         * expression.cs (Unary.ResolveOperator): Use TypeManager
7640         to resolve the type.
7641         
7642 2002-06-13  Ravi Pratap  <ravi@ximian.com>
7643
7644         * cs-parser.jay (enum_member_declaration): Pass in the attributes
7645         attached.
7646
7647         * enum.cs (AddEnumMember): Add support to store the attributes associated 
7648         with each member too.
7649
7650         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
7651         field builders too - this takes care of the enum member case.
7652
7653 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
7654
7655         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
7656         address-of operator on both value types and pointers.
7657         
7658 2002-06-10  Martin Baulig  <martin@gnome.org>
7659
7660         * interface.cs (Interface.PopulateIndexer): Add the indexer's
7661         PropertyBuilder to the `property_builders' list.
7662
7663         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
7664         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
7665         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
7666         find any indexers which are inherited from an interface.
7667
7668 2002-06-09  Martin Baulig  <martin@gnome.org>
7669
7670         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
7671         the same type as the constant if necessary.  There's also a test-130.cs
7672         for this.
7673
7674         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
7675
7676         * typemanager.cs (TypeManager.ChangeType): Previously known as
7677         Enum.ChangeEnumType().
7678
7679 2002-06-09  Martin Baulig  <martin@gnome.org>
7680
7681         * expression.cs (Cast.TryReduce): Added support for consts.
7682
7683 2002-06-08  Ravi Pratap  <ravi@ximian.com>
7684
7685         * class.cs (Accessor): Hold attributes information so we can pass
7686         it along.
7687
7688         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
7689         Modify to pass in attributes attached to the methods.
7690
7691         (add_accessor_declaration, remove_accessor_declaration): Ditto.
7692
7693         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
7694         to handle the Accessor kind :-)
7695
7696         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
7697         
7698 2002-06-08  Martin Baulig  <martin@gnome.org>
7699
7700         * expression.cs (Unary.TryReduceNegative): Added support for
7701         ULongConstants.
7702
7703 2002-06-08  Martin Baulig  <martin@gnome.org>
7704
7705         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
7706         name can't be found in the `defined_names' - the caller will do a
7707         MemberLookup in this case and thus find methods in System.Enum
7708         such as Enum.IsDefined().
7709
7710 2002-06-08  Martin Baulig  <martin@gnome.org>
7711
7712         * enum.cs (Enum.ChangeEnumType): This is a custom version of
7713         Convert.ChangeType() which works with TypeBuilder created types.
7714         (Enum.LookupEnumValue, Enum.Define): Use it here.
7715
7716         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
7717         `TypeBuilder.BaseType != null' check.
7718         (TypeContainer.FindMembers): Only lookup parent members if we
7719         actually have a parent.
7720         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
7721         (ConstructorInitializer.Resolve): Likewise.
7722
7723         * interface.cs (Interface.FindMembers): Added
7724         `TypeBuilder.BaseType != null' check.
7725
7726         * rootcontext.cs (RootContext.ResolveCore): Added
7727         "System.Runtime.CompilerServices.IndexerNameAttribute" to
7728         classes_second_stage.
7729
7730         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
7731         debug_type and trace_type when compiling with --nostdlib.       
7732
7733 2002-06-07  Martin Baulig  <martin@gnome.org>
7734
7735         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
7736         (AddField): Set it to true when adding a non-static field.
7737         (DefineType): Use `have_nonstatic_fields' to find out whether we
7738         have non-static fields, not `Fields != null'.
7739
7740 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
7741
7742         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
7743         dereferencing a null on the static-field code path)
7744
7745 2002-05-30  Martin Baulig  <martin@gnome.org>
7746
7747         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
7748         to take command line arguments.  Use reflection to call the new
7749         custom `Initialize' function on the symbol writer and pass it the
7750         command line arguments.
7751
7752         * driver.cs (--debug-args): New command line argument to pass command
7753         line arguments to the symbol writer.
7754
7755 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
7756
7757         * assign.cs (DoResolve): Forgot to do the implicit conversion to
7758         the target type for indexers and properties.  Thanks to Joe for
7759         catching this.
7760
7761 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
7762
7763         * typemanager.cs (MethodFlags): returns the method flags
7764         (Obsolete/ShouldIgnore) that control warning emission and whether
7765         the invocation should be made, or ignored. 
7766
7767         * expression.cs (Invocation.Emit): Remove previous hack, we should
7768         not do this on matching a base type, we should do this based on an attribute
7769
7770         Only emit calls to System.Diagnostics.Debug and
7771         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
7772         on the command line.
7773
7774         * rootcontext.cs: Global settings for tracing and debugging.
7775
7776         * cs-tokenizer.cs (define): New utility function to track
7777         defines.   Set the global settings for TRACE and DEBUG if found.
7778
7779 2002-05-25  Ravi Pratap  <ravi@ximian.com>
7780
7781         * interface.cs (Populate*): Pass in the TypeContainer as well as
7782         the DeclSpace as parameters so that we can create EmitContexts and
7783         then use that to apply attributes etc.
7784
7785         (PopulateMethod, PopulateEvent, PopulateProperty)
7786         (PopulateIndexer): Apply attributes everywhere.
7787
7788         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
7789         etc.
7790
7791         (ApplyAttributes): Update accordingly.
7792
7793         We now apply interface attributes for all members too.
7794
7795 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
7796
7797         * class.cs (Indexer.Define); Correctly check if we are explicit
7798         implementation (instead of checking the Name for a ".", we
7799         directly look up if the InterfaceType was specified).
7800
7801         Delay the creation of the PropertyBuilder.
7802
7803         Only create the PropertyBuilder if we are not an explicit
7804         interface implementation.   This means that explicit interface
7805         implementation members do not participate in regular function
7806         lookups, and hence fixes another major ambiguity problem in
7807         overload resolution (that was the visible effect).
7808
7809         (DefineMethod): Return whether we are doing an interface
7810         implementation. 
7811         
7812         * typemanager.cs: Temporary hack until we get attributes in
7813         interfaces (Ravi is working on that) and we get IndexerName
7814         support in interfaces.
7815
7816         * interface.cs: Register the indexers as properties.
7817
7818         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
7819         warning, I have verified that this is a bug in the .NET runtime
7820         (JavaScript suffers of the same problem).
7821
7822         * typemanager.cs (MemberLookup): When looking up members for
7823         interfaces, the parent of an interface is the implicit
7824         System.Object (so we succeed in searches of Object methods in an
7825         interface method invocation.  Example:  IEnumerable x;  x.ToString
7826         ()) 
7827
7828 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
7829
7830         * class.cs (Event): Events should also register if they do
7831         implement the methods that an interface requires.
7832
7833         * typemanager.cs (MemberLookup); use the new GetInterfaces
7834         method. 
7835
7836         (GetInterfaces): The code used to lookup interfaces for a type is
7837         used in more than one place, factor it here. 
7838
7839         * driver.cs: Track the errors at the bottom of the file, we kept
7840         on going.
7841
7842         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
7843         instance if the method we are calling is static!
7844
7845 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
7846
7847         * attribute.cs (ApplyAttributes): Make this function filter out
7848         the IndexerName attribute (as that attribute in reality is never
7849         applied) and return the string constant for the IndexerName
7850         attribute. 
7851
7852         * class.cs (TypeContainer.Emit): Validate that all the indexers
7853         have the same IndexerName attribute, and if so, set the
7854         DefaultName attribute on the class. 
7855
7856         * typemanager.cs: The return value might contain other stuff (not
7857         only methods).  For instance, consider a method with an "Item"
7858         property and an Item method.
7859
7860         * class.cs: If there is a problem with the parameter types,
7861         return. 
7862
7863 2002-05-24  Ravi Pratap  <ravi@ximian.com>
7864
7865         * ecore.cs (ImplicitConversionExists): Wrapper function which also
7866         looks at user defined conversion after making a call to 
7867         StandardConversionExists - we need this for overload resolution.
7868
7869         * expression.cs : Update accordingly the various method calls.
7870
7871         This fixes 2 bugs filed against implicit user defined conversions 
7872
7873 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
7874
7875         * statement.cs: Track the result of the assignment.
7876
7877 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
7878
7879         * expression.cs (MemberAccess): Improved error reporting for
7880         inaccessible members.
7881
7882 2002-05-22  Martin Baulig  <martin@gnome.org>
7883
7884         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
7885         itself with debugging support.
7886
7887 2002-05-22  Martin Baulig  <martin@gnome.org>
7888
7889         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
7890         Removed, this isn't needed anymore.
7891
7892 2002-05-20  Martin Baulig  <martin@gnome.org>
7893
7894         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
7895         be underlying type for an enum.
7896
7897 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
7898
7899         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
7900         that splits out the loading of just the core types.
7901
7902         * rootcontext.cs (ResolveCore): Split the struct resolution in
7903         two, so we can load the enumeration underlying types before any
7904         enums are used.
7905
7906         * expression.cs (Is): Bandaid until we fix properly Switch (see
7907         bug #24985 for details).
7908
7909         * typemanager.cs (ImplementsInterface): The hashtable will contain
7910         a null if there are no interfaces implemented.
7911
7912 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
7913
7914         * cs-parser.jay (indexer_declarator): It is fine to have array
7915         parameters
7916
7917 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
7918
7919         * typemanager.cs: (RegisterBuilder): New function used to register
7920         TypeBuilders that implement interfaces.  Since
7921         TypeBuilder.GetInterfaces (as usual) does not work with lame
7922         Reflection.Emit. 
7923         (AddUserType): register interfaces.
7924
7925         (ImplementsInterface): Use the builder_to_ifaces hash if we are
7926         dealing with TypeBuilder.  Also, arrays are showing up as
7927         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
7928         methods can not be invoked on them!
7929
7930         * ecore.cs (ExplicitReferenceConversionExists): Made public.
7931         (ImplicitReferenceConversionExists): Split out from
7932         StandardConversionExists. 
7933
7934         * expression.cs (As): We were only implementing one of the three
7935         cases for the as operator.  We now implement them all.
7936         (Is): Implement the various other cases for Is as well.
7937
7938         * typemanager.cs (CACHE): New define used to control if we want or
7939         not the FindMembers cache.  Seems to have a negative impact on
7940         performance currently
7941
7942         (MemberLookup): Nested types have full acess to
7943         enclosing type members
7944
7945         Remove code that coped with instance/static returns for events, we
7946         now catch this in RealFindMembers.
7947
7948         (RealFindMembers): only perform static lookup if the instance
7949         lookup did not return a type or an event.  
7950
7951 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
7952
7953         * assign.cs (CompoundAssign): We pass more semantic information
7954         now to Compound Assignments than we did before: now we have all
7955         the information at hand, and now we resolve the target *before* we
7956         do the expression expansion, which allows the "CacheValue" method
7957         to have the effect we intended (before, a [x] += 1 would generate
7958         two differen ArrayAccess expressions from the ElementAccess,
7959         during the resolution process).
7960
7961         (CompoundAssign.DoResolve): Resolve target and original_source here.
7962
7963 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
7964
7965         * expression.cs (ArrayAccess): dropped debugging information. 
7966
7967         * typemanager.cs: Small bug fix: I was always returning i_members,
7968         instead of one of i_members or s_members (depending on which had
7969         the content).
7970
7971         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
7972         method is invoked before any code generation takes place, and it
7973         is a mechanism to inform that the expression will be invoked more
7974         than once, and that the method should use temporary values to
7975         avoid having side effects
7976
7977         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
7978         
7979         * ecore.cs (Expression.CacheTemporaries): Provide empty default
7980         implementation.
7981
7982         * expression.cs (Indirection, ArrayAccess): Add support for
7983         CacheTemporaries in these two bad boys. 
7984
7985         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
7986         ldobj or ldind_ref.  
7987         (StoreFromPtr): Handle stobj as well.
7988
7989         * expression.cs (UnaryMutator): Share more code.
7990         
7991         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
7992         down: I was not tracking the Filter function as well, which
7993         was affecting the results of the cache.
7994
7995 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
7996
7997         * attribute.cs: Remove the hack to handle the CharSet property on
7998         StructLayouts. 
7999
8000 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
8001
8002         * attribute.cs (DoResolve): More uglyness, we now only try to
8003         resolve the attribute partially, to extract the CharSet
8004         information (only if we are a StructLayout attribute).  Otherwise 
8005
8006         (GetExtraTypeInfo): Add some code to conditionally kill in the
8007         future this.   I am more and more convinced that the .NET
8008         framework has special code to handle the attribute setting on
8009         certain elements.
8010
8011         * expression.cs (IsParamsMethodApplicable): Revert my previous
8012         foreach change here, it was wrong.
8013
8014 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
8015
8016         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
8017         (pp_expr): do not abort on unknown input, just return.
8018         (eval): abort if there are pending chars.
8019
8020         * attribute.cs (Attribute.Resolve): Positional parameters are
8021         optional.  Deal with that case.
8022
8023         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
8024         the Ansi/Unicode/Auto information for the type.
8025
8026         (TypeContainer.DefineType): instantiate the EmitContext here, as
8027         we will be using it during the type definition (to resolve
8028         attributes) and during the emit phase.
8029
8030         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
8031         to pull type information out of the attributes
8032
8033         (Attribute.Resolve): track the constructor builder, and allow for
8034         multiple invocations (structs and classes will use this).
8035
8036         * ecore.cs (MemberLookupFinal): new version with all the
8037         parameters customizable.
8038
8039         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
8040         constructors.  Return if the result value is null (as the error
8041         would have been flagged already by MemberLookupFinal)
8042
8043         Do not allow instances of abstract classes or interfaces to be
8044         created.
8045         
8046         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
8047         We have to compare the assembly property here when dealing with
8048         FamANDAssem and Assembly access modifiers, because we might be
8049         creating an assembly from *modules* (that means that we are not
8050         getting TypeBuilders for types defined in other modules that are
8051         part of this assembly).
8052
8053         (Method.Emit): If the method is marked abstract and has a body,
8054         emit an error. 
8055
8056         (TypeContainer.DefineMembers): If both the defined member and the
8057         parent name match are methods, then do not emit any warnings: let
8058         the Method.Define routine take care of flagging warnings.  But if
8059         there is a mismatch (method overrides something else, or method is
8060         overriwritten by something, then emit warning).
8061
8062         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
8063         set to null, this means `do not check for the return type on the
8064         signature'. 
8065
8066         (Method.Define): set the return type for the method signature to
8067         null, so that we get methods with the same name and parameters and
8068         different return types.  This is used to flag warning 114 (you are
8069         hiding a method, and you probably want to use the new/override
8070         keywords instead).
8071
8072         * typemanager.cs (MemberLookup): Implemented proper access
8073         control, closing a long standing set of bug reports.  The problem
8074         was that the Framework only has two bits: Public and NonPublic,
8075         and NonPublic includes private and protected methods, but we need
8076         to enforce the FamANDAssem, FamOrAssem and Family. 
8077
8078 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
8079
8080         * statement.cs (GotoCase): Return true: Ammounts to giving up
8081         knowledge on whether we return or not, and letting the other case
8082         be responsible for it.
8083
8084 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
8085
8086         * driver.cs: Do not load directories for each file processed, only
8087         do it if there is a pattern.
8088
8089         * ecore.cs: Report readonly assigns here as well, as we might have
8090         been resolved only by MemberAccess.
8091
8092         (SimpleName.SimpleNameResolve): Also be useful for LValue
8093         resolution.   We need this to propagate assign to local readonly variables
8094
8095         * typemanager.cs: Use a ptrhashtable for the criteria, because we
8096         do not want to reuse potential criteria memory.
8097
8098         * class.cs (MyEventBuilder): Set reflected_type;
8099
8100         * ecore.cs (Constantify): Added support for constifying bools.
8101
8102         (RootContext.LookupType): Added a cache for values looked up in
8103         the declaration space.
8104
8105         * typemanager.cs (FindMembers): Now is a front-end to
8106         RealFindMembers, and provides a two-level hashtable-based cache to
8107         the request.  
8108
8109         15% performance improvement: from 22.5 to 19.2 seconds.
8110
8111         * expression.cs (IsParamsMethodApplicable): use foreach.
8112         (Invocation.DoResolve): ditto.
8113         (New.DoResolve): ditto.
8114         (ArrayCreation.DoResolve): ditto.
8115
8116         * ecore.cs (FindMostEncompassingType): use foreach.
8117
8118         * delegate.cs (NewDelegate.DoResolve): Use foreach
8119
8120         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
8121         (RemoveMethods): use foreach.
8122
8123         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
8124         nested foreach statements instead of for, and also break out of
8125         the inner loop once a match is found.
8126         
8127         (Invocation.OverloadResolve): Use foreach, simplify the code. 
8128
8129 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
8130
8131         * cfold.cs (BinaryFold): During an enumeration evaluation context,
8132         we actually unwrap the expression to allow for extra information
8133         to be extracted. 
8134
8135         * expression.cs: Use Shr_Un on unsigned operations. 
8136
8137 2002-05-08  Ravi Pratap  <ravi@ximian.com>
8138
8139         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
8140         applicable operators was not being considered correctly. This closes
8141         the bug Miguel reported.
8142
8143 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
8144
8145         * attribute.cs: check that the type derives from System.Attribute
8146         and report the correct error in that case (moved the duplicate code to
8147         its own method, too).
8148
8149 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
8150
8151         * attribute.cs: lookup attribute type name as the spec says: first the
8152         bare attribute name and then name + "Attribute" (nant compiles with
8153         mcs after this fix).
8154
8155 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
8156
8157         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
8158         Because of the way we parse things, we should try to see if a
8159         UIntConstant can fit in an integer.
8160
8161 2002-05-07  Ravi Pratap  <ravi@ximian.com>
8162
8163         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
8164         when we are in an explicit context.
8165
8166         (ConvertReferenceExplicit): When converting from Iface type S to Class
8167         T make sure the rules are implemented as an OR.
8168
8169         * parameter.cs (ParameterType): Make it a property for now although the
8170         purpose really isn't anything immediate.
8171         
8172         * expression.cs (Is*Applicable): Do better checking on the parameter type
8173         of a ref/out parameter. The ones from the system assemblies are already 
8174         marked with the correct type so we don't need to do any correction.
8175
8176         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
8177         the object type is standard too so include that.
8178
8179 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8180
8181         * ecore.cs (StandardConversionExists): Augment with missing code:
8182         deal with IntConstant, LongConstants and Enumerations.
8183
8184         * assign.cs: Report the error, instead of failing silently
8185
8186         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
8187         typecontainer that they are declared, because the
8188         typecontainer/namespace will have the list of using clauses that
8189         need to be applied.
8190
8191         Assembly Attributes were escaping the normal registration
8192         mechanism. 
8193
8194         (EmitCode): Apply attributes within an EmitContext that represents
8195         the container they were declared on.
8196         
8197         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
8198
8199 2002-05-06  Ravi Pratap  <ravi@ximian.com>
8200
8201         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
8202         Revamp completely - make much cleaner as we now operate only
8203         on a set of Types.
8204
8205         (FindMostSpecificSource, FindMostSpecificTarget): New methods
8206         to implement the logic detailed in the spec more correctly.
8207
8208         (UserDefinedConversion): Update accordingly.
8209
8210 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8211
8212         * statement.cs: Return flow analysis information up.
8213
8214         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
8215         and the default.
8216
8217         (token): Do not consume an extra character before calling
8218         decimal_digits.
8219
8220 2002-05-06  Piers Haken <piersh@friskit.com>
8221
8222         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
8223
8224 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8225
8226         * class.cs (Constructor.Emit): Set the IsStatic flag in the
8227         EmitContext during the instance constructor initializer
8228         resolution, to stop access to instance variables.
8229
8230         This is mandated by the spec, last paragraph of the `constructor
8231         initializers' section. 
8232
8233 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
8234
8235         * cs-parser.jay, class.cs (Accessor): new class used to represent
8236         an accessor (get or set).  In the past we used `null' to represent
8237         a missing accessor.  But this is ambiguous because there was no
8238         way to tell in abstract indexers/properties if one of them was
8239         specified.
8240
8241         Now there is a way of addressing that.
8242
8243         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
8244         instead of FindMembers.
8245
8246         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
8247         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
8248
8249         * attribute.cs: Treat indexers and properties as the same in terms
8250         of applying attributes
8251
8252         * ecore.cs (FindMostEncompassedType): Use statically initialized
8253         EmptyExpressions()s like we do elsewhere to avoid creating useless
8254         objects (and we take this out of the tight loop).
8255
8256         (GetConversionOperators): Move the code to extract the actual
8257         operators to a separate routine to clean things up.
8258
8259 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
8260
8261         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
8262         events are always registered FieldBuilders.
8263         
8264         * class.cs (FieldBase): New class shared by Fields 
8265
8266         * delegate.cs: If we are a toplevel delegate, use our full name.
8267         If we are a nested delegate, then only use our tail name.
8268
8269 2002-05-02  Ravi Pratap  <ravi@ximian.com>
8270
8271         * expression.cs (IsApplicable): Ensure that we add the "&" to
8272         ref/out types before comparing it with the type of the argument.
8273
8274         (IsParamsMethodApplicable): Ditto.
8275
8276         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
8277         silly me ;-)
8278
8279         * delegate.cs : Handle the case when we have more than one applicable
8280         method. Flag an error only when we finish checking all.
8281
8282 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
8283
8284         * expression.cs: Add support for boolean static initializers.
8285
8286 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
8287
8288         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
8289
8290         * parameter.cs (ComputeParameterTypes,
8291         ComputeAndDefineParameterTypes): Better error handling: now we
8292         clear the `types' cache if we fail during any of the type lookups.
8293         We also return the status code correctly to our caller
8294
8295         * delegate.cs: If we fail to define a delegate, abort the extra
8296         steps. 
8297
8298         * expression.cs (Binary.ResolveOperator): for
8299         operator==(object,object) and operator !=(object, object) we also
8300         have to verify that there is an implicit conversion from one to
8301         the other.
8302
8303         (ArrayAccess.DoResolve): Array Access can operate on
8304         non-variables. 
8305
8306 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
8307
8308         * assign.cs (CompoundAssign): A new class used as a "flag" that
8309         the assignment actually is happening as part of a compound
8310         assignment operator.
8311
8312         During compound assignment, a few new rules exist to enable things
8313         like:
8314
8315         byte b |= 1 + 2
8316
8317         From the spec:
8318         
8319         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
8320         to the type of x) if y is implicitly convertible to the type of x,
8321         and the operator is a builtin operator and the return type of the
8322         operator is explicitly convertible to the type of x. 
8323
8324         * rootcontext.cs: Reset warning level to 2.  4 catches various
8325         "interesting" features in mcs, we must clean this up at some
8326         point, but currently am trying to kill other bugs ;-)
8327
8328         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
8329         in container classes as well.  
8330
8331         * expression.cs (Binary.ResolveOperator): Handle string case
8332         before anything else (as operator overloading does emit an error
8333         before doing anything else).
8334
8335         This code could go away when we move to a table driven model, but
8336         i could not come up with a good plan last night.
8337         
8338 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
8339
8340         * typemanager.cs (CSharpName): reimplementation using regex.
8341         * class.cs: added null check for fields in Emit
8342         * rootcontext.cs: set warninglevel to 4
8343
8344 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
8345
8346         * typemanager.cs (CSharpName): reimplemented with Lupus
8347         suggestion.
8348
8349 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
8350
8351         * statement.cs (If): correclty implement Resolve, because we were
8352         not catching sem errors in there.  The same process is needed
8353         everywhere else. 
8354         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
8355         
8356
8357         (Statement.Warning_DeadCodeFound): Factorize code.
8358         (While): Report dead code here too.
8359
8360         (Statement): Added Resolve virtual method to allow
8361         for resolution split from the emit code.
8362
8363 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
8364
8365         * statement.cs (EmitBoolExpression): No longer try to resolve the
8366         expression here.    
8367         (MakeBoolean): New utility function that resolve, implicitly
8368         converts to boolean and tags the expression. 
8369         
8370
8371         (If, Do): Implement dead code elimination.
8372         (While): Implement loop inversion
8373
8374         (Do, While, For, If): Resolve the expression prior to calling our
8375         code generation.
8376
8377 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
8378
8379         * class.cs:
8380           - added method Report28 (warning: program has more than one entry point)
8381           - added method IsEntryPoint, implements paragraph 10.1 of the spec
8382           - modified method Method.Define, the part at the end of the method
8383
8384         * rootcontext.cs: added static public Location EntryPointLocation;
8385           
8386         * ../errors/cs0028.cs : Add test case for the above warning.              
8387
8388         * typemanager.cs:
8389           - modified method CSharpName to allow arrays of primitive type to
8390             be printed nicely (e.g. instead of System.Int32[][] it now prints
8391             int[][])
8392           - added method CSharpSignature: returns the signature of a method
8393             in string format to be used in reporting errors, warnings, etc.
8394
8395         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
8396         with String.Empty.
8397         
8398 2002-04-26  Ravi Pratap  <ravi@ximian.com>
8399
8400         * delegate.cs (Define): Fix extremely silly bug where I was
8401         setting the type of the 'object' parameter of the BeginInvoke
8402         method to System.IAsyncResult instead of System.Object ;-)
8403
8404 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
8405
8406         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
8407         here. 
8408
8409         (Constructor.Emit): return if we fail to initialize the
8410         constructor.  Another door closed!  
8411
8412         * expression.cs (New.DoResolve): Improve error message (from -6 to
8413         1501).  Use DeclaredOnly lookup to find the exact constructor.
8414
8415         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
8416         loop.  This is useful.
8417
8418         * cs-parser.jay: Adjust the default parameters so that destructors
8419         have the proper signature.
8420
8421 2002-04-26  Martin Baulig  <martin@gnome.org>
8422
8423         * driver.cs (LoadAssembly): If `assembly' contains any characters
8424         which are only valid in path names and not in assembly names
8425         (currently slash, backslash and point), use Assembly.LoadFrom ()
8426         instead of Assembly.Load () on the `assembly' (before iteration
8427         over the link_paths).
8428
8429 2002-04-26  Martin Baulig  <martin@gnome.org>
8430
8431         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
8432
8433 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
8434
8435         * class.cs (Property): use the new typemanager.MemberLookup
8436
8437         (TypeContainer.MemberLookup): Implement using the
8438         TypeManager.MemberLookup now. 
8439         
8440         * typemanager.cs: Make MemberLookup a function of the TypeManager,
8441         and return MemberInfos, so that these can be used without an
8442         EmitContext (what we had before).
8443
8444 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
8445
8446         * expression.cs: Fix the case where the argument to params if the
8447         type of the params.  I omitted handling this before.   Fixed
8448
8449 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
8450
8451         * driver.cs: Call BootCorlib_PopulateCoreType
8452
8453         * class.cs (Property.CheckBase): Check for properties only, not
8454         for all members. 
8455
8456         * interface.cs: Temporary hack: try/catch around the
8457         CustomAttributeBuilder, because I am getting an exception that I
8458         do not understand.
8459
8460         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
8461         types whose definitions are required to be there (attributes are
8462         defined before standard types).
8463
8464         Compute definitions as we boot the various types, as they are used
8465         immediately (value_type class will need object_type, but if we do
8466         not initialize object_type, we will pass a null, which will let
8467         the runtime pick the System.Object from the existing corlib, which
8468         is not what we want).
8469
8470 2002-04-22  Patrik Torstensson <totte@labs2.com>
8471
8472         * cs-tokenizer.cs: fixed a number of trim() issues.
8473
8474 2002-04-22  Ravi Pratap  <ravi@ximian.com>
8475
8476         * expression.cs (Argument.Type): Ensure that we return the correct
8477         type when we have out or ref parameters [in which case we 
8478         append a "&"].
8479         
8480 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
8481
8482         * class.cs (Property, Indexer): Allow extern modifier in there. 
8483
8484         * typemanager.cs (InitBaseTypes): Initializes object_type and
8485         value_type, since those will be used early on during the bootstrap
8486         process to compile corlib.
8487
8488         (InitCoreTypes): Move code from here to InitBaseTypes.
8489
8490 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
8491
8492         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
8493         single-dimension arrays as using the ldlen opcode.  
8494
8495         Daniel Lewis discovered this optimization.  
8496
8497         * typemanager.cs: Add signature for System.Array::get_Length
8498
8499 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8500
8501         * statement.cs: report the error when the foreach does not apply to an
8502         array nor a collection.
8503
8504 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
8505
8506         * expression.cs: Add implicit conversions to the operator ~.
8507
8508         * constant.cs (DecimalConstant.Emit): Emit decimal value.
8509
8510         * typemanager.cs: Locate the decimal constructor.
8511
8512 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8513
8514         * attribute.cs: use the new property of TypeOf.
8515         * expression.cs: added 'get' property around typearg.
8516
8517         These changes fix a build breaker reported by NickD. Is this the
8518         correct way to fix?  If not, please, revert my changes and make it
8519         work :-).
8520
8521 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
8522
8523         * attribute.cs: Add support for typeof in attribute invocations.
8524         I am not sure that this is right though.
8525
8526 2002-04-14  Duncan Mak  <duncan@ximian.com>
8527
8528         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
8529         Binary.Operator.Division case.
8530
8531 2002-04-13  Ravi Pratap  <ravi@ximian.com>
8532
8533         * class.cs (DefineType): Ensure that we do a proper check on
8534         attribute types and also register it with the TypeManager.
8535
8536         (TypeContainer.Targets): The default for attribute types is
8537         AttributeTargets.All.
8538         
8539         * attribute.cs (ApplyAttributes): Registering the attribute type
8540         is done elsewhere, not when we discover we have a Usage attribute.
8541
8542 2002-04-12  Ravi Pratap  <ravi@ximian.com>
8543
8544         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
8545         and get rid of is_delegate parameter.
8546
8547         * everywhere : update.
8548         
8549 2002-04-12  Ravi Pratap  <ravi@ximian.com>
8550
8551         * cs-parser.jay (compilation_unit): Revamp completely to use
8552         some new ideas that I got from Rhys' grammar to solve the problems
8553         with assembly level attributes.
8554
8555         (outer_declaration): New grammar production.
8556
8557         (attribute_sections): Add.
8558
8559         (opt_attributes): Base on attribute_sections
8560
8561         (namespace_declaration): Allow opt_attributes to tackle the case
8562         when we have assembly level attributes - we are clever in this
8563         regard now ;-)
8564
8565         * attribute.cs (ApplyAttributes): Do not worry about assembly 
8566         attributes in the non-global context.
8567
8568         * rootcontext.cs (AddGlobalAttributes): Go back to using this
8569         instead of SetGlobalAttributes.
8570
8571         * class.cs, rootcontext.cs : Ensure we define and generate 
8572         attribute types before anything else.
8573
8574         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
8575         and flag the new error -20 for the case when the attribute type
8576         does not have valid targets specified. csc does not catch this.
8577
8578         * ../errors/errors.txt : update for error # -20
8579
8580 2002-04-11  Ravi Pratap  <ravi@ximian.com>
8581
8582         * support.cs (InternalParameters.ParameterModifier): Do some null
8583         checking and return sane values.
8584
8585         * class.cs (Method.Define): If we are a PInvoke method, ensure
8586         that we are static and extern. Report error # 601
8587
8588         * ../errors/cs0601.cs : Add test case for the above error.
8589
8590 2002-04-07  Ravi Pratap  <ravi@ximian.com>
8591
8592         * rootcontext.cs (attribute_types): We need to keep type of
8593         all attribute types separately and emit code for them first.
8594
8595         (RegisterAttribute) : Implement.
8596
8597         * class.cs (DefineType): Check if the current Type is a custom
8598         attribute type and register it accordingly.
8599
8600         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
8601         adding the first attribute twice and rename to
8602
8603         (SetGlobalAttributes): this.
8604
8605         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
8606         lookups.
8607
8608         * attribute.cs (ApplyAttributes): Take an additional argument telling us
8609         if we are processing global arguments. Hmm, I am unsure of this.
8610
8611 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8612
8613         * expression.cs: added static array of strings to avoid calling
8614         Enum.ToString () for Operator in Binary. Significant recover of
8615         performance.
8616
8617 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
8618
8619         * class.cs (FindMembers): Allow the Builders of the various
8620         members to be null.  If they are skip them.  This only happens
8621         during the PInvoke declaration.
8622
8623 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
8624
8625         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
8626         failure, so we do not keep going afterwards.
8627
8628         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
8629         wanted to pass `false' as the `is_delegate' argument.  If this is
8630         the case, why not use delegate_type == null to mean `is_delegate =
8631         false' and anything else as is_delegate = true.
8632
8633 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
8634
8635         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
8636         code for the section, not the beginning of the tests.
8637
8638 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
8639
8640         * cfold.cs: Handle operator + (Enum x, Underlying x) 
8641
8642         * expression.cs (Binary): same.  Warn about errors where we have
8643         Enum/Enum in operator + as well.
8644
8645 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
8646
8647         * statement.cs:
8648                 - added support for switch(bool)
8649                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
8650                 - add TableSwitchEmit() to handle table-based switch statements
8651
8652 2002-04-05  Ravi Pratap  <ravi@ximian.com>
8653
8654         * expression.cs (Invocation.OverloadResolve): Factor out code which
8655         does parameter compatibility checking with arguments so that we can 
8656         re-use the code even from Delegate.VerifyApplicability
8657
8658         (VerifyArgumentsCompat): Move above code here.
8659
8660         * delegate.cs (VerifyApplicability): Get rid of duplicate code
8661         and instead make a call to the above method.
8662
8663 2002-03-31  Ravi Pratap  <ravi@ximian.com>
8664
8665         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
8666         We use it to keep track of classes which are attribute types.
8667
8668 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
8669
8670         * delegate.cs (Delegate.Define): Correctly define the types in the
8671         presence of fixed and array parameters.
8672
8673         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
8674         doing FindMembers.
8675
8676         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
8677         include NonPublic after the first iteration.
8678
8679         * class.cs (Indexer.CheckBase): Only check if both parents are
8680         non-null. 
8681         
8682         * cs-parser.jay (accessor_body): If empty, set to null.
8683
8684         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
8685         same code path here to resolve constants names that we did have in
8686         MemberAccess.DoResolve.  There is too much code duplicated here.
8687
8688 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
8689
8690         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
8691
8692         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
8693         to MakeUnionSet.
8694
8695         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
8696         tokens, numbers and strings.
8697
8698         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
8699         parenthesis.
8700
8701         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
8702         asyncronous parameters and the regular parameters.  
8703
8704         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
8705         specify the target directory.
8706
8707         * expression.cs: (This.DoResolve): Simplify
8708         (As.Emit): Optimize, do not generate IsInst if the expression is
8709         always of the given type.
8710
8711         (Is.DoResolve): Bug fix, we were reporting both always/never for
8712         the is expression.
8713
8714         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
8715         creating too many unnecessary arrays.
8716
8717 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
8718
8719         * class.cs (EmitFieldInitializer): Use Assign expression to assign
8720         fields instead of rolling our own initializer.   Takes care of all
8721         implicit conversions, and drops unnecessary static checks/argument.
8722
8723 2002-03-31  Dick Porter  <dick@ximian.com>
8724
8725         * driver.cs: use the GetDirectories() return values properly, and
8726         use "/" as path separator.
8727
8728 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
8729
8730         * expression.cs (Unary): Optimize - - expr into expr.
8731         (Binary): Optimize a + (-b) into a -b.
8732
8733         * codegen.cs (CodeGen): Made all methods static.
8734
8735 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
8736
8737         * rootcontext.cs: 
8738
8739         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
8740         TypeBuilder property.
8741
8742         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
8743         instead. 
8744
8745         * tree.cs: Removed the various RecordXXXX, and replaced with a
8746         single RecordDecl.  Removed all the accessor methods, and just
8747         left a single access point Type 
8748
8749         * enum.cs: Rename DefineEnum to DefineType.
8750
8751         * decl.cs: New abstract method `DefineType' used to unify the
8752         Defines for Enumerations, Interfaces, TypeContainers and
8753         Delegates.
8754
8755         (FindType): Moved LookupInterfaceOrClass here.  Moved the
8756         LookupBaseClasses method that used to live in class.cs and
8757         interface.cs here, and renamed to FindType.
8758         
8759         * delegate.cs: Implement DefineType.  Take advantage of the
8760         refactored pattern for locating the parent builder without taking
8761         the parent_builder argument (which we know does not work if we are
8762         nested, and triggering a toplevel definition).
8763
8764 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
8765
8766         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
8767         accessibility of a member has changed during override and report
8768         an error if so.
8769
8770         * class.cs (Method.Define, Property.Define): Only complain on
8771         overrides if the method is private, any other accessibility is
8772         fine (and since we just checked the permission is the same, we are
8773         good to go).
8774
8775         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
8776         and elif are processed always.  The other pre-processing
8777         directives are only processed if we are "taking" the path
8778
8779 2002-03-29  Martin Baulig  <martin@gnome.org>
8780
8781         * class.cs (Method.Emit): Only emit symbolic debugging info if the
8782         current location is not Null.
8783
8784         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
8785         a separate method so we can profile it.
8786
8787         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
8788         `span.Seconds' are just seconds, but no minutes or hours.
8789         (MainDriver): Profile the CodeGen.SaveSymbols calls.
8790
8791 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
8792
8793         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
8794         Remove the gratuitous set of Final:
8795
8796                                 // If an interface implementation, then we can set Final.
8797                                 if (((flags & MethodAttributes.Abstract) == 0) &&
8798                                     implementing.DeclaringType.IsInterface)
8799                                         flags |= MethodAttributes.Final;
8800
8801         I do not know what I was smoking when I used that.
8802         
8803
8804         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
8805         step into fixing the name resolution issues for delegates and
8806         unifying the toplevel name resolution.
8807
8808 2002-03-28  Martin Baulig  <martin@gnome.org>
8809
8810         * class.cs (Method.Emit): If we have a symbol writer, call its
8811         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
8812         tell it about the current method.
8813
8814         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
8815         writer that we're going to emit the first byte of IL code for a new
8816         statement (a new source line).
8817         (EmitContext.EmitTopBlock): If we have a symbol writer, call
8818         EmitContext.Mark() before emitting any code.
8819
8820         * location.cs (SymbolDocument): Return null when we're Null.
8821
8822         * statement.cs (Statement): Moved the `Location loc' variable here.
8823         (Statement.EmitBoolExpression): If we have a symbol writer, call
8824         ec.Mark() before emitting any code to tell it that we're at the
8825         beginning of a new statement.
8826         (StatementExpression): Added `Location' argument to the constructor.
8827         (Block): Added public readonly variable `StartLocation' and public
8828         variable `EndLocation'.  The latter is to be set using SetEndLocation().
8829         (Block): Added constructor which takes a start and end location.
8830         (Block.SetEndLocation): New method. This sets the end location.
8831         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
8832         local variables we create.
8833         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
8834         each statement and do also mark the begin and end of the block.
8835
8836         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
8837         tell it the current lexer.Location, use Location.Null for the end of the
8838         block.
8839         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
8840         current block, set its end location using SetEndLocation().
8841         (statement_expression): StatementExpression constructor now takes the
8842         lexer.Location as additional argument.
8843         (for_statement, declare_local_variables): Likewise.
8844         (declare_local_variables): When creating a new implicit block, use the
8845         new Block constructor and pass it the lexer.Location.
8846
8847 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
8848
8849         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
8850         members also on the parent interfaces recursively.
8851
8852 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
8853
8854         * report.cs: Use new formats, since Gonzalo finished the missing
8855         bits. 
8856
8857         * expression.cs (Binary.ResolveOperator): added missing operator|
8858         operator& and operator^ for bool/bool.
8859
8860         * cs-parser.jay: CheckDef now takes a Location argument that is
8861         used to report errors more precisly (instead of reporting the end
8862         of a definition, we try to track something which is a lot closer
8863         to the source of the problem).
8864
8865         * cs-tokenizer.cs: Track global token use, so we can properly flag
8866         the use of #define/#undef after the first token has been seen.
8867
8868         Also, rename the reportXXXX to Error_DescriptiveName
8869
8870         * decl.cs (DeclSpace.IsTopLevel): Move property here from
8871         TypeContainer, so that Enum and Interface can use this too.
8872
8873         * class.cs (TypeContainer.LookupInterfaceOrClass,
8874         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
8875         `builder' argument.  Typically this was used to pass the parent
8876         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
8877         the definition).  
8878
8879         The problem is that a nested class could trigger the definition of
8880         a toplevel class, and the builder would be obviously wrong in that
8881         case. 
8882
8883         So we drop this argument, and we compute dynamically the
8884         TypeBuilder/ModuleBuilder (the correct information was available
8885         to us anyways from DeclSpace.Parent)
8886
8887         * interface.cs (Interface.DefineInterface): Drop builder
8888         parameter cleanup like class.cs
8889
8890         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
8891         like class.cs
8892
8893         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
8894         values. 
8895
8896         (Try.Emit): Propagate the returns value from the statement.
8897
8898         (Return.Emit): Even if we are leavning 
8899
8900         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
8901
8902         * modifiers.cs: Fix the computation of MethodAttributes flags.
8903
8904 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
8905
8906         * driver.cs: allow compilation of files that start with '/'.
8907         Add a default case when checking the argument of --target.
8908
8909 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
8910
8911         * interface.cs: Implement the same search algorithm for types in
8912         the interface code.
8913
8914         * delegate.cs: Do not allow multiple definition.
8915
8916         * Recovered ChangeLog that got accidentally amputated
8917
8918         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
8919
8920         * rootcontext.cs: Load manually enum to allow core classes to
8921         contain enumerations.
8922
8923         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
8924         Update to new static methods in TypeManager.
8925
8926         * typemanager.cs (GetMethod, GetConstructor): Use our
8927         implementation of FindMembers to find the members, since during
8928         corlib compilation, the types are TypeBuilders and GetMethod and
8929         GetConstructor do not work.
8930
8931         Make all methods in TypeManager static.
8932
8933         (InitCodeHelpers): Split the functionality from
8934         the InitCodeTypes function.
8935
8936         * driver.cs: Call InitCodeHelpers after we have populated the
8937         types. 
8938
8939         * cs-parser.jay (delegate_declaration): we did not used to compute
8940         the delegate name correctly for void delegates.
8941
8942 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
8943
8944         * rootcontext.cs (RootContext): Init the interface_resolve_order
8945         and type_container_resolve_order always.
8946
8947         (ResolveCore, BootstrapCorlib_ResolveClass,
8948         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
8949         compiler when compiling with --nostdlib
8950
8951         * class.cs (TypeContainer.DefineType): Check that our parent is
8952         not null.  This test is most important when we are bootstraping
8953         the core types.
8954
8955         * codegen.cs: Split out the symbol writing code.
8956
8957 2002-03-25  Martin Baulig  <martin@gnome.org>
8958
8959         * driver.cs (-g): Made -g an alias for --debug.
8960
8961 2002-03-24  Martin Baulig  <martin@gnome.org>
8962
8963         * codegen.cs (SymbolWriter): New public variable. Returns the
8964         current symbol writer.
8965         (CodeGen): Added `bool want_debugging_support' argument to the
8966          constructor. If true, tell the ModuleBuild that we want debugging
8967         support and ask it for the ISymbolWriter.
8968         (Save): If we have a symbol writer, call it's Close() method after
8969         saving the assembly.
8970
8971         * driver.c (--debug): New command line argument to create a
8972         debugger information file.
8973
8974         * location.cs (SymbolDocument): New public property. Returns an
8975         ISymbolDocumentWriter object for the current source file or null
8976         if we don't have a symbol writer.
8977
8978 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
8979
8980         * driver.cs (LoadAssembly): Correctly return when all the paths
8981         have been tried and not before.
8982
8983         * statement.cs (Switch.Emit): return the actual coverage for this
8984         statement (returns/not-returns)
8985
8986         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
8987         switch of the statement if we are the last switch section.  That
8988         kills two problems: try/catch problems (we used to emit an empty
8989         nop at the end) and switch statements where all branches would
8990         return. 
8991
8992 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
8993
8994         * driver.cs: Add default assemblies (the equivalent to the
8995         Microsoft CSC.RSP file)
8996
8997         * cs-tokenizer.cs: When updating `cols and setting it to zero,
8998         also update tokens_seen and set it to false.
8999
9000         * driver.cs: Implement --recurse for Mike.
9001
9002         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
9003         correctly splitting out the paths.
9004
9005 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
9006
9007         * interface.cs (Interface.PopulateProperty): Instead of using
9008         `parent' as the declaration space for the set parameters, use
9009         `this' 
9010
9011         * support.cs (InternalParameters): InternalParameters constructor
9012         takes a DeclSpace instead of a TypeContainer.
9013
9014         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
9015         types are being initialized, load the address of it before calling
9016         the function.  
9017
9018         (New): Provide a mechanism to disable the generation of local
9019         value type temporaries when the caller will be providing us with
9020         an address to store it.
9021
9022         (ArrayCreation.EmitDynamicInitializers): Use it.
9023
9024 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
9025
9026         * expression.cs (Invocation.EmitArguments): Only probe for array
9027         property if there is more than one argument.  Sorry about that.
9028
9029         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
9030         empty param arrays.
9031         
9032         * class.cs (Method.LabelParameters): Fix incorrect code path that
9033         prevented the `ParamArrayAttribute' from being applied to the
9034         params attribute.
9035
9036 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
9037
9038         * support.cs (ReflectionParameters): Correctly compute whether the
9039         last argument is a params array.  Fixes the problem with
9040         string.Split ('a')
9041
9042         * typemanager.cs: Make the assemblies array always be non-null
9043         (empty, but non-null)
9044
9045         * tree.cs (RecordDecl): New function that abstracts the recording
9046         of names.  This reports error 101, and provides a pointer to the
9047         previous declaration.  Fixes a crash in the compiler.
9048
9049         * cs-parser.jay (constructor_declaration): Update to new grammar,
9050         and provide a constructor_body that can be empty.
9051
9052 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
9053
9054         * driver.cs: Add support for --resources.
9055
9056         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
9057         Make all types for the various array helper methods be integer.
9058
9059         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
9060         CheckState to ConvCast.
9061
9062         (ConvCast): Now it takes a `checked' state argument, to avoid
9063         depending on the emit context for the conversion, and just using
9064         the resolve time setting.
9065
9066         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
9067         instead of Invocation.EmitArguments.  We do not emit the original
9068         arguments, instead we emit those which have been converted to
9069         unsigned int expressions.
9070
9071         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
9072
9073         * codegen.cs: ditto.
9074
9075         * expression.cs (LocalVariableReference): Drop the use of the
9076         Store function that depended on the variable index.
9077
9078         * statement.cs (VariableInfo): Drop the `Idx' property from this
9079         class, as this is not taking into account the indexes for
9080         temporaries tat we generate during the execution, getting the
9081         indexes wrong.
9082
9083         * class.cs: First emit class initializers, then call the parent
9084         constructor. 
9085
9086         * expression.cs (Binary): Fix opcode emision.
9087         (UnaryMutator.EmitCode): Support checked code generation
9088
9089         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
9090         matches for events for both the Static and Instance scans,
9091         pointing to the same element.   Fix that.
9092
9093 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
9094
9095         * rootcontext.cs (ResolveTree): Always set the
9096         interface_resolve_order, because nested interfaces will be calling
9097         into us.
9098
9099         * class.cs (GetInterfaceOrClass): Track the same resolution
9100         process used by TypeManager.LookupType.  This fixes the nested
9101         type lookups in class declarations (separate path from
9102         LookupType). 
9103
9104         (TypeContainer.DefineType): Also define nested interfaces.
9105         (TypeContainer.RegisterOrder): New public function used to
9106         register the order in which child interfaces need to be closed.
9107
9108         Nested interfaces need to be closed after their parents have been
9109         created. 
9110         
9111         * interface.cs (InterfaceAttr): Put all the logic for computing
9112         the interface attribute here. 
9113
9114         (DefineInterface): Register our interface order with the
9115         RootContext or with the TypeContainer depending on the case.
9116
9117 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
9118
9119         * cs-parser.jay: rework foreach statement to work with the new
9120         changes to the policy on SimpleNames.
9121         
9122         * report.cs: support Stacktrace on warnings as well.
9123
9124         * makefile: drop --unsafe and /unsafe from the compile.
9125
9126 2002-03-13  Ravi Pratap  <ravi@ximian.com>
9127
9128         * ecore.cs (StandardConversionExists): Modify to take an Expression
9129         as the first parameter. Ensure we do null -> reference type conversion
9130         checking.
9131
9132         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
9133         temporary Expression objects.
9134
9135 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
9136
9137         * interface.cs: workaround bug in method overloading resolution
9138         (there is already a bugzilla bug for it).
9139
9140 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
9141
9142         We could also solve this problem by having a separate path for
9143         performing type lookups, instead of DoResolve, we could have a
9144         ResolveType entry point, and only participating pieces of the
9145         production (simplename, deref, array) would implement this. 
9146         
9147         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
9148         signal SimpleName to only resolve type names and not attempt to
9149         resolve anything else.
9150
9151         * expression.cs (Cast): Set the flag.
9152
9153         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
9154
9155         * class.cs: Only report 108 if there is no `new' modifier.
9156
9157         * cs-parser.jay: rework foreach statement to work with the new
9158         changes to the policy on SimpleNames.
9159         
9160         * report.cs: support Stacktrace on warnings as well.
9161
9162         * makefile: drop --unsafe and /unsafe from the compile.
9163
9164 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
9165
9166         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9167         lookups here, instead of doing that at parse time.  This means
9168         that our grammar will not introduce `LocalVariableReferences' as
9169         expressions at this point.  That solves the problem of code like
9170         this:
9171
9172         class X {
9173            static void Main ()
9174            { int X = 1;
9175             { X x = null }}}
9176
9177         This is only half the fix.  The full fix requires parameters to
9178         also be handled in this way.
9179
9180         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
9181         makes the use more obvious of the DeclSpace.  The
9182         ec.TypeContainer.TypeBuilder is now only used to pull the
9183         TypeBuilder for it.
9184
9185         My theory is that I can get rid of the TypeBuilder completely from
9186         the EmitContext, and have typecasts where it is used (from
9187         DeclSpace to where it matters).  
9188
9189         The only pending problem is that the code that implements Aliases
9190         is on TypeContainer, and probably should go in DeclSpace.
9191
9192         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9193         lookups here, instead of doing that at parse time.  This means
9194         that our grammar will not introduce `LocalVariableReferences' as
9195         expressions at this point.  That solves the problem of code like
9196         this:
9197
9198         class X {
9199            static void Main ()
9200            { int X = 1;
9201             { X x = null }}}
9202
9203         This is only half the fix.  The full fix requires parameters to
9204         also be handled in this way.
9205
9206         * class.cs (Property.DefineMethod): When implementing an interface
9207         method, set newslot, when implementing an abstract method, do not
9208         set the flag (before we tried never setting it, or always setting
9209         it, which is the difference).
9210         (Indexer.DefineMethod): same.
9211         (Method.DefineMethod): same.
9212
9213         * ecore.cs: Only set the status used flag if we get back a Field.
9214
9215         * attribute.cs: Temporary hack, so Paolo can keep working.
9216
9217 2002-03-08  Ravi Pratap  <ravi@ximian.com>
9218
9219         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
9220         the unmanaged type in the case we have a MarshalAs attribute.
9221
9222         (Resolve): Handle the case when we are parsing the special MarshalAs
9223         attribute [we need to store the unmanaged type to use later]
9224         
9225         * typemanager.cs (marshal_as_attr_type): Built in type for the 
9226         MarshalAs Attribute.
9227
9228         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
9229         on parameters and accordingly set the marshalling info.
9230         
9231 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
9232
9233         * class.cs: Optimizing slightly by removing redundant code after
9234         we switched to the `NoTypes' return value.
9235         (Property.DefineMethod): use NoTypes here too.
9236
9237         This fixes the bug I introduced in my last batch of changes.
9238
9239 2002-03-05  Ravi Pratap  <ravi@ximian.com>
9240
9241         * tree.cs (RecordEnum): Add. We now keep track of enums too.
9242
9243         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
9244         Enums since those are types too. 
9245
9246         * cs-parser.jay (enum_declaration): Record enums as we parse them.
9247         
9248         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
9249         thanks to a call during the lookup process.
9250
9251 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
9252
9253         * statement.cs (Foreach): Lots of work to accomodate a particular
9254         kind of foreach statement that I had not kept in mind.  It is
9255         possible to have foreachs on classes that provide a GetEnumerator
9256         method that return objects that implement the "pattern" for using
9257         a foreach, there is no need to support GetEnumerator
9258         specifically. 
9259
9260         This is needed to compile nant.
9261
9262         * decl.cs: Only report 114 if the member is not `Finalize' and if
9263         the warning level is at least 2.
9264
9265         * class.cs: Moved the compare function from Method to
9266         MethodSignature. 
9267
9268         (MethodSignature.InheritableMemberSignatureCompare): Add new
9269         filter function that is used to extract inheritable methods from a
9270         class. 
9271
9272         (Method.Define): Use the new `inheritable_method_signature_filter'
9273         delegate
9274
9275         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
9276         command. 
9277
9278 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
9279
9280         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
9281
9282         * cs-parser.jay: Add opt_semicolon to the interface declaration.
9283
9284         * expression.cs: Pass location information to
9285         ConvertImplicitStandard. 
9286
9287         * class.cs: Added debugging code to track return values from
9288         interfaces. 
9289
9290 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
9291
9292         * expression.cs (Is.DoResolve): If either side of the `is' is an
9293         interface, do not flag the warning.
9294
9295         * ecore.cs (ImplicitReferenceConversion): We need a separate test
9296         for interfaces
9297
9298         * report.cs: Allow for --fatal to be used with --probe.
9299         
9300         * typemanager.cs (NoTypes): Move the definition for the empty Type
9301         array here. 
9302
9303         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
9304         properties. 
9305         (TypeContainer.DefineProxy): New function used to proxy to parent
9306         implementations when implementing interfaces.
9307         (TypeContainer.ParentImplements): used to lookup if our parent
9308         implements a public function that is required by an interface.
9309         (TypeContainer.VerifyPendingMethods): Hook this up.
9310
9311         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
9312         `modules' and `assemblies' arraylists into arrays.  We only grow
9313         these are the very early start up of the program, so this improves
9314         the speedof LookupType (nicely measured).
9315
9316         * expression.cs (MakeByteBlob): Replaced unsafe code with
9317         BitConverter, as suggested by Paolo.
9318
9319         * cfold.cs (ConstantFold.Binary): Special case: perform constant
9320         folding of string concatenation, but if either side is a string,
9321         and the other is not, then return null, and let the runtime use
9322         the concatenation on the string plus the object (using
9323         `Object.ToString'). 
9324
9325 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
9326
9327         Constant Folding has been implemented now.
9328         
9329         * expression.cs (Unary.Reduce): Do not throw an exception, catch
9330         the error instead on types that are not supported in one's
9331         complement. 
9332
9333         * constant.cs (Constant and all children): New set of functions to
9334         perform implict and explicit conversions.
9335         
9336         * ecore.cs (EnumConstant): Implement the new functions to perform
9337         conversion by proxying to the child expression.
9338
9339         * codegen.cs: (ConstantCheckState): Constant evaluation has its
9340         own separate setting that can not be turned off from the command
9341         line using --unchecked or --checked and is only controlled using
9342         the checked/unchecked statements and expressions.  This setting is
9343         used by the constant folder to flag errors.
9344
9345         * expression.cs (CheckedExpr, UncheckedExpr): Set the
9346         ConstantCheckState as well.   
9347
9348         During Resolve, they also have to flag the state, because the
9349         constant folder runs completely in the Resolve phase.
9350
9351         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
9352         well.
9353
9354 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
9355
9356         * cfold.cs: New file, this file contains the constant folder.
9357         
9358         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
9359         argument to track whether we are using the resulting address to
9360         load or store a value and provide better error messages. 
9361
9362         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
9363         new AddressOf arguments.
9364
9365         * statement.cs (Foreach.EmitCollectionForeach): Update
9366
9367         * expression.cs (Argument.Emit): Call AddressOf with proper
9368         arguments to track usage.
9369
9370         (New.DoEmit): Call AddressOf with new arguments.
9371
9372         (Unary.Emit): Adjust AddressOf call.
9373
9374 2002-03-01  Ravi Pratap  <ravi@ximian.com>
9375
9376         * cs-parser.jay (member_access): Change the case for pre-defined types
9377         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
9378         this suggestion.
9379
9380         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
9381         a method body.
9382
9383         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
9384         essentially like methods and apply attributes like MethodImplOptions to them too.
9385
9386         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
9387         not being null.
9388
9389         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
9390         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
9391         is the DeclSpace.
9392
9393         * Update code everywhere accordingly.
9394
9395         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
9396
9397         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
9398
9399 2002-02-28  Ravi Pratap  <ravi@ximian.com>
9400
9401         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
9402         try performing lookups against those instead of jumping straight into using
9403         the 'using' clauses.
9404
9405         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
9406
9407         (LookupType): Perform lookups in implicit parents too.
9408
9409         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
9410         sequence as RootContext.LookupType. 
9411
9412         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
9413         the various cases of namespace lookups into this method.
9414
9415 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
9416
9417         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
9418         in positional arguments)
9419
9420         * class.cs (Operator): Update the AllowedModifiers to contain
9421         extern. 
9422
9423         * cs-parser.jay: Update operator declaration to allow for the
9424         operator body to be empty.
9425
9426         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
9427         values. 
9428
9429 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
9430
9431         * class.cs (Method.Emit): Label parameters.
9432
9433         * driver.cs: Return 1 or 0 as the program exit code.
9434
9435 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
9436
9437         * expression.cs: Special case the `null' object when trying to
9438         auto-compute the type, as anything can be explicitly converted to
9439         that. 
9440
9441         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
9442         spotting this Paolo.
9443
9444         (Expression.ImplicitNumericConversion): Perform comparissions of
9445         the type using the underlying type in the case of an enumeration
9446         rather than using the enumeration type for the compare.
9447
9448         Cope with the underlying == type case, which is not possible to
9449         catch before. 
9450
9451         (Expression.ConvertNumericExplicit): Perform comparissions of
9452         the type using the underlying type in the case of an enumeration
9453         rather than using the enumeration type for the compare.
9454
9455         * driver.cs: If the user does not supply an extension, assume .exe
9456
9457         * cs-parser.jay (if_statement): Rewrote so that we can track the
9458         location for the if statement.
9459
9460         * expression.cs (Binary.ConstantFold): Only concat strings when
9461         the operation is "+", not everything ;-)
9462
9463         * statement.cs (Statement.EmitBoolExpression): Take a location
9464         argument. 
9465         (If, While, Do): Track location.
9466
9467         * expression.cs (Binary.ResolveOperator): In the object + string
9468         case, I was missing a call to ConvertImplicit
9469
9470 2002-02-25  Ravi Pratap  <ravi@ximian.com>
9471
9472         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
9473         Location arguments. Ensure we use RootContext.LookupType to do our work
9474         and not try to do a direct Type.GetType and ModuleBuilder.GetType
9475
9476         * interface.cs (PopulateMethod): Handle the type of the parameter being
9477         null gracefully.
9478
9479         * expression.cs (Invocation.BetterFunction): Handle the case when we 
9480         have a params method with no fixed arguments and a call is made with no
9481         arguments.
9482
9483 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
9484
9485         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
9486         the verbatim-string-literal
9487
9488         * support.cs (InternalParameters.ParameterModifier): handle null
9489         fixed parameters.
9490         (InternalParameters.ParameterType): ditto.
9491
9492         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
9493         duplicating the name of the variable parameter.
9494         (GetParameterByName): Fix bug where we were not looking up array
9495         paramters if they were the only present (thanks Paolo!).
9496         (GetParameterInfo): We only have an empty set of types if both
9497         fixed and array are set to null.
9498         (GetParameterInfo-idx): Handle FixedParameter == null
9499
9500         * cs-parser.jay: Handle the case where there is no catch
9501         statements (missing null test).
9502
9503 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
9504
9505         * driver.cs (MainDriver): Be conservative on our command line
9506         handling.
9507
9508         Catch DirectoryNotFoundException when calling GetFiles.
9509         
9510         (SplitPathAndPattern): Used to split the input specification into
9511         a path and a pattern that we can feed to Directory.GetFiles.
9512
9513 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
9514
9515         * statement.cs (Fixed): Implement the last case of the Fixed
9516         statement (string handling).
9517
9518         * expression.cs (StringPtr): New class used to return a char * to
9519         a string;  Used by the Fixed statement.
9520
9521         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
9522
9523         * expression.cs (Binary.ResolveOperator): Remove redundant
9524         MemberLookup pn parent type.
9525         Optimize union call, we do not need a union if the types are the same.
9526         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
9527         type.
9528
9529         Specialize the use of MemberLookup everywhere, instead of using
9530         the default settings. 
9531
9532         (StackAlloc): Implement stackalloc keyword.
9533
9534         * cs-parser.jay: Add rule to parse stackalloc.
9535         
9536         * driver.cs: Handle /h, /help, /?
9537
9538         * expression.cs (MakeByteBlob): Removed the hacks we had in place
9539         before we supported unsafe code.
9540         
9541         * makefile: add --unsafe to the self compilation of mcs.
9542
9543 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
9544
9545         * expression.cs (PointerArithmetic): New class that is used to
9546         perform pointer arithmetic.
9547         (Binary.Resolve): Handle pointer arithmetic
9548         Handle pointer comparission.
9549         (ArrayPtr): Utility expression class that is used to take the
9550         address of an array.
9551
9552         (ElementAccess): Implement array access for pointers
9553         
9554         * statement.cs (Fixed): Implement fixed statement for arrays, we
9555         are missing one more case before we are done.
9556
9557         * expression.cs (Indirection): Implement EmitAssign and set the
9558         ExprClass to Variable.  This allows pointer dereferences to be
9559         treated as variables, and to have values assigned to them.
9560         
9561         * ecore.cs (Expression.StoreFromPtr): New utility function to
9562         store values dereferencing.
9563
9564 2002-02-20  Ravi Pratap  <ravi@ximian.com>
9565
9566         * expression.cs (Binary.ResolveOperator): Ensure that we are
9567         not trying to operate on a void type - this fixes the reported
9568         bug.
9569
9570         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
9571         the parent implementation is sealed.
9572
9573         * ../errors/cs0239.cs : Add.
9574
9575         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
9576
9577         * typemanager.cs (unverifiable_code_type): Corresponds to 
9578         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
9579         which have unsafe code in them.
9580
9581         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
9582         unsafe context.
9583
9584 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
9585
9586         * cs-tokenizer.cs: Add support for @"litreal strings"
9587
9588         Make tokenizer accept pre-processor directives
9589         on any column (remove the old C-like limitation). 
9590
9591         * rootcontext.cs (EmitCode): Emit any global attributes.
9592         (AddGlobalAttributes): Used to keep track of assembly attributes. 
9593
9594         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
9595
9596         * cs-parser.jay: Add support for global attributes.  
9597
9598 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
9599
9600         * expression.cs (Indirection): New helper class.  Unary will
9601         create Indirection classes to be able to implement the
9602         IMemoryLocation interface on it.
9603
9604 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
9605
9606         * cs-parser.jay (fixed_statement): reference the right statement.
9607
9608         * statement.cs (Fixed.Emit): Finish implementing the fixed
9609         statement for the &x case.
9610
9611 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
9612
9613         * class.cs (Property.Define, Method.Define): Remove newslot when
9614         `implementing'.  
9615
9616         * modifiers.cs: My use of NewSlot when `Abstract' was set was
9617         wrong.  NewSlot should only be used if the `new' keyword is present.
9618
9619         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
9620         locating our system dir.  Sorry about this.
9621
9622 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
9623
9624         * driver.cs (GetSystemDir): Compute correctly the location of our
9625         system assemblies.  I was using the compiler directory instead of
9626         the library directory.
9627
9628 2002-02-13  Ravi Pratap  <ravi@ximian.com>
9629
9630         * expression.cs (BetterFunction): Put back in what Miguel commented out
9631         since it is the correct fix. The problem is elsewhere ;-)
9632
9633         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
9634         parameters of the parms method are themselves compatible or not !
9635
9636         (StandardConversionExists): Fix very dangerous bug where we were forgetting
9637         to check that a class implements an interface before saying that an implicit
9638         conversion was allowed. Use ImplementsInterface to do the checking.
9639
9640 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
9641
9642         * class.cs (Method.Define): Track whether we are an explicit
9643         implementation or not.  And only call DefineMethodOverride if we
9644         are an explicit implementation.
9645
9646         (Property.DefineMethod): Ditto.
9647
9648 2002-02-11  Ravi Pratap  <ravi@ximian.com>
9649
9650         * expression.cs (BetterFunction): Catch hideous bug which was
9651          preventing us from detecting ambiguous calls due to implicit casts i.e
9652         cs0121.
9653
9654 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
9655
9656         * support.cs (Pair): Remove un-needed method.  I figured why I was
9657         getting the error in cs-parser.jay, the variable in a foreach loop
9658         is readonly, and the compiler does not really treat this as a variable.
9659
9660         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
9661         instead of EQUALS in grammar.  
9662
9663         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
9664
9665         * expression.cs (Unary.DoResolve): Check whether the argument is
9666         managed or not.
9667
9668 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
9669
9670         * support.cs: Api for Pair to set a value.  Despite the fact that
9671         the variables are public the MS C# compiler refuses to compile
9672         code that accesses the field if the variable is part of a foreach
9673         statement. 
9674
9675         * statement.cs (Fixed): Begin implementation of the fixed
9676         statement.
9677
9678         (Block.AddVariable): Return the VariableInfo on success and null
9679         on failure instead of true/false. 
9680
9681         * cs-parser.jay (foreach): Catch errors on variables already
9682         defined (we were ignoring this value before) and properly unwind
9683         the block hierarchy
9684
9685         (fixed_statement): grammar for the fixed statement.
9686
9687 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
9688
9689         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
9690         pointer types to be incretemented.
9691
9692         (SizeOf): Implement.
9693
9694         * cs-parser.jay (pointer_member_access): Implement
9695         expr->IDENTIFIER production.
9696
9697         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
9698         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
9699         on safe contexts.
9700
9701         (Unary): Implement indirection.
9702
9703         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
9704         use in non-unsafe context).
9705
9706         (SimpleName.DoResolve): Check for pointers in field access on safe
9707         contexts. 
9708
9709         (Expression.LoadFromPtr): Factor the load-indirect code in this
9710         function.  This was duplicated in UnboxCast and ParameterReference
9711
9712 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
9713
9714         * expression.cs (ComposedCast): report an error if a pointer cast
9715         is used in a safe region.
9716
9717         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
9718         pointer type casts in unsafe context.
9719
9720         * codegen.cs (EmitContext): Set up IsUnsafe.
9721
9722         * cs-parser.jay (non_expression_type): Add productions for pointer
9723         casts. 
9724
9725         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
9726         code.  We should not use force into static mode if the method is
9727         not virtual.  Fixes bug in MIS
9728
9729         * statement.cs (Do.Emit, While.Emit, For.Emit,
9730         Statement.EmitBoolExpression): Add support to Do and While to
9731         propagate infinite loop as `I do return' semantics.
9732
9733         Improve the For case to also test for boolean constants.
9734
9735         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
9736         to the list of attributes we can add.
9737
9738         Remove `EmitContext' argument.
9739
9740         * class.cs (Method.Define): Apply parameter attributes.
9741         (Constructor.Define): Apply parameter attributes.
9742         (MethodCore.LabelParameters): Move here the core of labeling
9743         parameters. 
9744
9745         * support.cs (ReflectionParameters.ParameterModifier,
9746         InternalParameters.ParameterModifier): Use IsByRef on the type and
9747         only return the OUT bit for these parameters instead of in/out/ref
9748         flags.
9749
9750         This is because I miss-understood things.  The ParameterInfo.IsIn
9751         and IsOut represent whether the parameter has the [In] and [Out]
9752         attributes set.  
9753
9754 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
9755
9756         * ecore.cs (FieldExpr.Emit): Release temporaries.
9757
9758         * assign.cs (LocalTemporary.Release): new function.
9759
9760         * codegen.cs (EmitContext.GetTemporaryStorage,
9761         EmitContext.FreeTemporaryStorage): Rework the way we deal with
9762         temporary storage.  Now we can "put back" localbuilders when we
9763         are done with them
9764
9765 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
9766
9767         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
9768         need to make a copy of the variable to generate verifiable code.
9769
9770 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
9771
9772         * driver.cs: Compute dynamically the system directory.
9773
9774         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
9775         Slower, but more generally useful.  Used by the abstract
9776         registering implementation. 
9777
9778         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
9779         the rules for the special rule on Type/instances.  First check if
9780         we have the same name, and if so, try that special static path
9781         rather than the instance path.
9782         
9783 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
9784
9785         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
9786         for, while and if.
9787
9788         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
9789         Enum, ValueType, Delegate or Array for non-corlib compiles.
9790
9791         * cs-tokenizer.cs: Catch long identifiers (645)
9792
9793         * typemanager.cs (IndexerPropetyName): Ravi never tested this
9794         piece of code.
9795
9796         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
9797         fix, we were returning too early, so we were not registering
9798         pending methods from abstract classes.
9799
9800         Do not register pending methods if the class is abstract.
9801
9802         * expression.cs (Conditional.DoResolve): Report circular implicit
9803         conversions when we neecd to compute it for conditional
9804         expressions. 
9805
9806         (Is.DoResolve): If the expression is always of the provided type,
9807         flag warning 183.  If the expression can not ever be of the
9808         provided type flag warning 184.
9809
9810         * class.cs: Catch 169 as well.
9811
9812         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
9813         read. 
9814
9815 2002-01-18  Nick Drochak  <ndrochak@gol.com>
9816
9817         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
9818
9819 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
9820
9821         * interface.cs: (PopulateMethod): Check for pointers being defined
9822         only if the unsafe context is active.
9823         (PopulateProperty): ditto.
9824         (PopulateIndexer): ditto.
9825
9826         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
9827         specified.  If pointers are present, make sure that they are
9828         present in an unsafe context.
9829         (Constructor, Constructor.Define): ditto.
9830         (Field, Field.Define): ditto.
9831         (Property, Property.Define): ditto.
9832         (Event, Event.Define): ditto.
9833
9834         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
9835         hashtable if there are classes or structs defined.
9836
9837         * expression.cs (LocalVariableReference.DoResolve): Simplify this
9838         code, as the constant resolution moved.
9839
9840         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
9841         the metadata, so we can flag error 133. 
9842
9843         * decl.cs (MemberCore.UnsafeOK): New function to test that a
9844         pointer is being declared in an unsafe context.
9845
9846 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
9847
9848         * modifiers.cs (Modifiers.Check): Require a Location argument.
9849         Report error 227 for Unsafe use.
9850
9851         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
9852
9853         * statement.cs (For.Emit): If the test is null, then report that
9854         we do `return', as we wont reach anything afterwards.
9855
9856         (Switch.SwitchGoverningType): Track the expression that matched
9857         the conversion.
9858
9859         * driver.cs: Allow negative numbers as an error code to flag.
9860
9861         * cs-parser.jay: Handle 1551.
9862
9863         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
9864
9865 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
9866
9867         * cs-parser.jay: Report 1518 (type declaration can only contain
9868         class, struct, interface, enum or delegate)
9869
9870         (switch_label): Report 1523 (keywords `case' or `default' must
9871         preced code)
9872
9873         (opt_switch_sections): Report 1522 (empty switch)
9874
9875         * driver.cs: Report 1515 (response file specified multiple times)
9876         Report 1516 (Source file specified multiple times).
9877
9878         * expression.cs (Argument.Resolve): Signal 1510
9879
9880         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
9881         access not allowed in static code)
9882
9883 2002-01-11  Ravi Pratap  <ravi@ximian.com>
9884
9885         * typemanager.cs (IsPointerType): Utility method which we are going
9886         to need a lot.
9887
9888         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
9889         the object type, so we take care of that.
9890
9891         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
9892         
9893         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
9894         added to non-params parameters :-)
9895
9896         * typemanager.cs (CSharpName): Include 'void' type too. 
9897
9898         (void_ptr_type): Include in the set of core types.
9899
9900         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
9901         duplicating code.
9902
9903         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
9904         an unsafe context.
9905
9906         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
9907         completely forgotten about it.
9908
9909 2002-01-10  Ravi Pratap  <ravi@ximian.com>
9910
9911         * cs-parser.jay (pointer_type): Add. This begins our implementation
9912         of parsing rules for unsafe code.
9913
9914         (unsafe_statement): Implement.
9915
9916         (embedded_statement): Modify to include the above.
9917
9918         * statement.cs (Unsafe): Implement new class for unsafe blocks.
9919
9920         * codegen.cs (EmitContext.InUnsafe): Add. This determines
9921         if the current context is an unsafe one.
9922
9923         * cs-parser.jay (local_variable_pointer_type): Since local variable types
9924         are handled differently, we need separate rules for them.
9925
9926         (local_variable_declaration): Update to use local_variable_pointer_type
9927         to allow variable declarations of unmanaged pointer types.
9928
9929         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
9930         in unsafe contexts.
9931
9932         * ../errors/cs0214.cs : Add.
9933
9934 2002-01-16  Nick Drochak  <ndrochak@gol.com>
9935
9936         * makefile: remove 'response' file when cleaning.
9937
9938 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
9939
9940         * cs-parser.jay: Report 1524.
9941
9942 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
9943
9944         * typemanager.cs (RegisterMethod): drop checking if we have
9945         registered this from here
9946
9947 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
9948
9949         * class.cs (Method.EmitDestructor): Implement calling our base
9950         destructor. 
9951
9952         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
9953         value of InFinally.
9954
9955         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
9956         this routine and will wrap the call in a try/catch block.  Deal
9957         with the case.
9958
9959 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
9960
9961         * ecore.cs (Expression.MemberLookup): instead of taking a
9962         parameter `same_type' that was used to tell whether we could
9963         access private members we compute our containing type from the
9964         EmitContext.
9965
9966         (FieldExpr): Added partial support for volatile fields.  This does
9967         not work for volatile fields exposed from assemblies, as I can not
9968         figure out how to extract the modreq from it.
9969
9970         Updated all the source files to use this.
9971
9972         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
9973         because it is referenced by MemberLookup very often. 
9974
9975 2002-01-09  Ravi Pratap  <ravi@ximian.com>
9976
9977         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
9978         TypeBuilder.GetCustomAttributes to retrieve what we need.
9979
9980         Get rid of redundant default_member_attr_type as this is the same as
9981         default_member_type which already exists.
9982
9983         * interface.cs, attribute.cs : Update accordingly.
9984         
9985 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
9986
9987         * typemanager.cs: Enable IndexerPropertyName again.  It does not
9988         work for TYpeBuilders though.  Ravi, can you please fix this?
9989
9990         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
9991
9992         * expression.cs (Argument.Emit): Handle the case of ref objects
9993         being passed to ref functions;  
9994
9995         (ParameterReference.EmitLoad): Loads the content of the pointer
9996         without dereferencing.
9997
9998 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
9999
10000         * cs-tokenizer.cs: Implemented the pre-processing expressions.
10001
10002 2002-01-08  Ravi Pratap  <ravi@ximian.com>
10003
10004         * class.cs (Indexer.DefineMethod): Incorporate the interface
10005         type in the name of the method if we are doing explicit interface
10006         implementation.
10007
10008         * expression.cs (ConversionExists): Remove as it is completely obsolete.
10009
10010         (BetterConversion): Fix extremely trivial bug where we were referring to
10011         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
10012         again !
10013
10014         * ../errors/bug16.cs : Add although we have fixed it.
10015
10016 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
10017
10018         * expression.cs (BaseIndexer): Begin implementation.
10019
10020         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
10021
10022         * cs-parser.jay (indexer_declarator): Use qualified_identifier
10023         production directly to remove a shift/reduce, and implement
10024         explicit interface implementation.
10025
10026         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
10027         after a floating point suffix.
10028
10029         * expression.cs (DoNumericPromotions): Improved the conversion for
10030         uint/uint.  If we have a constant, we avoid doing a typecast to a
10031         larger type.
10032
10033         * class.cs (Indexer): Implement explicit interface implementation
10034         for indexers.
10035         
10036 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
10037
10038         * class.cs: make the default instance constructor public and hidebysig.
10039
10040 2001-01-03  Ravi Pratap  <ravi@ximian.com>
10041
10042         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
10043         so we can call it from elsewhere.
10044
10045         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
10046         we emit it internally if the class has a defined indexer; otherwise the user
10047         emits it by decorating the class definition with the DefaultMemberAttribute.
10048
10049         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
10050         attribute is not used on a type which defines an indexer.
10051
10052         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
10053         character when we skip whitespace.
10054
10055         * ../errors/cs0646.cs : Add.
10056
10057 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
10058
10059         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
10060         again. 
10061
10062         * makefile: Add practical target `mcs3.exe' which builds the third
10063         generation compiler. 
10064
10065         * expression.cs (New): Fix structures constructor calling.
10066
10067         * class.cs (Property, Method, Indexer): Emit Final flag on the
10068         method if we are an interface implementation and we are not
10069         abstract. 
10070
10071         * ecore.cs (PropertyExpr): New public field `IsBase', tells
10072         whether this property is referencing a `base' method.
10073
10074         * expression.cs (Invocation.EmitCall): take an extra argument:
10075         is_base, this is used to determine whether the `call' or
10076         `callvirt' opcode should be used.
10077
10078         
10079         * delegate.cs: update EmitCall.
10080
10081         * class.cs (Method.Define): Set NewSlot for the cases where we are
10082         not implementing an interface method.
10083
10084         (Property.Define): ditto.
10085
10086 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
10087
10088         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
10089         'r'.  Allows mcs to parse itself fully.
10090
10091 2002-01-02  Ravi Pratap  <ravi@ximian.com>
10092
10093         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
10094         of the number of initializers that require the InitializeArray method.
10095
10096         (CheckIndices): Store the Expression in all cases - not the plain value. Also
10097         update the above field where necessary.
10098
10099         (MakeByteBlob): Update accordingly.
10100
10101         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
10102         greater than 2.
10103
10104         (EmitDynamicInitializers): Update in accordance with the new optimization.
10105
10106         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
10107         same OpCode applies.
10108
10109         * cs-parser.jay : Fix some glaring errors I introduced.
10110
10111 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
10112
10113         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
10114         so that we can check for name clashes there too.
10115
10116         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
10117         for interface indexers.
10118
10119         * interfaces.cs (Define): Emit the default member attribute.
10120
10121         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
10122         variable was being referred to while setting the value ;-)
10123
10124 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
10125
10126         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
10127         byte-by-byte information when we know the data is zero.
10128
10129         Make the block always a multiple of 4, because
10130         DefineInitializedData has a bug.
10131
10132         * assign.cs: Fix, we should assign from the temporary, not from
10133         the source. 
10134
10135         * expression.cs (MakeByteBlob): Fix my incorrect code.
10136
10137 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
10138
10139         * typemanager.cs (EnumToUnderlying): This function is used to get
10140         the underlying type from an enumeration, because it does not
10141         always work. 
10142
10143         * constant.cs: Use the I4_S form for values between -128 and 127.
10144
10145         * statement.cs (Block.LookupLabel): Looks up a label.
10146         (Block): Drop support for labeled blocks.
10147
10148         (LabeledStatement): New kind of statement that represents a label
10149         only.
10150
10151         (Goto): Finally implement this bad boy.
10152         
10153         * cs-parser.jay: Update to reflect new mechanism to implement
10154         labels.
10155
10156 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
10157
10158         * codegen.cs (EmitContext.This): a codegen property that keeps the
10159         a single instance of this instead of creating many different this
10160         instances. 
10161
10162         * delegate.cs (Delegate.DoResolve): Update to use the property;
10163
10164         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
10165
10166         * expression.cs (BaseAccess.DoResolve): Ditto.
10167
10168 2001-12-29  Ravi Pratap  <ravi@ximian.com>
10169
10170         * typemanager.cs (methodimpl_attr_type): Add to hold the type
10171         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
10172
10173         (InitCoreTypes): Update accordingly.
10174
10175         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
10176         so we can quickly store the state.
10177
10178         (ApplyAttributes): Set the correct implementation flags
10179         for InternalCall methods.
10180
10181 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
10182
10183         * expression.cs (EmitCall): if a method is not virtual, then do
10184         not use callvirt on it.
10185
10186         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
10187         user defined stuff) requires the use of stobj, which takes an
10188         address on the stack instead of an array and an index.  So emit
10189         the Ldelema operation for it.
10190
10191         (EmitStoreOpcode): Use stobj for valuetypes.
10192
10193         (UnaryMutator.EmitCode): Use the right 1 value depending on
10194         whether we are dealing with int64/uint64, float or doubles.
10195
10196         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
10197         constructors that I implemented last night.
10198
10199         (Constructor.IsDefault): Fix to work properly for static
10200         constructors.
10201
10202         * cs-parser.jay (CheckDef): report method signature errors.
10203         Update error number 103 to be 132.
10204
10205         * decl.cs: New AdditionResult enumeration value: MethodExists.
10206         Although we do this check for methods later on in the semantic
10207         analysis, catching repeated default constructors is so easy that
10208         we catch these here. 
10209         
10210         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
10211         promotions code.
10212
10213         (ParameterReference.EmitAssign, Emit): handle
10214         bools as bytes.
10215
10216         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
10217         (ArrayAccess.EmitStoreOpcode): ditto.
10218
10219         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
10220
10221         * expression.cs (MakeByteBlob): Complete all the missing types
10222         (uint, short, ushort, byte, sbyte)
10223
10224         * class.cs: Only init instance field initializers on instance
10225         constructors. 
10226
10227         Rename `constructors' to instance_constructors. 
10228
10229         (TypeContainer.AddConstructor): Only add constructors to the list
10230         if it is not static.
10231
10232         Make sure that we handle default_static_constructor independently
10233         everywhere where we handle instance_constructors
10234
10235 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
10236
10237         * class.cs: Do not lookup or create a base initializer for a
10238         static constructor.
10239
10240         (ConstructorInitializer.Resolve): use the proper type to lookup
10241         for constructors.
10242
10243         * cs-parser.jay: Report error 1585 (modifiers between type and name).
10244
10245         * enum.cs, interface.cs: Remove CloseType, this is taken care by
10246         in DeclSpace. 
10247
10248         * decl.cs: CloseType is now an virtual method, the default
10249         implementation just closes this type.
10250         
10251 2001-12-28  Ravi Pratap  <ravi@ximian.com>
10252
10253         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
10254         to PreserveSig by default. Also emit HideBySig on such methods.
10255
10256         Basically, set the defaults to standard values.
10257
10258         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
10259         argument, if candidate is better, it can't be worse than the best !
10260
10261         (Invocation): Re-write bits to differentiate between methods being
10262         applicable in their expanded form and their normal form - for params
10263         methods of course.
10264
10265         Get rid of use_standard everywhere as only standard conversions are allowed
10266         in overload resolution. 
10267
10268         More spec conformance.
10269         
10270 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
10271
10272         * driver.cs: Add --timestamp, to see where the compiler spends
10273         most of its time.
10274
10275         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
10276         `this' in static code.
10277
10278         (SimpleName.DoResolve): Implement in terms of a helper function
10279         that allows static-references to be passed upstream to
10280         MemberAccess.
10281
10282         (Expression.ResolveWithSimpleName): Resolve specially simple
10283         names when called by MemberAccess to implement the special
10284         semantics. 
10285
10286         (Expression.ImplicitReferenceConversion): Handle conversions from
10287         Null to reference types before others, as Null's type is
10288         System.Object. 
10289
10290         * expression.cs (Invocation.EmitCall): Handle the special case of
10291         calling methods declared on a reference type from a ValueType
10292         (Base classes System.Object and System.Enum)
10293
10294         (MemberAccess.Resolve): Only perform lookups on Enumerations if
10295         the left hand side is a TypeExpr, not on every enumeration. 
10296
10297         (Binary.Resolve): If types are reference types, then do a cast to
10298         object on operators != and == of both arguments.
10299         
10300         * typemanager.cs (FindMembers): Extract instance and static
10301         members if requested.
10302
10303         * interface.cs (PopulateProperty): Use void_type instead of null
10304         as the return type for the setter method.
10305
10306         (PopulateIndexer): ditto.
10307
10308 2001-12-27  Ravi Pratap  <ravi@ximian.com>
10309
10310         * support.cs (ReflectionParameters): Fix minor bug where we
10311         were examining the wrong parameter for the ParamArray attribute.
10312
10313         Cope with requests for the type of the parameter at position
10314         greater than the params parameter's. We now return the element
10315         type of the params array as that makes more sense.
10316
10317         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
10318         accordingly as we no longer have to extract the element type
10319         ourselves.
10320
10321         (Invocation.OverloadResolve): Update.
10322
10323 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
10324
10325         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
10326         against IEnumerator, test whether the return value is a descendant
10327         of the IEnumerator interface.
10328
10329         * class.cs (Indexer.Define): Use an auxiliary method to implement
10330         the other bits of the method definition.  Begin support for
10331         explicit interface implementation.
10332
10333         (Property.DefineMethod): Use TypeManager.void_type instead of null
10334         for an empty return value.
10335
10336 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
10337
10338         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
10339         dealing with a FieldExpr which is composed of a FieldBuilder, in
10340         the code path we did extract the constant, but we should have
10341         obtained the underlying value to be able to cast it (otherwise we
10342         end up in an infinite loop, this is what Ravi was running into).
10343
10344         (ArrayCreation.UpdateIndices): Arrays might be empty.
10345
10346         (MemberAccess.ResolveMemberAccess): Add support for section
10347         14.5.4.1 that deals with the special case of E.I when E is a type
10348         and something else, that I can be a reference to a static member.
10349
10350         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
10351         handle a particular array type to create byte blobs, it is just
10352         something we dont generate byteblobs for.
10353
10354         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
10355         arguments. 
10356
10357         * location.cs (Push): remove the key from the hashtable that we
10358         are about to add.   This happens for empty files.
10359
10360         * driver.cs: Dispose files after we have parsed them.
10361
10362         (tokenize): new function that only runs the tokenizer on its
10363         input, for speed testing.
10364
10365 2001-12-26  Ravi Pratap  <ravi@ximian.com>
10366
10367         * class.cs (Event.Define): Define the private field only if there
10368         are no accessors defined.
10369
10370         * expression.cs (ResolveMemberAccess): If there is no associated
10371         field with the event, that means we have an event defined with its
10372         own accessors and we should flag error cs0070 since transforming
10373         ourselves into a field is not valid in that case.
10374
10375         * ecore.cs (SimpleName.DoResolve): Same as above.
10376
10377         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
10378         and charset to sane values.
10379
10380 2001-12-25  Ravi Pratap  <ravi@ximian.com>
10381
10382         * assign.cs (DoResolve): Perform check on events only if they 
10383         are being accessed outside the declaring type.
10384
10385         * cs-parser.jay (event_declarations): Update rules to correctly
10386         set the type of the implicit parameter etc.
10387
10388         (add_accessor, remove_accessor): Set current local parameters.
10389
10390         * expression.cs (Binary): For delegate addition and subtraction,
10391         cast the return value from the method into the appropriate delegate
10392         type.
10393
10394 2001-12-24  Ravi Pratap  <ravi@ximian.com>
10395
10396         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
10397         of these as the workaround is unnecessary.
10398
10399         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
10400         delegate data - none of that is needed at all.
10401
10402         Re-write bits to extract the instance expression and the delegate method
10403         correctly.
10404
10405         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
10406         on delegates too.
10407
10408         * attribute.cs (ApplyAttributes): New method to take care of common tasks
10409         of attaching attributes instead of duplicating code everywhere.
10410
10411         * everywhere : Update code to do attribute emission using the above method.
10412
10413 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
10414
10415         * expression.cs (IsParamsMethodApplicable): if there are not
10416         parameters, return immediately.
10417
10418         * ecore.cs: The 0 literal can be implicity converted to an enum
10419         type. 
10420
10421         (SimpleName.DoResolve): First lookup the type, then lookup the
10422         members. 
10423
10424         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
10425         want to get its address.  If the InstanceExpression is not
10426         addressable, store the result in a temporary variable, then get
10427         the address of it.
10428
10429         * codegen.cs: Only display 219 errors on warning level or above. 
10430
10431         * expression.cs (ArrayAccess): Make it implement the
10432         IMemoryLocation interface.
10433
10434         (Binary.DoResolve): handle the operator == (object a, object b)
10435         and operator != (object a, object b) without incurring into a
10436         BoxedCast (because 5 != o should never be performed).
10437
10438         Handle binary enumerator operators.
10439
10440         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
10441         value type, otherwise use Ldelem_ref.
10442
10443         Use precomputed names;
10444
10445         (AddressOf): Implement address of
10446
10447         * cs-parser.jay (labeled_statement): Fix recursive block
10448         addition by reworking the production.
10449
10450         * expression.cs (New.DoEmit): New has a special case:
10451                 
10452                  If we are dealing with a ValueType, we have a few
10453                  situations to deal with:
10454                 
10455                     * The target of New is a ValueType variable, that is
10456                       easy, we just pass this as the variable reference
10457                 
10458                     * The target of New is being passed as an argument,
10459                       to a boxing operation or a function that takes a
10460                       ValueType.
10461                 
10462                       In this case, we need to create a temporary variable
10463                       that is the argument of New.
10464
10465
10466 2001-12-23  Ravi Pratap  <ravi@ximian.com>
10467
10468         * rootcontext.cs (LookupType): Check that current_type is not null before
10469         going about looking at nested types.
10470
10471         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
10472         not implement the IAssignMethod interface any more.
10473
10474         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
10475         where we tranform them into FieldExprs if they are being resolved from within
10476         the declaring type.
10477
10478         * ecore.cs (SimpleName.DoResolve): Do the same here.
10479
10480         * assign.cs (DoResolve, Emit): Clean up code considerably. 
10481
10482         * ../errors/bug10.cs : Add.
10483
10484         * ../errors/cs0070.cs : Add.
10485
10486         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
10487
10488         * assign.cs : Get rid of EventIsLocal everywhere.
10489         
10490 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
10491
10492         * ecore.cs (ConvertIntLiteral): finished the implementation.
10493
10494         * statement.cs (SwitchLabel): Convert the value we are using as a
10495         key before looking up the table.
10496
10497 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
10498
10499         * codegen.cs (EmitTopBlock): Require a Location argument now.
10500
10501         * cs-parser.jay (constructor_declarator): We need to setup
10502         current_local_parameters before we parse the
10503         opt_constructor_initializer, to allow the variables to be bound
10504         to the constructor arguments.
10505
10506         * rootcontext.cs (LookupType): First lookup nested classes in our
10507         class and our parents before we go looking outside our class.
10508
10509         * expression.cs (ConstantFold): Extract/debox the values at the
10510         beginnning. 
10511
10512         * rootcontext.cs (EmitCode): Resolve the constants first before we
10513         resolve the types.  This is not really needed, but it helps debugging.
10514
10515         * statement.cs: report location.
10516         
10517         * cs-parser.jay: pass location to throw statement.
10518
10519         * driver.cs: Small bug fix.
10520
10521         * report.cs: Updated format to be 4-zero filled digits.
10522
10523 2001-12-22  Ravi Pratap  <ravi@ximian.com>
10524
10525         * expression.cs (CheckIndices): Fix minor bug where the wrong
10526         variable was being referred to ;-)
10527
10528         (DoEmit): Do not call EmitStaticInitializers when the 
10529         underlying type is System.Object.
10530
10531 2001-12-21  Ravi Pratap  <ravi@ximian.com>
10532
10533         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
10534         and do the usual workaround for SRE.
10535
10536         * class.cs (MyEventBuilder.EventType): New member to get at the type
10537         of the event, quickly.
10538
10539         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
10540
10541         * assign.cs (Assign.DoResolve): Handle the case when the target
10542         is an EventExpr and perform the necessary checks.
10543
10544         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
10545         interface.
10546
10547         (SimpleName.MemberStaticCheck): Include check for EventExpr.
10548
10549         (EventExpr): Set the type in the constructor itself since we 
10550         are meant to be born fully resolved.
10551
10552         (EventExpr.Define): Revert code I wrote earlier.
10553                 
10554         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
10555         instance expression is null. The instance expression is a This in that case
10556         or a null, depending on whether it is a static method or not.
10557
10558         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
10559         refers to more than one method.
10560
10561         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
10562         and accordingly flag errors.
10563
10564 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
10565
10566         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
10567
10568 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
10569
10570         * location.cs (ToString): Provide useful rutine.
10571
10572 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
10573
10574         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
10575         objects, return the actual integral boxed.
10576
10577         * statement.cs (SwitchLabel): define an ILLabel for each
10578         SwitchLabel. 
10579         
10580         (Switch.CheckSwitch): If the value is a Literal, extract
10581         the underlying literal.
10582         
10583         Also in the unused hashtable we had, add the SwitchLabel so we can
10584         quickly look this value up.
10585
10586         * constant.cs: Implement a bunch of new constants.  Rewrite
10587         Literal based on this.  Made changes everywhere to adapt to this.
10588         
10589         * expression.cs (Expression.MakeByteBlob): Optimize routine by
10590         dereferencing array only once, and also copes with enumrations.
10591
10592         bytes are two bytes wide, not one.
10593
10594         (Cast): Perform constant conversions.
10595         
10596         * ecore.cs (TryImplicitIntConversion): Return literals instead of
10597         wrappers to the literals here.
10598
10599         * expression.cs (DoNumericPromotions): long literals can converted
10600         to ulong implicity (this is taken care of elsewhere, but I was
10601         missing this spot).
10602
10603         * ecore.cs (Expression.Literalize): Make the return type Literal,
10604         to improve type checking.
10605
10606         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
10607
10608 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
10609
10610         * literal.cs: Revert code from ravi that checked the bounds.  The
10611         bounds are sane by the definition of the type itself. 
10612
10613         * typemanager.cs: Fix implementation of ImplementsInterface.  We
10614         need to actually look up in our parent hierarchy for interfaces
10615         implemented. 
10616
10617         * const.cs: Use the underlying type for enumerations
10618
10619         * delegate.cs: Compute the basename for the delegate creation,
10620         that should fix the delegate test case, and restore the correct
10621         Type Lookup semantics in rootcontext
10622
10623         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
10624         referencing a nested type with the Reflection API is using the "+"
10625         sign. 
10626
10627         * cs-parser.jay: Do not require EOF token at the end.
10628
10629 2001-12-20  Ravi Pratap  <ravi@ximian.com>
10630
10631         * rootcontext.cs (LookupType): Concatenate type names with
10632         a '.' instead of a '+' The test suite passes again.
10633
10634         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
10635         field of the enumeration.
10636
10637         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
10638         the case when the member is an EventExpr.
10639
10640         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
10641         static has an associated instance expression.
10642
10643         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
10644
10645         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
10646
10647         * class.cs (Event.Define): Register event and perform appropriate checks
10648         for error #111.
10649
10650         We define the Add and Remove methods even if the use provides none because
10651         in that case, we provide default implementations ourselves.
10652
10653         Define a private field of the type of the event. This is done by the CSC compiler
10654         and we should be doing it too ;-)
10655
10656         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
10657         More methods we use in code we generate.
10658
10659         (multicast_delegate_type, delegate_type): Two separate types since the distinction
10660         is important.
10661
10662         (InitCoreTypes): Update accordingly for the above.
10663
10664         * class.cs (Event.Emit): Generate code for default accessors that we provide
10665
10666         (EmitDefaultMethod): Do the job in the above.
10667
10668         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
10669         appropriate place.
10670
10671 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
10672
10673         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
10674         builders even if we were missing one.
10675
10676         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
10677         pass the Basename as our class name instead of the Name.  The
10678         basename will be correctly composed for us.
10679
10680         * parameter.cs (Paramters): Now takes a Location argument.
10681
10682         * decl.cs (DeclSpace.LookupType): Removed convenience function and
10683         make all the code call directly LookupType in RootContext and take
10684         this chance to pass the Location information everywhere.
10685
10686         * Everywhere: pass Location information.
10687
10688 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
10689
10690         * class.cs (Constructor.Define): Updated way of detecting the
10691         length of the parameters.
10692
10693         (TypeContainer.DefineType): Use basename as the type name for
10694         nested types.
10695
10696         (TypeContainer.Define): Do not recursively define types here, as
10697         definition is taken care in order by the RootContext.
10698
10699         * tree.cs: Keep track of namespaces in a per-file basis.
10700
10701         * parameter.cs (Parameter.ComputeSignature): Update to use
10702         DeclSpace. 
10703
10704         (Parameters.GetSignature): ditto.
10705
10706         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
10707         instead of a TypeContainer.
10708
10709         (Interface.SemanticAnalysis): Use `this' instead of our parent to
10710         resolve names.  Because we need to be resolve in our context, not
10711         our parents.
10712         
10713         * driver.cs: Implement response files.
10714
10715         * class.cs (TypeContainer.DefineType): If we are defined, do not
10716         redefine ourselves.
10717         
10718         (Event.Emit): Emit the code for add/remove handlers.
10719         (Event.Define): Save the MethodBuilders for add/remove.
10720
10721         * typemanager.cs: Use pair here too.
10722
10723         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
10724         DictionaryEntry requires the first argument to be non-null.  
10725         
10726         (enum_declaration): Compute full name for registering the
10727         enumeration.
10728         
10729         (delegate_declaration): Instead of using
10730         formal_parameter_list, use opt_formal_parameter_list as the list
10731         can be empty.
10732
10733         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
10734         (EventParsing): New property that controls whether `add' and
10735         `remove' are returned as tokens or identifiers (for events);
10736
10737 2001-12-19  Ravi Pratap  <ravi@ximian.com>
10738
10739         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
10740         use MyEventBuilder only and let it wrap the real builder for us.
10741
10742         (MyEventBuilder): Revamp constructor etc.
10743
10744         Implement all operations that we perform on EventBuilder in precisely the same
10745         way here too.
10746
10747         (FindMembers): Update to use the EventBuilder member.
10748
10749         (Event.Emit): Update accordingly.
10750
10751 2001-12-18  Ravi Pratap  <ravi@ximian.com>
10752
10753         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
10754         by calling the appropriate methods.
10755
10756         (GetCustomAttributes): Make stubs as they cannot possibly do anything
10757         useful.
10758
10759         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
10760
10761 2001-12-17  Ravi Pratap  <ravi@ximian.com>
10762
10763         * delegate.cs (Delegate.Populate): Check that the return type
10764         and various parameters types are indeed accessible.
10765
10766         * class.cs (Constructor.Define): Same here.
10767
10768         (Field.Define): Ditto.
10769
10770         (Event.Define): Ditto.
10771
10772         (Operator.Define): Check that the underlying Method defined itself
10773         correctly - so it's MethodBuilder should not be null.
10774
10775         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
10776         expression happens to be null.
10777
10778         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
10779         members but as of now we don't seem to be able to do anything really useful with it.
10780
10781         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
10782         not the EventBuilder.
10783
10784 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
10785
10786         * cs-tokenizer.cs: Add support for defines.
10787         Add support for #if, #elif, #else, #endif
10788         
10789         (eval_var): evaluates a variable.
10790         (eval): stubbed for evaluating functions.
10791
10792         * cs-parser.jay: Pass the defines information
10793
10794         * driver.cs: Add --define command line option.
10795
10796         * decl.cs: Move MemberCore here.
10797
10798         Make it the base class for DeclSpace.  This allows us to catch and
10799         report 108 and 109 for everything now.
10800
10801         * class.cs (TypeContainer.Define): Extract all the members
10802         before populating and emit the warning 108 (new keyword required
10803         to override) instead of having each member implement this.
10804
10805         (MemberCore.Define): New abstract method, we will be using this in
10806         the warning reporting engine in Populate.
10807         
10808         (Operator.Define): Adjust to new MemberCore protocol. 
10809
10810         * const.cs (Const): This does not derive from Expression, it is a
10811         temporary object we use to create fields, it is a MemberCore. 
10812
10813         * class.cs (Method.Define): Allow the entry point to be in a
10814         specific class.
10815
10816         * driver.cs: Rewrite the argument handler to clean it up a bit.
10817
10818         * rootcontext.cs: Made it just an auxiliary namespace feature by
10819         making everything static.
10820
10821         * driver.cs: Adapt code to use RootContext type name instead of
10822         instance variable.
10823
10824         * delegate.cs: Remove RootContext argument.
10825
10826         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
10827         argument. 
10828
10829         * class.cs (Event.Define): The lookup can fail.
10830         
10831         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
10832
10833         * expression.cs: Resolve the this instance before invoking the code.
10834
10835 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
10836
10837         * cs-parser.jay: Add a production in element_access that allows
10838         the thing to become a "type" reference.  This way we can parse
10839         things like "(string [])" as a type.
10840
10841         Note that this still does not handle the more complex rules of
10842         casts. 
10843         
10844
10845         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
10846
10847         * ecore.cs: (CopyNewMethods): new utility function used to
10848         assemble the list of methods from running FindMembers.
10849
10850         (MemberLookup): Rework FindMembers so that 
10851
10852 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
10853
10854         * class.cs (TypeContainer): Remove Delegates who fail to be
10855         defined.
10856
10857         * delegate.cs (Populate): Verify that we dont get null return
10858         values.   TODO: Check for AsAccessible.
10859
10860         * cs-parser.jay: Use basename to emit error 574 (destructor should
10861         have the same name as container class), not the full name.
10862
10863         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
10864         possible representation.  
10865
10866         Also implements integer type suffixes U and L.
10867
10868 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
10869
10870         * expression.cs (ArrayCreation.DoResolve): We need to do the
10871         argument resolution *always*.
10872
10873         * decl.cs: Make this hold the namespace.  Hold the root context as
10874         well.
10875         (LookupType): Move here.
10876
10877         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
10878
10879         * location.cs (Row, Name): Fixed the code, it was always returning
10880         references to the first file.
10881
10882         * interface.cs: Register properties defined through interfaces.
10883
10884         * driver.cs: Add support for globbing on the command line
10885
10886         * class.cs (Field): Make it derive from MemberCore as well.
10887         (Event): ditto.
10888
10889 2001-12-15  Ravi Pratap  <ravi@ximian.com>
10890
10891         * class.cs (Event::Define): Check that the type of the event is a delegate
10892         type else flag error #66.
10893
10894         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
10895         same.
10896
10897         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
10898         values of EntryPoint, CharSet etc etc.
10899
10900         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
10901
10902         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
10903         be null and we should ignore this. I am not sure if this is really clean. Apparently,
10904         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
10905         which needs this to do its work.
10906
10907         * ../errors/cs0066.cs : Add.
10908
10909 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
10910
10911         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
10912         helper functions.
10913
10914         * class.cs: (MethodSignature.MethodSignature): Removed hack that
10915         clears out the parameters field.
10916         (MemberSignatureCompare): Cleanup
10917
10918         (MemberCore): New base class used to share code between MethodCore
10919         and Property.
10920
10921         (RegisterRequiredImplementations) BindingFlags.Public requires
10922         either BindingFlags.Instace or Static.  Use instance here.
10923
10924         (Property): Refactored code to cope better with the full spec.
10925
10926         * parameter.cs (GetParameterInfo): Return an empty array instead
10927         of null on error.
10928
10929         * class.cs (Property): Abstract or extern properties have no bodies.
10930
10931         * parameter.cs (GetParameterInfo): return a zero-sized array.
10932
10933         * class.cs (TypeContainer.MethodModifiersValid): Move all the
10934         method modifier validation to the typecontainer so we can reuse
10935         this on properties.
10936
10937         (MethodCore.ParameterTypes): return an empty sized array of types.
10938
10939         (Property.Define): Test property modifier validity.
10940
10941         Add tests for sealed/override too.
10942
10943         (Method.Emit): abstract or extern methods have no bodies.
10944
10945 2001-12-14  Ravi Pratap  <ravi@ximian.com>
10946
10947         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
10948         thing.
10949
10950         (Method::Define, ::Emit): Modify accordingly.
10951
10952         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
10953
10954         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
10955
10956         * makefile: Pass in /unsafe.
10957
10958 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
10959
10960         * class.cs (MakeKey): Kill routine.
10961         
10962         * class.cs (TypeContainer.Define): Correctly define explicit
10963         method implementations (they require the full interface name plus
10964         the method name).
10965
10966         * typemanager.cs: Deply the PtrHashtable here and stop using the
10967         lame keys.  Things work so much better.
10968
10969         This of course broke everyone who depended on `RegisterMethod' to
10970         do the `test for existance' test.  This has to be done elsewhere.
10971
10972         * support.cs (PtrHashtable): A hashtable that avoid comparing with
10973         the object stupid Equals method (because, that like fails all over
10974         the place).  We still do not use it.
10975
10976         * class.cs (TypeContainer.SetRequiredInterface,
10977         TypeContainer.RequireMethods): Killed these two routines and moved
10978         all the functionality to RegisterRequiredImplementations.
10979
10980         (TypeContainer.RegisterRequiredImplementations): This routine now
10981         registers all the implementations required in an array for the
10982         interfaces and abstract methods.  We use an array of structures
10983         which can be computed ahead of time to reduce memory usage and we
10984         also assume that lookups are cheap as most classes will not
10985         implement too many interfaces.
10986
10987         We also avoid creating too many MethodSignatures.
10988
10989         (TypeContainer.IsInterfaceMethod): Update and optionally does not
10990         clear the "pending" bit if we find that there are problems with
10991         the declaration.
10992
10993         (TypeContainer.VerifyPendingMethods): Update to report errors of
10994         methods that look like implementations but are not.
10995
10996         (TypeContainer.Define): Add support for explicit interface method
10997         implementation. 
10998         
10999 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
11000
11001         * typemanager.cs: Keep track of the parameters here instead of
11002         being a feature of the TypeContainer.
11003
11004         * class.cs: Drop the registration of parameters here, as
11005         InterfaceMethods are also interface declarations.
11006
11007         * delegate.cs: Register methods with the TypeManager not only with
11008         the TypeContainer.  This code was buggy.
11009
11010         * interface.cs: Full registation here.
11011
11012 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
11013
11014         * expression.cs: Remove reducer for binary expressions, it can not
11015         be done this way.
11016
11017         * const.cs: Put here the code that used to go into constant.cs
11018
11019         * constant.cs: Put here the code for constants, this is a new base
11020         class for Literals.
11021
11022         * literal.cs: Make Literal derive from Constant.
11023
11024 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
11025
11026         * statement.cs (Return.Emit): Report error 157 if the user
11027         attempts to return from a finally block.
11028
11029         (Return.Emit): Instead of emitting a return, jump to the end of
11030         the function.
11031
11032         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
11033         LocalBuilder to store the result of the function.  ReturnLabel is
11034         the target where we jump.
11035         
11036
11037 2001-12-09  Radek Doulik  <rodo@ximian.com>
11038
11039         * cs-parser.jay: remember alias in current namespace
11040
11041         * ecore.cs (SimpleName::DoResolve): use aliases for types or
11042         namespaces
11043
11044         * class.cs (LookupAlias): lookup alias in my_namespace
11045
11046         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
11047         aliases hashtable
11048         (LookupAlias): lookup alias in this and if needed in parent
11049         namespaces
11050
11051 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
11052
11053         * support.cs: 
11054
11055         * rootcontext.cs: (ModuleBuilder) Made static, first step into
11056         making things static.  I need this to avoid passing the
11057         TypeContainer when calling ParameterType.
11058
11059         * support.cs (InternalParameters.ParameterType): Remove ugly hack
11060         that did string manipulation to compute the type and then call
11061         GetType.  Use Parameter.ParameterType instead.
11062
11063         * cs-tokenizer.cs: Consume the suffix for floating values.
11064
11065         * expression.cs (ParameterReference): figure out whether this is a
11066         reference parameter or not.  Kill an extra variable by computing
11067         the arg_idx during emission.
11068
11069         * parameter.cs (Parameters.GetParameterInfo): New overloaded
11070         function that returns whether a parameter is an out/ref value or not.
11071
11072         (Parameter.ParameterType): The type of the parameter (base,
11073         without ref/out applied).
11074         
11075         (Parameter.Resolve): Perform resolution here.
11076         (Parameter.ExternalType): The full type (with ref/out applied).
11077
11078         * statement.cs (Using.Emit, Using.EmitExpression): Implement
11079         support for expressions on the using statement.
11080
11081 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
11082
11083         * statement.cs (Using.EmitLocalVariableDecls): Split the
11084         localvariable handling of the using statement.
11085
11086         (Block.EmitMeta): Keep track of variable count across blocks.  We
11087         were reusing slots on separate branches of blocks.
11088
11089         (Try.Emit): Emit the general code block, we were not emitting it. 
11090
11091         Check the type of the declaration to be an IDisposable or
11092         something that can be implicity converted to it. 
11093
11094         Emit conversions if required.
11095
11096         * ecore.cs (EmptyExpression): New utility class.
11097         (Expression.ImplicitConversionExists): New utility function.
11098
11099 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
11100
11101         * statement.cs (Using): Implement.
11102
11103         * expression.cs (LocalVariableReference): Support read only variables.
11104
11105         * statement.cs: Remove the explicit emit for the Leave opcode.
11106         (VariableInfo): Add a readonly field.
11107
11108 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
11109
11110         * ecore.cs (ConvCast): new class used to encapsulate the various
11111         explicit integer conversions that works in both checked and
11112         unchecked contexts.
11113
11114         (Expression.ConvertNumericExplicit): Use new ConvCast class to
11115         properly generate the overflow opcodes.
11116
11117 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
11118
11119         * statement.cs: The correct type for the EmptyExpression is the
11120         element_type, not the variable type.  Ravi pointed this out.
11121
11122 2001-12-04  Ravi Pratap  <ravi@ximian.com>
11123
11124         * class.cs (Method::Define): Handle PInvoke methods specially
11125         by using DefinePInvokeMethod instead of the usual one.
11126
11127         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
11128         above to do the task of extracting information and defining the method.
11129         
11130 2001-12-04  Ravi Pratap  <ravi@ximian.com>
11131
11132         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
11133         of the condition for string type.
11134
11135         (Emit): Move that here. 
11136
11137         (ArrayCreation::CheckIndices): Keep string literals in their expression
11138         form.
11139
11140         (EmitDynamicInitializers): Handle strings appropriately.
11141
11142 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
11143
11144         * codegen.cs (EmitContext): Replace multiple variables with a
11145         single pointer to the current Switch statement.
11146
11147         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
11148         EmitContext.
11149
11150 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
11151
11152         * statement.cs 
11153
11154         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
11155         default'.
11156         
11157         (Foreach.Emit): Foreach on arrays was not setting
11158         up the loop variables (for break/continue).
11159
11160         (GotoCase): Semi-implented.
11161         
11162 2001-12-03  Ravi Pratap  <ravi@ximian.com>
11163
11164         * attribute.cs (CheckAttribute): Handle system attributes by using
11165         Attribute.GetAttributes to examine information we need.
11166
11167         (GetValidPlaces): Same here.
11168
11169         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
11170
11171         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
11172
11173         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
11174
11175         (Method::Define): Set appropriate flags if we have a DllImport attribute.
11176
11177         (Method::Emit): Handle the case when we are a PInvoke method.
11178
11179 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
11180
11181         * expression.cs: Use ResolveWithSimpleName on compound names.
11182
11183 2001-12-02  Ravi Pratap  <ravi@ximian.com>
11184
11185         * constant.cs (EmitConstant): Make sure we resolve the associated expression
11186         before trying to reduce it.
11187
11188         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
11189
11190         * constant.cs (LookupConstantValue): Implement.
11191
11192         (EmitConstant): Use the above in emitting the constant.
11193
11194         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
11195         that are user-defined by doing a LookupConstantValue on them.
11196
11197         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
11198         too, like above.
11199
11200 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
11201
11202         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
11203
11204         (BaseAccess.DoResolve): Implement.
11205
11206         (MemberAccess.DoResolve): Split this routine into a
11207         ResolveMemberAccess routine that can be used independently
11208
11209 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
11210
11211         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
11212         As that share bits of the implementation.  Is returns a boolean,
11213         while As returns the Type that is being probed.
11214
11215 2001-12-01  Ravi Pratap  <ravi@ximian.com>
11216
11217         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
11218         instead of a Literal - much easier.
11219
11220         (EnumInTransit): Remove - utterly useless :-)
11221
11222         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
11223
11224         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
11225
11226         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
11227         chain when we have no associated expression.
11228
11229 2001-11-30  Ravi Pratap  <ravi@ximian.com>
11230
11231         * constant.cs (Define): Use Location while reporting the errror.
11232
11233         Also emit a warning when 'new' is used and there is no inherited
11234         member to hide.
11235
11236         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
11237         populated.
11238
11239         (LookupEnumValue): Implement to lookup an enum member's value and define it
11240         if necessary.
11241
11242         (Populate): Re-write accordingly to use the above routine.
11243
11244 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
11245
11246         * expression.cs (This): Fix prototype for DoResolveLValue to
11247         override the base class DoResolveLValue.
11248
11249         * cs-parser.cs: Report errors cs574 and cs575 (destructor
11250         declarations) 
11251
11252         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
11253         (we need to load the address of the field here).  This fixes
11254         test-22. 
11255         
11256         (FieldExpr.DoResolveLValue): Call the DoResolve
11257         function to initialize the Instance expression.
11258         
11259         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
11260         correctly the GetEnumerator operation on a value type.
11261
11262         * cs-parser.jay: Add more simple parsing error catches.
11263
11264         * statement.cs (Switch): Add support for string switches.
11265         Handle null specially.
11266
11267         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
11268
11269 2001-11-28  Ravi Pratap  <ravi@ximian.com>
11270
11271         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
11272
11273         (declare_local_constant): New helper function.
11274
11275         * statement.cs (AddConstant): Keep a separate record of constants
11276
11277         (IsConstant): Implement to determine if a variable is a constant.
11278
11279         (GetConstantExpression): Implement.
11280
11281         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
11282
11283         * statement.cs (IsVariableDefined): Re-write.
11284
11285 2001-11-27  Ravi Pratap  <ravi@ximian.com>
11286
11287         * class.cs (TypeContainer::FindMembers): Look for constants
11288         in the case when we are looking for MemberTypes.Field
11289
11290         * expression.cs (MemberAccess::DoResolve): Check that in the
11291         case we are a FieldExpr and a Literal, we are not being accessed
11292         by an instance reference.
11293
11294         * cs-parser.jay (local_constant_declaration): Implement.
11295
11296         (declaration_statement): Implement for constant declarations.
11297
11298 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
11299
11300         * statement.cs (Switch): Catch double defaults.
11301
11302         (Switch): More work on the switch() statement
11303         implementation.  It works for integral values now, need to finish
11304         string support.
11305
11306
11307 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
11308
11309         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
11310         integer literals into other integer literals.  To be used by
11311         switch. 
11312
11313 2001-11-24  Ravi Pratap  <ravi@ximian.com>
11314
11315         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
11316         some memory.
11317
11318         (EmitDynamicInitializers): Cope with the above since we extract data
11319         directly from ArrayData now.
11320
11321         (ExpectInitializers): Keep track of whether initializers are mandatory
11322         or not.
11323
11324         (Bounds): Make it a hashtable to prevent the same dimension being 
11325         recorded for every element in that dimension.
11326
11327         (EmitDynamicInitializers): Fix bug which prevented the Set array method
11328         from being found.
11329
11330         Also fix bug which was causing the indices to be emitted in the reverse
11331         order.
11332
11333 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
11334
11335         * expression.cs (ArrayCreation): Implement the bits that Ravi left
11336         unfinished.  They do not work, because the underlying code is
11337         sloppy.
11338
11339 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11340
11341         * cs-parser.jay: Remove bogus fixme.
11342
11343         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
11344         on Switch statement.
11345         
11346 2001-11-23  Ravi Pratap  <ravi@ximian.com>
11347
11348         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
11349         the same. 
11350         
11351         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
11352         parameter. Apparently, any expression is allowed. 
11353
11354         (ValidateInitializers): Update accordingly.
11355
11356         (CheckIndices): Fix some tricky bugs thanks to recursion.
11357
11358         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
11359         I was being completely brain-dead.
11360
11361         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
11362         and re-write acordingly.
11363
11364         (DelegateInvocation): Re-write accordingly.
11365
11366         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
11367
11368         (MakeByteBlob): Handle types more correctly.
11369
11370         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
11371         initialization from expressions but it is incomplete because I am a complete
11372         Dodo :-|
11373
11374 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11375
11376         * statement.cs (If.Emit): Fix a bug that generated incorrect code
11377         on If.  Basically, we have to return `true' (ie, we do return to
11378         our caller) only if both branches of the if return.
11379
11380         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
11381         short-circuit operators, handle them as short circuit operators. 
11382
11383         (Cast.DoResolve): Resolve type.
11384         (Cast.Cast): Take an expression as the target type.
11385
11386         * cs-parser.jay (cast_expression): Remove old hack that only
11387         allowed a limited set of types to be handled.  Now we take a
11388         unary_expression and we resolve to a type during semantic
11389         analysis.
11390
11391         Use the grammar productions from Rhys to handle casts (this is
11392         not complete like Rhys syntax yet, we fail to handle that corner
11393         case that C# has regarding (-x), but we will get there.
11394         
11395 2001-11-22  Ravi Pratap  <ravi@ximian.com>
11396
11397         * class.cs (EmitFieldInitializer): Take care of the case when we have a
11398         field which is an array type.
11399
11400         * cs-parser.jay (declare_local_variables): Support array initialization too.
11401
11402         * typemanager.cs (MakeKey): Implement.
11403
11404         (everywhere): Use the above appropriately.
11405
11406         * cs-parser.jay (for_statement): Update for array initialization while
11407         declaring variables.
11408
11409         * ecore.cs : The error message was correct, it's the variable's names that
11410         were misleading ;-) Make the code more readable.
11411
11412         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
11413         the correct type etc.
11414
11415         (ConvertExplicit): Handle Enum types by examining the underlying type.
11416
11417 2001-11-21  Ravi Pratap  <ravi@ximian.com>
11418
11419         * parameter.cs (GetCallingConvention): Always return
11420         CallingConventions.Standard for now.
11421
11422 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11423
11424         * expression.cs (Binary.ResolveOperator): Update the values of `l'
11425         and `r' after calling DoNumericPromotions.
11426
11427         * ecore.cs: Fix error message (the types were in the wrong order).
11428
11429         * statement.cs (Foreach.ProbeCollectionType): Need to pass
11430         BindingFlags.Instance as well 
11431
11432         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
11433         implicit int literal conversion in an empty cast so that we
11434         propagate the right type upstream.
11435
11436         (UnboxCast): new class used to unbox value types.
11437         (Expression.ConvertExplicit): Add explicit type conversions done
11438         by unboxing.
11439
11440         (Expression.ImplicitNumericConversion): Oops, forgot to test for
11441         the target type before applying the implicit LongLiterals to ULong
11442         literal cast.
11443
11444 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
11445
11446         * cs-parser.jay (for_statement): Reworked the way For works: now
11447         we declare manually any variables that are introduced in
11448         for_initializer to solve the problem of having out-of-band code
11449         emition (that is what got for broken).
11450
11451         (declaration_statement): Perform the actual variable declaration
11452         that used to be done in local_variable_declaration here.
11453
11454         (local_variable_declaration): Do not declare anything, just pass
11455         the information on a DictionaryEntry
11456
11457 2001-11-20  Ravi Pratap  <ravi@ximian.com>
11458
11459         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
11460         re-write of the logic to now make it recursive.
11461
11462         (UpdateIndices): Re-write accordingly.
11463
11464         Store element data in a separate ArrayData list in the above methods.
11465
11466         (MakeByteBlob): Implement to dump the array data into a byte array.
11467
11468 2001-11-19  Ravi Pratap  <ravi@ximian.com>
11469
11470         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
11471         into CheckIndices.
11472
11473         * constant.cs (Define): Implement.
11474
11475         (EmitConstant): Re-write fully.
11476
11477         Pass in location info.
11478
11479         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
11480         respectively.
11481
11482         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
11483         DictionaryEntry since we need location info too.
11484
11485         (constant_declaration): Update accordingly.
11486
11487         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
11488         code into another method : UpdateIndices.
11489
11490 2001-11-18  Ravi Pratap  <ravi@ximian.com>
11491
11492         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
11493         some type checking etc.
11494
11495 2001-11-17  Ravi Pratap  <ravi@ximian.com>
11496
11497         * expression.cs (ArrayCreation::ValidateInitializers): Implement
11498         bits to provide dimension info if the user skips doing that.
11499
11500         Update second constructor to store the rank correctly.
11501
11502 2001-11-16  Ravi Pratap  <ravi@ximian.com>
11503
11504         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
11505         and try to implement.
11506
11507         * ../errors/cs0150.cs : Add.
11508
11509         * ../errors/cs0178.cs : Add.
11510
11511 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
11512
11513         * statement.cs: Implement foreach on multi-dimensional arrays. 
11514
11515         * parameter.cs (Parameters.GetParameterByName): Also lookup the
11516         name of the params argument.
11517
11518         * expression.cs: Use EmitStoreOpcode to get the right opcode while
11519         initializing the array.
11520
11521         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
11522         we can use this elsewhere.
11523
11524         * statement.cs: Finish implementation of foreach for single
11525         dimension arrays.
11526
11527         * cs-parser.jay: Use an out-of-band stack to pass information
11528         around, I wonder why I need this.
11529
11530         foreach_block: Make the new foreach_block the current_block.
11531
11532         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
11533         function used to return a static Parameters structure.  Used for
11534         empty parameters, as those are created very frequently.
11535
11536         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
11537
11538 2001-11-15  Ravi Pratap  <ravi@ximian.com>
11539
11540         * interface.cs : Default modifier is private, not public. The
11541         make verify test passes again.
11542
11543 2001-11-15  Ravi Pratap  <ravi@ximian.com>
11544
11545         * support.cs (ReflectionParameters): Fix logic to determine
11546         whether the last parameter is a params one. Test 9 passes again.
11547
11548         * delegate.cs (Populate): Register the builders we define with
11549         RegisterParameterForBuilder. Test 19 passes again.
11550
11551         * cs-parser.jay (property_declaration): Reference $6 instead
11552         of $$ to get at the location.
11553
11554         (indexer_declaration): Similar stuff.
11555
11556         (attribute): Ditto.
11557
11558         * class.cs (Property): Register parameters for the Get and Set methods
11559         if they exist. Test 23 passes again.
11560
11561         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
11562         call to EmitArguments as we are sure there aren't any params arguments. 
11563         Test 32 passes again.
11564
11565         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
11566         IndexOutOfRangeException. 
11567
11568         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
11569         Test 33 now passes again.
11570         
11571 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
11572
11573         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
11574         broke a bunch of things.  Will have to come up with a better way
11575         of tracking locations.
11576
11577         * statement.cs: Implemented foreach for single dimension arrays.
11578
11579 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
11580
11581         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
11582         an error.  This removes the lookup from the critical path.
11583
11584         * cs-parser.jay: Removed use of temporary_loc, which is completely
11585         broken. 
11586
11587 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
11588
11589         * support.cs (ReflectionParameters.ParameterModifier): Report
11590         whether the argument is a PARAMS argument or not.
11591
11592         * class.cs: Set the attribute `ParamArrayAttribute' on the
11593         parameter argument.
11594
11595         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
11596         and cons_param_array_attribute (ConstructorInfo for
11597         ParamArrayAttribute)., 
11598
11599         * codegen.cs: Emit the return using the `Return' statement, that
11600         way we can report the error correctly for missing return values. 
11601
11602         * class.cs (Method.Emit): Clean up.
11603
11604         * expression.cs (Argument.Resolve): Take another argument: the
11605         location where this argument is used.  Notice that this is not
11606         part of the "Argument" class as to reduce the size of the
11607         structure (we know the approximate location anyways).
11608
11609         Test if the argument is a variable-reference, if not, then
11610         complain with a 206.
11611
11612         (Argument.Emit): Emit addresses of variables.
11613
11614         (Argument.FullDesc): Simplify.
11615
11616         (Invocation.DoResolve): Update for Argument.Resolve.
11617
11618         (ElementAccess.DoResolve): ditto.
11619
11620         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
11621         method should be virtual, as this method is always virtual.
11622
11623         (NewDelegate.DoResolve): Update for Argument.Resolve.
11624
11625         * class.cs (ConstructorInitializer.DoResolve): ditto.
11626         
11627         * attribute.cs (Attribute.Resolve): ditto.
11628
11629 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
11630
11631         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
11632
11633         * expression.cs (ParameterReference): Drop IStackStorage and implement
11634         IAssignMethod instead. 
11635
11636         (LocalVariableReference): ditto.
11637         
11638         * ecore.cs (FieldExpr): Drop IStackStorage and implement
11639         IAssignMethod instead. 
11640
11641 2001-11-13  Miguel de Icaza <miguel@ximian.com>
11642
11643         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
11644         enumerations that are used in heavily used structures derive from
11645         byte in a laughable and pathetic attempt to reduce memory usage.
11646         This is the kind of pre-optimzations that you should not do at
11647         home without adult supervision.
11648
11649         * expression.cs (UnaryMutator): New class, used to handle ++ and
11650         -- separatedly from the other unary operators.  Cleans up the
11651         code, and kills the ExpressionStatement dependency in Unary.
11652
11653         (Unary): Removed `method' and `Arguments' from this class, making
11654         it smaller, and moving it all to SimpleCall, so I can reuse this
11655         code in other locations and avoid creating a lot of transient data
11656         strucutres when not required.
11657
11658         * cs-parser.jay: Adjust for new changes.
11659
11660 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
11661
11662         * enum.cs (Enum.Populate): If there is a failure during
11663         definition, return
11664
11665         * cs-parser.jay (opt_enum_base): we used to catch type errors
11666         here, but this is really incorrect.  The type error should be
11667         catched during semantic analysis.
11668
11669 2001-12-11  Ravi Pratap  <ravi@ximian.com>
11670
11671         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
11672         current_local_parameters as expected since I, in my stupidity, had forgotten
11673         to do this :-)
11674
11675         * attribute.cs (GetValidPlaces): Fix stupid bug.
11676
11677         * class.cs (Method::Emit): Perform check on applicability of attributes.
11678
11679         (Constructor::Emit): Ditto.
11680
11681         (Field::Emit): Ditto.
11682
11683         (Field.Location): Store location information.
11684
11685         (Property, Event, Indexer, Operator): Ditto.
11686
11687         * cs-parser.jay (field_declaration): Pass in location for each field.
11688
11689         * ../errors/cs0592.cs : Add.
11690
11691 2001-11-12  Ravi Pratap  <ravi@ximian.com>
11692
11693         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
11694
11695         (InitCoreTypes): Update accordingly.
11696
11697         (RegisterAttrType, LookupAttr): Implement.
11698
11699         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
11700         info about the same.
11701
11702         (Resolve): Update to populate the above as necessary.
11703
11704         (Error592): Helper.
11705
11706         (GetValidPlaces): Helper to the above.
11707
11708         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
11709
11710         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
11711
11712 2001-11-12  Ravi Pratap  <ravi@ximian.com>
11713
11714         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
11715
11716         * ../errors/cs0617.cs : Add.
11717
11718 2001-11-11  Ravi Pratap  <ravi@ximian.com>
11719
11720         * enum.cs (Emit): Rename to Populate to be more consistent with what
11721         we expect it to do and when exactly it is called.
11722
11723         * class.cs, rootcontext.cs : Update accordingly.
11724
11725         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
11726         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
11727
11728         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
11729
11730         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
11731         of a fieldinfo using the above, when dealing with a FieldBuilder.
11732
11733 2001-11-10  Ravi Pratap  <ravi@ximian.com>
11734
11735         * ../errors/cs0031.cs : Add.
11736
11737         * ../errors/cs1008.cs : Add.
11738
11739         * ../errrors/cs0543.cs : Add.
11740
11741         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
11742         enum type.
11743
11744         (FindMembers): Implement.
11745
11746         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
11747         enums and delegates too.
11748
11749         (enum_types): Rename to builder_to_enum.
11750
11751         (delegate_types): Rename to builder_to_delegate.
11752
11753         * delegate.cs (FindMembers): Implement.
11754
11755 2001-11-09  Ravi Pratap  <ravi@ximian.com>
11756
11757         * typemanager.cs (IsEnumType): Implement.
11758
11759         * enum.cs (Emit): Re-write parts to account for the underlying type
11760         better and perform checking etc.
11761
11762         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
11763         of the underlying type.
11764
11765         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
11766         value
11767
11768         * enum.cs (error31): Helper to report error #31.
11769
11770         * cs-parser.jay (enum_declaration): Store location of each member too.
11771
11772         * enum.cs (member_to_location): New hashtable. 
11773
11774         (AddEnumMember): Update location hashtable.
11775
11776         (Emit): Use the location of each member while reporting errors.
11777
11778 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
11779
11780         * cs-parser.jay: A for_initializer if is a
11781         local_variable_declaration really ammount to have an implicit
11782         block with the variable declaration and no initializer for for.
11783
11784         * statement.cs (For.Emit): Cope with null initializers.
11785
11786         This fixes the infinite loop on for initializers.
11787
11788 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
11789
11790         * enum.cs: More cleanup.
11791
11792         * ecore.cs: Remove dead code.
11793
11794         * class.cs (Property.Emit): More simplification.
11795         (Event.Emit): ditto.
11796
11797         Reworked to have less levels of indentation.
11798         
11799 2001-11-08  Ravi Pratap  <ravi@ximian.com>
11800
11801         * class.cs (Property): Emit attributes.
11802
11803         (Field): Ditto.
11804         
11805         (Event): Ditto.
11806
11807         (Indexer): Ditto.
11808
11809         (Operator): Ditto.
11810
11811         * enum.cs (Emit): Ditto.
11812
11813         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
11814         Enums too.
11815
11816         * class.cs (Field, Event, etc.): Move attribute generation into the
11817         Emit method everywhere.
11818
11819         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
11820         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
11821         as we had no way of defining nested enums !
11822
11823         * rootcontext.cs : Adjust code accordingly.
11824
11825         * typemanager.cs (AddEnumType): To keep track of enum types separately.
11826
11827 2001-11-07  Ravi Pratap  <ravi@ximian.com>
11828
11829         * expression.cs (EvalConstantExpression): Move into ecore.cs
11830         
11831         * enum.cs (Enum): Rename some members and make them public and readonly
11832         according to our convention.
11833
11834         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
11835         nothing else.
11836
11837         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
11838
11839         (Enum::Emit): Write a simple version for now which doesn't try to compute
11840         expressions. I shall modify this to be more robust in just a while.
11841
11842         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
11843
11844         (TypeContainer::CloseType): Create the Enum types too.
11845
11846         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
11847
11848         * expression.cs (EvalConstantExpression): Get rid of completely.
11849
11850         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
11851         user-defined values and other cases.
11852
11853         (IsValidEnumLiteral): Helper function.
11854
11855         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
11856         out there in the case we had a literal FieldExpr.
11857
11858         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
11859
11860         (Literalize): Revamp a bit to take two arguments.
11861         
11862         (EnumLiteral): New class which derives from Literal to wrap enum literals.
11863         
11864 2001-11-06  Ravi Pratap  <ravi@ximian.com>
11865
11866         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
11867
11868         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
11869
11870         (Resolve): Use the above to ensure we have proper initializers.
11871
11872 2001-11-05  Ravi Pratap  <ravi@ximian.com>
11873
11874         * expression.cs (Expression::EvalConstantExpression): New method to 
11875         evaluate constant expressions.
11876
11877         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
11878
11879 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
11880
11881         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
11882         in an array.
11883
11884         (Binary.ResolveOperator): Handle operator != (object a, object b)
11885         and operator == (object a, object b);
11886
11887         (Binary.DoNumericPromotions): Indicate whether the numeric
11888         promotion was possible.
11889
11890         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
11891         Implement.  
11892
11893         Made the ArrayAccess implement interface IAssignMethod instead of
11894         IStackStore as the order in which arguments are passed reflects
11895         this.
11896
11897         * assign.cs: Instead of using expr.ExprClass to select the way of
11898         assinging, probe for the IStackStore/IAssignMethod interfaces.
11899
11900         * typemanager.cs: Load InitializeArray definition.
11901
11902         * rootcontext.cs (RootContext.MakeStaticData): Used to define
11903         static data that can be used to initialize arrays. 
11904
11905 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
11906
11907         * expression.cs: Handle operator== and operator!= for booleans.
11908
11909         (Conditioal.Reduce): Implement reducer for the ?: operator.
11910
11911         (Conditional.Resolve): Implement dead code elimination.
11912
11913         (Binary.Resolve): Catch string literals and return a new
11914         concatenated string.
11915
11916         (Unary.Reduce): Implement reduction of unary expressions.
11917
11918         * ecore.cs: Split out the expression core handling here.
11919
11920         (Expression.Reduce): New method used to perform constant folding
11921         and CSE.  This is needed to support constant-expressions. 
11922         
11923         * statement.cs (Statement.EmitBoolExpression): Pass true and false
11924         targets, and optimize for !x.
11925
11926 2001-11-04  Ravi Pratap  <ravi@ximian.com>
11927
11928         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
11929         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
11930         set custom atttributes.
11931
11932         * literal.cs (Literal::GetValue): New abstract method to return the actual
11933         value of the literal, cast as an object.
11934
11935         (*Literal): Implement GetValue method.
11936
11937         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
11938         expressions to the arraylist but objects of type Argument.
11939
11940         * class.cs (TypeContainer::Emit): Emit our attributes too.
11941
11942         (Method::Emit, Constructor::Emit): Ditto.
11943
11944         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
11945         to be ignoring earlier.
11946
11947 2001-11-03  Ravi Pratap  <ravi@ximian.com>
11948
11949         * attribute.cs (AttributeSection::Define): Implement to do the business
11950         of constructing a CustomAttributeBuilder.
11951
11952         (Attribute): New trivial class. Increases readability of code.  
11953
11954         * cs-parser.jay : Update accordingly.
11955
11956         (positional_argument_list, named_argument_list, named_argument): New rules
11957
11958         (attribute_arguments): Use the above so that we are more correct.
11959         
11960 2001-11-02  Ravi Pratap  <ravi@ximian.com>
11961         
11962         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
11963         to perform all checks for a method with a params parameter.
11964
11965         (Invocation::OverloadResolve): Update to use the above method and therefore
11966         cope correctly with params method invocations.
11967
11968         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
11969         params too.
11970
11971         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
11972         constructors in our parent too because we can't afford to miss out on 
11973         protected ones ;-)
11974
11975         * attribute.cs (AttributeSection): New name for the class Attribute
11976
11977         Other trivial changes to improve readability.
11978
11979         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
11980         use the new class names.
11981         
11982 2001-11-01  Ravi Pratap  <ravi@ximian.com>
11983
11984         * class.cs (Method::Define): Complete definition for params types too
11985
11986         (Indexer::Define): Ditto.
11987
11988         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
11989         Cope everywhere with a request for info about the array parameter.
11990
11991 2001-11-01  Ravi Pratap  <ravi@ximian.com>
11992
11993         * tree.cs (RecordNamespace): Fix up to check for the correct key.
11994
11995         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
11996         local_variable_type to extract the string corresponding to the type.
11997
11998         (local_variable_type): Fixup the action to use the new helper method.
11999
12000         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
12001         go.
12002
12003         * expression.cs : Clean out code which uses the above.
12004
12005 2001-10-31  Ravi Pratap  <ravi@ximian.com>
12006         
12007         * typemanager.cs (RegisterMethod): Check if we already have an existing key
12008         and bale out if necessary by returning a false.
12009
12010         (RegisterProperty): Ditto.
12011
12012         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
12013         and print out appropriate error messages.
12014
12015         * interface.cs (everywhere): Ditto.
12016
12017         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
12018         location to constructor.
12019
12020         * class.cs (Property, Event, Indexer): Update accordingly.
12021
12022         * ../errors/cs111.cs : Added.
12023
12024         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
12025         of a method, as laid down by the spec.
12026
12027         (Invocation::OverloadResolve): Use the above method.
12028
12029 2001-10-31  Ravi Pratap  <ravi@ximian.com>
12030
12031         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
12032         now take a TypeContainer and a Parameters object.
12033
12034         (ParameterData): Modify return type of ParameterModifier method to be 
12035         Parameter.Modifier and not a string.
12036
12037         (ReflectionParameters, InternalParameters): Update accordingly.
12038
12039         * expression.cs (Argument::GetParameterModifier): Same here.
12040
12041         * support.cs (InternalParameters::ParameterType): Find a better way of determining
12042         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
12043         symbol in it at all so maybe this is only for now.
12044
12045 2001-10-30  Ravi Pratap  <ravi@ximian.com>
12046
12047         * support.cs (InternalParameters): Constructor now takes an extra argument 
12048         which is the actual Parameters class.
12049
12050         (ParameterDesc): Update to provide info on ref/out modifiers.
12051
12052         * class.cs (everywhere): Update call to InternalParameters to pass in
12053         the second argument too.
12054
12055         * support.cs (ParameterData): Add ParameterModifier, which is a method 
12056         to return the modifier info [ref/out etc]
12057
12058         (InternalParameters, ReflectionParameters): Implement the above.
12059
12060         * expression.cs (Argument::ParameterModifier): Similar function to return
12061         info about the argument's modifiers.
12062
12063         (Invocation::OverloadResolve): Update to take into account matching modifiers 
12064         too.
12065
12066         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
12067         a new SetFormalParameters object which we pass to InternalParameters.
12068
12069 2001-10-30  Ravi Pratap  <ravi@ximian.com>
12070
12071         * expression.cs (NewArray): Merge into the ArrayCreation class.
12072
12073 2001-10-29  Ravi Pratap  <ravi@ximian.com>
12074
12075         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
12076         NewUserdefinedArray into one as there wasn't much of a use in having
12077         two separate ones.
12078
12079         * expression.cs (Argument): Change field's name to ArgType from Type.
12080
12081         (Type): New readonly property which returns the proper type, taking into 
12082         account ref/out modifiers.
12083
12084         (everywhere): Adjust code accordingly for the above.
12085
12086         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
12087         whether we are emitting for a ref or out parameter.
12088
12089         * expression.cs (Argument::Emit): Use the above field to set the state.
12090
12091         (LocalVariableReference::Emit): Update to honour the flag and emit the
12092         right stuff.
12093
12094         * parameter.cs (Attributes): Set the correct flags for ref parameters.
12095
12096         * expression.cs (Argument::FullDesc): New function to provide a full desc.
12097
12098         * support.cs (ParameterData): Add method ParameterDesc to the interface.
12099
12100         (ReflectionParameters, InternalParameters): Implement the above method.
12101
12102         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
12103         reporting errors.
12104
12105         (Invocation::FullMethodDesc): Ditto. 
12106
12107 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
12108
12109         * cs-parser.jay: Add extra production for the second form of array
12110         creation. 
12111
12112         * expression.cs (ArrayCreation): Update to reflect the above
12113         change. 
12114
12115         * Small changes to prepare for Array initialization.
12116
12117 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
12118
12119         * typemanager.cs (ImplementsInterface): interface might be null;
12120         Deal with this problem;
12121
12122         Also, we do store negative hits on the cache (null values), so use
12123         this instead of calling t.GetInterfaces on the type everytime.
12124
12125 2001-10-28  Ravi Pratap  <ravi@ximian.com>
12126
12127         * typemanager.cs (IsBuiltinType): New method to help determine the same.
12128
12129         * expression.cs (New::DoResolve): Get rid of array creation code and instead
12130         split functionality out into different classes.
12131
12132         (New::FormArrayType): Move into NewBuiltinArray.
12133
12134         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
12135         quite useless.
12136
12137         (NewBuiltinArray): New class to handle creation of built-in arrays.
12138
12139         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
12140         account creation of one-dimensional arrays.
12141
12142         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
12143
12144         (NewUserdefinedArray::DoResolve): Implement.
12145
12146         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
12147
12148         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
12149         we maintain inside the TypeManager. This is necessary to perform lookups on the
12150         module builder.
12151
12152         (LookupType): Update to perform GetType on the module builders too.     
12153
12154         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
12155
12156         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
12157
12158 2001-10-23  Ravi Pratap  <ravi@ximian.com>
12159
12160         * expression.cs (New::DoResolve): Implement guts of array creation.
12161
12162         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
12163         
12164 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
12165
12166         * expression.cs: Fix bug I introduced lsat night that broke
12167         Delegates. 
12168
12169         (Expression.Resolve): Report a 246 error (can not resolve name)
12170         if we find a SimpleName in the stream.
12171         
12172         (Expression.ResolveLValue): Ditto.
12173         
12174         (Expression.ResolveWithSimpleName): This function is a variant of
12175         ResolveName, this one allows SimpleNames to be returned without a
12176         warning.  The only consumer of SimpleNames is MemberAccess
12177
12178 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
12179
12180         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
12181         might arrive here.  I have my doubts that this is correct.
12182
12183         * statement.cs (Lock): Implement lock statement.
12184
12185         * cs-parser.jay: Small fixes to support `lock' and `using'
12186
12187         * cs-tokenizer.cs: Remove extra space
12188
12189         * driver.cs: New flag --checked, allows to turn on integer math
12190         checking. 
12191
12192         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
12193         Threading.Monitor.Exit 
12194         
12195 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
12196
12197         * expression.cs (IndexerAccess::DoResolveLValue): Set the
12198         Expression Class to be IndexerAccess.
12199
12200         Notice that Indexer::DoResolve sets the eclass to Value.
12201
12202 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
12203
12204         * class.cs (TypeContainer::Emit): Emit code for indexers.
12205
12206         * assign.cs (IAssignMethod): New interface implemented by Indexers
12207         and Properties for handling assignment.
12208
12209         (Assign::Emit): Simplify and reuse code. 
12210         
12211         * expression.cs (IndexerAccess, PropertyExpr): Implement
12212         IAssignMethod, clean up old code. 
12213
12214 2001-10-22  Ravi Pratap  <ravi@ximian.com>
12215
12216         * typemanager.cs (ImplementsInterface): New method to determine if a type
12217         implements a given interface. Provides a nice cache too.
12218
12219         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
12220         method.
12221
12222         (ConvertReferenceExplicit): Ditto.
12223
12224         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
12225         various methods, with correct names etc.
12226
12227         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
12228         Operator.UnaryNegation.
12229
12230         * cs-parser.jay (operator_declarator): Be a little clever in the case where
12231         we have a unary plus or minus operator.
12232
12233         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
12234         UnaryMinus.
12235
12236         * everywhere : update accordingly.
12237
12238         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
12239         respectively.
12240
12241         * class.cs (Method::Define): For the case where we are implementing a method
12242         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
12243         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
12244         
12245 2001-10-21  Ravi Pratap  <ravi@ximian.com>
12246
12247         * interface.cs (FindMembers): Implement to work around S.R.E
12248         lameness.
12249
12250         * typemanager.cs (IsInterfaceType): Implement.
12251
12252         (FindMembers): Update to handle interface types too.
12253
12254         * expression.cs (ImplicitReferenceConversion): Re-write bits which
12255         use IsAssignableFrom as that is not correct - it doesn't work.
12256
12257         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
12258         and accordingly override EmitStatement.
12259
12260         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
12261         using the correct logic :-)
12262
12263 2001-10-19  Ravi Pratap  <ravi@ximian.com>
12264
12265         * ../errors/cs-11.cs : Add to demonstrate error -11 
12266
12267 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
12268
12269         * assign.cs (Assign::Resolve): Resolve right hand side first, and
12270         then pass this as a hint to ResolveLValue.
12271         
12272         * expression.cs (FieldExpr): Add Location information
12273
12274         (FieldExpr::LValueResolve): Report assignment to readonly
12275         variable. 
12276         
12277         (Expression::ExprClassFromMemberInfo): Pass location information.
12278
12279         (Expression::ResolveLValue): Add new method that resolves an
12280         LValue. 
12281
12282         (Expression::DoResolveLValue): Default invocation calls
12283         DoResolve. 
12284
12285         (Indexers): New class used to keep track of indexers in a given
12286         Type. 
12287
12288         (IStackStore): Renamed from LValue, as it did not really describe
12289         what this did.  Also ResolveLValue is gone from this interface and
12290         now is part of Expression.
12291
12292         (ElementAccess): Depending on the element access type
12293         
12294         * typemanager.cs: Add `indexer_name_type' as a Core type
12295         (System.Runtime.CompilerServices.IndexerNameAttribute)
12296
12297         * statement.cs (Goto): Take a location.
12298         
12299 2001-10-18  Ravi Pratap  <ravi@ximian.com>
12300
12301         * delegate.cs (Delegate::VerifyDelegate): New method to verify
12302         if two delegates are compatible.
12303
12304         (NewDelegate::DoResolve): Update to take care of the case when
12305         we instantiate a delegate from another delegate.
12306
12307         * typemanager.cs (FindMembers): Don't even try to look up members
12308         of Delegate types for now.
12309
12310 2001-10-18  Ravi Pratap  <ravi@ximian.com>
12311
12312         * delegate.cs (NewDelegate): New class to take care of delegate
12313         instantiation.
12314
12315         * expression.cs (New): Split the delegate related code out into 
12316         the NewDelegate class.
12317
12318         * delegate.cs (DelegateInvocation): New class to handle delegate 
12319         invocation.
12320
12321         * expression.cs (Invocation): Split out delegate related code into
12322         the DelegateInvocation class.
12323
12324 2001-10-17  Ravi Pratap  <ravi@ximian.com>
12325
12326         * expression.cs (New::DoResolve): Implement delegate creation fully
12327         and according to the spec.
12328
12329         (New::DoEmit): Update to handle delegates differently.
12330
12331         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
12332         because of which we were printing out arguments in reverse order !
12333
12334         * delegate.cs (VerifyMethod): Implement to check if the given method
12335         matches the delegate.
12336
12337         (FullDelegateDesc): Implement.
12338
12339         (VerifyApplicability): Implement.
12340
12341         * expression.cs (Invocation::DoResolve): Update to accordingly handle
12342         delegate invocations too.
12343
12344         (Invocation::Emit): Ditto.
12345
12346         * ../errors/cs1593.cs : Added.
12347
12348         * ../errors/cs1594.cs : Added.
12349
12350         * delegate.cs (InstanceExpression, TargetMethod): New properties.
12351
12352 2001-10-16  Ravi Pratap  <ravi@ximian.com>
12353
12354         * typemanager.cs (intptr_type): Core type for System.IntPtr
12355
12356         (InitCoreTypes): Update for the same.
12357
12358         (iasyncresult_type, asynccallback_type): Ditto.
12359
12360         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
12361         correct.
12362
12363         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
12364         too.
12365
12366         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
12367         the builders for the 4 members of a delegate type :-)
12368
12369         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
12370         type.
12371
12372         * expression.cs (New::DoResolve): Implement guts for delegate creation.
12373
12374         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
12375
12376 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
12377
12378         * statement.cs (Break::Emit): Implement.   
12379         (Continue::Emit): Implement.
12380
12381         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12382         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12383         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12384         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
12385         end loop
12386         
12387         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
12388         properties that track the label for the current loop (begin of the
12389         loop and end of the loop).
12390
12391 2001-10-15  Ravi Pratap  <ravi@ximian.com>
12392
12393         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
12394         use of emitting anything at all.
12395
12396         * class.cs, rootcontext.cs : Get rid of calls to the same.
12397
12398         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
12399
12400         (Populate): Define the constructor correctly and set the implementation
12401         attributes.
12402
12403         * typemanager.cs (delegate_types): New hashtable to hold delegates that
12404         have been defined.
12405
12406         (AddDelegateType): Implement.
12407
12408         (IsDelegateType): Implement helper method.
12409
12410         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
12411
12412         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
12413         and accordingly handle it.
12414
12415         * delegate.cs (Populate): Take TypeContainer argument.
12416         Implement bits to define the Invoke method. However, I still haven't figured out
12417         how to take care of the native int bit :-(
12418
12419         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
12420         Qualify the name of the delegate, not its return type !
12421
12422         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
12423         conversion.
12424
12425         (StandardConversionExists): Checking for array types turns out to be recursive.
12426
12427         (ConvertReferenceExplicit): Implement array conversion.
12428
12429         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
12430         
12431 2001-10-12  Ravi Pratap  <ravi@ximian.com>
12432
12433         * cs-parser.jay (delegate_declaration): Store the fully qualified
12434         name as it is a type declaration.
12435
12436         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
12437         readonly.
12438
12439         (DefineDelegate): Renamed from Define. Does the same thing essentially,
12440         as TypeContainer::DefineType.
12441
12442         (Populate): Method in which all the definition of the various methods (Invoke)
12443         etc is done.
12444
12445         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
12446         see.
12447         
12448         (CloseDelegate): Finally creates the delegate.
12449
12450         * class.cs (TypeContainer::DefineType): Update to define delegates.
12451         (Populate, Emit and CloseType): Do the same thing here too.
12452
12453         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
12454         delegates in all these operations.
12455
12456 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
12457
12458         * expression.cs: LocalTemporary: a new expression used to
12459         reference a temporary that has been created.
12460
12461         * assign.cs: Handle PropertyAccess back here, so that we can
12462         provide the proper semantic access to properties.
12463
12464         * expression.cs (Expression::ConvertReferenceExplicit): Implement
12465         a few more explicit conversions. 
12466
12467         * modifiers.cs: `NEW' modifier maps to HideBySig.
12468
12469         * expression.cs (PropertyExpr): Make this into an
12470         ExpressionStatement, and support the EmitStatement code path. 
12471
12472         Perform get/set error checking, clean up the interface.
12473
12474         * assign.cs: recognize PropertyExprs as targets, and if so, turn
12475         them into toplevel access objects.
12476
12477 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
12478
12479         * expression.cs: PropertyExpr::PropertyExpr: use work around the
12480         SRE.
12481
12482         * typemanager.cs: Keep track here of our PropertyBuilders again to
12483         work around lameness in SRE.
12484
12485 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
12486
12487         * expression.cs (LValue::LValueResolve): New method in the
12488         interface, used to perform a second resolution pass for LValues. 
12489         
12490         (This::DoResolve): Catch the use of this in static methods.
12491
12492         (This::LValueResolve): Implement.
12493
12494         (This::Store): Remove warning, assigning to `this' in structures
12495         is 
12496
12497         (Invocation::Emit): Deal with invocation of
12498         methods on value types.  We need to pass the address to structure
12499         methods rather than the object itself.  (The equivalent code to
12500         emit "this" for structures leaves the entire structure on the
12501         stack instead of a pointer to it). 
12502
12503         (ParameterReference::DoResolve): Compute the real index for the
12504         argument based on whether the method takes or not a `this' pointer
12505         (ie, the method is static).
12506
12507         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
12508         value types returned from functions when we need to invoke a
12509         method on the sturcture.
12510         
12511
12512 2001-10-11  Ravi Pratap  <ravi@ximian.com>
12513
12514         * class.cs (TypeContainer::DefineType): Method to actually do the business of
12515         defining the type in the Modulebuilder or Typebuilder. This is to take
12516         care of nested types which need to be defined on the TypeBuilder using
12517         DefineNestedMethod.
12518
12519         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
12520         methods in RootContext, only ported to be part of TypeContainer.
12521
12522         (TypeContainer::GetInterfaceOrClass): Ditto.
12523
12524         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
12525
12526         * interface.cs (Interface::DefineInterface): New method. Does exactly
12527         what RootContext.CreateInterface did earlier, only it takes care of nested types 
12528         too.
12529
12530         (Interface::GetInterfaces): Move from RootContext here and port.
12531
12532         (Interface::GetInterfaceByName): Same here.
12533
12534         * rootcontext.cs (ResolveTree): Re-write.
12535
12536         (PopulateTypes): Re-write.
12537
12538         * class.cs (TypeContainer::Populate): Populate nested types too.
12539         (TypeContainer::Emit): Emit nested members too.
12540
12541         * typemanager.cs (AddUserType): Do not make use of the FullName property,
12542         instead just use the name argument passed in as it is already fully
12543         qualified.
12544
12545         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
12546         to TypeContainer mapping to see if a type is user-defined.
12547
12548         * class.cs (TypeContainer::CloseType): Implement. 
12549
12550         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
12551         the default constructor.
12552         
12553         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
12554         twice.
12555
12556         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
12557
12558         * interface.cs (CloseType): Create the type here.
12559         
12560         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
12561         the hierarchy.
12562
12563         Remove all the methods which are now in TypeContainer.
12564
12565 2001-10-10  Ravi Pratap  <ravi@ximian.com>
12566
12567         * delegate.cs (Define): Re-write bits to define the delegate
12568         correctly.
12569
12570 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
12571
12572         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
12573
12574         * expression.cs (ImplicitReferenceConversion): handle null as well
12575         as a source to convert to any reference type.
12576
12577         * statement.cs (Return): Perform any implicit conversions to
12578         expected return type.  
12579
12580         Validate use of return statement.  
12581
12582         * codegen.cs (EmitContext): Pass the expected return type here.
12583
12584         * class.cs (Method, Constructor, Property): Pass expected return
12585         type to EmitContext.
12586
12587 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
12588
12589         * expression.cs: Make DoResolve take an EmitContext instead of a
12590         TypeContainer.
12591
12592         Replaced `l' and `location' for `loc', for consistency.
12593         
12594         (Error, Warning): Remove unneeded Tc argument.
12595
12596         * assign.cs, literal.cs, constant.cs: Update to new calling
12597         convention. 
12598         
12599         * codegen.cs: EmitContext now contains a flag indicating whether
12600         code is being generated in a static method or not.
12601
12602         * cs-parser.jay: DecomposeQI, new function that replaces the old
12603         QualifiedIdentifier.  Now we always decompose the assembled
12604         strings from qualified_identifier productions into a group of
12605         memberaccesses.
12606
12607 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
12608
12609         * rootcontext.cs: Deal with field-less struct types correctly now
12610         by passing the size option to Define Type.
12611
12612         * class.cs: Removed hack that created one static field. 
12613
12614 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
12615
12616         * statement.cs: Moved most of the code generation here. 
12617
12618 2001-10-09  Ravi Pratap  <ravi@ximian.com>
12619
12620         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
12621         seem very right.
12622
12623         (ElementAccess): Remove useless bits for now - keep checks as the spec
12624         says.
12625
12626 2001-10-08  Ravi Pratap  <ravi@ximian.com>
12627
12628         * expression.cs (ElementAccess::DoResolve): Remove my crap code
12629         and start performing checks according to the spec.
12630
12631 2001-10-07  Ravi Pratap  <ravi@ximian.com>
12632
12633         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
12634         rank_specifiers instead.
12635
12636         (rank_specifiers): Change the order in which the rank specifiers are stored
12637
12638         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
12639
12640         * expression.cs (ElementAccess): Implement the LValue interface too.
12641         
12642 2001-10-06  Ravi Pratap  <ravi@ximian.com>
12643         
12644         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
12645         except that user defined conversions are not included.
12646
12647         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
12648         perform the conversion of the return type, if necessary.
12649
12650         (New::DoResolve): Check whether we are creating an array or an object
12651         and accordingly do the needful.
12652
12653         (New::Emit): Same here.
12654
12655         (New::DoResolve): Implement guts of array creation.
12656
12657         (New::FormLookupType): Helper function.
12658
12659 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
12660
12661         * codegen.cs: Removed most of the code generation here, and move the
12662         corresponding code generation bits to the statement classes. 
12663
12664         Added support for try/catch/finalize and throw.
12665         
12666         * cs-parser.jay: Added support for try/catch/finalize.
12667
12668         * class.cs: Catch static methods having the flags override,
12669         virtual or abstract.
12670
12671         * expression.cs (UserCast): This user cast was not really doing
12672         what it was supposed to do.  Which is to be born in fully resolved
12673         state.  Parts of the resolution were being performed at Emit time! 
12674
12675         Fixed this code.
12676
12677 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
12678
12679         * expression.cs: Implicity convert the result from UserCast.
12680
12681 2001-10-05  Ravi Pratap  <ravi@ximian.com>
12682
12683         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
12684         prevented it from working correctly. 
12685
12686         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
12687         merely ConvertImplicit.
12688
12689 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
12690
12691         * typemanager.cs: Make the LookupTypeContainer function static,
12692         and not per-instance.  
12693
12694         * class.cs: Make static FindMembers (the one that takes a Type
12695         argument). 
12696
12697         * codegen.cs: Add EmitForeach here.
12698
12699         * cs-parser.jay: Make foreach a toplevel object instead of the
12700         inline expansion, as we need to perform semantic analysis on it. 
12701
12702 2001-10-05  Ravi Pratap  <ravi@ximian.com>
12703
12704         * expression.cs (Expression::ImplicitUserConversion): Rename to
12705         UserDefinedConversion.
12706
12707         (Expression::UserDefinedConversion): Take an extra argument specifying 
12708         whether we look for explicit user conversions too.
12709
12710         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
12711
12712         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
12713
12714         (ExplicitUserConversion): Make it a call to UserDefinedConversion
12715         with the appropriate arguments.
12716
12717         * cs-parser.jay (cast_expression): Record location too.
12718
12719         * expression.cs (Cast): Record location info.
12720
12721         (Expression::ConvertExplicit): Take location argument.
12722
12723         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
12724         to determine if we are doing explicit conversions.
12725
12726         (UserCast::Emit): Update accordingly.
12727
12728         (Expression::ConvertExplicit): Report an error if everything fails.
12729
12730         * ../errors/cs0030.cs : Add.
12731
12732 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
12733
12734         * modifiers.cs: If the ABSTRACT keyword is present, also set the
12735         virtual and newslot bits. 
12736
12737         * class.cs (TypeContainer::RegisterRequiredImplementations):
12738         Record methods we need.
12739
12740         (TypeContainer::MakeKey): Helper function to make keys for
12741         MethodBases, since the Methodbase key is useless.
12742
12743         (TypeContainer::Populate): Call RegisterRequiredImplementations
12744         before defining the methods.   
12745
12746         Create a mapping for method_builders_to_methods ahead of time
12747         instead of inside a tight loop.
12748
12749         (::RequireMethods):  Accept an object as the data to set into the
12750         hashtable so we can report interface vs abstract method mismatch.
12751
12752 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
12753
12754         * report.cs: Make all of it static.
12755
12756         * rootcontext.cs: Drop object_type and value_type computations, as
12757         we have those in the TypeManager anyways.
12758
12759         Drop report instance variable too, now it is a global.
12760
12761         * driver.cs: Use try/catch on command line handling.
12762
12763         Add --probe option to debug the error reporting system with a test
12764         suite. 
12765
12766         * report.cs: Add support for exiting program when a probe
12767         condition is reached.
12768
12769 2001-10-03  Ravi Pratap  <ravi@ximian.com>
12770
12771         * expression.cs (Binary::DoNumericPromotions): Fix the case when
12772         we do a forcible conversion regardless of type, to check if 
12773         ForceConversion returns a null.
12774
12775         (Binary::error19): Use location to report error.
12776
12777         (Unary::error23): Use location here too.
12778
12779         * ../errors/cs0019.cs : Check in.
12780
12781         * ../errors/cs0023.cs : Check in.
12782
12783         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
12784         case of a non-null MethodInfo object with a length of 0 !
12785
12786         (Binary::ResolveOperator): Flag error if overload resolution fails to find
12787         an applicable member - according to the spec :-)
12788         Also fix logic to find members in base types.
12789
12790         (Unary::ResolveOperator): Same here.
12791
12792         (Unary::report23): Change name to error23 and make first argument a TypeContainer
12793         as I was getting thoroughly confused between this and error19 :-)
12794         
12795         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
12796         (::FindMostEncompassedType): Implement.
12797         (::FindMostEncompassingType): Implement.
12798         (::StandardConversionExists): Implement.
12799
12800         (UserImplicitCast): Re-vamp. We now need info about most specific
12801         source and target types so that we can do the necessary conversions.
12802
12803         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
12804         mathematical union with no duplicates.
12805
12806 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
12807
12808         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
12809         in order from base classes to child classes, so that we can in
12810         child classes look up in our parent for method names and
12811         attributes (required for handling abstract, virtual, new, override
12812         constructs: we need to instrospect our base class, and if we dont
12813         populate the classes in order, the introspection might be
12814         incorrect.  For example, a method could query its parent before
12815         the parent has any methods and would determine that the parent has
12816         no abstract methods (while it could have had them)).
12817
12818         (RootContext::CreateType): Record the order in which we define the
12819         classes.
12820
12821 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
12822
12823         * class.cs (TypeContainer::Populate): Also method definitions can
12824         fail now, keep track of this.
12825
12826         (TypeContainer::FindMembers): Implement support for
12827         DeclaredOnly/noDeclaredOnly flag.
12828
12829         (Constructor::Emit) Return the ConstructorBuilder.
12830
12831         (Method::Emit) Return the MethodBuilder. 
12832         Check for abstract or virtual methods to be public.
12833
12834         * rootcontext.cs (RootContext::CreateType): Register all the
12835         abstract methods required for the class to be complete and the
12836         interface methods that must be implemented. 
12837
12838         * cs-parser.jay: Report error 501 (method requires body if it is
12839         not marked abstract or extern).
12840
12841         * expression.cs (TypeOf::Emit): Implement.
12842
12843         * typemanager.cs: runtime_handle_type, new global type.
12844
12845         * class.cs (Property::Emit): Generate code for properties.
12846
12847 2001-10-02  Ravi Pratap  <ravi@ximian.com>
12848
12849         * expression.cs (Unary::ResolveOperator): Find operators on base type
12850         too - we now conform exactly to the spec.
12851
12852         (Binary::ResolveOperator): Same here.
12853
12854         * class.cs (Operator::Define): Fix minor quirk in the tests.
12855
12856         * ../errors/cs0215.cs : Added.
12857
12858         * ../errors/cs0556.cs : Added.
12859
12860         * ../errors/cs0555.cs : Added.
12861
12862 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
12863
12864         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
12865         single integer which is really efficient
12866
12867 2001-10-01  Ravi Pratap  <ravi@ximian.com>
12868
12869         *  expression.cs (Expression::ImplicitUserConversion): Use location
12870         even in the case when we are examining True operators.
12871  
12872         * class.cs (Operator::Define): Perform extensive checks to conform
12873         with the rules for operator overloading in the spec.
12874
12875         * expression.cs (Expression::ImplicitReferenceConversion): Implement
12876         some of the other conversions mentioned in the spec.
12877
12878         * typemanager.cs (array_type): New static member for the System.Array built-in
12879         type.
12880
12881         (cloneable_interface): For System.ICloneable interface.
12882
12883         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
12884         we start resolving the tree and populating types.
12885
12886         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
12887  
12888 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
12889
12890         * expression.cs (Expression::ExprClassFromMemberInfo,
12891         Expression::Literalize): Create literal expressions from
12892         FieldInfos which are literals.
12893
12894         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
12895         type casts, because they were wrong.  The test suite in tests
12896         caught these ones.
12897
12898         (ImplicitNumericConversion): ushort to ulong requires a widening
12899         cast. 
12900
12901         Int32 constant to long requires widening cast as well.
12902
12903         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
12904         for integers because the type on the stack is not i4.
12905
12906 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
12907
12908         * expression.cs (report118): require location argument. 
12909
12910         * parameter.cs: Do not dereference potential null value.
12911
12912         * class.cs: Catch methods that lack the `new' keyword when
12913         overriding a name.  Report warnings when `new' is used without
12914         anything being there to override.
12915
12916         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
12917
12918         * class.cs: Only add constructor to hashtable if it is non-null
12919         (as now constructors can fail on define).
12920
12921         (TypeManager, Class, Struct): Take location arguments.
12922
12923         Catch field instance initialization in structs as errors.
12924
12925         accepting_filter: a new filter for FindMembers that is static so
12926         that we dont create an instance per invocation.
12927
12928         (Constructor::Define): Catch errors where a struct constructor is
12929         parameterless 
12930
12931         * cs-parser.jay: Pass location information for various new
12932         constructs. 
12933         
12934         * delegate.cs (Delegate): take a location argument.
12935
12936         * driver.cs: Do not call EmitCode if there were problesm in the
12937         Definition of the types, as many Builders wont be there. 
12938
12939         * decl.cs (Decl::Decl): Require a location argument.
12940
12941         * cs-tokenizer.cs: Handle properly hex constants that can not fit
12942         into integers, and find the most appropiate integer for it.
12943
12944         * literal.cs: Implement ULongLiteral.
12945
12946         * rootcontext.cs: Provide better information about the location of
12947         failure when CreateType fails.
12948         
12949 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
12950
12951         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
12952         as well.
12953
12954         * expression.cs (Binary::CheckShiftArguments): Add missing type
12955         computation.
12956         (Binary::ResolveOperator): Add type to the logical and and logical
12957         or, Bitwise And/Or and Exclusive Or code paths, it was missing
12958         before.
12959
12960         (Binary::DoNumericPromotions): In the case where either argument
12961         is ulong (and most signed types combined with ulong cause an
12962         error) perform implicit integer constant conversions as well.
12963
12964 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
12965
12966         * expression.cs (UserImplicitCast): Method should always be
12967         non-null. 
12968         (Invocation::BetterConversion): Simplified test for IntLiteral.
12969
12970         (Expression::ImplicitNumericConversion): Split this routine out.
12971         Put the code that performs implicit constant integer conversions
12972         here. 
12973
12974         (Expression::Resolve): Become a wrapper around DoResolve so we can
12975         check eclass and type being set after resolve.
12976
12977         (Invocation::Badness): Remove this dead function
12978
12979         (Binary::ResolveOperator): Do not compute the expensive argumnets
12980         unless we have a union for it.
12981
12982         (Probe::Emit): Is needs to do an isinst and then
12983         compare against null.
12984
12985         (::CanConvert): Added Location argument.  If the Location argument
12986         is null (Location.Null), then we do not report errors.  This is
12987         used by the `probe' mechanism of the Explicit conversion.  We do
12988         not want to generate an error for something that the user
12989         explicitly requested to be casted.  But the pipeline for an
12990         explicit cast first tests for potential implicit casts.
12991
12992         So for now, if the Location is null, it means `Probe only' to
12993         avoid adding another argument.   Might have to revise this
12994         strategy later.
12995
12996         (ClassCast): New class used to type cast objects into arbitrary
12997         classes (used in Explicit Reference Conversions).
12998
12999         Implement `as' as well.
13000
13001         Reverted all the patches from Ravi below: they were broken:
13002
13003                 * The use of `level' as a mechanism to stop recursive
13004                   invocations is wrong.  That was there just to catch the
13005                   bug with a strack trace but not as a way of addressing
13006                   the problem.
13007
13008                   To fix the problem we have to *understand* what is going
13009                   on and the interactions and come up with a plan, not
13010                   just get things going.
13011
13012                 * The use of the type conversion cache that I proposed
13013                   last night had an open topic: How does this work across
13014                   protection domains.  A user defined conversion might not
13015                   be public in the location where we are applying the
13016                   conversion, a different conversion might be selected
13017                   (ie, private A->B (better) but public B->A (worse),
13018                   inside A, A->B applies, but outside it, B->A will
13019                   apply).
13020
13021                 * On top of that (ie, even if the above is solved),
13022                   conversions in a cache need to be abstract.  Ie, `To
13023                   convert from an Int to a Short use an OpcodeCast', not
13024                   `To convert from an Int to a Short use the OpcodeCast on
13025                   the variable 5' (which is what this patch was doing).
13026         
13027 2001-09-28  Ravi Pratap  <ravi@ximian.com>
13028
13029         * expression.cs (Invocation::ConversionExists): Re-write to use
13030         the conversion cache
13031         
13032         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
13033         cache all conversions done, not just user-defined ones.
13034
13035         (Invocation::BetterConversion): The real culprit. Use ConversionExists
13036         to determine if a conversion exists instead of acutually trying to 
13037         perform the conversion. It's faster too.
13038
13039         (Expression::ConvertExplicit): Modify to use ConversionExists to check
13040         and only then attempt the implicit conversion.
13041
13042 2001-09-28  Ravi Pratap  <ravi@ximian.com>
13043
13044         * expression.cs (ConvertImplicit): Use a cache for conversions
13045         already found. Check level of recursion and bail out if necessary.
13046         
13047 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
13048
13049         * typemanager.cs (string_concat_string_string, string_concat_object_object):
13050         Export standard methods that we expect for string operations.
13051         
13052         * statement.cs (Block::UsageWarning): Track usage of variables and
13053         report the errors for not used variables.
13054
13055         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
13056         operator. 
13057
13058 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
13059
13060         * codegen.cs: remove unnneded code 
13061
13062         * expression.cs: Removed BuiltinTypeAccess class
13063
13064         Fix the order in which implicit conversions are
13065         done.  
13066
13067         The previous fixed dropped support for boxed conversions (adding a
13068         test to the test suite now)
13069
13070         (UserImplicitCast::CanConvert): Remove test for source being null,
13071         that code is broken.  We should not feed a null to begin with, if
13072         we do, then we should track the bug where the problem originates
13073         and not try to cover it up here.
13074
13075         Return a resolved expression of type UserImplicitCast on success
13076         rather than true/false.  Ravi: this is what I was talking about,
13077         the pattern is to use a static method as a "constructor" for
13078         objects. 
13079
13080         Also, do not create arguments until the very last minute,
13081         otherwise we always create the arguments even for lookups that
13082         will never be performed. 
13083
13084         (UserImplicitCast::Resolve): Eliminate, objects of type
13085         UserImplicitCast are born in a fully resolved state. 
13086         
13087         * typemanager.cs (InitCoreTypes): Init also value_type
13088         (System.ValueType). 
13089
13090         * expression.cs (Cast::Resolve): First resolve the child expression.
13091
13092         (LValue): Add new method AddressOf to be used by
13093         the `&' operator.  
13094
13095         Change the argument of Store to take an EmitContext instead of an
13096         ILGenerator, because things like FieldExpr need to be able to call
13097         their children expression to generate the instance code. 
13098
13099         (Expression::Error, Expression::Warning): Sugar functions for
13100         reporting errors.
13101
13102         (Expression::MemberLookup): Accept a TypeContainer instead of a
13103         Report as the first argument.
13104
13105         (Expression::ResolvePrimary): Killed.  I still want to improve
13106         this as currently the code is just not right.
13107
13108         (Expression::ResolveMemberAccess): Simplify, but it is still
13109         wrong. 
13110
13111         (Unary::Resolve): Catch errors in AddressOf operators.
13112
13113         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
13114         index to a byte for the short-version, or the compiler will choose
13115         the wrong Emit call, which generates the wrong data.
13116
13117         (ParameterReference::Emit, ::Store): same.
13118
13119         (FieldExpr::AddressOf): Implement.
13120         
13121         * typemanager.cs: TypeManager: made public variable instead of
13122         property.
13123         
13124         * driver.cs: document --fatal.
13125
13126         * report.cs (ErrorMessage, WarningMessage): new names for the old
13127         Error and Warning classes.
13128
13129         * cs-parser.jay (member_access): Turn built-in access to types
13130         into a normal simplename
13131
13132 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13133
13134         * expression.cs (Invocation::BetterConversion): Fix to cope
13135         with q being null, since this was introducing a bug.
13136
13137         * expression.cs (ConvertImplicit): Do built-in conversions first.
13138
13139 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13140
13141         * expression.cs (UserImplicitCast::Resolve): Fix bug.
13142
13143 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13144
13145         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
13146         I had introduced long ago (what's new ?).
13147
13148         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
13149         the work of all the checking. 
13150         (ConvertImplicit): Call CanConvert and only then create object if necessary.
13151         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
13152
13153         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
13154         that is the right way. 
13155
13156         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
13157         overloading resolution. Use everywhere instead of cutting and pasting code.
13158
13159         (Binary::ResolveOperator): Use MakeUnionSet.
13160
13161         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
13162         we have to convert to bool types. Not complete yet.
13163         
13164 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
13165
13166         * typemanager.cs (TypeManager::CSharpName): support ushort.
13167
13168         * expression.cs (Expression::TryImplicitIntConversion): Attempts
13169         to provide an expression that performsn an implicit constant int
13170         conversion (section 6.1.6).
13171         (Expression::ConvertImplicitRequired): Reworked to include
13172         implicit constant expression conversions.
13173
13174         (Expression::ConvertNumericExplicit): Finished.
13175
13176         (Invocation::Emit): If InstanceExpression is null, then it means
13177         that we perform a call on this.
13178         
13179 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
13180
13181         * expression.cs (Unary::Emit): Remove some dead code.
13182         (Probe): Implement Resolve and Emit for `is'.
13183         (Expression::ConvertImplicitRequired): Attempt to do constant
13184         expression conversions here.  Maybe should be moved to
13185         ConvertImplicit, but I am not sure.
13186         (Expression::ImplicitLongConstantConversionPossible,
13187         Expression::ImplicitIntConstantConversionPossible): New functions
13188         that tell whether is it possible to apply an implicit constant
13189         expression conversion.
13190
13191         (ConvertNumericExplicit): Started work on explicit numeric
13192         conversions.
13193
13194         * cs-parser.jay: Update operator constants.
13195
13196         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
13197         (Parameters::GetSignature): Hook up VerifyArgs here.
13198         (Parameters::VerifyArgs): Verifies that no two arguments have the
13199         same name. 
13200
13201         * class.cs (Operator): Update the operator names to reflect the
13202         ones that the spec expects (as we are just stringizing the
13203         operator names).
13204         
13205         * expression.cs (Unary::ResolveOperator): Fix bug: Use
13206         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
13207         previous usage did only work for our methods.
13208         (Expression::ConvertImplicit): Handle decimal implicit numeric
13209         conversions as well.
13210         (Expression::InternalTypeConstructor): Used to invoke constructors
13211         on internal types for default promotions.
13212
13213         (Unary::Emit): Implement special handling for the pre/post
13214         increment/decrement for overloaded operators, as they need to have
13215         the same semantics as the other operators.
13216
13217         (Binary::ResolveOperator): ditto.
13218         (Invocation::ConversionExists): ditto.
13219         (UserImplicitCast::Resolve): ditto.
13220         
13221 2001-09-26  Ravi Pratap  <ravi@ximian.com>
13222
13223         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
13224         operator, return after emitting body. Regression tests pass again !
13225
13226         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
13227         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
13228         (Invocation::OverloadResolve): Ditto.
13229         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
13230
13231         * everywhere : update calls to the above methods accordingly.
13232
13233 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
13234
13235         * assign.cs (Assign): Make it inherit from ExpressionStatement.
13236
13237         * expression.cs (ExpressionStatement): New base class used for
13238         expressions that can appear in statements, so that we can provide
13239         an alternate path to generate expression that do not leave a value
13240         on the stack.
13241
13242         (Expression::Emit, and all the derivatives): We no longer return
13243         whether a value is left on the stack or not.  Every expression
13244         after being emitted leaves a single value on the stack.
13245
13246         * codegen.cs (EmitContext::EmitStatementExpression): Use the
13247         facilties of ExpressionStatement if possible.
13248
13249         * cs-parser.jay: Update statement_expression.
13250
13251 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
13252
13253         * driver.cs: Change the wording of message
13254
13255 2001-09-25  Ravi Pratap  <ravi@ximian.com>
13256
13257         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
13258         the type of the expression to the return type of the method if
13259         we have an overloaded operator match ! The regression tests pass again !
13260         (Unary::ResolveOperator): Ditto.
13261
13262         * expression.cs (Invocation::ConversionExists): Correct the member lookup
13263         to find "op_Implicit", not "implicit" ;-)
13264         (UserImplicitCast): New class to take care of user-defined implicit conversions.
13265         (ConvertImplicit, ForceConversion): Take TypeContainer argument
13266
13267         * everywhere : Correct calls to the above accordingly.
13268
13269         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
13270         (ConvertImplicit): Do user-defined conversion if it exists.
13271
13272 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
13273
13274         * assign.cs: track location.
13275         (Resolve): Use implicit conversions on assignment.
13276
13277         * literal.cs: Oops.  Not good, Emit of short access values should
13278         pass (Bytes) or the wrong argument will be selected.
13279
13280         * expression.cs (Unary::Emit): Emit code for -expr.
13281         
13282         (Unary::ResolveOperator): Handle `Substract' for non-constants
13283         (substract from zero from the non-constants).
13284         Deal with Doubles as well. 
13285         
13286         (Expression::ConvertImplicitRequired): New routine that reports an
13287         error if no implicit conversion exists. 
13288
13289         (Invocation::OverloadResolve): Store the converted implicit
13290         expressions if we make them
13291         
13292 2001-09-24  Ravi Pratap  <ravi@ximian.com>
13293
13294         * class.cs (ConstructorInitializer): Take a Location argument.
13295         (ConstructorBaseInitializer): Same here.
13296         (ConstructorThisInitializer): Same here.
13297
13298         * cs-parser.jay : Update all calls accordingly.
13299
13300         * expression.cs (Unary, Binary, New): Take location argument.
13301         Update accordingly everywhere.
13302
13303         * cs-parser.jay : Update all calls to the above to take a location
13304         argument.
13305
13306         * class.cs : Ditto.
13307
13308 2001-09-24  Ravi Pratap  <ravi@ximian.com>
13309
13310         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
13311         (Invocation::BetterConversion): Same here
13312         (Invocation::ConversionExists): Ditto.
13313
13314         (Invocation::ConversionExists): Implement.
13315
13316 2001-09-22  Ravi Pratap  <ravi@ximian.com>
13317
13318         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
13319         Also take an additional TypeContainer argument.
13320
13321         * All over : Pass in TypeContainer as argument to OverloadResolve.
13322
13323         * typemanager.cs (CSharpName): Update to check for the string type and return
13324         that too.
13325
13326         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
13327         a given method.
13328         
13329 2001-09-21  Ravi Pratap  <ravi@ximian.com>
13330
13331         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
13332         (Invocation::BetterFunction): Implement.
13333         (Invocation::BetterConversion): Implement.
13334         (Invocation::ConversionExists): Skeleton, no implementation yet.
13335
13336         Okay, things work fine !
13337
13338 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
13339
13340         * typemanager.cs: declare and load enum_type, delegate_type and
13341         void_type. 
13342
13343         * expression.cs (Expression::Emit): Now emit returns a value that
13344         tells whether a value is left on the stack or not.  This strategy
13345         might be reveted tomorrow with a mechanism that would address
13346         multiple assignments.
13347         (Expression::report118): Utility routine to report mismatches on
13348         the ExprClass.
13349
13350         (Unary::Report23): Report impossible type/operator combination
13351         utility function.
13352
13353         (Unary::IsIncrementableNumber): Whether the type can be
13354         incremented or decremented with add.
13355         (Unary::ResolveOperator): Also allow enumerations to be bitwise
13356         complemented. 
13357         (Unary::ResolveOperator): Implement ++, !, ~,
13358
13359         (Invocation::Emit): Deal with new Emit convetion.
13360         
13361         * All Expression derivatives: Updated their Emit method to return
13362         whether they leave values on the stack or not.
13363         
13364         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
13365         stack for expressions that are statements. 
13366
13367 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
13368
13369         * expression.cs (LValue): New interface.  Must be implemented by
13370         LValue objects.
13371         (LocalVariableReference, ParameterReference, FieldExpr): Implement
13372         LValue interface.
13373         
13374         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
13375         interface for generating code, simplifies the code.
13376
13377 2001-09-20  Ravi Pratap  <ravi@ximian.com>
13378
13379         * expression.cs (everywhere): Comment out return statements in ::Resolve
13380         methods to avoid the warnings.
13381
13382 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
13383
13384         * driver.cs (parse): Report error 2001 if we can not open the
13385         source file.
13386
13387         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
13388         not resolve it.
13389
13390         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
13391         object. 
13392
13393         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
13394         otherwise nested blocks end up with the same index.
13395
13396         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
13397
13398         * expression.cs:  Instead of having FIXMEs in the Resolve
13399         functions, throw exceptions so it is obvious that we are facing a
13400         bug. 
13401
13402         * cs-parser.jay (invocation_expression): Pass Location information.
13403
13404         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
13405         Use a basename for those routines because .NET does not like paths
13406         on them. 
13407
13408         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
13409         already defined.
13410
13411 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
13412
13413         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
13414         are loading the correct data types (throws an exception if not).
13415         (TypeManager::InitCoreTypes): Use CoreLookupType
13416
13417         * expression.cs (Unary::ResolveOperator): return the child
13418         expression for expressions which are just +expr.
13419         (Unary::ResolveOperator): Return negative literals for -LITERAL
13420         expressions (otherwise they are Unary {Literal}).
13421         (Invocation::Badness): Take into account `Implicit constant
13422         expression conversions'.
13423
13424         * literal.cs (LongLiteral): Implement long literal class.
13425         (IntLiteral): export the `Value' of the intliteral. 
13426
13427 2001-09-19  Ravi Pratap  <ravi@ximian.com>
13428
13429         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
13430
13431         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
13432         instead of 'Operator'
13433
13434         * expression.cs (Binary::ResolveOperator): Update accordingly.
13435         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
13436         and 'Minus'
13437
13438         * cs-parser.jay (unary_expression): Update to use the new names.
13439
13440         * gen-treedump.cs (GetUnary): Same here.
13441
13442         * expression.cs (Unary::Resolve): Implement.
13443         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
13444         operators are found instead of making noise ;-)
13445         (Unary::ResolveOperator): New method to do precisely the same thing which
13446         Binary::ResolveOperator does for Binary expressions.
13447         (Unary.method, .Arguments): Add.
13448         (Unary::OperName): Implement.   
13449         (Unary::ForceConversion): Copy and Paste !
13450
13451         * class.cs (Operator::Define): Fix a small bug for the case when we have 
13452         a unary operator.
13453
13454         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
13455         for the inbuilt operators. Only overloading works for now ;-)
13456
13457 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
13458
13459         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
13460         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
13461
13462         * expression.cs (This::Emit): Implement. 
13463         (This::Resolve): Implement.
13464         (TypeOf:Resolve): Implement.
13465         (Expression::ResolveSimpleName): Add an implicit this to instance
13466         field references. 
13467         (MemberAccess::Resolve): Deal with Parameters and Fields. 
13468         Bind instance variable to Field expressions.
13469         (FieldExpr::Instance): New field used to track the expression that
13470         represents the object instance.
13471         (FieldExpr::Resolve): Track potential errors from MemberLookup not
13472         binding 
13473         (FieldExpr::Emit): Implement.
13474
13475         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
13476         the last instruction contains a return opcode to avoid generating
13477         the last `ret' instruction (this generates correct code, and it is
13478         nice to pass the peverify output).
13479
13480         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
13481         initializer for static and instance variables.
13482         (Constructor::Emit): Allow initializer to be null in the case of
13483         static constructors.  Only emit initializer for instance
13484         constructors. 
13485
13486         (TypeContainer::FindMembers): Return a null array if there are no
13487         matches.
13488
13489         Also fix the code for the MemberTypes.Method branch, as it was not
13490         scanning that for operators (or tried to access null variables before).
13491
13492         * assign.cs (Assign::Emit): Handle instance and static fields. 
13493
13494         * TODO: Updated.
13495
13496         * driver.cs: Stop compilation if there are parse errors.
13497
13498         * cs-parser.jay (constructor_declaration): Provide default base
13499         initializer for non-static constructors.
13500         (constructor_declarator): Do not provide a default base
13501         initializers if none was specified.
13502         Catch the fact that constructors should not have parameters.
13503
13504         * class.cs: Do not emit parent class initializers for static
13505         constructors, that should be flagged as an error.
13506
13507 2001-09-18  Ravi Pratap  <ravi@ximian.com>
13508
13509         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
13510         Move back code into TypeContainer::Populate.
13511
13512 2001-09-18  Ravi Pratap  <ravi@ximian.com>
13513
13514         * class.cs (TypeContainer::AddConstructor): Fix the check to
13515         compare against Name, not Basename. 
13516         (Operator::OpType): Change Plus and Minus to Add and Subtract.
13517
13518         * cs-parser.jay : Update accordingly.
13519
13520         * class.cs (TypeContainer::FindMembers): For the case where we are searching
13521         for methods, don't forget to look into the operators too.
13522         (RegisterMethodBuilder): Helper method to take care of this for
13523         methods, constructors and operators.
13524         (Operator::Define): Completely revamp.
13525         (Operator.OperatorMethod, MethodName): New fields.
13526         (TypeContainer::Populate): Move the registering of builders into
13527         RegisterMethodBuilder.
13528         (Operator::Emit): Re-write.
13529
13530         * expression.cs (Binary::Emit): Comment out code path to emit method
13531         invocation stuff for the case when we have a user defined operator. I am
13532         just not able to get it right !
13533         
13534 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
13535
13536         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
13537         argument. 
13538
13539         (Expression::MemberLookup): Provide a version that allows to
13540         specify the MemberTypes and BindingFlags. 
13541
13542         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
13543         so it was not fetching variable information from outer blocks.
13544
13545         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
13546         Beforefieldinit as it was buggy.
13547
13548         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
13549         that Ravi put here.  
13550
13551         * class.cs (Constructor::Emit): Only emit if block is not null.
13552         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
13553         deal with this by semantically definining it as if the user had
13554         done it.
13555
13556         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
13557         constructors as we now "emit" them at a higher level.
13558
13559         (TypeContainer::DefineDefaultConstructor): Used to define the
13560         default constructors if none was provided.
13561
13562         (ConstructorInitializer): Add methods Resolve and Emit. 
13563         
13564         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
13565
13566 2001-09-17  Ravi Pratap  <ravi@ximian.com>
13567
13568         * class.cs (TypeContainer::EmitDefaultConstructor): Register
13569         the default constructor builder with our hashtable for methodbuilders
13570         to methodcores.
13571
13572         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
13573         and argument_count is 0 in which case we have a match.
13574         (Binary::ResolveOperator): More null checking and miscellaneous coding
13575         style cleanup.
13576
13577 2001-09-17  Ravi Pratap  <ravi@ximian.com>
13578
13579         * rootcontext.cs (IsNameSpace): Compare against null.
13580
13581         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
13582
13583         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
13584         and Unary::Operator.
13585
13586         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
13587         accordingly.
13588
13589         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
13590         we have overloaded operators.
13591         (Binary::ResolveOperator): Implement the part which does the operator overload
13592         resolution.
13593
13594         * class.cs (Operator::Emit): Implement.
13595         (TypeContainer::Emit): Emit the operators we have too.
13596
13597         * expression.cs (Binary::Emit): Update to emit the appropriate code for
13598         the case when we have a user-defined operator.
13599         
13600 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
13601
13602         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
13603
13604 2001-09-16  Ravi Pratap  <ravi@ximian.com>
13605
13606         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
13607         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
13608         (Constructor::Emit): Implement.
13609         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
13610         if we have no work to do. 
13611         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
13612         Emit method.
13613
13614         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
13615         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
13616
13617         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
13618         of parent.parent.
13619
13620 2001-09-15  Ravi Pratap  <ravi@ximian.com>
13621
13622         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
13623         in the source.
13624         (Tree::RecordNamespace): Method to do what the name says ;-)
13625         (Tree::Namespaces): Property to get at the namespaces hashtable.
13626
13627         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
13628         keep track.
13629
13630         * rootcontext.cs (IsNamespace): Fixed it :-)
13631
13632 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
13633
13634         * class.cs (TypeContainer::FindMembers): Add support for
13635         constructors. 
13636         (MethodCore): New class that encapsulates both the shared aspects
13637         of a Constructor and a Method.  
13638         (Method, Constructor): Factored pieces into MethodCore.
13639
13640         * driver.cs: Added --fatal which makes errors throw exceptions.
13641         Load System assembly as well as part of the standard library.
13642
13643         * report.cs: Allow throwing exceptions on errors for debugging.
13644
13645         * modifiers.cs: Do not use `parent', instead use the real type
13646         container to evaluate permission settings.
13647
13648         * class.cs: Put Ravi's patch back in.  He is right, and we will
13649         have to cope with the
13650
13651 2001-09-14  Ravi Pratap  <ravi@ximian.com>
13652
13653         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
13654         FamORAssem, not FamANDAssem.
13655         
13656 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
13657
13658         * driver.cs: Added --parse option that only parses its input files
13659         and terminates.
13660
13661         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
13662         incorrect.  IsTopLevel is not used to tell whether an object is
13663         root_types or not (that can be achieved by testing this ==
13664         root_types).  But to see if this is a top-level *class* (not
13665         necessarly our "toplevel" container). 
13666
13667 2001-09-14  Ravi Pratap  <ravi@ximian.com>
13668
13669         * enum.cs (Enum::Define): Modify to call the Lookup method on the
13670         parent instead of a direct call to GetType.
13671
13672 2001-09-14  Ravi Pratap  <ravi@ximian.com>
13673
13674         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
13675         Modifiers.TypeAttr. This should just be a call to that method.
13676
13677         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
13678         object so that we can determine if we are top-level or not.
13679
13680         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
13681         TypeContainer too.
13682
13683         * enum.cs (Enum::Define): Ditto.
13684
13685         * modifiers.cs (FieldAttr): Re-write.
13686
13687         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
13688         (TypeContainer::HaveStaticConstructor): New property to provide access
13689         to precisely that info.
13690
13691         * modifiers.cs (MethodAttr): Re-write.
13692         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
13693
13694         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
13695         of top-level types as claimed.
13696         
13697 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
13698
13699         * expression.cs (MemberLookup): Fruitless attempt to lookup
13700         constructors.  Maybe I need to emit default constructors?  That
13701         might be it (currently .NET emits this for me automatically).
13702         (Invocation::OverloadResolve): Cope with Arguments == null.
13703         (Invocation::EmitArguments): new function, shared by the new
13704         constructor and us.
13705         (Invocation::Emit): Handle static and instance methods.  Emit
13706         proper call instruction for virtual or non-virtual invocations.
13707         (New::Emit): Implement.
13708         (New::Resolve): Implement.
13709         (MemberAccess:Resolve): Implement.
13710         (MethodGroupExpr::InstanceExpression): used conforming to the spec
13711         to track instances.
13712         (FieldExpr::Resolve): Set type.
13713
13714         * support.cs: Handle empty arguments.
13715                 
13716         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
13717         SimpleLookup): Auxiliary routines to help parse a qualifier
13718         identifier.  
13719
13720         Update qualifier_identifier rule.
13721
13722         * codegen.cs: Removed debugging messages.
13723
13724         * class.cs: Make this a global thing, this acts just as a "key" to
13725         objects that we might have around.
13726
13727         (Populate): Only initialize method_builders_to_methods once.
13728
13729         * expression.cs (PropertyExpr): Initialize type from the
13730         PropertyType. 
13731
13732         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
13733         Resolve pattern.  Attempt to implicitly convert value to boolean.
13734         Emit code.
13735
13736         * expression.cs: Set the type for the int32/int32 argument case.
13737         (Binary::ResolveOperator): Set the return type to boolean for
13738         comparission operators
13739
13740         * typemanager.cs: Remove debugging print code.
13741
13742         (Invocation::Resolve): resolve type.
13743
13744         * class.cs: Allocate a MemberInfo of the correct size, as the code
13745         elsewhere depends on the test to reflect the correct contents.
13746
13747         (Method::) Keep track of parameters, due to System.Reflection holes
13748
13749         (TypeContainer::Populate): Keep track of MethodBuilders to Method
13750         mapping here.
13751
13752         (TypeContainer::FindMembers): Use ArrayList and then copy an array
13753         of the exact size and return that.
13754
13755         (Class::LookupMethodByBuilder): New function that maps
13756         MethodBuilders to its methods.  Required to locate the information
13757         on methods because System.Reflection bit us again.
13758
13759         * support.cs: New file, contains an interface ParameterData and
13760         two implementations: ReflectionParameters and InternalParameters
13761         used to access Parameter information.  We will need to grow this
13762         as required.
13763
13764         * expression.cs (Invocation::GetParameterData): implement a cache
13765         and a wrapper around the ParameterData creation for methods. 
13766         (Invocation::OverloadResolve): Use new code.
13767
13768 2001-09-13  Ravi Pratap  <ravi@ximian.com>
13769
13770         * class.cs (TypeContainer::EmitField): Remove and move into 
13771         (Field::Define): here and modify accordingly.
13772         (Field.FieldBuilder): New member.
13773         (TypeContainer::Populate): Update accordingly.
13774         (TypeContainer::FindMembers): Implement.
13775
13776 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
13777
13778         * statement.cs: (VariableInfo::VariableType): New field to be
13779         initialized with the full type once it is resolved. 
13780
13781 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
13782
13783         * parameter.cs (GetParameterInfo): Use a type cache to compute
13784         things only once, and to reuse this information
13785
13786         * expression.cs (LocalVariableReference::Emit): Implement.
13787         (OpcodeCast::Emit): fix.
13788
13789         (ParameterReference::Resolve): Implement.
13790         (ParameterReference::Emit): Implement.
13791
13792         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
13793         that are expressions need to stay as Expressions.
13794
13795         * typemanager.cs (CSharpName): Returns the C# name of a type if
13796         possible. 
13797
13798         * expression.cs (Expression::ConvertImplicit): New function that
13799         implements implicit type conversions.
13800
13801         (Expression::ImplicitReferenceConversion): Implements implicit
13802         reference conversions.
13803
13804         (EmptyCast): New type for transparent casts.
13805
13806         (OpcodeCast): New type for casts of types that are performed with
13807         a sequence of bytecodes.
13808         
13809         (BoxedCast): New type used for casting value types into reference
13810         types.  Emits a box opcode.
13811
13812         (Binary::DoNumericPromotions): Implements numeric promotions of
13813         and computation of the Binary::Type.
13814
13815         (Binary::EmitBranchable): Optimization.
13816
13817         (Binary::Emit): Implement code emission for expressions.
13818         
13819         * typemanager.cs (TypeManager): Added two new core types: sbyte
13820         and byte.
13821
13822 2001-09-12  Ravi Pratap  <ravi@ximian.com>
13823
13824         * class.cs (TypeContainer::FindMembers): Method which does exactly
13825         what Type.FindMembers does, only we don't have to use reflection. No
13826         implementation yet.
13827
13828         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
13829         typecontainer objects as we need to get at them.
13830         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
13831
13832         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
13833         typecontainer object.
13834
13835         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
13836         of just a Report object.
13837
13838 2001-09-11  Ravi Pratap  <ravi@ximian.com>
13839
13840         * class.cs (Event::Define): Go back to using the prefixes "add_" and
13841         "remove_"
13842         (TypeContainer::Populate): Now define the delegates of the type too.
13843         (TypeContainer.Delegates): Property to access the list of delegates defined
13844         in the type.
13845
13846         * delegates.cs (Delegate::Define): Implement partially.
13847
13848         * modifiers.cs (TypeAttr): Handle more flags.
13849
13850 2001-09-11  Ravi Pratap  <ravi@ximian.com>
13851
13852         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
13853         and not <=
13854         (Operator::Define): Re-write logic to get types by using the LookupType method
13855         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
13856         (Indexer::Define): Ditto.
13857         (Event::Define): Ditto.
13858         (Property::Define): Ditto.
13859         
13860 2001-09-10  Ravi Pratap  <ravi@ximian.com>
13861
13862         * class.cs (TypeContainer::Populate): Now define operators too. 
13863         (TypeContainer.Operators): New property to access the list of operators
13864         in a type.
13865         (Operator.OperatorMethodBuilder): New member to hold the method builder
13866         for the operator we are defining.
13867         (Operator::Define): Implement.
13868
13869 2001-09-10  Ravi Pratap  <ravi@ximian.com>
13870
13871         * class.cs (Event::Define): Make the prefixes of the accessor methods
13872         addOn_ and removeOn_ 
13873
13874         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
13875         of the location being passed in too. Ideally, this should go later since all
13876         error reporting should be done through the Report object.
13877
13878         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
13879         (Populate): Iterate thru the indexers we have and define them too.
13880         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
13881         for the get and set accessors.
13882         (Indexer::Define): Implement.
13883         
13884 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
13885
13886         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
13887         my previous implementation, did not work.
13888
13889         * typemanager.cs: Add a couple of missing types (the longs).
13890
13891         * literal.cs: Use TypeManager.bool_type instead of getting it.
13892
13893         * expression.cs (EventExpr): New kind of expressions.
13894         (Expressio::ExprClassFromMemberInfo): finish
13895
13896 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
13897
13898         * assign.cs: Emit stores to static fields differently.
13899
13900 2001-09-08  Ravi Pratap  <ravi@ximian.com>
13901
13902         * Merge in changes and adjust code to tackle conflicts. Backed out my
13903         code in Assign::Resolve ;-) 
13904
13905 2001-09-08  Ravi Pratap  <ravi@ximian.com>
13906
13907         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
13908         instead Report.Error and also pass in the location.
13909         (CSharpParser::Lexer): New readonly property to return the reference
13910         to the Tokenizer object.
13911         (declare_local_variables): Use Report.Error with location instead of plain 
13912         old error.
13913         (CheckDef): Ditto.
13914
13915         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
13916         (Operator.CheckBinaryOperator): Ditto.
13917
13918         * cs-parser.jay (operator_declarator): Update accordingly.
13919
13920         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
13921         (CheckBinaryOperator): Same here.
13922
13923         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
13924         on the name without any prefixes of namespace names etc. This is because we
13925         already might have something already fully qualified like 
13926         'System.Console.WriteLine'
13927
13928         * assign.cs (Resolve): Begin implementation. Stuck ;-)
13929
13930 2001-09-07  Ravi Pratap  <ravi@ximian.com>
13931
13932         * cs-tokenizer.cs (location): Return a string which also contains
13933         the file name.
13934
13935         * expression.cs (ElementAccess): New class for expressions of the
13936         type 'element access.'
13937         (BaseAccess): New class for expressions of the type 'base access.'
13938         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
13939         respectively.
13940         
13941         * cs-parser.jay (element_access): Implement action.
13942         (base_access): Implement actions.
13943         (checked_expression, unchecked_expression): Implement.
13944
13945         * cs-parser.jay (local_variable_type): Correct and implement.
13946         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
13947
13948         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
13949
13950         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
13951         name and the specifiers.
13952
13953         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
13954         
13955         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
13956         making them all public ;-)
13957
13958         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
13959         class anyways.
13960         
13961 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
13962
13963         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
13964         PropertyExprs.
13965         (FieldExpr, PropertyExprs): New resolved expressions.
13966         (SimpleName::MemberStaticCheck): Perform static checks for access
13967         to non-static fields on static methods. Maybe this should be
13968         generalized for MemberAccesses. 
13969         (SimpleName::ResolveSimpleName): More work on simple name
13970         resolution. 
13971
13972         * cs-parser.jay (primary_expression/qualified_identifier): track
13973         the parameter index.
13974
13975         * codegen.cs (CodeGen::Save): Catch save exception, report error.
13976         (EmitContext::EmitBoolExpression): Chain to expression generation
13977         instead of temporary hack.
13978         (::EmitStatementExpression): Put generic expression code generation.
13979
13980         * assign.cs (Assign::Emit): Implement variable assignments to
13981         local variables, parameters and fields.
13982
13983 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
13984
13985         * statement.cs (Block::GetVariableInfo): New method, returns the
13986         VariableInfo for a variable name in a block.
13987         (Block::GetVariableType): Implement in terms of GetVariableInfo
13988
13989         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
13990         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
13991
13992 2001-09-06  Ravi Pratap  <ravi@ximian.com>
13993
13994         * cs-parser.jay (operator_declaration): Continue on my quest : update
13995         to take attributes argument.
13996         (event_declaration): Ditto.
13997         (enum_declaration): Ditto.
13998         (indexer_declaration): Ditto.
13999         
14000         * class.cs (Operator::Operator): Update constructor accordingly.
14001         (Event::Event): Ditto.
14002
14003         * delegate.cs (Delegate::Delegate): Same here.
14004
14005         * enum.cs (Enum::Enum): Same here.
14006         
14007 2001-09-05  Ravi Pratap  <ravi@ximian.com>
14008
14009         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
14010
14011         * ../tests/cs0658.cs : New file to demonstrate error 0658.
14012
14013         * attribute.cs (Attributes): New class to encapsulate all attributes which were
14014         being passed around as an arraylist.
14015         (Attributes::AddAttribute): Method to add attribute sections.
14016
14017         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
14018         (struct_declaration): Update accordingly.
14019         (constant_declaration): Update.
14020         (field_declaration): Update.
14021         (method_header): Update.
14022         (fixed_parameter): Update.
14023         (parameter_array): Ditto.
14024         (property_declaration): Ditto.
14025         (destructor_declaration): Ditto.
14026         
14027         * class.cs (Struct::Struct): Update constructors accordingly.
14028         (Class::Class): Ditto.
14029         (Field::Field): Ditto.
14030         (Method::Method): Ditto.
14031         (Property::Property): Ditto.
14032         (TypeContainer::OptAttribute): update property's return type.
14033         
14034         * interface.cs (Interface.opt_attributes): New member.
14035         (Interface::Interface): Update to take the extra Attributes argument.
14036
14037         * parameter.cs (Parameter::Parameter): Ditto.
14038
14039         * constant.cs (Constant::Constant): Ditto.
14040
14041         * interface.cs (InterfaceMemberBase): New OptAttributes field.
14042         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
14043         the attributes as a parameter.
14044         (InterfaceProperty): Update constructor call.
14045         (InterfaceEvent): Ditto.
14046         (InterfaceMethod): Ditto.
14047         (InterfaceIndexer): Ditto.
14048
14049         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
14050         pass the attributes too.
14051         (interface_event_declaration): Ditto.
14052         (interface_property_declaration): Ditto.
14053         (interface_method_declaration): Ditto.
14054         (interface_declaration): Ditto.
14055
14056 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
14057
14058         * class.cs (Method::Define): Track the "static Main" definition to
14059         create an entry point. 
14060
14061         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
14062         EntryPoint if we find it. 
14063
14064         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
14065         (EmitContext::ig): Make this variable public.
14066
14067         * driver.cs: Make the default output file be the first file name
14068         with the .exe extension.  
14069
14070         Detect empty compilations
14071
14072         Handle various kinds of output targets.  Handle --target and
14073         rename -t to --dumper.
14074
14075         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
14076         methods inherited from Expression return now an Expression.  This
14077         will is used during the tree rewriting as we resolve them during
14078         semantic analysis.
14079
14080         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
14081         the spec.  Missing entirely is the information about
14082         accessability of elements of it.
14083
14084         (Expression::ExprClassFromMemberInfo): New constructor for
14085         Expressions that creates a fully initialized Expression based on
14086         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
14087         a Type.
14088
14089         (Invocation::Resolve): Begin implementing resolution of invocations.
14090         
14091         * literal.cs (StringLiteral):  Implement Emit.
14092
14093 2001-09-05  Ravi Pratap  <ravi@ximian.com>
14094
14095         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
14096         member.
14097         
14098 2001-09-04  Ravi Pratap  <ravi@ximian.com>
14099
14100         * cs-parser.jay (attribute_arguments): Implement actions.
14101         (attribute): Fix bug in production. Implement action.
14102         (attribute_list): Implement.
14103         (attribute_target): Implement.
14104         (attribute_target_specifier, opt_target_specifier): Implement
14105         (CheckAttributeTarget): New method to check if the attribute target
14106         is valid.
14107         (attribute_section): Implement.
14108         (opt_attributes): Implement.
14109
14110         * attribute.cs : New file to handle attributes.
14111         (Attribute): Class to hold attribute info.
14112
14113         * cs-parser.jay (opt_attribute_target_specifier): Remove production
14114         (attribute_section): Modify production to use 2 different rules to 
14115         achieve the same thing. 1 s/r conflict down !
14116         Clean out commented, useless, non-reducing dimension_separator rules.
14117         
14118         * class.cs (TypeContainer.attributes): New member to hold list
14119         of attributes for a type.
14120         (Struct::Struct): Modify to take one more argument, the attribute list.
14121         (Class::Class): Ditto.
14122         (Field::Field): Ditto.
14123         (Method::Method): Ditto.
14124         (Property::Property): Ditto.
14125         
14126         * cs-parser.jay (struct_declaration): Update constructor call to
14127         pass in the attributes too.
14128         (class_declaration): Ditto.
14129         (constant_declaration): Ditto.
14130         (field_declaration): Ditto.
14131         (method_header): Ditto.
14132         (fixed_parameter): Ditto.
14133         (parameter_array): Ditto.
14134         (property_declaration): Ditto.
14135
14136         * constant.cs (Constant::Constant): Update constructor similarly.
14137         Use System.Collections.
14138
14139         * parameter.cs (Parameter::Parameter): Update as above.
14140
14141 2001-09-02  Ravi Pratap  <ravi@ximian.com>
14142
14143         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
14144         (TypeContainer.delegates): New member to hold list of delegates.
14145
14146         * cs-parser.jay (delegate_declaration): Implement the action correctly 
14147         this time as I seem to be on crack ;-)
14148
14149 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
14150
14151         * rootcontext.cs (RootContext::IsNamespace): new function, used to
14152         tell whether an identifier represents a namespace.
14153
14154         * expression.cs (NamespaceExpr): A namespace expression, used only
14155         temporarly during expression resolution.
14156         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
14157         utility functions to resolve names on expressions.
14158
14159 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
14160
14161         * codegen.cs: Add hook for StatementExpressions. 
14162
14163         * class.cs: Fix inverted test for static flag in methods.
14164
14165 2001-09-02  Ravi Pratap  <ravi@ximian.com>
14166
14167         * class.cs (Operator::CheckUnaryOperator): Correct error number used
14168         to make it coincide with MS' number.
14169         (Operator::CheckBinaryOperator): Ditto.
14170
14171         * ../errors/errors.txt : Remove error numbers added earlier.
14172
14173         * ../errors/cs1019.cs : Test case for error # 1019
14174
14175         * ../errros/cs1020.cs : Test case for error # 1020
14176
14177         * cs-parser.jay : Clean out commented cruft.
14178         (dimension_separators, dimension_separator): Comment out. Ostensibly not
14179         used anywhere - non-reducing rule.
14180         (namespace_declarations): Non-reducing rule - comment out.
14181
14182         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
14183         with TypeContainer::AddEnum.
14184
14185         * delegate.cs : New file for delegate handling classes.
14186         (Delegate): Class for declaring delegates.
14187
14188         * makefile : Update.
14189
14190         * cs-parser.jay (delegate_declaration): Implement.
14191
14192 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
14193
14194         * class.cs (Event::Define): Implement.
14195         (Event.EventBuilder): New member.
14196
14197         * class.cs (TypeContainer::Populate): Update to define all enums and events
14198         we have.
14199         (Events): New property for the events arraylist we hold. Shouldn't we move to using
14200         readonly fields for all these cases ?
14201
14202 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
14203
14204         * class.cs (Property): Revamp to use the convention of making fields readonly.
14205         Accordingly modify code elsewhere.
14206
14207         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
14208         the Define method of the Property class.
14209
14210         * class.cs : Clean up applied patch and update references to variables etc. Fix 
14211         trivial bug.
14212         (TypeContainer::Populate): Update to define all the properties we have. Also
14213         define all enumerations.
14214
14215         * enum.cs (Define): Implement.
14216         
14217 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
14218
14219         * cs-parser.jay (overloadable_operator): The semantic value is an
14220         enum of the Operator class.
14221         (operator_declarator): Implement actions.
14222         (operator_declaration): Implement.
14223
14224         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
14225         validity of definitions.
14226         (Operator::CheckBinaryOperator): Static method to check for binary operators
14227         (TypeContainer::AddOperator): New method to add an operator to a type.
14228
14229         * cs-parser.jay (indexer_declaration): Added line to actually call the
14230         AddIndexer method so it gets added ;-)
14231
14232         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
14233         already taken care of by the MS compiler ?  
14234
14235 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
14236
14237         * class.cs (Operator): New class for operator declarations.
14238         (Operator::OpType): Enum for the various operators.
14239
14240 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
14241
14242         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
14243         ostensibly handle this in semantic analysis.
14244
14245         * cs-parser.jay (general_catch_clause): Comment out
14246         (specific_catch_clauses, specific_catch_clause): Ditto.
14247         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
14248         (catch_args, opt_catch_args): New productions.
14249         (catch_clause): Rewrite to use the new productions above
14250         (catch_clauses): Modify accordingly.
14251         (opt_catch_clauses): New production to use in try_statement
14252         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
14253         and re-write the code in the actions to extract the specific and
14254         general catch clauses by being a little smart ;-)
14255
14256         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
14257         Hooray, try and catch statements parse fine !
14258         
14259 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14260
14261         * statement.cs (Block::GetVariableType): Fix logic to extract the type
14262         string from the hashtable of variables.
14263
14264         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
14265         I end up making that mistake ;-)
14266         (catch_clauses): Fixed gross error which made Key and Value of the 
14267         DictionaryEntry the same : $1 !!
14268
14269 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14270
14271         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
14272
14273         * cs-parser.jay (event_declaration): Correct to remove the semicolon
14274         when the add and remove accessors are specified. 
14275
14276 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14277
14278         * cs-parser.jay (IndexerDeclaration): New helper class to hold
14279         information about indexer_declarator.
14280         (indexer_declarator): Implement actions.
14281         (parsing_indexer): New local boolean used to keep track of whether
14282         we are parsing indexers or properties. This is necessary because 
14283         implicit_parameters come into picture even for the get accessor in the 
14284         case of an indexer.
14285         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
14286
14287         * class.cs (Indexer): New class for indexer declarations.
14288         (TypeContainer::AddIndexer): New method to add an indexer to a type.
14289         (TypeContainer::indexers): New member to hold list of indexers for the
14290         type.
14291
14292 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
14293
14294         * cs-parser.jay (add_accessor_declaration): Implement action.
14295         (remove_accessor_declaration): Implement action.
14296         (event_accessors_declaration): Implement
14297         (variable_declarators): swap statements for first rule - trivial.
14298
14299         * class.cs (Event): New class to hold information about event
14300         declarations.
14301         (TypeContainer::AddEvent): New method to add an event to a type
14302         (TypeContainer::events): New member to hold list of events.
14303
14304         * cs-parser.jay (event_declaration): Implement actions.
14305
14306 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
14307
14308         * cs-parser.jay (dim_separators): Implement. Make it a string
14309         concatenating all the commas together, just as they appear.
14310         (opt_dim_separators): Modify accordingly
14311         (rank_specifiers): Update accordingly. Basically do the same
14312         thing - instead, collect the brackets here.
14313         (opt_rank_sepcifiers): Modify accordingly.
14314         (array_type): Modify to actually return the complete type string
14315         instead of ignoring the rank_specifiers.
14316         (expression_list): Implement to collect the expressions
14317         (variable_initializer): Implement. We make it a list of expressions
14318         essentially so that we can handle the array_initializer case neatly too.
14319         (variable_initializer_list): Implement.
14320         (array_initializer): Make it a list of variable_initializers
14321         (opt_array_initializer): Modify accordingly.
14322
14323         * expression.cs (New::NType): Add enumeration to help us
14324         keep track of whether we have an object/delegate creation
14325         or an array creation.
14326         (New:NewType, New::Rank, New::Indices, New::Initializers): New
14327         members to hold data about array creation.
14328         (New:New): Modify to update NewType
14329         (New:New): New Overloaded contructor for the array creation
14330         case.
14331
14332         * cs-parser.jay (array_creation_expression): Implement to call
14333         the overloaded New constructor.
14334         
14335 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
14336
14337         * class.cs (TypeContainer::Constructors): Return member
14338         constructors instead of returning null.
14339
14340 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
14341
14342         * typemanager.cs (InitCoreTypes): Initialize the various core
14343         types after we have populated the type manager with the user
14344         defined types (this distinction will be important later while
14345         compiling corlib.dll)
14346
14347         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
14348         on Expression Classification.  Now all expressions have a method
14349         `Resolve' and a method `Emit'.
14350
14351         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
14352         generation from working.     Also add some temporary debugging
14353         code. 
14354         
14355 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
14356
14357         * codegen.cs: Lots of code generation pieces.  This is only the
14358         beginning, will continue tomorrow with more touches of polish.  We
14359         handle the fundamentals of if, while, do, for, return.  Others are
14360         trickier and I need to start working on invocations soon.
14361         
14362         * gen-treedump.cs: Bug fix, use s.Increment here instead of
14363         s.InitStatement. 
14364
14365         * codegen.cs (EmitContext): New struct, used during code
14366         emission to keep a context.   Most of the code generation will be
14367         here. 
14368
14369         * cs-parser.jay: Add embedded blocks to the list of statements of
14370         this block.  So code generation proceeds in a top down fashion.
14371
14372 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
14373
14374         * statement.cs: Add support for multiple child blocks.
14375
14376 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
14377
14378         * codegen.cs (EmitCode): New function, will emit the code for a
14379         Block of code given a TypeContainer and its ILGenerator. 
14380
14381         * statement.cs (Block): Standard public readonly optimization.
14382         (Block::Block constructors): Link children. 
14383         (Block::Child): Child Linker.
14384         (Block::EmitVariables): Emits IL variable declarations.
14385
14386         * class.cs: Drop support for MethodGroups here, delay until
14387         Semantic Analysis.
14388         (Method::): Applied the same simplification that I did before, and
14389         move from Properties to public readonly fields.
14390         (Method::ParameterTypes): Returns the parameter types for the
14391         function, and implements a cache that will be useful later when I
14392         do error checking and the semantic analysis on the methods is
14393         performed.
14394         (Constructor::GetCallingConvention): Renamed from CallingConvetion
14395         and made a method, optional argument tells whether this is a class
14396         or a structure to apply the `has-this' bit.
14397         (Method::GetCallingConvention): Implement, returns the calling
14398         convention. 
14399         (Method::Define): Defines the type, a second pass is performed
14400         later to populate the methods.
14401
14402         (Constructor::ParameterTypes): implement a cache similar to the
14403         one on Method::ParameterTypes, useful later when we do semantic
14404         analysis. 
14405
14406         (TypeContainer::EmitMethod):  New method.  Emits methods.
14407
14408         * expression.cs: Removed MethodGroup class from here.
14409         
14410         * parameter.cs (Parameters::GetCallingConvention): new method.
14411
14412 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
14413
14414         * class.cs (TypeContainer::Populate): Drop RootContext from the
14415         argument. 
14416
14417         (Constructor::CallingConvention): Returns the calling convention.
14418         (Constructor::ParameterTypes): Returns the constructor parameter
14419         types. 
14420         
14421         (TypeContainer::AddConstructor): Keep track of default constructor
14422         and the default static constructor.
14423
14424         (Constructor::) Another class that starts using `public readonly'
14425         instead of properties. 
14426
14427         (Constructor::IsDefault): Whether this is a default constructor. 
14428
14429         (Field::) use readonly public fields instead of properties also.
14430
14431         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
14432         track of static constructors;  If none is used, turn on
14433         BeforeFieldInit in the TypeAttributes. 
14434
14435         * cs-parser.jay (opt_argument_list): now the return can be null
14436         for the cases where there are no arguments. 
14437
14438         (constructor_declarator): If there is no implicit `base' or
14439         `this', then invoke the default parent constructor. 
14440         
14441         * modifiers.cs (MethodAttr): New static function maps a set of
14442         modifiers flags into a MethodAttributes enum
14443         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
14444         MethodAttr, TypeAttr to represent the various mappings where the
14445         modifiers are used.
14446         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
14447
14448 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
14449
14450         * parameter.cs (GetParameterInfo): Fix bug where there would be no
14451         method arguments.
14452
14453         * interface.cs (PopulateIndexer): Implemented the code generator
14454         for interface indexers.
14455
14456 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
14457
14458         * interface.cs (InterfaceMemberBase): Now we track the new status
14459         here.  
14460
14461         (PopulateProperty): Implement property population.  Woohoo!  Got
14462         Methods and Properties going today. 
14463
14464         Removed all the properties for interfaces, and replaced them with
14465         `public readonly' fields. 
14466
14467 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
14468
14469         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
14470         initialize their hashtables/arraylists only when they are needed
14471         instead of doing this always.
14472
14473         * parameter.cs: Handle refs and out parameters.
14474
14475         * cs-parser.jay: Use an ArrayList to construct the arguments
14476         instead of the ParameterCollection, and then cast that to a
14477         Parameter[] array.
14478
14479         * parameter.cs: Drop the use of ParameterCollection and use
14480         instead arrays of Parameters.
14481
14482         (GetParameterInfo): Use the Type, not the Name when resolving
14483         types. 
14484
14485 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
14486
14487         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
14488         and instead use public readonly fields.
14489
14490         * class.cs: Put back walking code for type containers.
14491
14492 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
14493
14494         * class.cs (MakeConstant): Code to define constants.
14495
14496         * rootcontext.cs (LookupType): New function.  Used to locate types 
14497
14498         
14499 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
14500
14501         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
14502         this System.Reflection code is.  Kudos to Microsoft
14503         
14504         * typemanager.cs: Implement a type cache and avoid loading all
14505         types at boot time.  Wrap in LookupType the internals.  This made
14506         the compiler so much faster.  Wow.  I rule!
14507         
14508         * driver.cs: Make sure we always load mscorlib first (for
14509         debugging purposes, nothing really important).
14510
14511         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
14512         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
14513
14514         * rootcontext.cs: Lookup types on their namespace;  Lookup types
14515         on namespaces that have been imported using the `using' keyword.
14516
14517         * class.cs (TypeContainer::TypeAttr): Virtualize.
14518         (Class::TypeAttr): Return attributes suitable for this bad boy.
14519         (Struct::TypeAttr): ditto.
14520         Handle nested classes.
14521         (TypeContainer::) Remove all the type visiting code, it is now
14522         replaced with the rootcontext.cs code
14523
14524         * rootcontext.cs (GetClassBases): Added support for structs. 
14525
14526 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
14527
14528         * interface.cs, statement.cs, class.cs, parameter.cs,
14529         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
14530         Drop use of TypeRefs, and use strings instead.
14531
14532 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
14533
14534         * rootcontext.cs: 
14535
14536         * class.cs (Struct::Struct): set the SEALED flags after
14537         checking the modifiers.
14538         (TypeContainer::TypeAttr): new property, returns the
14539         TypeAttributes for a class.  
14540
14541         * cs-parser.jay (type_list): Oops, list production was creating a
14542         new list of base types.
14543
14544         * rootcontext.cs (StdLib): New property.
14545         (GetInterfaceTypeByName): returns an interface by type name, and
14546         encapsulates error handling here.
14547         (GetInterfaces): simplified.
14548         (ResolveTree): Encapsulated all the tree resolution here.
14549         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
14550         types. 
14551         
14552         * driver.cs: Add support for --nostdlib, to avoid loading the
14553         default assemblies.
14554         (Main): Do not put tree resolution here. 
14555
14556         * rootcontext.cs: Beginning of the class resolution.
14557
14558 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
14559
14560         * rootcontext.cs: Provide better error reporting. 
14561
14562         * cs-parser.jay (interface_base): set our $$ to be interfaces.
14563
14564         * rootcontext.cs (CreateInterface): Handle the case where there
14565         are no parent interfaces.
14566         
14567         (CloseTypes): Routine to flush types at the end.
14568         (CreateInterface): Track types.
14569         (GetInterfaces): Returns an array of Types from the list of
14570         defined interfaces.
14571
14572         * typemanager.c (AddUserType): Mechanism to track user types (puts
14573         the type on the global type hash, and allows us to close it at the
14574         end). 
14575         
14576 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
14577
14578         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
14579         RecordInterface instead.
14580
14581         * cs-parser.jay: Updated to reflect changes above.
14582
14583         * decl.cs (Definition): Keep track of the TypeBuilder type that
14584         represents this type here.  Not sure we will use it in the long
14585         run, but wont hurt for now.
14586
14587         * driver.cs: Smaller changes to accomodate the new code.
14588
14589         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
14590         when done. 
14591
14592         * rootcontext.cs (CreateInterface):  New method, used to create
14593         the System.TypeBuilder type for interfaces.
14594         (ResolveInterfaces): new entry point to resolve the interface
14595         hierarchy. 
14596         (CodeGen): Property, used to keep track of the code generator.
14597
14598 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
14599
14600         * cs-parser.jay: Add a second production for delegate_declaration
14601         with `VOID'.
14602
14603         (enum_body): Put an opt_comma here instead of putting it on
14604         enum_body or enum_member_declarations so we can handle trailing
14605         commas on enumeration members.  Gets rid of a shift/reduce.
14606         
14607         (type_list): Need a COMMA in the middle.
14608
14609         (indexer_declaration): Tell tokenizer to recognize get/set
14610
14611         * Remove old targets.
14612
14613         * Re-add the parser target.
14614
14615 2001-07-13  Simon Cozens <simon@simon-cozens.org>
14616
14617         * cs-parser.jay: Add precendence rules for a number of operators
14618         ot reduce the number of shift/reduce conflicts in the grammar.
14619         
14620 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
14621
14622         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
14623         and put it here.
14624
14625         Get rid of old crufty code.
14626
14627         * rootcontext.cs: Use this to keep track of the parsed
14628         representation and the defined types available to the program. 
14629
14630         * gen-treedump.cs: adjust for new convention.
14631
14632         * type.cs: Split out the type manager, and the assembly builder
14633         from here. 
14634
14635         * typemanager.cs: the type manager will live here now.
14636
14637         * cil-codegen.cs: And the code generator here. 
14638
14639 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
14640
14641         * makefile: Fixed up for easy making.
14642
14643 2001-07-13  Simon Cozens <simon@simon-cozens.org>
14644
14645         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
14646         the 
14647
14648         (unary_expression): Expand pre_increment_expression and
14649         post_decrement_expression to reduce a shift/reduce.
14650
14651 2001-07-11  Simon Cozens
14652
14653         * cs-tokenizer.cs: Hex numbers should begin with a 0.
14654
14655         Improve allow_keyword_as_indent name.
14656
14657 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
14658
14659         * Adjustments for Beta2. 
14660
14661 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
14662
14663         * decl.cs: Added `Define' abstract method.
14664         (InTransit): new property, used to catch recursive definitions. 
14665
14666         * interface.cs: Implement `Define'. 
14667
14668         * modifiers.cs: Map Modifiers.constants to
14669         System.Reflection.TypeAttribute flags.
14670
14671         * class.cs: Keep track of types and user-defined types.
14672         (BuilderInit): New method for creating an assembly
14673         (ResolveType): New function to launch the resolution process, only
14674         used by interfaces for now.
14675
14676         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
14677         that are inserted into the name space. 
14678
14679 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
14680
14681         * ARGH.  I have screwed up my tree so many times due to the use of
14682         rsync rather than using CVS.  Going to fix this at once. 
14683
14684         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
14685         load types.
14686
14687 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
14688
14689         * Experiment successful: Use System.Type rather that our own
14690         version of Type.  
14691
14692 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
14693
14694         * cs-parser.jay: Removed nsAliases from here.
14695
14696         Use new namespaces, handle `using XXX;' 
14697
14698         * namespace.cs: Reimplemented namespace handling, use a recursive
14699         definition of the class.  Now we can keep track of using clauses
14700         and catch invalid using clauses.
14701
14702 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
14703
14704         * gen-treedump.cs: Adapted for all the renaming.
14705
14706         * expression.cs (Expression): this class now has a Type property
14707         which returns an expression Type.
14708
14709         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
14710         `Type', as this has a different meaning now in the base
14711
14712 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
14713
14714         * interface.cs, class.cs: Removed from all the sources the
14715         references to signature computation, as we can not do method
14716         signature computation during the parsing time, as we are not
14717         trying to solve at that point distinguishing:
14718
14719         class X {
14720                 void a (Blah x) {}
14721                 void a (NS.Blah x) {}
14722         }
14723
14724         Which depending on the context might be valid or not, as we do not
14725         know if Blah is the same thing as NS.Blah at that point.
14726
14727         * Redid everything so the code uses TypeRefs now instead of
14728         Types.  TypeRefs are just temporary type placeholders, that need
14729         to be resolved.  They initially have a pointer to a string and the
14730         current scope in which they are used.  This is used later by the
14731         compiler to resolve the reference to an actual Type. 
14732
14733         * DeclSpace is no longer a CIR.Type, and neither are
14734         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
14735         are all DeclSpaces, but no Types. 
14736
14737         * type.cs (TypeRefManager): This implements the TypeRef manager,
14738         which keeps track of all the types that need to be resolved after
14739         the parsing has finished. 
14740
14741 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
14742
14743         * ARGH.  We are going to have to store `foreach' as a class rather
14744         than resolving it, as we need to verify error 1579 after name
14745         resolution.   *OR* we could keep a flag that says `This request to
14746         IEnumerator comes from a foreach statement' which we can then use
14747         to generate the error.
14748
14749 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
14750
14751         * class.cs (TypeContainer.AddMethod): we now add methods to the
14752         MethodGroup instead of the method hashtable.  
14753
14754         * expression.cs: Add MethodGroup abstraction, which gets us one
14755         step closer to the specification in the way we handle method
14756         declarations.  
14757
14758         * cs-parser.jay (primary_expression): qualified_identifier now
14759         tried to match up an identifier to a local variable reference or
14760         to a parameter reference.
14761
14762         current_local_parameters is now a parser global variable that
14763         points to the current parameters for the block, used during name
14764         lookup.
14765
14766         (property_declaration): Now creates an implicit `value' argument to
14767         the set accessor.
14768
14769 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
14770
14771         * parameter.cs: Do not use `param' arguments as part of the
14772         signature, per the spec.
14773
14774 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
14775
14776         * decl.cs: Base class for classes, structs and interfaces.  This
14777         is the "Declaration Space" 
14778
14779         * cs-parser.jay: Use CheckDef for checking declaration errors
14780         instead of having one on each function.
14781
14782         * class.cs: Factor out some code for handling error handling in
14783         accordance to the "Declarations" section in the "Basic Concepts"
14784         chapter in the ECMA C# spec.
14785
14786         * interface.cs: Make all interface member classes derive from
14787         InterfaceMemberBase.
14788
14789 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
14790
14791         * Many things: all interfaces are parsed and generated in
14792         gen-treedump.  Support for member variables, constructors,
14793         destructors, properties, constants is there.
14794
14795         Beginning of the IL backend, but very little done, just there for
14796         testing purposes. 
14797
14798 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
14799
14800         * cs-parser.jay: Fix labeled statement.
14801
14802         * cs-tokenizer.cs (escape): Escape " and ' always.
14803         ref_line, ref_name: keep track of the line/filename as instructed
14804         by #line by the compiler.
14805         Parse #line.
14806
14807 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
14808
14809         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
14810         to match the values in System.CodeDOM.
14811
14812         Divid renamed to Divide.
14813
14814         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
14815         statements. 
14816         (Statements.set): remove.
14817
14818         * System.CodeDOM/CodeCatchClause.cs: always have a valid
14819         statements. 
14820
14821         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
14822         falseStatements always have valid values. 
14823
14824         * cs-parser.jay: Use System.CodeDOM now.
14825