2004-04-02 Martin Baulig <martin@ximian.com>
[mono.git] / mcs / gmcs / ChangeLog
1 2004-04-02  Martin Baulig  <martin@ximian.com>
2
3         * convert.cs: Added type parameter conversions.
4
5         * ecore.cs
6         (UnboxCast.Emit): Emit an `unbox.any' for type params.
7         (ClassCast.Emit): If the source type is a type parameter, box it.
8         If the target type is a type parameter, emit an `unbox.any'
9         instead of a `classcast'.       
10
11 2004-04-01  Martin Baulig  <martin@ximian.com>
12
13         * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
14
15 2004-04-01  Martin Baulig  <martin@ximian.com>
16
17         * expression.cs (Invocation.EmitCall): If we're invoking a method
18         on a type parameter, use the new `Constrained' prefix opcode.
19
20 2004-04-01  Martin Baulig  <martin@ximian.com>
21
22         * generic.cs (ConstructedType.CheckConstraints): Use
23         Convert.ImplicitStandardConversionExists(); user-defined implicit
24         conversions are not allowed according to the spec.
25
26 2004-03-30  Martin Baulig  <martin@ximian.com>
27
28         * expression.cs (New): Added support for type parameters.
29
30         * typemanager.cs
31         (TypeManager.activator_type): New public static field.
32         (TypeManager.activator_create_instance): Likewise.
33
34 2004-03-30  Martin Baulig  <martin@ximian.com>
35
36         * typemanager.cs (TypeManager.HasConstructorConstraint): New
37         public method.
38
39 2004-03-30  Martin Baulig  <martin@ximian.com>
40
41         * generic.cs (ConstructedType.CheckConstraints): Actually follow
42         the spec here: the argument type must be convertible to the
43         constraints.
44
45 2004-03-30  Martin Baulig  <martin@ximian.com>
46
47         * generic.cs
48         (TypeParameter.Define, TypeParameter.DefineMethod): Call
49         TypeManager.AddTypeParameter().
50         (ConstructedType.CheckConstraints): Re-enable this and actually
51         check whether we have a constructor constraint.
52
53         * typemanager.cs
54         (TypeManager.builder_to_type_param): New static field.
55         (TypeManager.AddTypeParameter): New static method.
56         (TypeManager.LookupTypeParameter): New public method.
57
58 2004-03-30  Martin Baulig  <martin@ximian.com>
59
60         * generic.cs (TypeParameter.DefineType): Return a boolean and use
61         the new API to actually define the constructor constraint.
62
63         * typemanager.cs
64         (TypeManager.new_constraint_attr_type): New static field.
65         (TypeManager.InitCoreTypes): Initialize it.
66
67 2004-03-30  Martin Baulig  <martin@ximian.com>
68
69         * generic.cs (Constraints): Completed error checking, use correct
70         error numbers.
71
72 2004-03-29  Martin Baulig  <martin@ximian.com>
73
74         * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
75
76         * expression.cs (Invocation.InferTypeArguments): Added overloaded
77         public version which takes a `ParameterData pd' instead of an
78         `ArrayList args'.
79
80 2004-03-29  Martin Baulig  <martin@ximian.com>
81
82         * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
83         not a MethodInfo.       
84
85 2004-03-29  Martin Baulig  <martin@ximian.com>
86
87         * expression.cs (Argument.ResolveMethodGroup): If we're a
88         ConstructedType, call GetMemberAccess() on it.  
89
90 2004-03-29  Martin Baulig  <martin@ximian.com>
91
92         * class.cs (MethodBase.CheckGenericOverride): New abstract method.
93         (MethodCore.CheckGenericOverride): When overriding a generic
94         method, check whether the constraints match.
95
96         * support.cs (GenericConstraints): New public interface.
97         (ParameterData.GenericConstraints): New public method.
98
99         * parameter.cs (Parameter.Resolve): Check whether we're a generic
100         method parameter and compute our constraints if appropriate.
101         (Parameter.GenericConstraints): New public property.
102
103         * generic.cs (Constraints): Implement GenericConstraints.
104
105 2004-03-29  Martin Baulig  <martin@ximian.com>
106
107         * decl.cs (MemberCache.FindMemberToOverride): Use
108         `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
109
110 2004-03-29  Martin Baulig  <martin@ximian.com>
111
112         * generic.cs (GenericMethod.Define): Resolve our type parameters.
113
114 2004-03-29  Martin Baulig  <martin@ximian.com>
115
116         * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
117         not allowed on non-generic declarations").
118
119 2004-03-29  Martin Baulig  <martin@ximian.com>
120
121         * expression.cs (Invocation.InferTypeArguments): Added overloaded
122         public version of this method.
123
124         * class.cs (MethodCore.IsDuplicateImplementation): Use
125         Invocation.InferTypeArguments() to check this.
126
127 2004-03-29  Martin Baulig  <martin@ximian.com>
128
129         * convert.cs: Use TypeManager.IsDelegateType() instead of
130         comparing types correctly.
131
132 2004-03-29  Martin Baulig  <martin@ximian.com>
133
134         * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
135         types directly to make it work for generic instances.
136
137         * typemanager.cs (TypeManager.IsSubclassOf): New static method.
138
139 2004-03-29  Martin Baulig  <martin@ximian.com>
140
141         * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
142         support for arrays.     
143
144 2004-03-24  Martin Baulig  <martin@ximian.com>
145
146         * decl.cs (DeclSpace.FindType): Also use
147         TypeManager.CheckGeneric() for types from the using clauses.
148
149 2004-03-23  Martin Baulig  <martin@ximian.com>
150
151         * expression.cs (Invocation.OverloadResolve): Added `bool
152         may_fail' argument and use it instead of the Location.IsNull() hack.
153
154 2004-03-23  Martin Baulig  <martin@ximian.com>
155
156         * expression.cs (Invocation.InferType): Use correct type inference
157         rules here.     
158
159 2004-03-23  Martin Baulig  <martin@ximian.com>
160
161         * ecore.cs (MethodGroupExpr.Name): Use
162         TypeManager.CSharpSignature() instead of just the name.
163
164         * expression.cs (Invocation.OverloadResolve): Provide better error
165         reporting.
166         (Invocation.DoResolve): OverloadResolve() never returns null
167         without reporting an error, so removed the error -6 reporting here.
168
169 2004-03-23  Martin Baulig  <martin@ximian.com>
170
171         * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
172         generic methods.
173
174         * cs-parser.jay (delegate_declaration): Support generic delegates.
175
176         * delegate.cs: Support generic delegates.
177
178 2004-03-22  Martin Baulig  <martin@ximian.com>
179
180         * expression.cs (Invocation.InferParamsTypeArguments): New static
181         method; does type inference for params arguments.
182
183 2004-03-21  Martin Baulig  <martin@ximian.com>
184
185         * typemanager.cs (TypeManager.IsGenericMethod): New public static
186         method; checks whether a method is a generic method.    
187
188         * expression.cs (Invocation.InferTypeArguments): New static method;
189         infer type arguments for generic method invocation.
190
191         * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
192         property; we set this to true if we're resolving a generic method
193         invocation and the user specified type arguments, ie. we're not
194         doing type inference.
195
196 2004-03-20  Martin Baulig  <martin@ximian.com>
197
198         * class.cs (MethodData.DeclaringType): New public property.
199         (MethodData.Define): Set DeclaringType here.
200         (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
201         instead of OperatorMethodBuilder.DeclaringType.
202
203 2004-03-20  Martin Baulig  <martin@ximian.com>
204
205         * cs-tokenizer.cs (xtoken): Return a special
206         Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
207
208         * cs-parser.jay (default_value_expression): Switch to the new
209         syntax (14.5.13).
210
211 2004-03-19  Martin Baulig  <martin@ximian.com>
212
213         * decl.cs (MemberName): New class.  We use this to "construct"
214         namespace_or_type_name's.
215
216         * generics.cs (TypeArguments.GetDeclarations): New public method;
217         returns the type arguments as a string[] and reports a CS0081 if
218         one of them is not an identifier.
219
220         * class.cs (MemberBase): The .ctor now takes the name as a
221         MemberName instead of a string.
222         (MemberBase.ExplicitInterfaceName): Changed type from string to
223         Expression.
224         (MemberBase.DoDefine): If we're an explicit implementation, the
225         InterfaceType may be a generic instance.
226
227         * cs-parser.jay (namespace_or_type_name): Return a MemberName.
228         (namespace_name): Call MemberName.GetName () to transform the
229         MemberName into a string and ensure we don't have any type
230         arguments.
231         (type_name): Call MemberName.GetTypeExpression() to transfrom the
232         MemberName into an expression.
233         (method_header): Use namespace_or_type_name instead of member_name.     
234
235 2004-03-19  Martin Baulig  <martin@ximian.com>
236
237         * class.cs (MemberCore.IsDuplicateImplementation): Check whether
238         two overloads may unify for some type parameter substitutions and
239         report a CS0408 if appropriate.
240
241 2004-03-19  Martin Baulig  <martin@ximian.com>
242
243         * class.cs (MemberCore.IsDuplicateImplementation): Report the
244         error here and not in our caller.
245
246 2004-03-19  Martin Baulig  <martin@ximian.com>
247
248         * interface.cs: Completely killed this file.
249         (Interface): We're now a TypeContainer and live in class.cs.
250
251         * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
252         argument; we're now also called for interfaces.
253         (TypeContainer.DefineMembers): Allow this method being called
254         multiple times.
255         (TypeContainer.GetMethods): New public method; formerly known as
256         Interface.GetMethod().  This is used by PendingImplementation.
257         (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
258         it's now private and non-static.
259         (Interface): Moved this here; it's now implemented similar to
260         Class and Struct.
261         (Method, Property, Event, Indexer): Added `bool is_interface'
262         argument to their .ctor's.
263         (MemberBase.IsInterface): New public field.
264
265         * cs-parser.jay: Create normal Method, Property, Event, Indexer
266         instances instead of InterfaceMethod, InterfaceProperty, etc.
267         (opt_interface_base): Removed; we now use `opt_class_base' instead.
268         (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
269
270 2004-03-19  Martin Baulig  <martin@ximian.com>
271
272         * class.cs (MethodCore.IsDuplicateImplementation): New private
273         method which does the CS0111 checking.
274         (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
275         Use IsDuplicateImplementation().
276
277 2004-03-17 Ben Maurer  <bmaurer@users.sourceforge.net>
278
279         * decl.cs (FindMemberToOverride): New method to find the correct
280         method or property to override in the base class.
281         * class.cs
282             - Make Method/Property use the above method to find the
283               version in the base class.
284             - Remove the InheritableMemberSignatureCompare as it is now
285               dead code.
286
287         This patch makes large code bases much faster to compile, as it is
288         O(n) rather than O(n^2) to do this validation.
289
290         Also, it fixes bug 52458 which is that nested classes are not
291         taken into account when finding the base class member.
292         
293         Reviewed/Approved by Martin.
294
295 2004-03-17  Martin Baulig  <martin@ximian.com>
296
297         * expression.cs (MemberAccess.DoResolve): Take the parent's number
298         of type arguments into account; use the `real_num_type_args'
299         approach like in DoResolveAsTypeStep().
300
301         * generic.cs (GenericMemberAccess.DoResolve): Make this work for
302         nested types.
303
304 2004-03-17  Marek Safar  <marek.safar@seznam.cz>
305
306         * interface.cs: In all interface classes removed redundant
307         member initialization.
308
309 2004-03-16  Martin Baulig  <martin@ximian.com>
310
311         * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
312
313 2004-03-15  Miguel de Icaza  <miguel@ximian.com>
314
315         * decl.cs (DefineTypeAndParents): New helper method to define a
316         type's containers before the type itself is defined;  This is a
317         bug exposed by the recent changes to Windows.Forms when an
318         implemented interface was defined inside a class that had not been
319         built yet.   
320
321         * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
322
323         (Check): Loop correctly to report errors modifiers
324         (UNSAFE was not in the loop, since it was the same as TOP).
325
326         * interface.cs: Every interface member now takes a ModFlags,
327         instead of a "is_new" bool, which we set on the base MemberCore. 
328
329         Every place where we called "UnsafeOk" in the interface, now we
330         call the proper member (InterfaceMethod.UnsafeOK) instead to get
331         the unsafe settings from the member declaration instead of the
332         container interface. 
333
334         * cs-parser.jay (opt_new): Allow unsafe here per the spec. 
335
336         * pending.cs (TypeAndMethods): Add `get_indexer_name' and
337         `set_indexer_name' to the pending bits (one per type).
338
339         We fixed a bug today that was picking the wrong method to
340         override, since for properties the existing InterfaceMethod code
341         basically ignored the method name.  Now we make sure that the
342         method name is one of the valid indexer names.
343
344 2004-03-14  Gustavo Giráldez  <gustavo.giraldez@gmx.net>
345  
346         * support.cs (SeekableStreamReader): Keep track of stream byte
347         positions and don't mix them with character offsets to the buffer.
348
349         Patch from Gustavo Giráldez
350         
351 2004-03-15  Marek Safar  <marek.safar@seznam.cz>
352
353         * interface.cs (InterfaceSetGetBase): Removed double member
354         initialization, base class does it as well.
355
356 2004-03-13  Martin Baulig  <martin@ximian.com>
357
358         * class.cs: Reverted Miguel's latest commit; it makes mcs crash
359         when compiling corlib.
360
361 2004-03-13  Miguel de Icaza  <miguel@ximian.com>
362
363         * convert.cs (ExplicitConversion): We were reporting an error on
364         certain conversions (object_type source to a value type, when the
365         expression was `null') before we had a chance to pass it through
366         the user defined conversions.
367
368         * driver.cs: Replace / and \ in resource specifications to dots.
369         Fixes 50752
370
371         * class.cs: Add check for duplicate operators.  Fixes 52477
372
373 2004-03-11  Miguel de Icaza  <miguel@ximian.com>
374
375         * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
376         that are in the middle of the statements, not only at the end.
377         Fixes #54987
378
379         * class.cs (TypeContainer.AddField): No longer set the
380         `HaveStaticConstructor' flag, now we call it
381         `UserDefineStaticConstructor' to diferentiate the slightly
382         semantic difference.
383
384         The situation is that we were not adding BeforeFieldInit (from
385         Modifiers.TypeAttr) to classes that could have it.
386         BeforeFieldInit should be set to classes that have no static
387         constructor. 
388
389         See:
390
391         http://www.yoda.arachsys.com/csharp/beforefieldinit.html
392
393         And most importantly Zoltan's comment:
394
395         http://bugzilla.ximian.com/show_bug.cgi?id=44229
396
397         "I think beforefieldinit means 'it's ok to initialize the type sometime 
398          before its static fields are used', i.e. initialization does not need
399          to be triggered by the first access to the type. Setting this flag
400          helps the JIT to compile better code, since it can run the static
401          constructor at JIT time, and does not need to generate code to call it
402          (possibly lots of times) at runtime. Unfortunately, mcs does not set
403          this flag for lots of classes like String. 
404          
405          csc sets this flag if the type does not have an explicit static 
406          constructor. The reasoning seems to be that if there are only static
407          initalizers for a type, and no static constructor, then the programmer
408          does not care when this initialization happens, so beforefieldinit
409          can be used.
410          
411          This bug prevents the AOT compiler from being usable, since it 
412          generates so many calls to mono_runtime_class_init that the AOT code
413          is much slower than the JITted code. The JITted code is faster, 
414          because it does not generate these calls if the vtable is type is
415          already initialized, which is true in the majority of cases. But the
416          AOT compiler can't do this."
417
418 2004-03-10  Miguel de Icaza  <miguel@ximian.com>
419
420         * class.cs (MethodData.Emit): Refactor the code so symbolic
421         information is generated for destructors;  For some reasons we
422         were taking a code path that did not generate symbolic information
423         before. 
424
425 2004-03-11 Ben Maurer  <bmaurer@users.sourceforge.net>
426
427         * class.cs: Create a Constructor.CheckBase method that
428         takes care of all validation type code. The method
429         contains some code that was moved from Define.
430
431         It also includes new code that checks for duplicate ctors.
432         This fixes bug #55148.
433
434 2004-03-09  Joshua Tauberer <tauberer@for.net>
435
436         * expression.cs (ArrayCreation): Fix: More than 6 nulls in
437         a { ... }-style array creation invokes EmitStaticInitializers
438         which is not good for reference-type arrays.  String, decimal
439         and now null constants (NullCast) are not counted toward
440         static initializers.
441
442 2004-03-05  Martin Baulig  <martin@ximian.com>
443
444         * location.cs (SourceFile.HasLineDirective): New public field;
445         specifies whether the file contains or is referenced by a "#line"
446         directive.
447         (Location.DefineSymbolDocuments): Ignore source files which
448         either contain or are referenced by a "#line" directive.        
449
450 2004-02-29  Ben Maurer <bmaurer@users.sourceforge.net>
451
452         * class.cs (Method.CheckBase): Avoid using FindMembers, we have
453         direct access to our parent, so check the method inline there.
454
455 2004-02-27 Ben Maurer  <bmaurer@users.sourceforge.net>
456
457         * expression.cs (Invocation.EmitCall): Miguel's last commit
458         caused a regression. If you had:
459         
460             T t = null;
461             t.Foo ();
462
463         In Foo the implict this would be null.
464         
465 2004-02-27  Miguel de Icaza  <miguel@ximian.com>
466
467         * expression.cs (Invocation.EmitCall): If the method is not
468         virtual, do not emit a CallVirt to it, use Call.
469
470         * typemanager.cs (GetFullNameSignature): Improve the method to
471         cope with ".ctor" and replace it with the type name.
472
473         * class.cs (ConstructorInitializer.Resolve): Now the method takes
474         as an argument the ConstructorBuilder where it is being defined,
475         to catch the recursive constructor invocations.
476
477 2004-03-16  Martin Baulig  <martin@ximian.com>
478
479         * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
480         ConstructedType, call ResolveType() on it to get the type rather
481         than just using `expr.Type'.
482
483 2004-03-16  Martin Baulig  <martin@ximian.com>
484
485         * generics.cs (ConstructedType.GetMemberAccess): Take the
486         EmitContext instead on the TypeExpr and use
487         ec.TypeContainer.CurrentType/ec.ContainerType.
488
489 2004-03-16  Martin Baulig  <martin@ximian.com>
490
491         * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
492         parameters before aliases.
493
494 2004-03-16  Martin Baulig  <martin@ximian.com>
495
496         * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
497         New oublic function; checks whether two generic instances may become
498         equal under some instantiations (26.3.1).
499
500         * class.cs (TypeContainer.Define): Call
501         TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
502         error.
503
504 2004-03-16  Martin Baulig  <martin@ximian.com>
505
506         * class.cs (TypeContainer.GetClassBases): Moved
507         Error_TypeParameterAsBase() here and also check whether the base
508         class is not an attribute.
509
510 2004-03-16  Martin Baulig  <martin@ximian.com>
511
512         * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
513
514 2004-03-16  Martin Baulig  <martin@ximian.com>
515
516         * class.cs (Error_TypeParameterAsBase): Use correct error number
517         here (CS0689).  
518
519 2004-03-16  Martin Baulig  <martin@ximian.com>
520
521         * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
522         for generics.
523
524         * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
525         error reporting.
526
527 2004-03-15  Martin Baulig  <martin@ximian.com>
528
529         * typemanager.cs (TypeManager.GetFullName): New public method.
530         (TypeManager.MemberLookup): Added `int_num_type_arguments'
531         argument; only return members with the correct number of type
532         arguments.
533         (TypeManager.CheckGeneric): Allow -1 to bypass the check.
534         (TypeManager.FilterWithClosure): Call CheckGeneric() to check
535         whether the number of type arguments matches.
536
537         * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
538         not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
539
540         * expression.cs (MemberAccess): Added public `NumTypeArguments'
541         field; it's set by the protected .ctor when we're actually a
542         GenericMemberAccess.
543         (MemberAccess.ResolveAsTypeStep): Compute the total number of type
544         arguments and pass it to MemberLookupFinal ().
545
546         * ecore.cs (Expression.MemberLookup): Added `int
547         num_type_arguments' argument; only return members with the correct
548         number of type arguments.
549         (Expression.MemberLookupFailed): Check whether the MemberLookup
550         failed because we did not have the correct number of type
551         arguments; report CS0305 in this case.
552
553         * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
554         `e.ResolveAsTypeTerminal()' already did so.
555
556 2004-03-15  Martin Baulig  <martin@ximian.com>
557
558         * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
559         we're a ConstructedType; in this case, the caller must report an
560         error (for instance CS0131).
561
562         * generic.cs (TypeArguments): Added Location argument to the .ctor.
563         (TypeArguments.Resolve): Actually report errors here.
564
565 2004-03-15  Miguel de Icaza  <miguel@ximian.com>
566
567         * pending.cs (TypeAndMethods): Add `get_indexer_name' and
568         `set_indexer_name' to the pending bits (one per type).
569
570         We fixed a bug today that was picking the wrong method to
571         override, since for properties the existing InterfaceMethod code
572         basically ignored the method name.  Now we make sure that the
573         method name is one of the valid indexer names.
574
575 2004-03-15  Martin Baulig  <martin@ximian.com>
576
577         * typemanager.cs (TypeManager.IndexerPropertyName): Added support
578         for generic instances.
579
580 2004-03-13  Martin Baulig  <martin@ximian.com>
581
582         * class.cs (TypeContainer.DefineType): Call
583         TypeManager.AddUserType() immediately after creating the
584         TypeBuilder; pass all type parameters when creating the
585         CurrentType.
586
587         * decl.cs (DeclSpace.FindNestedType): New public method.
588         (DeclSpace.FindType): Added `int num_type_args' argument; only
589         return types with the correct number of type parameters.
590         (DeclSpace.CountTypeParams): New public property.
591
592         * ecore.cs (SimpleName.ctor): Added overloaded version which takes
593         the number of type parameters; defaults to zero.
594
595         * generic.cs (TypeArguments.Count): New public property.
596         (ConstructedType.DoResolveAsTypeStep): First call
597         ds.FindNestedType() to find out whether we're nested in the
598         current generic type; in this case, we inherit all type parameters
599         from the current class.
600
601         * rootcontext.cs (RootContext.NamespaceLookup): Added `int
602         num_type_args' argument.
603         (RootContext.LookupType): Added overloaded version which takes the
604         number of type arguments; only return types with the correct
605         number of type arguments.
606
607         * typemanager.cs (TypeManager.CheckGeneric): New public function;
608         checks whether `Type t' has `int num_type_args'.
609
610 2004-03-13  Martin Baulig  <martin@ximian.com>
611
612         * generic.cs (GenericMethod.DefineType): New method; calls
613         DefineType() on all the type parameters.
614
615         * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
616         (MethodData.Define): If we're a generic method, call
617         GenericMethod.DefineType() to define the type parameters.       
618
619 2004-03-10  Martin Baulig  <martin@ximian.com>
620
621         * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
622         instead of IsAssignableFrom.    
623
624 2004-03-10  Martin Baulig  <martin@ximian.com>
625
626         * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
627
628         * support.cs (ParameterData.HasArrayParameter): New property.
629         (ReflectionParameters.ctor): Take a MethodBase instead of a
630         ParameterInfo[].  If we have any type parameters, get the generic
631         method definition and ask it whether we have variable arguments.
632
633 2004-02-26  Miguel de Icaza  <miguel@ximian.com>
634
635         * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
636         routines to check if a type is an enumerable/enumerator allow
637         classes that implement the IEnumerable or IEnumerator interfaces.
638
639         * class.cs (Property, Operator): Implement IIteratorContainer, and
640         implement SetYields.
641
642         (Property.Define): Do the block swapping for get_methods in the
643         context of iterators.   We need to check if Properties also
644         include indexers or not.
645
646         (Operator): Assign the Block before invoking the
647         OperatorMethod.Define, so we can trigger the Iterator code
648         replacement. 
649
650         * cs-parser.jay (SimpleIteratorContainer): new helper class.  Both
651         Property and Operator classes are not created when we parse the
652         declarator but until we have the block completed, so we use a
653         singleton SimpleIteratorContainer.Simple to flag whether the
654         SetYields has been invoked.
655
656         We propagate this setting then to the Property or the Operator to
657         allow the `yield' to function.
658
659 2004-02-25  Marek Safar  <marek.safar@seznam.cz>
660
661         * codegen.cs: Implemented attribute support for modules.
662         New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
663         Assembly/Module functionality.
664         
665         * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
666         interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
667         Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
668
669 2004-02-16  Marek Safar  <marek.safar@seznam.cz>
670
671         * interface.cs (FindMembers): The operation is performed on all base
672         interfaces and not only on the first. It is required for future CLS Compliance patch.
673
674 2004-02-12 Ben Maurer  <bmaurer@users.sourceforge.net>
675
676         * statement.cs, codegen.cs:
677         This patch deals with patterns such as:
678
679         public class List : IEnumerable {
680
681                 public MyEnumerator GetEnumerator () {
682                         return new MyEnumerator(this);
683                 }
684         
685                 IEnumerator IEnumerable.GetEnumerator () {
686                         ...
687                 }
688                 
689                 public struct MyEnumerator : IEnumerator {
690                         ...
691                 }
692         }
693
694         Before, there were a few things we did wrong:
695         1) we would emit callvirt on a struct, which is illegal
696         2) we emited ldarg when we needed to emit ldarga
697         3) we would mistakenly call the interface methods on an enumerator
698         type that derived from IEnumerator and was in another assembly. For example:
699
700         public class MyEnumerator : IEnumerator
701
702         Would have the interface methods called, even if there were public impls of the
703         method. In a struct, this lead to invalid IL code.
704         
705 2004-02-11  Marek Safar  <marek.safar@seznam.cz>
706
707         * const.cs: Const is now derived from FieldBase. Method EmitConstant name
708           renamed to Emit.
709
710         * delegate.cs (Define): Fixed crash when delegate type is undefined.
711         
712 2004-02-11  Miguel de Icaza  <miguel@ximian.com>
713
714         * cs-parser.jay: Fix small regression: we were not testing V2
715         compiler features correctly.
716
717         * interface.cs: If the emit context is null, then create one
718
719 2004-02-09  Marek Safar  <marek.safar@seznam.cz>
720
721         * decl.cs (GetSignatureForError): New virtual method to get full name
722           for error messages.
723         
724         * attribute.cs (IAttributeSupport): New interface for attribute setting.
725           Now it is possible to rewrite ApplyAttributes method to be less if/else.
726
727         * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
728           Duplicated members and code in these classes has been removed.
729           Better encapsulation in these classes.
730
731 2004-02-07  Miguel de Icaza  <miguel@ximian.com>
732
733         * assign.cs (Assign.DoResolve): When dealing with compound
734         assignments, there is a new rule in ECMA C# 2.4 (might have been
735         there before, but it is documented here) that states that in:
736
737         a op= b;
738
739         If b is of type int, and the `op' is a shift-operator, then the
740         above is evaluated as:
741
742         a = (int) a op b 
743
744         * expression.cs (Binary.ResolveOperator): Instead of testing for
745         int/uint/long/ulong, try to implicitly convert to any of those
746         types and use that in pointer arithmetic.
747
748         * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
749         method to print information for from the type, not from the
750         null-method we were given.
751
752 2004-02-01  Duncan Mak  <duncan@ximian.com>
753
754         * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
755         parsing for cmd, fixes bug #53694.
756
757 2004-02-04  Marek Safar  <marek.safar@seznam.cz>
758
759         * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
760         in the member name duplication tests. Property and operator name duplication
761         was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
762
763 2004-02-03  Marek Safar  <marek.safar@seznam.cz>
764
765         * interface.cs (PopulateMethod): Fixed crash when interface method
766         returns not existing type (error test cs0246-3.cs).
767
768 2004-02-02  Ravi Pratap M <ravi@ximian.com>
769
770         * cs-parser.jay (interface_accessors): Re-write actions to also
771         store attributes attached to get and set methods. Fix spelling
772         while at it.
773
774         (inteface_property_declaration): Modify accordingly.
775
776         (InterfaceAccessorInfo): New helper class to store information to pass
777         around between rules that use interface_accessors.
778
779         * interface.cs (Emit): Apply attributes on the get and set
780         accessors of properties and indexers too.
781         
782         * attribute.cs (ApplyAttributes): Modify accordingly to use the
783         right MethodBuilder when applying attributes to the get and set accessors.
784
785 2004-01-31  Miguel de Icaza  <miguel@ximian.com>
786
787         * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
788
789 2004-01-26  Miguel de Icaza  <miguel@ximian.com>
790
791         * cs-tokenizer.cs: Handle #line hidden from PDC bits.
792
793 2004-01-25  Miguel de Icaza  <miguel@ximian.com>
794
795         * cs-parser.jay: Remove YIELD token, instead use the new grammar
796         changes that treat `yield' specially when present before `break'
797         or `return' tokens.
798
799         * cs-tokenizer.cs: yield is no longer a keyword.
800
801 2004-01-23  Marek Safar  <marek.safar@seznam.cz>
802
803         * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
804         setting for default constructors.
805         For default constructors are almost every time set wrong Modifier. The
806         generated IL code has been alright. But inside mcs this values was
807         wrong and this was reason why several of my CLS Compliance tests
808         failed.
809
810 2004-02-27  Martin Baulig  <martin@ximian.com>
811
812         * generics.cs (ConstructedType.ResolveType): Make the nested type
813         stuff actually work.
814
815 2004-02-25  Martin Baulig  <martin@ximian.com>
816
817         * decl.cs (DeclSpace.CurrentTypeParameters): New protected
818         property; returns the type parameters just from the current type,
819         ie. with the ones from outer classes.
820         (DeclSpace.LookupGeneric): First search in the current class, then
821         in outer classes.
822         (DeclSpace.initialize_type_params): When hiding a type parameter
823         from an outer class, put it into the `type_param_list' anyways.
824
825         * expression.cs (MemberAccess.expr): Made this field protected.
826
827         * class.cs (TypeContainer.Define): The `CurrentType' just contains
828         the type parameters from the current class.
829
830         * generic.cs (ConstructedType.ResolveType): Support nested generic
831         types by taking the type parameters which we inherit from outer
832         classes into account.
833         (GenericMemberAccess.ResolveAsTypeStep): Override this and added
834         support for nested generic types.
835
836 2004-02-23  Martin Baulig  <martin@ximian.com>
837
838         * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
839         field and check whether we're nested inside a generic type.
840         (DeclSpace.ResolveType): If we're resolving to a generic type
841         definition, create a ConstructedType and return its resolved type.
842         (DeclSpace.initialize_type_params): New private method;
843         initializes the `type_param_list' field from the type parameters
844         from this and all enclosing classes.
845         (DeclSpace.TypeParameters): Call initialize_type_params() unless
846         we're already initialized.
847
848 2004-02-23  Martin Baulig  <martin@ximian.com>
849
850         * class.cs (Method.Define): Create the generic method before
851         calling DoDefine().
852         (Memberbase.DoDefine): Added DeclSpace argument (in addition to
853         the TypeContainer one); we use this for generic methods.
854
855         * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
856         parent's TypeBuilder.
857
858 2004-02-18  Martin Baulig  <martin@ximian.com>
859
860         * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
861         to check for equality.
862
863 2004-02-05  Martin Baulig  <martin@ximian.com>
864
865         * ecore.cs (FieldExpr.DoResolveLValue): If we have an
866         `ec.TypeContainer.CurrentType', use it instead of
867         `ec.ContainerType' to check whether we're in the type's ctor.
868
869 2004-01-29  Martin Baulig  <martin@ximian.com>
870
871         * expression.cs (Invocation.DoResolve): If we're a
872         `ConstructedType', then we're actually a generic method, so
873         rewrite the expr as a GenericMemberAccess.
874
875         * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
876         here; manually parse it into a string.
877
878 2004-01-28  Martin Baulig  <martin@ximian.com>
879
880         * typemanager.cs (TypeManager.IsEqual): New static method.
881         (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
882         check for equality instead of using `=='.
883
884 2004-01-26  Martin Baulig  <martin@ximian.com>
885
886         * decl.cs (DeclSpace.CurrentType): New public field.
887
888         * expression.cs (This.ResolveBase): If we have an
889         `ec.TypeContainer.CurrentType', use it instead of
890         `ec.ContainerType'.
891
892         * class.cs (TypeContainer.DefineType): If we're a generic type,
893         create the `CurrentType' (unresolved).
894         (TypeContainer.GenericType): New private field.
895         (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
896         it and store it in `GenericType' before creating the MemberCache.
897         (TypeContainer.GetMembers): If we have a `GenericType', call
898         TypeManager.FindMembers() on it.
899
900         * interface.cs (Interface.GenericType): New private field.
901         (Interface.DefineType): If we're a generic type, create the
902         `CurrentType' (unresolved).
903         (Interface.DefineMembers): If we have a `CurrentType', resolve it
904         and store it in `GenericType' before creating the MemberCache.
905         (Interface.GetMembers): If we have a `GenericType', call
906         TypeManager.FindMembers() on it.
907
908 2004-01-22  Martin Baulig  <martin@ximian.com>
909
910         * cs-parser.jay (namespace_or_type_name): Return an Expression,
911         not a QualifiedIdentifier.  This is what `type_name_expression'
912         was previously doing.
913         (type_name_expression): Removed; the code is now in
914         `namespace_or_type_name'.
915         (qualified_identifier): Removed, use `namespace_or_type_name'
916         instead.
917         (QualifiedIdentifier): Removed this class.      
918
919 2004-01-22  Martin Baulig  <martin@ximian.com>
920
921         * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
922         not a string as alias name.
923
924 2004-01-21  Miguel de Icaza  <miguel@ximian.com>
925
926         * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
927         #52730 bug, and instead compute correctly the need to use a
928         temporary variable when requesting an address based on the
929         static/instace modified of the field and the constructor.
930  
931 2004-01-21  Martin Baulig  <martin@ximian.com>
932
933         * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
934         class and namespace before looking up aliases.  Fixes #52517.
935
936 2004-01-21  Martin Baulig  <martin@ximian.com>
937
938         * flowanalysis.cs (UsageVector.Merge): Allow variables being
939         assinged in a 'try'; fixes exception4.cs.
940
941 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
942         * class.cs : Implemented parameter-less constructor for TypeContainer
943         
944         * decl.cs: Attributes are now stored here. New property OptAttributes
945         
946         * delegate.cs, enum.cs, interface.cs: Removed attribute member.
947         
948         * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
949
950 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
951
952         * typemanager.cs (CSharpSignature): Now reports also inner class name.
953           (CSharpSignature): New method for indexer and property signature.
954
955 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
956
957         * pending.cs (IsVirtualFilter): Faster implementation.
958
959 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
960
961         * typemanager.cs: Avoid inclusion of same assembly more than once.
962
963 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
964
965         * cs-parser.jay: Fixed problem where the last assembly attribute
966           has been applied also to following declaration (class, struct, etc.)
967           
968 2004-01-21  Marek Safar  <marek.safar@seznam.cz>
969
970         * class.cs: Added error CS0538, CS0539 reporting.
971         Fixed crash on Microsoft runtime when field type is void.
972
973         * cs-parser.jay: Added error CS0537 reporting.
974
975         * pending.cs: Added error CS0535 reporting.
976         Improved error report for errors CS0536, CS0534.
977
978 2004-01-20  Miguel de Icaza  <miguel@ximian.com>
979
980         Merge a few bits from the Anonymous Method MCS tree.
981         
982         * statement.cs (ToplevelBlock): New class for toplevel methods,
983         will hold anonymous methods, lifted variables.
984
985         * cs-parser.jay: Create toplevel blocks for delegates and for
986         regular blocks of code. 
987
988 2004-01-20  Martin Baulig  <martin@ximian.com>
989
990         * codegen.cs (EmitContext): Removed `InTry', `InCatch',
991         `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
992         and `NeedExplicitReturn'; added `IsLastStatement'.
993         (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
994         have a `ReturnLabel' or we're not unreachable.
995
996         * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
997         child's reachability; don't just override ours with it.  Fixes
998         #58058 (lluis's example).
999         (FlowBranching): Added public InTryOrCatch(), InCatch(),
1000         InFinally(), InLoop(), InSwitch() and
1001         BreakCrossesTryCatchBoundary() methods.
1002
1003         * statement.cs (Return): Do all error checking in Resolve().
1004         Unless we are the last statement in a top-level block, always
1005         create a return label and jump to it.
1006         (Break, Continue): Do all error checking in Resolve(); also make
1007         sure we aren't leaving a `finally'.
1008         (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
1009         statement in a top-level block.
1010         (Block.Flags): Added `IsDestructor'.
1011         (Block.IsDestructor): New public property.
1012
1013 2004-01-20  Martin Baulig  <martin@ximian.com>
1014
1015         * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
1016
1017 2004-01-20  Martin Baulig  <martin@ximian.com>
1018
1019         * statement.cs (Statement.ResolveUnreachable): New public method.
1020         (If, While): Do the dead-code elimination in Resolve(), not in Emit().
1021         (Block.Resolve): Resolve unreachable statements.
1022
1023 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
1024
1025         * expression.cs: We need to fix the case where we do
1026         not have a temp variable here.
1027
1028         * assign.cs: Only expression compound assignments need
1029         temporary variables.
1030
1031 2004-01-19 Ben Maurer  <bmaurer@users.sourceforge.net>
1032
1033         * flowanalysis.cs: Reduce memory allocation in a few ways:
1034           - A block with no variables should not allocate a bit
1035             vector for itself.
1036           - A method with no out parameters does not need any tracking
1037             for assignment of the parameters, so we need not allocate
1038             any data for it.
1039           - The arrays:
1040                 public readonly Type[] VariableTypes;
1041                 public readonly string[] VariableNames;
1042             Are redundant. The data is already stored in the variable
1043             map, so we need not allocate another array for it.
1044           - We need to add alot of checks for if (params | locals) == null
1045             due to the first two changes.
1046
1047 2004-01-18  Miguel de Icaza  <miguel@ximian.com>
1048
1049         * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
1050         implement IMemoryLocation, we store a copy on a local variable and
1051         take the address of it.  Patch from Benjamin Jemlich
1052
1053         * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
1054         to use a special "type_name_expression" rule which reduces the
1055         number of "QualifiedIdentifier" classes created, and instead
1056         directly creates MemberAccess expressions.
1057
1058 2004-01-17  Miguel de Icaza  <miguel@ximian.com>
1059
1060         * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
1061         that fixes #52853.  Null literal assignment to ValueType
1062
1063         * class.cs (MethodData.Emit): Instead of checking the name of the
1064         method to determine if its a destructor, create a new derived
1065         class from Method called Destructor, and test for that.  
1066
1067         * cs-parser.jay: Create a Destructor object instead of a Method.  
1068
1069         Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
1070
1071         Fixes: 52933
1072         
1073 2004-01-16  Miguel de Icaza  <miguel@ximian.com>
1074
1075         * expression.cs (Binary.ResolveOperator): Perform an implicit
1076         conversion from MethodGroups to their delegate types on the
1077         Addition operation.
1078
1079         * delegate.cs: Introduce a new class DelegateCreation that is the
1080         base class for `NewDelegate' and `ImplicitDelegateCreation',
1081         factor some code in here.
1082
1083         * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
1084         conversion from MethodGroups to compatible delegate types. 
1085
1086         * ecore.cs (Expression.Resolve): Do not flag error 654
1087         (Methodgroupd needs parenthesis) if running on the V2 compiler, as
1088         we allow conversions from MethodGroups to delegate types now.
1089         
1090         * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
1091         assignments in v2 either.
1092
1093 2004-01-10  Miguel de Icaza  <miguel@ximian.com>
1094
1095         * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
1096         static read-only fields in ctors.
1097
1098         Applied patch from Benjamin Jemlich 
1099
1100         * expression.cs (UnaryMutator): Avoid leaking local variables. 
1101         
1102 2004-01-09  Miguel de Icaza  <miguel@ximian.com>
1103
1104         * cs-tokenizer.cs (IsCastToken): Allow the various native types
1105         here to return true, as they can be used like this:
1106
1107                 (XXX) int.MEMBER ()
1108
1109         Fixed 49836 and all the other dups
1110         
1111 2004-01-09  Zoltan Varga  <vargaz@freemail.hu>
1112
1113         * driver.cs: Implement /win32res and /win32icon.
1114
1115 2004-01-08  Miguel de Icaza  <miguel@ximian.com>
1116
1117         * cs-parser.jay: Add a rule to improve error handling for the
1118         common mistake of placing modifiers after the type.
1119
1120 2004-01-07  Miguel de Icaza  <miguel@ximian.com>
1121
1122         * cs-parser.jay (interface_event_declaration): Catch
1123         initialization of events on interfaces, and report cs0068
1124
1125         * cs-parser.jay (interface_event_declaration): Catch
1126         initialization of events. 
1127
1128         * ecore.cs: Better report missing constructors.
1129         
1130         * expression.cs (Binary.ResolveOperator): My previous bug fix had
1131         the error reporting done in the wrong place.  Fix.
1132
1133         * expression.cs (Binary.ResolveOperator): Catch the 
1134         operator + (E x, E y) error earlier, and later allow for implicit
1135         conversions in operator +/- (E e, U x) from U to the underlying
1136         type of E.
1137
1138         * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
1139         52596, if the container class is abstract, the default constructor
1140         is protected otherwise its public (before, we were always public).
1141
1142         * statement.cs (Fixed.Resolve): Catch a couple more errors in the
1143         fixed statement.
1144
1145         (Using.EmitLocalVariableDecls): Applied patch from Benjamin
1146         Jemlich that fixes bug #52597, MCS was generating invalid code for
1147         idisposable structs.   Thanks to Ben for following up with this
1148         bug as well.
1149         
1150 2004-01-06  Miguel de Icaza  <miguel@ximian.com>
1151
1152         * driver.cs: Allow assemblies without code to be generated, fixes
1153         52230.
1154
1155 2004-01-07  Nick Drochak <ndrochak@gol.com>
1156
1157         * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
1158
1159 2004-01-05  Miguel de Icaza  <miguel@ximian.com>
1160
1161         * cs-parser.jay: Add rules to improve error reporting if fields or
1162         methods are declared at the namespace level (error 116)
1163
1164         * Add rules to catch event add/remove
1165
1166 2004-01-04  David Sheldon <dave-mono@earth.li>
1167
1168   * expression.cs: Added matching ")" to error message for 
1169   CS0077
1170
1171 2004-01-03 Todd Berman <tberman@gentoo.org>
1172         
1173         * ecore.cs, attribute.cs:
1174         Applying fix from #52429.
1175
1176 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1177
1178         * ecore.cs, expression.cs, statement.cs:
1179         Total rewrite of how we handle branching. We
1180         now handle complex boolean expressions with fewer
1181         jumps. As well if (x == 0) no longer emits a ceq.
1182
1183         if (x is Foo) is much faster now, because we generate
1184         better code.
1185
1186         Overall, we get a pretty big improvement on our benchmark
1187         tests. The code we generate is smaller and more readable.
1188
1189         I did a full two-stage bootstrap. The patch was reviewed
1190         by Martin and Miguel.
1191
1192 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1193
1194         * cs-parser.jay: Make primary_expression not take a QI.
1195         we dont need this because the member_access rule covers
1196         us here. So we replace the rule with just IDENTIFIER.
1197
1198         This has two good effects. First, we remove a s/r conflict.
1199         Second, we allocate many fewer QualifiedIdentifier objects.
1200
1201 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1202
1203         * attribute.cs: Handle MarshalAs attributes as pseudo, and
1204         set the correct information via SRE. This prevents
1205         hanging on the MS runtime. Fixes #29374.
1206
1207 2004-01-03 Ben Maurer  <bmaurer@users.sourceforge.net>
1208
1209         * convert.cs: correctly handle conversions to value types
1210         from Enum and ValueType as unboxing conversions.
1211
1212         Fixes bug #52569. Patch by Benjamin Jemlich.
1213
1214 2004-01-02  Ravi Pratap  <ravi@ximian.com>
1215
1216         * expression.cs (BetterConversion): Prefer int -> uint
1217         over int -> ulong (csc's behaviour). This fixed bug #52046.
1218
1219 2004-01-02 Ben Maurer  <bmaurer@users.sourceforge.net>
1220
1221         * decl.cs (MemberCache.FindMembers): now returns a
1222         MemberInfo [].
1223
1224         * typemanager.cs: In general, go with with ^^.
1225         (CopyNewMethods): take an IList.
1226         (RealMemberLookup): Only allocate an arraylist
1227         if we copy from two sets of methods.
1228
1229         This change basically does two things:
1230         1) Fewer array lists allocated due to CopyNewMethods.
1231         2) the explicit cast in MemberList costed ALOT.
1232
1233 2004-01-02  Zoltan Varga  <vargaz@freemail.hu>
1234
1235         * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
1236         a hashtable to avoid needless string allocations when an identifier is
1237         used more than once (the common case).
1238
1239 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
1240
1241         * pending.cs: MS's TypeBuilder.GetInterfaces ()
1242         is broken, it will not return anything. So, we
1243         have to use the information we have in mcs to
1244         do the task.
1245
1246         * typemanager.cs: Add a cache for GetInterfaces,
1247         since this will now be used more often (due to ^^)
1248
1249         (GetExplicitInterfaces) New method that gets the
1250         declared, not effective, interfaces on a type
1251         builder (eg, if you have interface IFoo, interface
1252         IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
1253         { IBar }.
1254
1255         This patch makes MCS able to bootstrap itself on
1256         Windows again.
1257
1258 2004-01-01 Ben Maurer  <bmaurer@users.sourceforge.net>
1259
1260         * expression.cs: Remove the Nop's that Miguel put
1261         in by mistake.
1262
1263 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
1264
1265         * report.cs, codegen.cs: Give the real stack trace to
1266         the error when an exception is thrown.
1267
1268 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
1269
1270         * decl.cs: only allocate hashtables for ifaces if 
1271         it is an iface!
1272
1273 2003-12-31 Ben Maurer  <bmaurer@users.sourceforge.net>
1274
1275         * expression.cs: fix the error from cs0121-2.cs
1276         (a parent interface has two child interfaces that
1277         have a function with the same name and 0 params
1278         and the function is called through the parent).
1279
1280 2003-12-30 Ben Maurer  <bmaurer@users.sourceforge.net>
1281
1282         * class.cs, rootcontext.cs, typmanager.cs: do not
1283         leak pointers.
1284
1285 2003-12-28 Ben Maurer  <bmaurer@users.sourceforge.net>
1286
1287         * codegen.cs: remove stack for the ec flow branching.
1288         It is already a linked list, so no need.
1289
1290 2003-12-27 Ben Maurer  <bmaurer@users.sourceforge.net>
1291
1292         * Makefile: Allow custom profiler here.
1293
1294 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
1295
1296         * typemanager.cs (LookupType):
1297           - Use a static char [], because split takes
1298             a param array for args, so it was allocating
1299             every time.
1300           - Do not store true in a hashtable, it boxes.
1301
1302 2003-12-26 Ben Maurer  <bmaurer@users.sourceforge.net>
1303
1304         * flowanalysis.cs: bytify common enums.
1305
1306 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
1307
1308         * modifiers.cs: Add a new set of flags for the
1309         flags allowed on explicit interface impls.
1310         * cs-parser.jay: catch the use of modifiers in
1311         interfaces correctly.
1312         * class.cs: catch private void IFoo.Blah ().
1313
1314         All related to bug #50572.
1315
1316 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
1317
1318         * decl.cs: Rewrite the consistant accessability checking.
1319         Accessability is not linear, it must be implemented in
1320         a tableish way. Fixes #49704.
1321
1322 2003-12-25 Ben Maurer  <bmaurer@users.sourceforge.net>
1323
1324         * expression.cs: Handle negation in a checked context.
1325         We must use subtraction from zero. Fixes #38674.
1326
1327 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1328
1329         * class.cs: Ignore static void main in DLLs.
1330         * rootcontext.cs: Handle the target type here,
1331         since we are have to access it from class.cs
1332         * driver.cs: account for the above.
1333
1334 2003-12-23 Ben Maurer  <bmaurer@users.sourceforge.net>
1335
1336         * report.cs: Give line numbers and files if available.
1337
1338 2003-12-20  Zoltan Varga  <vargaz@freemail.hu>
1339
1340         * driver.cs: Implement /addmodule.
1341
1342         * typemanager.cs:  Change 'modules' field so it now contains Modules not
1343         ModuleBuilders.
1344
1345 2003-12-20  Martin Baulig  <martin@ximian.com>
1346
1347         * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
1348         (FieldBase.IsAssigned): Removed this field.
1349         (FieldBase.SetAssigned): New public method.
1350         (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
1351
1352 2003-12-20  Martin Baulig  <martin@ximian.com>
1353
1354         * expression.cs (LocalVariableReference.DoResolve): Don't set
1355         `vi.Used' if we're called from DoResolveLValue().
1356
1357         * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
1358         returns the usage vector it just merged into the current one -
1359         pass this one to UsageWarning().
1360         (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
1361         of the `EmitContext', don't call this recursively on our children.
1362
1363 2003-12-19  Zoltan Varga  <vargaz@freemail.hu>
1364
1365         * driver.cs: Implement /target:module.
1366
1367 2003-12-18  Zoltan Varga  <vargaz@freemail.hu>
1368
1369         * support.cs (CharArrayHashtable): New helper class.
1370
1371         * cs-tokenizer.cs: Store keywords in a hashtable indexed by 
1372         char arrays, not strings, so we can avoid creating a string in
1373         consume_identifier if the identifier is a keyword.
1374
1375 2003-12-16  Martin Baulig  <martin@ximian.com>
1376
1377         * statement.cs (LocalInfo.Assigned): Removed this property.
1378         (LocalInfo.Flags): Removed `Assigned'.
1379         (LocalInfo.IsAssigned): New public method; takes the EmitContext
1380         and uses flow analysis.
1381         (Block.UsageWarning): Made this method private.
1382         (Block.Resolve): Call UsageWarning() if appropriate.
1383
1384         * expression.cs (LocalVariableReference.DoResolve): Always set
1385         LocalInfo.Used here.
1386
1387 2003-12-13  Martin Baulig  <martin@ximian.com>
1388
1389         * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
1390         any value here; we're now using flow analysis to figure out
1391         whether a statement/block returns a value.
1392
1393 2003-12-13  Martin Baulig  <martin@ximian.com>
1394
1395         * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
1396         working again.
1397         (FlowBranching.MergeFinally): Don't call
1398         `branching.CheckOutParameters()' here, this is called in
1399         MergeTopBlock().
1400         (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
1401         when adding the `finally' vector.       
1402
1403 2003-12-13  Martin Baulig  <martin@ximian.com>
1404
1405         * flowanalysis.cs
1406         (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
1407         actually work and also fix #48962.
1408
1409 2003-12-12 Ben Maurer  <bmaurer@users.sourceforge.net>
1410
1411         * decl.cs: Do not check System.Object for nested types,
1412         since we know it does not have any. Big bang for buck:
1413
1414         BEFORE:
1415            Run 1:   8.35 seconds
1416            Run 2:   8.32 seconds
1417            corlib:  17.99 seconds
1418         AFTER:
1419            Run 1:   8.17 seconds
1420            Run 2:   8.17 seconds
1421            corlib:  17.39 seconds
1422
1423 2003-12-11 Ben Maurer  <bmaurer@users.sourceforge.net>
1424
1425         * class.cs (FindMembers): Allocate arraylists on demand. Most of the
1426         time we are returning 0 members, so we save alot here.
1427
1428 2003-12-11  Martin Baulig  <martin@ximian.com>
1429
1430         * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
1431         `MergeChild()', also just take the `FlowBranching' as argument;
1432         call Merge() on it and return the result.
1433         (FlowBranching.Merge): We don't need to do anything if we just
1434         have one sibling.
1435
1436 2003-12-11  Martin Baulig  <martin@ximian.com>
1437
1438         * flowanalysis.cs: Use a list of `UsageVector's instead of storing
1439         them in an `ArrayList' to reduce memory usage.  Thanks to Ben
1440         Maurer for this idea.
1441
1442 2003-12-11  Martin Baulig  <martin@ximian.com>
1443
1444         * flowanalysis.cs (MergeResult): This class is now gone; we now
1445         use the `UsageVector' for this.  The reason for this is that if a
1446         branching just has one sibling, we don't need to "merge" them at
1447         all - that's the next step to do.
1448         (FlowBranching.Merge): We now return a `UsageVector' instead of a
1449         `MergeResult'.
1450
1451 2003-12-11  Martin Baulig  <martin@ximian.com>
1452
1453         Reworked flow analyis and made it more precise and bug-free.  The
1454         most important change is that we're now using a special `Reachability'
1455         class instead of having "magic" meanings of `FlowReturns'.  I'll
1456         do some more cleanups and optimizations and also add some more
1457         documentation this week.
1458
1459         * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
1460         largely reworked this class.
1461         (FlowReturns): Removed `Unreachable' and `Exception'; we now use
1462         the new `Reachability' class instead of having "magic" values here.
1463         (FlowBranching): We're now using an instance of `Reachability'
1464         instead of having separate `Returns', `Breaks' etc. fields.
1465
1466         * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
1467         based on flow analysis; ignore the return value of block.Emit ().
1468
1469 2003-12-10  Zoltan Varga  <vargaz@freemail.hu>
1470
1471         * driver.cs typemanager.cs: Find the mono extensions to corlib even
1472         if they are private.
1473
1474 2003-12-09  Martin Baulig  <martin@ximian.com>
1475
1476         * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
1477         call them directly on the UsageVector.
1478
1479 2003-12-09  Martin Baulig  <martin@ximian.com>
1480
1481         * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
1482         Changed return type from `FlowReturns' to `Reachability'.
1483
1484 2003-12-09  Martin Baulig  <martin@ximian.com>
1485
1486         * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
1487         (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
1488         `Reachable' fields with a single `Reachability' one.
1489
1490 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1491
1492         * class.cs (FindMembers): Remove foreach's.
1493
1494         Bootstrap times:
1495         
1496         BEFORE
1497                 Run 1:   8.74 seconds
1498                 Run 2:   8.71 seconds
1499         
1500         AFTER
1501                 Run 1:   8.64 seconds
1502                 Run 2:   8.58 seconds
1503         
1504
1505 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1506
1507         * cs-parser.jay:
1508         * gen-treedump.cs:
1509         * statement.cs:
1510         This patch does a few things:
1511                 1. EmptyStatement is now a singleton, so it is never reallocated.
1512                 2. All blah is EmptyStatement constructs have been changed to
1513                    blah == EmptyStatement.Value, which is much faster and valid
1514                    now that EmptyStatement is a singleton.
1515                 3. When resolving a block, rather than allocating a new array for
1516                    the non-empty statements, empty statements are replaced with
1517                    EmptyStatement.Value
1518                 4. Some recursive functions have been made non-recursive.
1519         Mainly the performance impact is from (3), however (1) and (2) are needed for
1520         this to work. (4) does not make a big difference in normal situations, however
1521         it makes the profile look saner.
1522
1523         Bootstrap times:
1524
1525         BEFORE
1526         9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
1527         9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
1528         Total memory allocated: 56397 KB
1529         
1530         AFTER
1531         9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
1532         8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
1533         Total memory allocated: 55666 KB
1534
1535 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1536
1537         * support.cs: Rewrite DoubleHash to use its own impl. Is faster
1538         than the hashtable in a hashtable version
1539
1540         * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
1541         we always end up concating a string. This results in a huge perf
1542         loss, because many strings have to be tracked by the GC. In this
1543         patch, we first use a hashtable that works with two keys, so that
1544         the strings do not need to be concat'ed.
1545
1546         Bootstrap times:
1547         BEFORE
1548                 Run 1:   8.74 seconds
1549                 Run 2:   8.71 seconds
1550         
1551         AFTER
1552                 Run 1:   8.65 seconds
1553                 Run 2:   8.56 seconds
1554         
1555 2003-12-08 Ben Maurer  <bmaurer@users.sourceforge.net>
1556
1557         * Makefile: Add a new target `do-time' that does a quick and simple
1558         profile, leaving easy to parse output.
1559
1560 2003-12-08  Zoltan Varga  <vargaz@freemail.hu>
1561
1562         * codegen.cs (Init): Create the dynamic assembly with 
1563         AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
1564
1565 2003-12-02 Ben Maurer  <bmaurer@users.sourceforge.net>
1566
1567         * support.cs: Make the PtrHashtable use only one
1568         instance of its comparer.
1569
1570 2003-11-30  Zoltan Varga  <vargaz@freemail.hu>
1571
1572         * typemanager.cs: Fix lookup of GetNamespaces.
1573
1574 2003-11-29  Miguel de Icaza  <miguel@ximian.com>
1575
1576         * expression.cs: Removed redundant line.
1577
1578         * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
1579         ArrayLists, use for loops with bounds.  
1580
1581         * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
1582         arraylist.
1583
1584         * expression.cs (Invocation.OverloadResolve): Avoid foreach on
1585         arraylists, use for loop with bounds.
1586
1587         The above three changes give us a 0.071 second performance
1588         improvement out of 3.294 seconds down to 3.223.  On my machine
1589         the above changes reduced the memory usage by 1,387 KB during
1590         compiler bootstrap.
1591
1592         * cs-parser.jay (QualifiedIdentifier): New class used to represent
1593         QualifiedIdentifiers.  Before we created a new string through
1594         concatenation, and mostly later on, the result would be
1595         manipulated by DecomposeQI through string manipulation.
1596
1597         This reduced the compiler memory usage for bootstrapping from
1598         59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
1599         compile times in 0.05 seconds.
1600
1601 2003-11-28  Dick Porter  <dick@ximian.com>
1602
1603         * support.cs: Do string compares with the Invariant culture.
1604
1605         * rootcontext.cs: 
1606         * gen-treedump.cs: 
1607         * expression.cs: 
1608         * driver.cs: 
1609         * decl.cs: 
1610         * codegen.cs: 
1611         * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
1612         the comparison is done with the Invariant culture.
1613
1614 2003-11-27  Miguel de Icaza  <miguel@ximian.com>
1615
1616         * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
1617         GetEnumerator method.
1618
1619         (ProbeCollectionType): Iterate starting at the most specific type
1620         upwards looking for a GetEnumerator
1621
1622         * expression.cs: Shift count can be up to 31 for int/uint and 63
1623         for long/ulong.
1624
1625 2003-11-26  Miguel de Icaza  <miguel@ximian.com>
1626
1627         * statement.cs (Block.LookupLabel): Also look for the label on the
1628         children blocks.  Use a hash table to keep track of visited
1629         nodes. 
1630
1631         * cfold.cs (IntConstant to UIntConstant mapping): Only return if
1632         we actually did transform the other operand, otherwise fall back
1633         to the common codepath that casts to long.
1634
1635         * cs-tokenizer.cs: Use the same code pattern as the int case.
1636         Maybe I should do the parsing myself, and avoid depending on the
1637         Parse routines to get this done.
1638
1639 2003-11-25  Miguel de Icaza  <miguel@ximian.com>
1640
1641         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
1642         which fixes bug 51347.  This time test it.
1643         
1644         * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
1645         attributes for example can not tell the difference between these.
1646         The difference was only a syntax feature of the language. 
1647
1648         * attribute.cs: Apply attributes to delegates.
1649
1650         * delegate.cs: Call the apply attributes method.
1651
1652 2003-11-24  Miguel de Icaza  <miguel@ximian.com>
1653
1654         * convert.cs (TryImplicitIntConversion): One line bug fix: we were
1655         comparing 0 vs Byte.MinValue, not the value
1656
1657         (ImplicitConversionRequired): When reporting a conversion error,
1658         use error 31 to print out the constant error instead of the
1659         simpler 29.
1660
1661         * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),  
1662         which fixes bug 51347.
1663         
1664 2003-11-22  Miguel de Icaza  <miguel@ximian.com>
1665
1666         * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen) 
1667         which fixes the -warnaserror command line option.
1668         
1669 2003-11-21  Miguel de Icaza  <miguel@ximian.com>
1670
1671         * cfold.cs (DoNumericPromotions): During constant folding of
1672         additions on UIntConstant, special case intconstants with
1673         IntConstants like we do on the expression binary operator. 
1674
1675 2003-11-12  Miguel de Icaza  <miguel@ximian.com>
1676
1677         * convert.cs (ImplicitReferenceConversion): We were missing a case
1678         (System.Enum are not value types or class types, so we need to
1679         classify them separatedly).
1680
1681         * driver.cs: We do not support error 2007.
1682
1683 2003-11-12 Jackson Harper <jackson@ximian.com>
1684
1685         * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
1686         system directory. Also use the full file name so users can
1687         libraries names mscorlib-o-tron.dll in a non system dir.
1688         
1689 2004-01-04  David Sheldon <dave-mono@earth.li>
1690
1691         * expression.cs: Added matching ")" to error message for CS0077.
1692
1693 2003-12-19  Martin Baulig  <martin@ximian.com>
1694
1695         * typemanager.cs (TypeManager.IsEqualGenericType): New public
1696         static method; see documentation in the method.
1697         (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
1698
1699         * convert.cs (Convert.ImplicitReferenceConversion,
1700         Convert.ImplicitReferenceConversionExists): Add support for
1701         generic type declarations; see gen-36.cs.
1702
1703 2003-12-19  Martin Baulig  <martin@ximian.com>
1704
1705         * pending.cs (Pending.InterfaceMethod): Use
1706         `Type.IsAssignableFrom()' instead of `=='.
1707
1708 2003-12-18  Martin Baulig  <martin@ximian.com>
1709
1710         * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
1711         byref types first.
1712
1713         * convert.cs (Convert.ImplicitStandardConversionExists): Use
1714         `expr_type.Equals (target_type)' instead of `=='.
1715
1716 2003-12-08  Martin Baulig  <martin@ximian.com>
1717
1718         * generics.cs (Constraints.Types): Removed.
1719         (Constraints.Resolve): Just resolve everything to TypeExpr's, not
1720         to Type's.
1721         (Constraints.ResolveTypes): New public method; resolves the
1722         TypeExpr's to Type's.
1723         (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
1724         longer takes the constraints.
1725         (TypeParameter.DefineMethod): Likewise.
1726         (TypeParameter.DefineType): New public method.  Calls
1727         `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
1728         the constraints.
1729
1730 2003-12-08  Martin Baulig  <martin@ximian.com>
1731
1732         * convert.cs (Convert.ImplicitConversionStandard): Use
1733         `expr_type.Equals (target_type)' instead of `=='.
1734
1735 2003-12-08  Martin Baulig  <martin@ximian.com>
1736
1737         * typemanager.cs (TypeManager.GetReferenceType): Call
1738         `Type.MakeByRefType ()'.
1739
1740 2003-12-08  Martin Baulig  <martin@ximian.com>
1741
1742         * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
1743         just has some special meaning in some situations.  For instance,
1744         it is allowed to use `where' as the name of a variable etc.
1745
1746 2003-12-04  Martin Baulig  <martin@ximian.com>
1747
1748         * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
1749         `Type.MakeArrayType()' for array types.
1750
1751 2003-11-18  Miguel de Icaza  <miguel@ximian.com>
1752
1753         * expression.cs (Invocation.VerifyArgumentsCompat): Remove
1754         debugging message.
1755
1756         (SizeOf.DoResolve): assign the `type_queried' field.  This gets
1757         corlib to compile.
1758
1759 2003-11-16  Martin Baulig  <martin@ximian.com>
1760
1761         * codegen.cs (EmitContext.IsGeneric): Removed.
1762
1763         * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
1764         ResolveGeneric() on the DeclSpace.
1765
1766 2003-11-16  Martin Baulig  <martin@ximian.com>
1767
1768         * generic.cs (TypeArguments.Resolve):
1769         `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
1770         `ResolveType()' on it to get the Type.
1771
1772 2003-11-15  Martin Baulig  <martin@ximian.com>
1773
1774         * generic.cs (ConstructedType.GetInterfaces): Override this.
1775
1776 2003-11-14  Martin Baulig  <martin@ximian.com>
1777
1778         * interface.cs (Interface.DefineType): Define all type parameters
1779         before adding the interfaces we inherit.
1780
1781 2003-11-11  Martin Baulig  <martin@ximian.com>
1782
1783         * generic.cs (ConstructedType.ResolveType): Always call
1784         `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
1785
1786 2003-11-10  Martin Baulig  <martin@ximian.com>
1787
1788         * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
1789         (TypeManager.InitCoreTypes): Initialize them here, but instead of
1790         calling `ResolveType()' on them, directly assign their `Type'.
1791
1792 2003-11-08  Martin Baulig  <martin@ximian.com>
1793
1794         * generic.cs (ConstructedType): Override `IsClass' etc.
1795
1796 2003-11-08  Martin Baulig  <martin@ximian.com>
1797
1798         * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
1799         return value and the `out parent' parameter.
1800         (TypeContainer.DefineType): Moved the CS0644 check into
1801         GetClassBases().  Don't pass the interface types to the
1802         `builder.DefineType()'/`builder.DefineNestedType()', but resolve
1803         them later and then call `TypeBuilder.AddInterfaceImplementation()'.
1804
1805         * ecore.cs (TypeExpr.IsAttribute): New property.
1806         (TypeExpr.GetInterfaces): New method.
1807
1808         * interface.cs (Interface.GetInterfaceTypeByName): Return a
1809         TypeExpr instead of a Type.
1810         (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
1811         (Interface.DefineType): Don't pass the interface types to the
1812         `builder.Definetype()'/`builder.DefineNestedType()', but resolve
1813         them later and then call `TypeBulider.AddInterfaceImplementation()'.
1814
1815         * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
1816         instead of a `Type[]'.
1817         (TypeManager.RegisterBuilder): Likewise.
1818         (TypeManager.AddUserInterface): Likewise.
1819         (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
1820         `Type[]' and also return a `TypeExpr[]'.
1821         (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
1822
1823 2003-11-08  Martin Baulig  <martin@ximian.com>
1824
1825         * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
1826         Expression.     
1827
1828 2003-11-08  Martin Baulig  <martin@ximian.com>
1829
1830         * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
1831         TypeManager.ResolveExpressionTypes().
1832
1833         * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
1834         instead of an Expression.
1835         (TypeExpr): This is now an abstract base class for `TypeExpression'.
1836         (TypeExpression): New public class; formerly known as `TypeExpr'.
1837
1838         * expression.cs (ComposedCast): Derive from TypeExpr.
1839
1840         * typemanager.cs (TypeManager.system_*_expr): These are now
1841         TypExpr's instead of Expression's.
1842         (TypeManager.ResolveExpressionTypes): New public static function;
1843         called from DeclSpace.GetTypeResolveEmitContext() to resolve all
1844         of them.        
1845
1846 2003-11-06  Miguel de Icaza  <miguel@ximian.com>
1847
1848         * expression.cs (New.DoResolve): Do not dereference value that
1849         might be a null return.
1850
1851         * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
1852         sure that the constant value has the right type.  Fixes an
1853         unreported bug, similar to 50425.
1854
1855         * const.cs (Const.LookupConstantValue): Call
1856         ImplicitStandardConversionExists before doing a conversion to
1857         avoid havng the TypeManager.ChangeType do conversions.
1858
1859         Reduced the number of casts used
1860
1861         (Const.ChangeType): New routine to enable reuse of the constant
1862         type changing code from statement.
1863
1864         * typemanager.cs (ChangeType): Move common initialization to
1865         static global variables.
1866
1867         Fixes #50425.
1868
1869         * convert.cs (ImplicitReferenceConversion): Somehow we allowed
1870         every value type to go through, even if it was void.  Fix that. 
1871
1872         * cs-tokenizer.cs: Use is_identifier_start_character on the start
1873         character of the define, and the is_identifier_part_character for
1874         the rest of the string.
1875
1876 2003-11-05  Miguel de Icaza  <miguel@ximian.com>
1877
1878         * expression.cs (UnaryMutator.EmitCode): When I updated
1879         LocalVariableReference.DoResolve, I overdid it, and dropped an
1880         optimization done on local variable references.
1881
1882 2003-11-04  Miguel de Icaza  <miguel@ximian.com>
1883
1884         * ecore.cs: Convert the return from Ldlen into an int.
1885
1886 2003-10-20  Miguel de Icaza  <miguel@ximian.com>
1887
1888         * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
1889         the accessibility, this is a special case for toplevel non-public
1890         classes (internal for instance).
1891
1892 2003-10-20  Nick Drochak <ndrochak@gol.com>
1893
1894         * ecore.cs: Fix typo and build.  Needed another right paren.
1895
1896 2003-10-19  Miguel de Icaza  <miguel@ximian.com>
1897
1898         * ecore.cs: Applied fix from Ben Maurer.   We were handling in the
1899         `internal' case regular and protected, but not allowing protected
1900         to be evaluated later.  Bug 49840
1901
1902 2003-10-15  Miguel de Icaza  <miguel@ximian.com>
1903
1904         * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
1905         to kb.Nlast, and not the kb.nFirst to isolate the switch
1906         statement.
1907
1908         Extract the underlying type, so enumerations of long/ulong are
1909         treated like long/ulong.
1910
1911 2003-10-14  Miguel de Icaza  <miguel@ximian.com>
1912
1913         * expression.cs (New): Overload the meaning of RequestedType to
1914         track the possible creation of the NewDelegate type, since
1915         DoResolve is invoked more than once for new constructors on field
1916         initialization.
1917
1918         See bugs: #48800 and #37014
1919
1920         * cs-parser.jay (declare_local_constants): Take an arraylist
1921         instead of a single constant.
1922
1923         (local_constant_declaration): It should take a
1924         constant_declarators, not a constant_declarator.  Fixes 49487
1925
1926         * convert.cs: Fix error report.
1927
1928 2003-10-13 Jackson Harper <jackson@ximian.com>
1929
1930         * typemanager.cs (TypeToCoreType): Add float and double this fixes
1931         bug #49611
1932         
1933 2003-11-03  Martin Baulig  <martin@ximian.com>
1934
1935         * expression.cs (ArrayAccess.GetStoreOpcode): Added
1936         `out bool has_type_arg'; if set, we need to pass the type to
1937         ig.Emit().
1938         (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
1939         Stelem_Any/Ldelem_Any for generic parameters.   
1940
1941 2003-11-02  Martin Baulig  <martin@ximian.com>
1942
1943         * expression.cs (Invocation.EmitCall): Use
1944         `TypeManager.IsValueType()' to check whether it's a value type.
1945         Don't set `struct_call' when calling a method on a type parameter.
1946
1947 2003-11-02  Martin Baulig  <martin@ximian.com>
1948
1949         * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
1950         and removed the TypeBuilder argument.
1951
1952         * typemanager.cs (TypeManager.IsValueType): Return
1953         `t.IsGenericParameter || t.IsValueType'.
1954
1955 2003-10-25  Martin Baulig  <martin@ximian.com>
1956
1957         * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
1958         call ConstructedType.Resolve() on it.
1959
1960         * generic.cs (ConstructedType.Resolve): Set `type' on success.
1961
1962 2003-10-25  Martin Baulig  <martin@ximian.com>
1963
1964         * class.cs (TypeContainer.GetClassBases): Changed
1965         `out Type parent' into `out TypeExpr parent'.  Moved CS0644 and
1966         CS8214 reporting here.
1967         (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
1968         instead of a `Type' for our parent.  In case of a recursive
1969         declaration (see tests/gen-23.cs for an example), our parent is a
1970         ConstructedType and it doesn't have its type set.  So, first
1971         create our own TypeBuilder, then call constructed.Resolve() to get
1972         the parent's type and finally TypeBuilder.SetParent() it.
1973
1974         * ecore.cs (TypeExpr.Name): New public virtual property.
1975
1976         * generic.cs
1977         (ConstructedType): We're now a TypeExpr and not just an Expression.
1978         (ConstructedType.ResolveAsTypeStep): Don't resolve our type
1979         arguments here; this is done later.
1980         (ConstructedType.Resolve): New public method to resolve the type
1981         arguments and bind them.
1982
1983 2003-10-21  Martin Baulig  <martin@ximian.com>
1984
1985         * convert.cs: Use `TypeManager.IsValueType' instead of
1986         'type.IsValueType' everywhere.
1987
1988         * typemanager.cs (TypeManager.IsValueType): Return true for type
1989         parameters.  The reason for this is that we need to box a type
1990         parameter when converting it to a reference type.
1991
1992         * cs-parser.jay: Added support for default value expressions.
1993
1994         * generics.cs (DefaultValueExpression): New public class.       
1995
1996 2003-10-17  Martin Baulig  <martin@ximian.com>
1997
1998         * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
1999         TypeContainer so we can also use this for Interfaces.
2000         (TypeParameter.Resolve): Likewise.
2001
2002         * interface.cs (Interface.DefineType): Added support for generic
2003         interfaces.
2004
2005         * cs-parser.jay: Added support for generic structs and interfaces.
2006
2007 2003-10-17  Martin Baulig  <martin@ximian.com>
2008
2009         * generic.cs (GenericMemberAccess.DoResolve): We can now actually
2010         call generic methods :-)
2011
2012 2003-10-16  Martin Baulig  <martin@ximian.com>
2013
2014         * cs-parser.jay (namespace_or_type_name): Only create a
2015         GenericMemberAccess if we actually have type arguments.
2016
2017 2003-10-13  Martin Baulig  <martin@ximian.com>
2018
2019         * class.cs (Method.Define): If we're a generic method, call
2020         TypeBuilder.DefineGenericMethod () before resolving
2021         the parameters.
2022         (MethodData): Added .ctor which takes an additional MethodBuilder
2023         argument; this is used for generic methods.
2024         (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
2025         we already have a MethodBuilder.
2026
2027 2003-10-10  Martin Baulig  <martin@ximian.com>
2028
2029         * class.cs (Method): Added .ctor which takes a `GenericMethod'
2030         instead of a `DeclSpace'.  This is used for generic methods.
2031
2032         * cs-parser.jay (method_header): Added support for generic
2033         methods; create a `GenericMethod' instance and pass it to the
2034         `Method's .ctor; it'll be used as the `DeclSpace' to lookup
2035         parameters and locals.
2036
2037         * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
2038         since we already have the location.  Check whether we're a generic
2039         type declaration or a generic method and create the correct type
2040         parameter.
2041
2042         * generic.cs (TypeParameter.DefineMethod): New public method.
2043         (GenericMethod): New public class; derives from DeclSpace and is
2044         used for generic methods.       
2045
2046 2003-10-09  Martin Baulig  <martin@ximian.com>
2047
2048         * class.cs (MethodCore): Added additional `DeclSpace ds' argument
2049         to the .ctor.
2050         (MethodCore.DoDefineParameters): Removed the TypeContainer
2051         argument; use the DeclSpace which was passed to the .ctor instead.
2052         (MethodCore.CheckParameter): Take a DeclSpace instead of a
2053         TypeContainer; we only need a DeclSpace here.
2054
2055 2003-10-09  Martin Baulig  <martin@ximian.com>
2056
2057         * class.cs (MethodData): Added additional `DeclSpace ds' argument
2058         to the .ctor.
2059         (MethodData.Define, MethodData.Emit): Pass the `ds' to the
2060         EmitContext's .ctor.    
2061
2062 2003-10-09  Martin Baulig  <martin@ximian.com>
2063
2064         * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
2065         (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
2066         AsAccessible(), moved them as well.
2067
2068         * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
2069
2070 2003-10-07  Miguel de Icaza  <miguel@ximian.com>
2071
2072         * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
2073         generation for >=, as spotted by Paolo, bug 48679.  
2074         Patch from David Waite.
2075
2076         * cs-tokenizer.cs: Add handling for #pragma.
2077
2078         * cs-parser.jay: Allow for both yield and yield return in the
2079         syntax.  The anti-cobolization of C# fight will go on!
2080
2081         * class.cs (TypeBuilder.DefineType): Catch error condition here
2082         (Parent.DefineType erroring out and returning null).
2083
2084         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
2085         coping with enumerations variables, we were mistakenly processing
2086         them as a regular value type instead of built-in types.  Fixes the
2087         bug #48063
2088
2089         * typemanager.cs (IsBuiltinOrEnum): New method.
2090
2091 2003-09-30  Miguel de Icaza  <miguel@ximian.com>
2092
2093         * cs-parser.jay: Upgrade: yield now needs the return clause.
2094
2095 2003-10-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
2096
2097         * cs-parser.jay : Renamed yyName to yyNames related to jay.
2098
2099 2003-09-29  Martin Baulig  <martin@ximian.com>
2100
2101         * typemanager.cs (TypeManager.GetMethodFlags): Added support for
2102         inflated generic methods.
2103
2104         * generics.cs (ConstructedType): Distinguish between open and
2105         closed constructed types; correctly resolve the arguments.
2106
2107 2003-09-22  Martin Baulig  <martin@ximian.com>
2108
2109         * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
2110         all type arguments meet their constraints.
2111
2112 2003-09-19  Martin Baulig  <martin@ximian.com>
2113
2114         * decl.cs (MemberCache.SetupCacheForInterface): Take a
2115         `MemberCache parent' argument.  Normally, an interface doesn't
2116         have a parent type except System.Object, but we use this in gmcs
2117         for generic type parameters.
2118
2119 2003-09-18  Martin Baulig  <martin@ximian.com>
2120
2121         * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
2122         on `type.IsInterface'; don't check whether the type has a parent
2123         to determine whether it's an interface.
2124
2125 2003-09-17  Martin Baulig  <martin@ximian.com>
2126
2127         * generic.cs (ConstructedType.ToString): Always use `name' as the
2128         type name.
2129
2130 2003-09-15  Martin Baulig  <martin@ximian.com>
2131
2132         * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
2133
2134         * generic.cs (Constraints.Resolve): New public method; this is
2135         called to resolve the constraint types and to check whether all
2136         the constraints are correct.
2137         (Constraints.Types): New public property.
2138         (TypeParameter.Resolve): New public method; resolves all the
2139         type's constraints.
2140
2141         * class.cs (TypeContainer.DefineType): Call
2142         TypeParameter.Resolve() before actually defining the type.
2143
2144 2003-09-15  Martin Baulig  <martin@ximian.com>
2145
2146         * class.cs (TypeContainer.DefineType): Added an error flag to
2147         avoid reporting duplicate CS0146's ("class definition is
2148         circular.").
2149
2150         * driver.cs (Driver.MainDriver): Abort if
2151         RootContext.ResolveTree() reported any errors.
2152
2153 2003-09-07  Martin Baulig  <martin@ximian.com>
2154
2155         * report.cs (Error, Warning): Added overloaded versions which take
2156         a `params object[] args' and call String.Format().
2157
2158 2003-09-07  Martin Baulig  <martin@ximian.com>
2159
2160         * decl.cs (DeclSpace..ctor): Don't call
2161         NamespaceEntry.DefineName() here; do it in RecordDecl() which is
2162         called from Tree.RecordDecl().  Fixes the CS0101 reporting.
2163         (DeclSpace.RecordDecl): New method.
2164
2165         * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
2166
2167 2003-09-02  Ravi Pratap  <ravi@ximian.com>
2168
2169         * attribute.cs (CheckAttributeTarget): Ensure that we allow return
2170         value attributes to be applied to ParameterBuilders.
2171
2172         * class.cs (MethodCore.LabelParameters): Make static and more
2173         generic so that it can be used from other places - like interface
2174         methods, for instance.
2175
2176         * interface.cs (Interface.Emit): Call LabelParameters before
2177         emitting attributes on the InterfaceMethod.
2178
2179 2003-09-07  Martin Baulig  <martin@ximian.com>
2180
2181         * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
2182         if the number of type parameters doesn't match.
2183
2184 2003-09-04  Martin Baulig  <martin@ximian.com>
2185
2186         * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
2187         for arrays of generic type params (ie. `!0[]').
2188
2189 2003-09-04  Martin Baulig  <martin@ximian.com>
2190
2191         * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
2192         for the moment.
2193
2194 2003-09-04  Martin Baulig  <martin@ximian.com>
2195
2196         * decl.cs (DeclSpace.LookupGeneric): New method.
2197         (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
2198         moment.
2199
2200         * generic.cs (TypeParameterExpr): Take a TypeParameter as
2201         argument, not just a string.
2202         (TypeParameter.Define): New public method; this is called to
2203         actually define the generic parameter; after this, you can use the
2204         new `Type' property to get the type.
2205
2206 2003-09-04  Martin Baulig  <martin@ximian.com>
2207
2208         * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
2209         is now an ArrayList; initialize the result of the `TypeParameters'
2210         property here.
2211         (DeclSpace.GetGenericData): Removed.
2212         (DeclSpace.LookupGeneric): Temporarily removed; we need to
2213         implement this in a different way.
2214         (DeclSpace.GetTypeParameters): Removed; there's now a
2215         `TypeParameters' property.
2216         (DeclSpace.TypeParameters): New public property.
2217
2218         * generic.cs (Constraints): Make this class public.
2219         (TypeParameter): New public class.
2220
2221 2003-09-04  Martin Baulig  <martin@ximian.com>
2222
2223         * decl.cs (DeclSpace.GetTypeParameters): New method to return the
2224         generic parameters.
2225
2226         * class.cs (TypeContainer.DefineType): Call
2227         TypeBuilder.DefineGenericParameter () on all generic parameters if
2228         this is a generic type.
2229
2230 2003-08-28  Martin Baulig  <martin@ximian.com>
2231
2232         * sample-stack.il: Compile this with ilasm: "ilasm /dll
2233         sample-stack.il".
2234
2235         * sample-hello.cs: Compile this with gmcs: "gmcs
2236         /r:sample-stack.dll sample-hello.cs".
2237
2238 2003-08-28  Martin Baulig  <martin@ximian.com>
2239
2240         * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
2241         the parameters to the generic type.
2242
2243 2003-08-28  Martin Baulig  <martin@ximian.com>
2244
2245         * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
2246
2247 2003-08-28  Martin Baulig  <martin@ximian.com>
2248
2249         * cs-parser.jay (opt_type_argument_list): Use
2250         `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
2251         (primary_expression): Replace `qualified_identifier' with `type_name'.
2252         (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
2253
2254         * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
2255         parser to check whether it is syntactically a type parameter list;
2256         return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
2257         this case.
2258
2259 2003-08-26  Martin Baulig  <martin@ximian.com>
2260
2261         * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
2262         resolving aliases; fixes #47927.
2263
2264 2003-08-26  Martin Baulig  <martin@ximian.com>
2265
2266         * statement.cs (Using.DoResolve): This is internally emitting a
2267         try/finally clause, so we need to set ec.NeedExplicitReturn if we
2268         do not always return.  Fixes #47681.
2269
2270 2003-08-26  Martin Baulig  <martin@ximian.com>
2271
2272         * decl.cs (MemberCore): Moved WarningNotHiding(),
2273         Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
2274         into MemberBase.
2275         (AdditionResult): Make this nested in DeclSpace.
2276         (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
2277         argument; call NamespaceEntry.Define() unless we're nested in a
2278         class or struct.
2279
2280         * namespace.cs (Namespace.DefineName): New public function.  This
2281         is called from DeclSpace's .ctor to add 
2282         (Namespace.Lookup): Include DeclSpaces in the lookup.
2283
2284         * class.cs (Operator): Derive from MemberBase, not MemberCore.
2285
2286         * const.cs (Const): Derive from MemberBase, not MemberCore.     
2287
2288 2003-08-25  Martin Baulig  <martin@ximian.com>
2289
2290         * convert.cs (Convert.ExplicitReferenceConversion): When
2291         converting from an interface type to a class, unbox if the target
2292         type is a struct type.  Fixes #47822.
2293
2294 2003-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2295
2296         * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
2297         #47854.
2298
2299 2003-08-22  Martin Baulig  <martin@ximian.com>
2300
2301         * class.cs (TypeManager.DefineType): When defining a nested type,
2302         call DefineType() on our parent; fixes #47801.
2303
2304 2003-08-22  Martin Baulig  <martin@ximian.com>
2305
2306         * class.cs (MethodData.Define): While checking if a method is an
2307         interface implementation, improve the test a bit more to fix #47654.
2308
2309 2003-08-22  Martin Baulig  <martin@ximian.com>
2310
2311         * expression.cs (Probe.DoResolve): Check whether `expr' resolved
2312         correctly; fixes #47722.
2313
2314 2003-08-22  Martin Baulig  <martin@ximian.com>
2315
2316         * expression.cs (UnaryMutator.ResolveVariable): If the target is a
2317         LocalVariableReference, ensure it's not read-only.  Fixes #47536.
2318
2319         * statement.cs (Fixed.DoResolve): Make all variables read-only. 
2320
2321 2003-08-22  Martin Baulig  <martin@ximian.com>
2322
2323         * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
2324         can only be assigned in static constructors.  Fixes #47161.
2325
2326 2003-08-22  Martin Baulig  <martin@ximian.com>
2327
2328         Rewrote and improved the flow analysis code.
2329
2330         * flowbranching.cs (FlowBranching): Make this class abstract.
2331         (FlowBranching.CreateBranching): New static function to create a
2332         new flow branching.
2333         (FlowBranchingBlock, FlowBranchingException): New classes.
2334         (FlowBranching.UsageVector.Type): New public readonly field.
2335         (FlowBranching.UsageVector.Breaks): Removed the setter.
2336         (FlowBranching.UsageVector.Returns): Removed the setter.
2337         (FlowBranching.UsageVector): Added Break(), Return(),
2338         NeverReachable() and Throw() methods to modify the reachability.
2339         (FlowBranching.UsageVector.MergeChildren): Removed, this is now
2340         done by FlowBranching.Merge().
2341         (FlowBranching.UsageVector.MergeChild): New method; merges the
2342         merge result into the current vector.
2343         (FlowBranching.Merge): New abstract method to merge a branching.
2344
2345 2003-08-12  Martin Baulig  <martin@ximian.com>
2346
2347         * expression.cs (Indirection.CacheTemporaries): Create the
2348         LocalTemporary with the pointer type, not its element type.
2349
2350 2003-08-10  Miguel de Icaza  <miguel@ximian.com>
2351
2352         * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
2353         token was a keyword or not.
2354
2355         Add `error' options where an IDENTIFIER was expected;  Provide
2356         CheckToken and CheckIdentifierToken convenience error reporting
2357         functions. 
2358
2359         Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
2360
2361         * decl.cs: Rename `NamespaceEntry Namespace' public field into
2362         NameSpaceEntry NameSpaceEntry.
2363
2364         (LookupInterfaceOrClass): Avoid creating a full qualified name
2365         from namespace and name: avoid doing lookups when we know the
2366         namespace is non-existant.   Use new Tree.LookupByNamespace which
2367         looks up DeclSpaces based on their namespace, name pair.
2368
2369         * driver.cs: Provide a new `parser verbose' to display the
2370         exception thrown during parsing.  This is turned off by default
2371         now, so the output of a failure from mcs is more graceful.
2372
2373         * namespace.cs: Track all the namespaces defined in a hashtable
2374         for quick lookup.
2375         
2376         (IsNamespace): New method
2377
2378 2003-08-09  Miguel de Icaza  <miguel@ximian.com>
2379
2380         * namespace.cs: Remove redundant call;  Avoid using MakeFQN when
2381         we know that we need to concatenate (full typename can never be
2382         null). 
2383
2384         * class.cs: ditto.
2385
2386         * statement.cs: Use a bitfield;  Do not initialize to null things
2387         which are done by the constructor by default.
2388
2389         * cs-parser.jay: bug fix, parameter was 4, not 3.
2390
2391         * expression.cs: Just use the property;
2392
2393         * statement.cs: No need for GetVariableInfo method.
2394
2395 2003-08-08  Martin Baulig  <martin@ximian.com>
2396
2397         * flowanalysis.cs (FlowReturns): This is now nested in the
2398         `FlowBranching' class.
2399         (MyBitVector): Moved this here from statement.cs.
2400         (FlowBranching.SiblingType): New enum type.
2401         (FlowBranching.CreateSibling): Added `SiblingType' argument.
2402
2403 2003-08-07  Martin Baulig  <martin@ximian.com>
2404
2405         * flowanalysis.cs (FlowBranchingType): This is now nested in the
2406         `FlowBranching' class and called `BranchingType'.
2407
2408 2003-08-07  Martin Baulig  <martin@ximian.com>
2409
2410         * flowanalysis.cs: Moved all the control flow analysis code into
2411         its own file.
2412
2413 2003-08-07  Martin Baulig  <martin@ximian.com>
2414
2415         * assign.cs (Assign.DoResolve): `target' must either be an
2416         IAssignMethod or an EventAccess; report a CS0131 otherwise.  Fixes
2417         #37319.
2418
2419 2003-08-07  Miguel de Icaza  <miguel@ximian.com>
2420
2421         * expression.cs (BinaryMethod): This kind of expression is created by the
2422         Binary class if it determines that the operator has to be handled
2423         by a method.
2424
2425         (BinaryDelegate): This kind of expression is created if we are
2426         dealing with a + or - operator on delegates.
2427
2428         (Binary): remove method, argumetns, and DelegateOperator: when
2429         dealing with methods, 
2430         
2431         * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
2432
2433         * statement.cs (Block): use bitfields for the three extra booleans
2434         we had in use.   Remove unused topblock parameter.
2435
2436         * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
2437
2438         * assign.cs: Drop extra unneeded tests.
2439
2440 2003-08-06  Miguel de Icaza  <miguel@ximian.com>
2441
2442         * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
2443
2444         * statement.cs (Foreach): Use VariableStorage instead of
2445         LocalBuilders.   
2446
2447         * codegen.cs (VariableStorage): New class used by clients that
2448         require a variable stored: locals or fields for variables that
2449         need to live across yield.
2450
2451         Maybe provide a convenience api for EmitThis+EmitLoad?
2452
2453         (GetTemporaryLocal, FreeTemporaryLocal): Recycle
2454         these bad boys.
2455
2456 2003-08-05  Miguel de Icaza  <miguel@ximian.com>
2457
2458         * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
2459         RemapParameterLValue): New methods that are used to turn a
2460         precomputed FieldInfo into an expression like this:
2461
2462                 instance.FieldInfo
2463
2464         The idea is to use this instead of making LocalVariableReference
2465         have more than one meaning.
2466
2467         * cs-parser.jay: Add error production to BASE.
2468
2469         * ecore.cs: Deal with TypeManager.GetField returning null, which
2470         is now a valid return value.
2471
2472         (FieldExprNoAddress): New expression for Fields whose address can
2473         not be taken.
2474
2475         * expression.cs (LocalVariableReference): During the resolve
2476         phases, create new expressions if we are in a remapping context.
2477         Remove code that dealt with remapping here.
2478
2479         (ParameterReference): same.
2480
2481         (ProxyInstance): New expression, like the `This' expression, but
2482         it is born fully resolved.  We know what we are doing, so remove
2483         the errors that are targeted to user-provided uses of `this'.
2484
2485         * statement.cs (Foreach): our variable is now stored as an
2486         Expression;  During resolution, follow the protocol, dont just
2487         assume it will return this.
2488         
2489 2003-08-06  Martin Baulig  <martin@ximian.com>
2490
2491         * support.cs (SeekableStreamReader.cs): New public class.
2492
2493         * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
2494         SeekableStreamReader instead of the normal StreamReader.
2495
2496 2003-08-04  Martin Baulig  <martin@ximian.com>
2497
2498         * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
2499         CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
2500         deambiguate casts and delegate invocations.
2501         (parenthesized_expression): Use the new tokens to ensure this is
2502         not a cast of method invocation.
2503
2504         * cs-tokenizer.cs (is_punct): Return one of the new special tokens
2505         when reading a `)' and Deambiguate_CloseParens () was previously
2506         called.
2507
2508         * expression.cs (ParenthesizedExpression): New class.  This is
2509         just used for the CS0075 test.
2510         (Binary.DoResolve): Check for CS0075.   
2511
2512 2003-07-29  Ravi Pratap  <ravi@ximian.com>
2513
2514         * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
2515         Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
2516         reference comparison.
2517
2518         (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
2519         examine the ReturnType for equality - this is necessary in the
2520         cases of implicit and explicit operators whose signature also
2521         includes the return type.
2522
2523 2003-07-26  Miguel de Icaza  <miguel@ximian.com>
2524
2525         * namespace.cs: Cache the result of the namespace computation,
2526         instead of computing it every time.
2527
2528 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
2529
2530         * decl.cs: Use a global arraylist that we reuse over invocations
2531         to avoid excesive memory consumption.  Reduces memory usage on an
2532         mcs compile by one meg (45 average).
2533
2534         * typemanager.cs (LookupTypeReflection): In .NET pointers are
2535         private, work around that.
2536
2537 2003-07-23  Miguel de Icaza  <miguel@ximian.com>
2538
2539         * literal.cs (IntLiteral): Define Zero and One static literals. 
2540
2541         * cs-parser.jay (integer_literal): use static literals to reduce
2542         memory usage for the most used literals (0, 1 and -1).  211kb
2543         reduced in memory usage.
2544
2545         Replace all calls to `new ArrayList' with `new
2546         ArrayList(4)' which is a good average number for most allocations,
2547         and also requires only 16 bytes of memory for its buffer by
2548         default. 
2549
2550         This reduced MCS memory usage in seven megabytes for the RSS after
2551         bootstrapping.
2552
2553 2003-07-28  Ravi Pratap  <ravi@ximian.com>
2554
2555         * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
2556         handle params methods the correct way by forming only one
2557         applicable set with params and normal methods in them. Earlier we
2558         were looking at params methods only if we found no normal methods
2559         which was not the correct thing to do.
2560
2561         (Invocation.BetterFunction): Take separate arguments indicating
2562         when candidate and the best method are params methods in their
2563         expanded form.
2564
2565         This fixes bugs #43367 and #46199.
2566
2567         * attribute.cs: Documentation updates.
2568
2569         (CheckAttribute): Rename to CheckAttributeTarget.
2570         (GetValidPlaces): Rename to GetValidTargets.
2571
2572         * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
2573         bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
2574
2575         Fixes bug #44468.
2576
2577 2003-07-28  Miguel de Icaza  <miguel@ximian.com>
2578
2579         * codegen.cs: Compute IsGeneric correctly.
2580
2581         * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
2582         resolution. 
2583
2584         Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
2585         OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN.  There were too many
2586         regressions, and I was chasing more bugs than I required.
2587
2588         * interface.cs: Use expressions for base type names (like classes
2589         and structs have been doing for a while now), and resolve that.
2590         This patch should probably go into head as well.
2591
2592         This makes it one less user of FindType.
2593
2594 2003-07-24  Miguel de Icaza  <miguel@ximian.com>
2595
2596         This compiler can not self host currently.  Need to fix that.
2597         
2598         * Makefile: compile to `gmcs.exe'
2599
2600         * driver.cs: Turn on v2 by default on gmcs.
2601
2602         * generic.cs (ConstructedType): Does no longer take a container
2603         type argument;  That will be taken care of later.
2604
2605         (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
2606         Use SimpleName to resolve for now, so we can continue the work on
2607         the parser, until we get Type.GetType that understands generics.
2608
2609         (ConstructedType.ToString): Implement
2610
2611         (TypeArguments.Resolve): Resolve the child expressions as types. 
2612         
2613         * cs-parser.jay: Rename interface_constraints to
2614         type_parameter_constraints
2615
2616         (namespace_or_type_name): Only use constructed types for the basic
2617         construction, we will deal with identifier<...> later.
2618
2619         (type/type_name): No longer call DecomposeQI, as
2620         namespace_or_type_name is always decoded now.
2621         
2622 2003-07-22  Ravi Pratap  <ravi@ximian.com>
2623
2624         * expression.cs (Invocation.OverloadResolve): Follow the spec more
2625         closely: we eliminate methods in base types when we have an
2626         applicable method in a top-level type.
2627
2628         Please see section 14.5.5.1 for an exact description of what goes
2629         on. 
2630
2631         This fixes bug #45127 and a host of other related to corlib compilation.
2632
2633         * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
2634         array is the method corresponding to the top-level type (this is
2635         because of the changes made to icall.c) so we change this
2636         accordingly.
2637
2638         (MethodGroupExpr.Name): This too.
2639
2640         * typemanager.cs (GetElementType): New method which does the right
2641         thing when compiling corlib. 
2642
2643         * everywhere: Make use of the above in the relevant places.
2644
2645 2003-07-22  Martin Baulig  <martin@ximian.com>
2646
2647         * cs-parser.jay (invocation_expression): Moved
2648         `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
2649         `cast_expression', but create a InvocationOrCast which later
2650         resolves to either an Invocation or a Cast.
2651
2652         * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
2653         method; call this before EmitStatement() to make sure that this
2654         expression can be used as a statement.
2655
2656         * expression.cs (InvocationOrCast): New class; resolves to either
2657         an Invocation or a Cast.
2658
2659         * statement.cs (StatementExpression): Call ResolveStatement() on
2660         the ExpressionStatement before emitting it.
2661
2662 2003-07-21  Martin Baulig  <martin@ximian.com>
2663
2664         * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
2665         `ref' and `out' attributes match; fixes #46220.
2666         (MemberAccess.ResolveMemberAccess): You can't reference a type
2667         through an expression; fixes #33180.
2668         (Indexers.GetIndexersForType): Don't return the indexers from
2669         interfaces the class implements; fixes #46502.
2670
2671 2003-07-21  Martin Baulig  <martin@ximian.com>
2672
2673         * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
2674         CS0661 checks; fixes bug #30442.
2675
2676 2003-07-21  Martin Baulig  <martin@ximian.com>
2677
2678         * decl.cs (AdditionResult): Added `Error'.
2679
2680         * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
2681
2682         * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
2683         cs0031.cs actually work.
2684
2685  2003-07-20  Miguel de Icaza  <miguel@ximian.com>
2686  
2687         * cs-parser.jay (namespace_name): do not use
2688         namespace_or_type_name, use qualified_identifier, because
2689         namespace_or_type_name will soon return a composed expression
2690         instead of a string.
2691  
2692         (namespace_or_type_name): Instead of returning a string, now this
2693         production returns an expression.
2694  
2695         * codegen.cs (EmitContext): Setup IsGeneric property based on
2696         whether our DeclSpace is generic, our the method is generic.
2697  
2698         * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
2699         the method is generic.
2700  
2701         * cs-parser.jay (type_arguments, opt_type_argument_list,
2702         type_parameters, type_parameter_list, opt_type_parameter_list,
2703         type_parameter,, opt_type_parameter_constraints_clauses,
2704         type_parameter_constraints_clauses,
2705         type_parameter_constraint_clause, type_parameter_constraint,
2706         interface_constraints): Add new production
2707  
2708         * decl.cs (DeclSpace): IsGeneric, flag to track whether this
2709         DeclSpace is generic or not.
2710  
2711         (DeclSpace.SetParameterInfo): New routine, used to set the
2712         parameter info for a type.
2713  
2714         (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
2715         returns a GenericTypeExpr
2716  
2717         * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
2718         generic, lookup the generic argument.
2719  
2720         * attribute.cs: Do not allow TypeParameterExpressions in
2721         Attributes.
2722  
2723         * class.cs: Do not allow the Main method to be defined in a
2724         Generic container.
2725  
2726         * expression.cs (SizeOf): Do not allow generic types to be used as
2727         arguments to sizeof.
2728  
2729         * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
2730         it: whether a type is generic or not.  Only works for types we are
2731         currently building for now.
2732         
2733 2003-07-20  Martin Baulig  <martin@ximian.com>
2734
2735         * namespace.cs: Fixed that bug which caused a crash when compiling
2736         the debugger's GUI.
2737
2738 2003-07-20  Miguel de Icaza  <miguel@ximian.com>
2739
2740         * typemanager.cs (LookupTypeReflection): Never expose types which
2741         are NotPublic, NestedPrivate, NestedAssembly, or
2742         NestedFamANDAssem.  We used to return these, and later do a check
2743         that would report a meaningful error, but the problem is that we
2744         would not get the real match, if there was a name override.
2745
2746 2003-07-18  Miguel de Icaza  <miguel@ximian.com>
2747
2748         * namespace.cs (Namespace, Name): Do not compute the namespace
2749         name dynamically, compute it in the constructor.  This reduced
2750         memory usage by 1697 KB.
2751
2752         * driver.cs: Use --pause to pause at the end.
2753
2754 2003-07-17  Peter Williams  <peter@newton.cx>
2755
2756         * Makefile: Change the name of the test target so that it doesn't
2757         conflict with the recursive test target.
2758
2759 2003-07-17  Miguel de Icaza  <miguel@ximian.com>
2760
2761         * expression.cs (LocalVariableReference.Emit, EmitAssign,
2762         AddressOf): Do not use EmitThis, that was wrong, use the actual
2763         this pointer.
2764
2765 2003-07-15  Miguel de Icaza  <miguel@ximian.com>
2766
2767         * class.cs (MethodData.Define): While checking if a method is an
2768         interface implementation, improve the test: If we are not public
2769         (use new test here: use the computed MethodAttributes directly,
2770         instead of the parsed modifier flags) check if the `implementing'
2771         method comes from an interface or not.
2772
2773         * pending.cs (VerifyPendingMethods): Slightly better error
2774         message.
2775
2776         * makefile: add test target that does the mcs bootstrap.
2777
2778 2003-07-16  Ravi Pratap  <ravi@ximian.com>
2779
2780         * interface.cs (Define): Do nothing here since there are no
2781         members to populate etc. Move the attribute emission out of here
2782         since this was just totally the wrong place to put it. Attribute
2783         application happens during the 'Emit' phase, not in the 'Define'
2784         phase.
2785
2786         (Emit): Add this method and move the attribute emission here
2787
2788         * rootcontext.cs (EmitCode): Call the Emit method on interface
2789         types too.
2790
2791 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
2792
2793         * expression.cs (OverloadResolve): Report error only if Location
2794         is not 'Null' which means that there was a probe going on.
2795
2796 2003-07-14  Martin Baulig  <martin@ximian.com>
2797
2798         * expression.cs (ConditionalLogicalOperator): New public class to
2799         implement user defined conditional logical operators.
2800         This is section 14.11.2 in the spec and bug #40505.
2801
2802 2003-07-14  Martin Baulig  <martin@ximian.com>
2803
2804         * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
2805
2806 2003-07-14  Martin Baulig  <martin@ximian.com>
2807
2808         * codegen.cs (EmitContext.InFixedInitializer): New public field.
2809
2810         * ecore.cs (IVariable.VerifyFixed): New interface method.
2811
2812         * expression.cs (Unary.ResolveOperator): When resolving the `&'
2813         operator, check whether the variable is actually fixed.  Fixes bug
2814         #36055.  Set a variable definitely assigned when taking its
2815         address as required by the spec.
2816
2817         * statement.cs (LocalInfo.IsFixed): New field.
2818         (LocalInfo.MakePinned): Set `IsFixed' to true.
2819
2820 2003-07-14  Ravi Pratap M  <ravi@ximian.com>
2821
2822         * attribute.cs (Attribute.Resolve): While doing a Member lookup
2823         for .ctors, ensure that we only ask for members declared in the
2824         attribute type (BindingFlags.DeclaredOnly).
2825
2826         Fixes bug #43632.
2827
2828         * expression.cs (Error_WrongNumArguments): Report error 1501
2829         correctly the way CSC does.
2830
2831 2003-07-13  Martin Baulig  <martin@ximian.com>
2832
2833         * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
2834         lookup on the fully qualified name, to make things like "X.X" work
2835         where "X.X" is a fully qualified type name, but we also have a
2836         namespace "X" in the using list.  Fixes #41975.
2837
2838 2003-07-13  Martin Baulig  <martin@ximian.com>
2839
2840         * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
2841         function. If we're a CompoundAssign, we need to create an embedded
2842         CompoundAssign, not an embedded Assign.
2843         (Assign.DoResolve): Make this work for embedded CompoundAssign's.
2844         Fixes #45854.
2845
2846 2003-07-13  Martin Baulig  <martin@ximian.com>
2847
2848         * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
2849         work to fix bug #46088.
2850
2851 2003-07-13  Ravi Pratap <ravi@ximian.com>
2852
2853         * class.cs (Operator.Emit): Do not emit attributes here - it is
2854         taken care of by the Method class that we delegate too. This takes
2855         care of bug #45876.
2856         
2857 2003-07-10  Martin Baulig  <martin@ximian.com>
2858
2859         * expression.cs (TypeOfVoid): New class.
2860         (TypeOf): Report a CS0673 if it's System.Void.  Fixes #42264.
2861
2862 2003-07-10  Martin Baulig  <martin@ximian.com>
2863
2864         * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
2865         bug #35957.
2866
2867 2003-07-10  Martin Baulig  <martin@ximian.com>
2868
2869         * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
2870         not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
2871
2872         * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
2873
2874         * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
2875
2876 2003-07-10  Martin Baulig  <martin@ximian.com>
2877
2878         * expression.cs (ArrayCreation): Don't use a byte blob for arrays
2879         of decimal.  Fixes #42850.
2880
2881         NOTE: I also fixed the created byte blob, but this doesn't work on
2882         the MS runtime and csc never produces any byte blobs for decimal
2883         arrays.
2884
2885 2003-07-10  Martin Baulig  <martin@ximian.com>
2886
2887         * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
2888         structs; fixes #32068.
2889         (Block.AddChildVariableNames): Fixed #44302.
2890
2891 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2892
2893         * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
2894         
2895 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2896
2897         * attribute.cs: And this test is onger needed.
2898
2899 2003-07-08  Martin Baulig  <martin@ximian.com>
2900
2901         * rootcontext.cs (RootContext.NamespaceLookup): Ignore
2902         inaccessible types.  Fixes #36313.
2903
2904         * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
2905
2906         * namespace.cs (NamespaceEntry): Create implicit entries for all
2907         namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
2908         implicit entries for N1.N2 and N1.
2909
2910 2003-07-08  Martin Baulig  <martin@ximian.com>
2911
2912         Rewrote the handling of namespaces to fix a lot of the issues
2913         wrt. `using' aliases etc.
2914
2915         * namespace.cs (Namespace): Splitted this class into a
2916         per-assembly `Namespace' and a per-file `NamespaceEntry'.
2917
2918         * typemanager.cs (TypeManager.IsNamespace): Removed.
2919         (TypeManager.ComputeNamespaces): Only compute namespaces from
2920         loaded assemblies here, not the namespaces from the assembly we're
2921         currently compiling.
2922
2923 2003-07-08  Martin Baulig  <martin@ximian.com>
2924
2925         * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
2926
2927 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2928
2929         * typemanager.cs: Reverted patch from Gonzalo, my previous patch
2930         already fixed it.  
2931
2932         I thought about the memory savings here, but LookupTypeReflection
2933         is used under already very constrained scenarios.  Compiling
2934         corlib or mcs only exposes one hit, so it would not really reduce
2935         any memory consumption.
2936
2937 2003-07-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2938
2939         * typemanager.cs: fixes bug #45889 by only adding public types from
2940         other assemblies to the list of known types.
2941
2942 2003-07-07  Miguel de Icaza  <miguel@ximian.com>
2943
2944         * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
2945         on the type we resolved.
2946
2947 2003-07-05  Martin Baulig  <martin@ximian.com>
2948
2949         * pending.cs (PendingImplementation.ParentImplements): Don't
2950         create the proxy if the parent is abstract.
2951
2952         * class.cs (TypeContainer.DefineIndexers): Process explicit
2953         interface implementations first.  Fixes #37714.
2954
2955 2003-07-04  Miguel de Icaza  <miguel@ximian.com>
2956
2957         * expression.cs (MemberAccess.ResolveMemberAccess): Events are
2958         defined recursively;  but since we modify the input parameters
2959         (left is set to `this' temporarily), we reset this value if the
2960         left_is_explicit is false, which gives the original semantics to
2961         the code.  
2962
2963         * literal.cs (NullPointer): new class used to represent a null
2964         literal in a pointer context.
2965
2966         * convert.cs (Convert.ImplicitReferenceConversion): Is the target
2967         type is a pointer, use a NullPointer object instead of a
2968         NullLiteral.   Closes 43687
2969
2970         (ExplicitConversion): Convert pointer values using
2971         the conv opcode to the proper type.
2972
2973         * ecore.cs (New): change ValueTypeVariable property into a method,
2974         that returns whether the valuetype is suitable for being used.
2975
2976         * expression.cs (Binary.DoNumericPromotions): Only return if we
2977         the int constant was a valid uint, and we can return both left and
2978         right as uints.  If not, we continue processing, to trigger the
2979         type conversion.  This fixes 39018.
2980
2981         * statement.cs (Block.EmitMeta): During constant resolution, set
2982         the CurrentBlock property on the emitcontext, so that we resolve
2983         constants propertly.
2984
2985 2003-07-02  Martin Baulig  <martin@ximian.com>
2986
2987         * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
2988         (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
2989
2990         * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
2991         than emitting it here.
2992
2993         * statement.cs: Fixed some more flow analysis bugs.
2994
2995 2003-07-02  Martin Baulig  <martin@ximian.com>
2996
2997         * class.cs (MethodData.Define): When implementing interface
2998         methods, set Final unless we're Virtual.
2999
3000         * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
3001         check work for interface methods.
3002
3003 2003-07-01  Martin Baulig  <martin@ximian.com>
3004
3005         * ecore.cs (EmitContext.This): Replaced this property with a
3006         GetThis() method which takes a Location argument.  This ensures
3007         that we get the correct error location for a CS0188.
3008
3009 2003-07-01  Miguel de Icaza  <miguel@ximian.com>
3010
3011         * ecore.cs: (Convert.ConvertIntLiteral): Add test for
3012         ImplicitStandardConversion.
3013
3014         * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
3015
3016 2003-07-01  Zoltan Varga  <vargaz@freemail.hu>
3017
3018         * expression.cs (ResolveOperator): Fix Concat (string, string, string)
3019         optimization.
3020
3021 2003-06-30  Miguel de Icaza  <miguel@ximian.com>
3022
3023         * class.cs (Constructor.Define): Turn off initlocals for unsafe
3024         constructors.
3025
3026         (MethodData.Define): Turn off initlocals for unsafe methods.
3027
3028 2003-06-29  Miguel de Icaza  <miguel@ximian.com>
3029
3030         * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
3031         complete;  Fixes #37521.
3032
3033         * delegate.cs: Use Modifiers.TypeAttr to compute the
3034         TypeAttributes, instead of rolling our own.  This makes the flags
3035         correct for the delegates.
3036
3037 2003-06-28  Miguel de Icaza  <miguel@ximian.com>
3038
3039         * class.cs (Constructor.Define): Set the private flag for static
3040         constructors as well.
3041
3042         * cs-parser.jay (statement_expression): Set the return value to
3043         null, to avoid a crash when we catch an error.
3044
3045 2003-06-24  Miguel de Icaza  <miguel@ximian.com>
3046
3047         * cs-parser.jay: Applied patch from Jackson that adds support for
3048         extern and unsafe modifiers to destructor declarations.
3049
3050         * expression.cs: Report error 21 if the user is trying to index a
3051         System.Array.
3052
3053         * driver.cs: Add an error message, suggested by the bug report.
3054
3055         * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
3056         if we do not have a ": this ()" constructor initializer.  Fixes 45149
3057
3058 2003-06-14  Miguel de Icaza  <miguel@ximian.com>
3059
3060         * namespace.cs: Add some information to reduce FAQs.
3061
3062 2003-06-13  Miguel de Icaza  <miguel@ximian.com>
3063
3064         * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
3065         underlying enumeration types.  Fixes #43915.
3066
3067         * expression.cs: Treat ushort/short as legal values to be used in
3068         bitwise operations.
3069
3070 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
3071
3072         * delegate.cs: transfer custom attributes for paramenters from
3073         the delegate declaration to Invoke and BeginInvoke.
3074
3075 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
3076
3077         * attribute.cs: handle custom marshalers and emit marshal info
3078         for fields, too.
3079
3080 2003-05-28  Hector E. Gomez Morales  <hgomez_36@flashmail.com>
3081
3082         * makefile.gnu: Added anonymous.cs to the compiler sources.
3083
3084 2003-05-28  Miguel de Icaza  <miguel@ximian.com>
3085
3086         * iterators.cs: Change the name of the proxy class to include two
3087         underscores.
3088
3089         * cs-parser.jay: Update grammar to include anonymous methods.
3090         
3091         * anonymous.cs: new file.
3092
3093 2003-05-27  Miguel de Icaza  <miguel@ximian.com>
3094
3095         * class.cs (Field.Define): Add missing test for pointers and
3096         safety. 
3097
3098 2003-05-27  Ravi Pratap  <ravi@ximian.com>
3099
3100         * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
3101         we use the stobj opcode.
3102
3103         (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
3104         since it wasn't the correct fix. 
3105
3106         It still is puzzling that we are required to use stobj for IntPtr
3107         which seems to be a ValueType.
3108
3109 2003-05-26  Miguel de Icaza  <miguel@ximian.com>
3110
3111         * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
3112         during regular simple name resolution.   Now, the trick is that
3113         instead of returning for processing the simplename, we do a
3114         TypeManager.LookupType (ie, a rooted lookup as opposed to a
3115         contextual lookup type).   If a match is found, return that, if
3116         not, return for further composition.
3117
3118         This fixes long-standing 30485.
3119
3120         * expression.cs (ArrayCreation.EmitDynamicInitializers): When
3121         using the address to initialize an object, do an Stobj instead of
3122         using the regular Stelem.
3123
3124         (IndexerAccess.Emit, IndexerAccess.EmitAssign):
3125         Pass `is_base_indexer' to Invocation.EmitCall instead of false.
3126         Because if we are a BaseIndexerAccess that value will be true.
3127         Fixes 43643.
3128
3129         * statement.cs (GotoCase.Resolve): Return after reporting an
3130         error, do not attempt to continue. 
3131
3132         * expression.cs (PointerArithmetic.Emit): If our operand is a
3133         long, convert our constants to match the operand before
3134         multiplying.  Convert to I type before adding.   Fixes 43670.
3135         
3136 2003-05-14  Ravi Pratap  <ravi@ximian.com>
3137
3138         * enum.cs (ImplicitConversionExists) : Rename to
3139         ImplicitEnumConversionExists to remove ambiguity. 
3140
3141         * ecore.cs (NullCast): New type of cast expression class which
3142         basically is very similar to EmptyCast with the difference being
3143         it still is a constant since it is used only to cast a null to
3144         something else
3145         (eg. (string) null)
3146
3147         * convert.cs (ImplicitReferenceConversion): When casting a null
3148         literal, we return a NullCast.
3149
3150         * literal.cs (NullLiteralTyped): Remove - I don't see why this
3151         should be around anymore.
3152
3153         The renaming (reported was slightly wrong). Corrections:
3154
3155         ConvertImplicitStandard -> ImplicitConversionStandard
3156         ConvertExplicitStandard -> ExplicitConversionStandard
3157
3158         * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
3159         before passing them in !
3160
3161         * convert.cs (ImplicitConversionStandard): When comparing for
3162         equal expr and target types, ensure that expr is not a
3163         NullLiteral.
3164
3165         In general, we must not be checking (expr_type ==
3166         target_type) in the top level conversion methods
3167         (ImplicitConversion, ExplicitConversion etc). This checking is
3168         done in the methods that they delegate to.
3169
3170 2003-05-20  Miguel de Icaza  <miguel@ximian.com>
3171
3172         * convert.cs: Move Error_CannotConvertType,
3173         ImplicitReferenceConversion, ImplicitReferenceConversionExists,
3174         ImplicitNumericConversion, ImplicitConversionExists,
3175         ImplicitUserConversionExists, StandardConversionExists,
3176         FindMostEncompassedType, FindMostSpecificSource,
3177         FindMostSpecificTarget, ImplicitUserConversion,
3178         ExplicitUserConversion, GetConversionOperators,
3179         UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
3180         TryImplicitIntConversion, Error_CannotConvertImplicit,
3181         ConvertImplicitRequired, ConvertNumericExplicit,
3182         ExplicitReferenceConversionExists, ConvertReferenceExplicit,
3183         ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
3184         its own file.
3185
3186         Perform the following renames:
3187         
3188         StandardConversionExists -> ImplicitStandardConversionExists
3189         ConvertImplicit -> ImplicitConversion
3190         ConvertImplicitStandard -> ImplicitStandardConversion
3191         TryImplicitIntConversion -> ImplicitIntConversion
3192         ConvertImplicitRequired -> ImplicitConversionRequired
3193         ConvertNumericExplicit -> ExplicitNumericConversion
3194         ConvertReferenceExplicit -> ExplicitReferenceConversion
3195         ConvertExplicit -> ExplicitConversion
3196         ConvertExplicitStandard -> ExplicitStandardConversion
3197
3198 2003-05-19  Martin Baulig  <martin@ximian.com>
3199
3200         * statement.cs (TypeInfo.StructInfo): Made this type protected.
3201         (TypeInfo): Added support for structs having structs as fields.
3202
3203         * ecore.cs (FieldExpr): Implement IVariable.
3204         (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
3205         VariableInfo for the field.
3206
3207 2003-05-18  Martin Baulig  <martin@ximian.com>
3208
3209         * expression.cs (This.DoResolve): Report a CS0027 if we're
3210         emitting a field initializer.
3211
3212 2003-05-18  Martin Baulig  <martin@ximian.com>
3213
3214         * expression.cs (This.ResolveBase): New public function.
3215         (This.DoResolve): Check for CS0188.
3216
3217         * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
3218         This.Resolve().
3219
3220         * ecore.cs (MethodGroupExpr.DoResolve): Set the
3221         `instance_expression' to null if we don't have any non-static
3222         methods.
3223
3224 2003-05-18  Martin Baulig  <martin@ximian.com>
3225
3226         Reworked the way how local variables and parameters are handled by
3227         the flow analysis code.
3228
3229         * statement.cs (TypeInfo, VariableMap): New public classes.
3230         (VariableInfo): New public class.  This is now responsible for
3231         checking whether a variable has been assigned.  It is used for
3232         parameters and local variables.
3233         (Block.EmitMeta): Take the InternalParameters as argument; compute
3234         the layout of the flow vectors here.
3235         (Block.LocalMap, Block.ParameterMap): New public properties.
3236         (FlowBranching): The .ctor doesn't get the InternalParameters
3237         anymore since Block.EmitMeta() now computes the layout of the flow
3238         vector.
3239         (MyStructInfo): This class is now known as `StructInfo' and nested
3240         in `TypeInfo'; we don't access this directly anymore.
3241
3242         * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
3243         property and removed IsAssigned(), IsFieldAssigned(),
3244         SetAssigned() and SetFieldAssigned(); we now call them on the
3245         VariableInfo so we don't need to duplicate this code everywhere.
3246
3247         * expression.cs (ParameterReference): Added `Block block' argument
3248         to the .ctor.
3249         (LocalVariableReference, ParameterReference, This): The new
3250         VariableInfo class is now responsible for all the definite
3251         assignment stuff.
3252
3253         * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
3254         IsParameterAssigned, SetParameterAssigned): Removed.
3255
3256 2003-05-18  Martin Baulig  <martin@ximian.com>
3257
3258         * typemanager.cs (InitCoreTypes): Try calling
3259         SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
3260         the 3-args-version.  Corlib now also needs our `void_type'.
3261         (GetMethod): Added overloaded version which takes an optional
3262         `bool report_errors' to allow lookups of optional methods.
3263
3264 2003-05-12  Martin Baulig  <martin@ximian.com>
3265
3266         * statement.cs (VariableInfo): Renamed to LocalInfo since it's
3267         only used for locals and not for parameters.
3268
3269 2003-05-12  Miguel de Icaza  <miguel@ximian.com>
3270
3271         * support.cs (InternalParameters.ParameterType): Return the
3272         ExternalType of the parameter.
3273
3274         * parameter.cs (Parameter.ExternalType): drop the two arguments,
3275         they were unused.
3276
3277 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
3278
3279         * class.cs (MethodData.Define): Do not set the `newslot' on
3280         interface members, if they are also flagged as "override".
3281
3282         * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
3283         better code for ++i and i++.  This only works for static fields
3284         and local variables.
3285
3286         * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
3287         want to pull the DeclSpace out of the builder_to_declspace instead
3288         of the TypeBuilder (like in TypeContainer.FindMembers).
3289
3290         * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
3291         instead of LookupTypeContainer.  Fixes the crash on .NET for
3292         looking up interface members.
3293
3294         * const.cs: Create our own emit context during the Definition
3295         stage, so that constants are evaluated in the proper context, when
3296         a recursive definition happens.
3297
3298 2003-05-11  Martin Baulig  <martin@ximian.com>
3299
3300         * statement.cs (Block.CreateSwitchBlock): New method.  Creates a
3301         new block for a switch section.
3302         (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
3303         the adding/lookup in the switch block.  Fixes #39828.
3304
3305 2003-05-09  Miguel de Icaza  <miguel@ximian.com>
3306
3307         * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
3308         functionality: I needed to convert the data after I had performed
3309         the add/sub operation into the operands type size.
3310
3311         * ecore.cs (ImplicitReferenceConversion): When boxing an interface
3312         pass the type for the box operation, otherwise the resulting
3313         object would have been of type object.
3314
3315         (BoxedCast): Add constructor to specify the type to box as.
3316
3317 2003-05-07  Miguel de Icaza  <miguel@ximian.com>
3318
3319         * iterators.cs: I was reusing the `count' variable inadvertently,
3320         take steps to not allow this to happen.
3321
3322 2003-05-06  Miguel de Icaza  <miguel@ximian.com>
3323
3324         * attribute.cs (Attribute.Resolve): Params attributes are encoded
3325         by creating an array at the point where the params starts and
3326         putting all those arguments there, then adjusting the size of the
3327         array.
3328
3329 2003-05-05  Miguel de Icaza  <miguel@ximian.com>
3330
3331         * expression.cs (New.AddressOf): Implement interface
3332         IMemoryLocation.  This is used when the `new' operator is used in
3333         the context of an invocation to a method on a value type.
3334
3335         See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
3336         example. 
3337
3338         * namespace.cs: Also check the using aliases here.
3339
3340         * driver.cs: Move the test for using validity after the types have
3341         been entered, so we do a single pass that also includes the using
3342         aliases. 
3343
3344         * statement.cs (Try.Resolve): Avoid crashing if there is a failure
3345         in the regular case.   CreateSiblingForFinally is doing extra
3346         error checking.
3347
3348         * attribute.cs (GetAttributeArgumentExpression): Store the result
3349         on an out value, and use the return value to indicate failure
3350         instead of using null (which is a valid return for Constant.GetValue).
3351
3352         * statement.cs: Perform the analysis flow for the increment
3353         portion after the statement, because this will be the real flow of
3354         execution.  Fixes #42385
3355
3356         * codegen.cs (EmitContext.EmitArgument,
3357         EmitContext.EmitStoreArgument): New helper functions when the
3358         RemapToProxy flag is set.
3359
3360         * expression.cs (ParameterReference.EmitLdarg): Expose this useful
3361         function.
3362
3363         Add support for remapping parameters. 
3364
3365         * iterators.cs: Propagate parameter values;  Store parameter
3366         values in the proxy classes.
3367         
3368 2003-05-04  Miguel de Icaza  <miguel@ximian.com>
3369
3370         * ecore.cs (FieldExpr): Fix an obvious bug.  static fields do not
3371         need a proxy reference;  I do not know what I was thinking
3372
3373         * cs-parser.jay (constructor_initializer): catch another error,
3374         and display nice message.
3375         
3376         (field_declaration): catch void field declaration
3377         to flag a better error. 
3378
3379         * class.cs (MemberBase.CheckBase): Report an error instead of a
3380         warning if a new protected member is declared in a struct. 
3381         (Field.Define): catch the error of readonly/volatile.
3382
3383         * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
3384
3385         (FieldExpr.AddressOf): ditto.  Catch error where the address of a
3386         volatile variable is taken
3387
3388 2003-05-02  Miguel de Icaza  <miguel@ximian.com>
3389
3390         * statement.cs (Fixed.Resolve): Report an error if we are not in
3391         an unsafe context.
3392
3393 2003-05-01  Miguel de Icaza  <miguel@ximian.com>
3394
3395         * typemanager.cs: reuse the code that handles type clashes for
3396         delegates and enumerations.
3397
3398         * class.cs (Report28): Always report.
3399
3400         * expression.cs (EncodeAsAttribute): Allow nulls here.
3401
3402 2003-04-28  Miguel de Icaza  <miguel@ximian.com>
3403
3404         * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
3405         the functionality for testing whether an expression is valid for
3406         an attribute here.  Also handle the case of arrays of elements
3407         being stored. 
3408
3409         * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
3410         encoding a linear array into an array of objects that are suitable
3411         to be passed to an CustomAttributeBuilder.
3412
3413         * delegate.cs: Check unsafe types being used outside of an Unsafe context.
3414
3415         * ecore.cs: (FieldExpr): Handle field remapping here.
3416
3417         * iteratators.cs: Pass the instance variable (if the method is an
3418         instance method) to the constructors, so we can access the field
3419         variables on the class.
3420
3421         TODO: Test this with structs.  I think the THIS variable on
3422         structs might have to be a pointer, and not a refenrece
3423
3424 2003-04-27  Miguel de Icaza  <miguel@ximian.com>
3425
3426         * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
3427         local variables to fields in a proxy class.
3428
3429         * iterators.cs (PopulateProxy): Rename our internal fields to
3430         <XXX>.  
3431         Create a <THIS> field if we are an instance method, so we can
3432         reference our parent container variables.
3433         (MapVariable): Called back from the EmitContext code to enter a
3434         new variable to field mapping into the proxy class (we just create
3435         a FieldBuilder).
3436
3437         * expression.cs
3438         (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
3439         for using the remapped locals to fields.
3440
3441         I placed the code here, because that gives the same semantics to
3442         local variables, and only changes the Emit code.
3443
3444         * statement.cs (Fixed.Resolve): it is not allowed to have fixed
3445         statements inside iterators.
3446         (VariableInfo): Add a FieldBuilder for the cases when we are
3447         remapping local variables to fields in a proxy class
3448
3449         * ecore.cs (SimpleNameResolve): Avoid testing two times for
3450         current_block != null.
3451
3452         * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
3453         not cope with strings, as it has been moved to the
3454         TableSwitchEmit.  Fixed bug in switch generation.
3455
3456         * expression.cs (New.DoResolve): Provide more context for the user
3457         when reporting an error.
3458
3459         * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
3460         pointers. 
3461
3462         * expression.cs (MemberAccess.DoResolve): When we get a type back,
3463         check the permissions for it.  Note than in a type-resolution
3464         context the check was already present in DeclSpace.ResolveType,
3465         but was missing from the MemberAccess.
3466
3467         (ArrayCreation.CheckIndices): warn if the user has
3468         more nested levels of expressions, but there are no more
3469         dimensions specified.  Avoids crash on bug 41906.
3470
3471 2003-04-26  Miguel de Icaza  <miguel@ximian.com>
3472
3473         * statement.cs (Block): replace Implicit bool, for a generic
3474         flags.   
3475         New flag: `Unchecked'.  This is used during the EmitMeta phase
3476         (which is out-of-line with the regular Resolve/Emit process for a
3477         statement, as this is done ahead of time, but still gets a chance
3478         to call constant resolve).
3479         
3480         (Block.Flags): new enum for adding a new flag.
3481
3482         (Block.EmitMeta): track the state of unchecked.
3483         
3484         (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
3485         to enable constant resolution to work there as well.
3486
3487 2003-04-22  Miguel de Icaza  <miguel@ximian.com>
3488
3489         * typemanager.cs (ienumerable_type): Also look up
3490         System.Collections.IEnumerable. 
3491
3492 2003-04-21  Miguel de Icaza  <miguel@ximian.com>
3493
3494         TODO: Test more than one conditional per method.
3495         
3496         * class.cs (Indexer.Define): Report the location where the user is
3497         referencing the unsupported feature.
3498
3499         (MethodData): Overload the use of `conditionals' to
3500         minimize the creation of needless ArrayLists.   This saves roughly
3501         212kb on my machine.
3502
3503         (Method): Implement the new IIteratorContainer interface.
3504         (Method.SetYields): Implement the method by setting the ModFlags
3505         to contain METHOD_YIELDS.
3506         
3507         * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
3508         which just got set to null.
3509
3510         * iterators.cs: New file.
3511
3512         (Yield, YieldBreak): New statements.
3513
3514         * statement.cs (Return.Resolve): Flag an error if we are used in
3515         an iterator method.
3516
3517         * codegen.cs (InIterator): New flag set if the code is being
3518         compiled in an iterator method.
3519
3520         * modifiers.cs: New flag METHOD_YIELDS.  This modifier is an
3521         internal modifier, and we just use it to avoid adding extra
3522         fields, as this is seldom used.  
3523
3524         * cs-parser.jay: Add yield_statement (yield and yield break).
3525
3526         * driver.cs: New flag -v2 to turn on version 2 features. 
3527
3528         * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
3529         hashtable when v2 is enabled.
3530
3531 2003-04-20  Miguel de Icaza  <miguel@ximian.com>
3532
3533         * typemanager.cs (TypeManager.NamespaceClash): Use to check if
3534         there is already a namespace defined with this name.
3535
3536         (TypeManager.InitCoreTypes): Remove the temporary workaround, as
3537         people upgraded their corlibs.
3538
3539         (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
3540         always use fully qualified types, no need to use the compiler
3541         front end.
3542
3543         (TypeManager.IsNamespace): Use binarysearch.
3544         
3545         * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
3546         AddDelegate): I did not quite use the new IsValid API properly: I
3547         have to pass the short-name and the fullname.  I was passing only
3548         the basename instead of the fullname sometimes. 
3549
3550         (TypeContainer.DefineType): call NamespaceClash.
3551
3552         * interface.cs (Interface.DefineType): use NamespaceClash before
3553         defining the type.
3554
3555         * delegate.cs (Delegate.DefineType): use NamespaceClash before
3556         defining the type.
3557
3558         * enum.cs: (Enum.DefineType): use NamespaceClash before
3559         defining the type.
3560
3561         * typemanager.cs (: 3-line patch that gives us some tasty 11%
3562         speed increase.  First, use the negative_hits cache when we get a
3563         negative.  Second, add the type with its full original name
3564         instead of the new . and + encoded name (reflection uses + to
3565         separate type from a nested type).  Use LookupTypeReflection
3566         directly which bypasses the type->name hashtable (that we already
3567         know does not contain the type.
3568         
3569         * decl.cs (DeclSpace.ResolveTypeExpr): track the
3570         location/container type. 
3571
3572         * driver.cs: When passing utf8, use directly the UTF8Encoding.
3573
3574 2003-04-19  Miguel de Icaza  <miguel@ximian.com>
3575
3576         * decl.cs (ResolveTypeExpr): Mirror check acess here too.
3577
3578         * delegate.cs (NewDelegate.Resolve): Test whether an instance
3579         method is being referenced in the method group from a static
3580         context, and report error 120 if so.
3581
3582         * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
3583         Error118. 
3584
3585         * typemanager.cs: Add intermediate namespaces (if a namespace A.B
3586         is created, we create the A namespace).
3587
3588         * cs-parser.jay: A namespace also introduces a DeclarationFound.
3589         Fixes #41591
3590
3591 2003-04-18  Miguel de Icaza  <miguel@ximian.com>
3592
3593         * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
3594         invocation to ModuleBuilder.GetType with the same values will
3595         return a new type instance, so we need to cache its return
3596         values. 
3597
3598         * expression.cs (Binary.ResolveOperator): Only allow the compare
3599         operators on enums if they are of the same type.
3600
3601         * ecore.cs (Expression.ImplicitReferenceConversion): handle target
3602         types of ValueType on their own case.  Before we were giving them
3603         the same treatment as objects.
3604
3605         * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
3606         fullname.  Short name is used to compare against container name.
3607         Fullname is used to check against defined namespace names.
3608         
3609         * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
3610         AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
3611
3612         (Method.CheckBase): Call parent.
3613         (MemberBase.CheckBase): Check for protected members on sealed
3614         classes.
3615         (PropertyBase.CheckBase): Call parent.
3616         (Field.Define): Call parent.
3617
3618         * report.cs: Negative error codes are now mapped to 8000 - code,
3619         so that the display is render more nicely.
3620
3621         * typemanager.cs: Do not use try/catch, instead report a regular
3622         error. 
3623
3624         (GetPointerType, GetReferenceType): These methods provide
3625         mechanisms to obtain the T* and T& from a T.  We had the code
3626         previously scattered around the code base, and it also used
3627         TypeManager.LookupType that would go through plenty of caches.
3628         This one goes directly to the type source.
3629
3630         In some places we did the Type.GetType followed by
3631         ModuleBuilder.GetType, but not in others, so this unifies the
3632         processing as well.
3633
3634         * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
3635         statements now that we have namespace information.
3636
3637         * typemanager.cs (IsNamespace): New method, returns whether the
3638         string presented is a namespace or not.
3639
3640         (ComputeNamespaces): New public entry point, computes the list of
3641         available namespaces, using the GetNamespaces API call in Mono, or
3642         the slower version in MS.NET.   
3643
3644         Now before we start the semantic analysis phase, we have a
3645         complete list of namespaces including everything that the user has
3646         provided.
3647
3648         Deleted old code to cache namespaces in .nsc files.
3649
3650 2003-04-17  Miguel de Icaza  <miguel@ximian.com>
3651
3652         * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
3653         class/struct location definition Location for the implicit
3654         constructor location.
3655
3656         (Operator.Define): Use the location of the operator for the
3657         implicit Method definition.
3658
3659         (Constructor.Emit): use the constructor location for the implicit
3660         base initializer constructor.
3661
3662         * ecore.cs: Remove ITypeExpression.  This interface is now gone,
3663         and the Expression class now contains two new methods:
3664
3665         ResolveAsTypeStep and ResolveAsTypeTerminal.  This is used to
3666         isolate type lookup from the rest of the resolution process.
3667
3668         Since we use Expressions to hold type definitions due to the way
3669         we parse the input we have historically overloaded Resolve to
3670         perform the Type lookups if a special flag is passed.  Now this is
3671         eliminated and two methods take their place. 
3672         
3673         The differences in the two methods between xStep and xTerminal is
3674         that xStep is involved in our current lookup system that uses
3675         SimpleNames to compose a name, while xTerminal is used just to
3676         catch the case where the simplename lookup failed.
3677         
3678 2003-04-16  Miguel de Icaza  <miguel@ximian.com>
3679
3680         * expression.cs (ResolveMemberAccess): Remove redundant code.
3681         TypeExpr expressions are always born fully resolved.
3682
3683         * interface.cs (PopulateMethod): Do not lookup the types twice.
3684         We were doing it once during SemanticAnalysis and once during
3685         PopulateMethod.
3686
3687         * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
3688         in local variable type definitions, were being returned as a
3689         SimpleName (we decomposed everything into a string), that is
3690         because primary_expression was being used instead of a type in the
3691         grammar (reduce/reduce conflicts).
3692
3693         The part that was wrong is that we converted the expression into a
3694         string (an oversimplification in one hand, compounded with primary
3695         expressions doing string concatenation).
3696
3697         So things like:
3698
3699         A.B.C [] x;
3700
3701         Would return "A.B.C[]" as a SimpleName.  This stopped things like
3702         using clauses from working on this particular context.  And a type
3703         was being matched directly against "A.B.C[]".
3704
3705         We now use the correct approach, and allow for ComposedCast to be
3706         part of the unary expression.  So the "A.B.C []" become a composed
3707         cast of "A.B.C" (as a nested group of MemberAccess with a
3708         SimpleName at the end) plus the rank composition "[]". 
3709
3710         Also fixes 35567
3711         
3712 2003-04-10  Miguel de Icaza  <miguel@ximian.com>
3713
3714         * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
3715         for the access level checking.
3716
3717         * class.cs: Cosmetic changes.  Renamed `TypeContainer parent' to
3718         `TypeContainer container', because I kept getting confused when I
3719         was debugging this code.
3720
3721         * expression.cs (Indexers): Instead of tracking getters/setters,
3722         we now track them in parallel.  We create one arraylist less, but
3723         most importantly it is possible now for the LValue code to find a
3724         matching get for a set.
3725
3726         (IndexerAccess.DoResolveLValue): Update the code.
3727         GetIndexersForType has been modified already to extract all the
3728         indexers from a type.  The code assumed it did not.
3729
3730         Also make the code set the correct return type for the indexer.
3731         This was fixed a long time ago for properties, but was missing for
3732         indexers.  It used to be void_type.
3733
3734         (Binary.Emit): Test first for doubles instead of
3735         floats, as they are more common.
3736
3737         (Binary.EmitBranchable): Use the .un version of the branch opcodes
3738         when dealing with floats and the <=, >= operators.  This fixes bug
3739         #39314 
3740
3741         * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
3742         to load the array value by emitting a load on the foreach variable
3743         type.  This was incorrect.  
3744
3745         We now emit the code to load an element using the the array
3746         variable type, and then we emit the conversion operator.
3747
3748         Fixed #40176
3749
3750 2003-04-10  Zoltan Varga  <vargaz@freemail.hu>
3751
3752         * attribute.cs: Avoid allocation of ArrayLists in the common case.
3753
3754 2003-04-09  Miguel de Icaza  <miguel@ximian.com>
3755
3756         * class.cs (MethodSignature.InheritableMemberSignatureCompare):
3757         test for protection before we test for signatures. 
3758
3759         (MethodSignature.ToString): implement.
3760
3761         * expression.cs (Unary.TryReduceNegative): Add missing minus sign
3762         to the case where we reduced into a LongConstant.
3763
3764         * decl.cs (CheckAccessLevel): If the type is an array, we can not
3765         depend on whether the information is acurrate, because the
3766         Microsoft runtime will always claim that the array type is public,
3767         regardless of the real state.
3768
3769         If the type is a pointer, another problem happens: the type is
3770         reported as non-public in Microsoft.  
3771
3772         In both cases we have to call CheckAccessLevel recursively with
3773         the underlying type as the argument to be tested.
3774
3775 2003-04-08  Miguel de Icaza  <miguel@ximian.com>
3776
3777         * assign.cs (Assign.Emit): If we are dealing with a compound
3778         assignment expression, we should use the code path that stores the
3779         intermediate result in a temporary value.  This fixes #40903.
3780
3781         *expression.cs (Indirection.ToString): Provide ToString method for
3782         debugging. 
3783         
3784 2003-04-08  Zoltan Varga  <vargaz@freemail.hu>
3785
3786         * class.cs: Null out fields holding references to Block objects so
3787         they can be garbage collected.
3788
3789         * expression.cs (OverloadResolve): Remove unused local.
3790
3791 2003-04-07  Martin Baulig  <martin@ximian.com>
3792
3793         * codegen.cs (EmitContext.CurrentFile): New public field.
3794         (EmitContext.Mark): Use the CurrentFile to check whether the
3795         location is in the correct file.
3796         (EmitContext.EmitTopBlock): Initialize CurrentFile here.
3797
3798 2003-04-07  Martin Baulig  <martin@ximian.com>
3799
3800         * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
3801
3802         * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
3803         location.  [FIXME: The location argument which gets passed to this
3804         method is sometimes wrong!]
3805
3806 2003-04-07  Nick Drochak <ndrochak@gol.com>
3807
3808         * codegen.cs: Be more verbose when we can't find the symbol writer dll.
3809
3810 2003-04-07  Miguel de Icaza  <miguel@ximian.com>
3811
3812         * expression.cs (Indirection.EmitAssign): We were using the
3813         temporary, but returning immediately instead of continuing the
3814         EmitAssing flow.
3815
3816 2003-04-06  Martin Baulig  <martin@ximian.com>
3817
3818         * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
3819         if it's a nested child, but also deriving from the outer class.
3820         See test 190.cs.
3821
3822         * typemanager.cs (IsNestedChildOf): Make this work if it's a
3823         nested child, but also deriving from the outer class.  See
3824         test-190.cs.
3825         (FilterWithClosure): We may access private members of the outer
3826         class if we're a nested child and deriving from the outer class.
3827         (RealMemberLookup): Only set `closure_private_ok' if the
3828         `original_bf' contained BindingFlags.NonPublic.
3829
3830 2003-04-05  Martin Baulig  <martin@ximian.com>
3831
3832         * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
3833         probe if its a type parameter, and if so, flag an error.
3834
3835         * decl.cs: Move here the SetParameterInfo code from class.cs.
3836         Handle IsGeneric here.
3837
3838         Handle a variety of errors in the parameter info definition.
3839
3840         * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
3841         type parameters here.
3842
3843         * cs-parser.jay (class_declaration): report errors for parameters
3844         here as well.
3845
3846 2003-01-21  Miguel de Icaza  <miguel@ximian.com>
3847
3848         * generic.cs: New file, contains support code for generics.
3849
3850         * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
3851         OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
3852
3853         Update parser for the above removals.
3854
3855         * cs-tokenizer.cs: Do not handle <<= or >>= specially.  This is
3856         now taken care of in the parser.
3857
3858 2003-04-02  Miguel de Icaza  <miguel@ximian.com>
3859
3860         * class.cs (Event.Define): Do not allow abstract events to have
3861         initializers. 
3862
3863 2003-04-01  Miguel de Icaza  <miguel@ximian.com>
3864
3865         * cs-parser.jay: Add error productions for ADD/REMOVE missing a
3866         block in event declarations.
3867
3868         * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
3869         value type, get its address.
3870
3871         * expression.cs (Is.Emit): For action `LeaveOnStack' we were
3872         leaving a class on the stack instead of a boolean value (int
3873         0/1).  Change the code so we compare against null, and then the
3874         result against zero.
3875
3876         * class.cs (TypeContainer.GetClassBases): We were checking for the
3877         parent class being sealed too late.
3878
3879         * expression.cs (Binary.Emit): For <= and >= when dealing with
3880         floating point values, use cgt.un and clt.un instead of cgt and
3881         clt alone.
3882
3883 2003-04-01  Zoltan Varga  <vargaz@freemail.hu>
3884
3885         * statement.cs: Apply the same optimization as MS: skip the 
3886         GetEnumerator returning an IEnumerator, and use the one returning a 
3887         CharEnumerator instead. This allows us to avoid the try-finally block 
3888         and the boxing.
3889
3890 2003-03-31  Gaurav Vaish <gvaish_mono@lycos.com>
3891
3892         * cs-parser.jay: Attributes cannot be applied to
3893                          namespaces. Fixes #40473
3894
3895 2003-03-31  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3896
3897         * class.cs:
3898         (Add*): check if the name is valid using the full name for constants,
3899         fields, properties and events.
3900
3901 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
3902
3903         * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
3904         char constants to be part of the enumeration.
3905
3906         * expression.cs (Conditional.DoResolve): Add support for operator
3907         true. Implements the missing functionality from 14.12
3908
3909         * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
3910         operator true/false as required by the spec.
3911
3912         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
3913         implicit conversion to boolean.
3914
3915         * statement.cs (Statement.ResolveBoolean): A boolean expression is
3916         also one where the type implements `operator true'. 
3917
3918         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
3919         get an expression that will invoke operator true based on an
3920         expression.  
3921
3922         (GetConversionOperators): Removed the hack that called op_True
3923         here.  
3924
3925         (Expression.ResolveBoolean): Move this from Statement.
3926
3927 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
3928
3929         * ecore.cs (FieldExpr): do not allow initialization of initonly
3930         fields on derived classes
3931
3932 2003-03-13  Martin Baulig  <martin@ximian.com>
3933
3934         * statement.cs (Block.Emit): Call ig.BeginScope() and
3935         ig.EndScope() when compiling with debugging info; call
3936         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
3937
3938 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
3939
3940         * expression.cs (Indexers): Do not construct immediately, allow
3941         for new members to be appended as we go.  Fixes 38143
3942
3943 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3944
3945         * expression.cs: save/restore context when resolving an unchecked
3946         expression.
3947
3948 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
3949
3950         * cfold.cs: Catch division by zero in modulus operator during
3951         constant folding.
3952
3953 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
3954
3955         * interface.cs (Interface.DefineMembers): Avoid defining members
3956         twice. 
3957
3958 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
3959
3960         * driver.cs: handle the +/- options for -noconfig
3961
3962         * statement.cs (Unckeched.Resolve): Also track the state of
3963         unchecked in the Resolve phase.
3964
3965 2003-02-27  Martin Baulig  <martin@ximian.com>
3966
3967         * ecore.cs (Expression.MemberLookup): Don't create a
3968         MethodGroupExpr for something which is not a method.  Fixes #38291.
3969
3970 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
3971
3972         * class.cs (MemberBase.CheckParameters): Also check that the type
3973         is unmanaged if it is a pointer.
3974
3975         * expression.cs (SizeOf.Resolve): Add location information.
3976
3977         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
3978         a managed type is declared.
3979
3980         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
3981         parameter modifiers as well.  Fixes bug 38606
3982
3983         * class.cs: Very sad.  Am backing out the speed up changes
3984         introduced by the ArrayList -> Array in the TypeContainer, as they
3985         were not actually that much faster, and introduced a bug (no error
3986         reports on duplicated methods).
3987
3988         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
3989         source first, this will guarantee that we have a valid expression
3990         before calling in lower levels functions that will require a
3991         resolved object.  Then use this original_source in the
3992         target.ResolveLValue instead of the original source that was
3993         passed to us.
3994
3995         Another change.  Use target.Resolve instead of LValueResolve.
3996         Although we are resolving for LValues, we will let the Assign code
3997         take care of that (it will be called again from Resolve).  This
3998         basically allows code like this:
3999
4000         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
4001         class Y { void A (X x) { x [0] += o; }
4002
4003         The problem was that the indexer was trying to resolve for
4004         set_Item (idx, object o) and never finding one.  The real set_Item
4005         was set_Item (idx, X).  By delaying the process we get the right
4006         semantics. 
4007
4008         Fixes bug 36505
4009         
4010 2003-02-23  Martin Baulig  <martin@ximian.com>
4011
4012         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
4013         while calling DoEmit ().
4014
4015         * codegen.cs (EmitContext.Mark): Don't mark locations in other
4016         source files; if you use the #line directive inside a method, the
4017         compiler stops emitting line numbers for the debugger until it
4018         reaches the end of the method or another #line directive which
4019         restores the original file.
4020
4021 2003-02-23  Martin Baulig  <martin@ximian.com>
4022
4023         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
4024
4025 2003-02-23  Martin Baulig  <martin@ximian.com>
4026
4027         * statement.cs (Block.AddChildVariableNames): We need to call this
4028         recursively, not just for our immediate children.
4029
4030 2003-02-23  Martin Baulig  <martin@ximian.com>
4031
4032         * class.cs (Event.Define): Always make the field private, like csc does.
4033
4034         * typemanager.cs (TypeManager.RealMemberLookup): Make events
4035         actually work, fixes bug #37521.
4036
4037 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
4038
4039         * delegate.cs: When creating the various temporary "Parameters"
4040         classes, make sure that we call the ComputeAndDefineParameterTypes
4041         on those new parameters (just like we do with the formal ones), to
4042         allow them to be resolved in the context of the DeclSpace.
4043
4044         This fixes the bug that Dick observed in Bugzilla #38530.
4045
4046 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
4047
4048         * expression.cs (ResolveMemberAccess): When resolving a constant,
4049         do not attempt to pull a constant if the value was not able to
4050         generate a valid constant.
4051
4052         * const.cs (LookupConstantValue): Do not report more errors than required.
4053
4054 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4055
4056         * expression.cs: fixes bug #38328.
4057
4058 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
4059
4060         * class.cs: Changed all the various members that can be part of a
4061         class from being an ArrayList to be an Array of the right type.
4062         During the DefineType type_list, interface_list, delegate_list and
4063         enum_list are turned into types, interfaces, delegates and enums
4064         arrays.  
4065
4066         And during the member population, indexer_list, event_list,
4067         constant_list, field_list, instance_constructor_list, method_list,
4068         operator_list and property_list are turned into their real arrays.
4069
4070         Although we could probably perform this operation earlier, for
4071         good error reporting we need to keep the lists and remove the
4072         lists for longer than required.
4073
4074         This optimization was triggered by Paolo profiling the compiler
4075         speed on the output of `gen-sample-program.pl' perl script. 
4076
4077         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
4078         not crash in methods like MemberLookupFailed that use this field.  
4079
4080         This problem arises when the compiler fails to resolve a type
4081         during interface type definition for example.
4082
4083 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
4084
4085         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
4086         inherit from System.Object, so we have to stop at null, not only
4087         when reaching System.Object.
4088
4089 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
4090
4091         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
4092         DeclaredOnly because the parent indexer might have had a different
4093         name, but did not loop until the top of the hierarchy was reached.
4094
4095         The problem this one fixes is 35492: when a class implemented an
4096         indexer from an interface, we were getting the interface method
4097         (which was abstract) and we were flagging an error (can not invoke
4098         abstract method).
4099
4100         This also keeps bug 33089 functioning, and test-148 functioning.
4101
4102         * typemanager.cs (IsSpecialMethod): The correct way of figuring
4103         out if a method is special is to see if it is declared in a
4104         property or event, or whether it is one of the predefined operator
4105         names.   This should fix correctly #36804.
4106
4107 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
4108
4109         The goal here is to remove the dependency on EmptyCast.Peel ().
4110         Killing it completely.
4111         
4112         The problem is that currently in a number of places where
4113         constants are expected, we have to "probe" for an EmptyCast, and
4114         Peel, which is not the correct thing to do, as this will be
4115         repetitive and will likely lead to errors. 
4116
4117         The idea is to remove any EmptyCasts that are used in casts that
4118         can be reduced to constants, so we only have to cope with
4119         constants. 
4120
4121         This bug hunt was triggered by Bug 37363 and the desire to remove
4122         the duplicate pattern where we were "peeling" emptycasts to check
4123         whether they were constants.  Now constants will always be
4124         constants.
4125         
4126         * ecore.cs: Use an enumconstant here instead of wrapping with
4127         EmptyCast.  
4128
4129         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
4130         throwing me off.  By handling this we can get rid of a few hacks.
4131         
4132         * statement.cs (Switch): Removed Peel() code.
4133
4134 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
4135
4136         * class.cs: Location information for error 508
4137
4138         * expression.cs (New.DoResolve): Add a guard against double
4139         resolution of an expression.  
4140
4141         The New DoResolve might be called twice when initializing field
4142         expressions (see EmitFieldInitializers, the call to
4143         GetInitializerExpression will perform a resolve on the expression,
4144         and later the assign will trigger another resolution
4145
4146         This leads to bugs (#37014)
4147
4148         * delegate.cs: The signature for EndInvoke should contain any ref
4149         or out parameters as well.  We were not doing this in the past. 
4150
4151         * class.cs (Field.Define): Do not overwrite the type definition
4152         inside the `volatile' group.  Turns out that volatile enumerations
4153         were changing the type here to perform a validity test, which
4154         broke conversions. 
4155
4156 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
4157
4158         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
4159         and structs, we do not want to load the instance variable
4160
4161         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
4162         enum_type has to be handled like an object reference (implicit
4163         conversions exists from this to object), but the regular IsClass
4164         and IsValueType tests will never return true for this one.
4165
4166         Also we use TypeManager.IsValueType instead of type.IsValueType,
4167         just for consistency with the rest of the code (this is only
4168         needed if we ever use the construct exposed by test-180.cs inside
4169         corlib, which we dont today).
4170
4171 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
4172
4173         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
4174         just InternalCall.
4175
4176 2003-02-09  Martin Baulig  <martin@ximian.com>
4177
4178         * namespace.cs (Namespace..ctor): Added SourceFile argument.
4179         (Namespace.DefineNamespaces): New static public method; this is
4180         called when we're compiling with debugging to add all namespaces
4181         to the symbol file.
4182
4183         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
4184         pass it to the Namespace's .ctor.
4185
4186         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
4187         and MethodBase arguments; pass the namespace ID to the symwriter;
4188         pass the MethodBase instead of the token to the symwriter.
4189         (SymbolWriter.DefineNamespace): New method to add a namespace to
4190         the symbol file.
4191
4192 2003-02-09  Martin Baulig  <martin@ximian.com>
4193
4194         * symbolwriter.cs: New file.  This is a wrapper around
4195         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
4196         methods here in near future.
4197
4198 2003-02-09  Martin Baulig  <martin@ximian.com>
4199
4200         * codegen.cs (EmitContext.Mark): Just pass the arguments to
4201         ILGenerator.MarkSequencePoint() which are actually used by the
4202         symbol writer.
4203
4204 2003-02-09  Martin Baulig  <martin@ximian.com>
4205
4206         * location.cs (SourceFile): New public sealed class.  This
4207         contains the name and an index which is used in the location's token.
4208         (Location): Reserve an appropriate number of bits in the token for
4209         the source file instead of walking over that list, this gives us a
4210         really huge performance improvement when compiling with debugging.
4211
4212         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
4213         `SourceFile' argument instead of a string.
4214         (Driver.ProcessFile): Add all the files via Location.AddFile(),
4215         but don't parse/tokenize here, we need to generate the list of all
4216         source files before we do that.
4217         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
4218         the files.
4219
4220         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
4221         instead of a string.
4222
4223         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
4224         of a string.
4225
4226 2003-02-09  Martin Baulig  <martin@ximian.com>
4227
4228         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
4229         filename on `#line default'.
4230
4231 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
4232
4233         * statement.cs: don't clear the pinned var when the fixed statement
4234         returns from the method (fixes bug#37752).
4235
4236 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
4237
4238         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
4239         to IsValueType.
4240
4241 2003-02-07  Martin Baulig  <martin@ximian.com>
4242
4243         * driver.cs: Removed the `--debug-args' command line argument.
4244
4245         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
4246         automatically by the AsssemblyBuilder.
4247         (CodeGen.InitializeSymbolWriter): We don't need to call any
4248         initialization function on the symbol writer anymore.  This method
4249         doesn't take any arguments.
4250
4251 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
4252
4253         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
4254         from referenced assemblies as well.
4255
4256 2003-02-02  Martin Baulig  <martin@ximian.com>
4257
4258         * class.cs (MethodData.Emit): Generate debugging info for external methods.
4259
4260 2003-02-02  Martin Baulig  <martin@ximian.com>
4261
4262         * class.cs (Constructor.Emit): Open the symbol writer before
4263         emitting the constructor initializer.
4264         (ConstructorInitializer.Emit): Call ec.Mark() to allow
4265         single-stepping through constructor initializers.
4266
4267 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
4268
4269         * class.cs: Handle error 549: do not allow virtual methods in
4270         sealed classes. 
4271
4272 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
4273
4274         * decl.cs: Check access levels when resolving types
4275         
4276 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
4277
4278         * statement.cs: Add parameters and locals set in catch blocks that might 
4279         return to set vector
4280
4281 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
4282
4283         * class.cs (Operator): Set the SpecialName flags for operators.
4284         
4285         * expression.cs (Invocation.DoResolve): Only block calls to
4286         accessors and operators on SpecialName methods.
4287
4288         (Cast.TryReduce): Handle conversions from char constants.
4289
4290
4291 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
4292
4293         * statement.cs: small memory and time optimization in FlowBranching.
4294         
4295 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
4296
4297         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
4298         problem that the last fix but in the other sid (Set).
4299
4300         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
4301         access when there is no indexer in the hierarchy.
4302         
4303 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
4304
4305         * class.cs: Combine some if statements.
4306
4307 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4308
4309         * driver.cs: fixed bug #37187.
4310
4311 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
4312
4313         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
4314         any indexer, it's needed to build a list with all the indexers in the
4315         hierarchy (AllGetters), else we have problems. Fixes #35653.
4316
4317 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
4318
4319         * class.cs (MethodData.Define): It is wrong for an interface
4320         implementation to be static in both cases: explicit and implicit.
4321         We were only handling this in one case.
4322
4323         Improve the if situation there to not have negations.
4324         
4325         * class.cs (Field.Define): Turns out that we do not need to check
4326         the unsafe bit on field definition, only on usage.  Remove the test.
4327
4328 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4329
4330         * driver.cs: use assembly.Location instead of Codebase (the latest
4331         patch made mcs fail when using MS assemblies).
4332
4333 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
4334
4335         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
4336         get the path to *corlib.dll.
4337
4338 2003-01-21  Nick Drochak <ndrochak@gol.com>
4339
4340         * cs-tokenizer.cs:
4341         * pending.cs:
4342         * typemanager.cs: Remove compiler warnings
4343
4344 2003-01-20  Duncan Mak  <duncan@ximian.com>
4345
4346         * AssemblyInfo.cs: Bump the version number to 0.19.
4347         
4348 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4349
4350         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
4351
4352 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
4353
4354         * class.cs (Constructor::Emit): Emit debugging info for constructors.
4355
4356 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
4357
4358         * cs-parser.jay: Small fix: we were not comparing the constructor
4359         name correctly.   Thanks to Zoltan for the initial pointer.
4360
4361 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
4362
4363         * cs-tokenizer.cs: Set file name when specified with #line
4364
4365 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
4366
4367         * cs-parser.jay: Only perform the constructor checks here if we
4368         are named like the class;  This will help provider a better
4369         error.  The constructor path is taken when a type definition is
4370         not found, but most likely the user forgot to add the type, so
4371         report that rather than the constructor error.
4372
4373 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
4374
4375         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
4376         allocations.
4377
4378 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4379
4380         * cs-parser.jay: Add cleanup call.
4381
4382 2003-01-13  Duncan Mak  <duncan@ximian.com>
4383
4384         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
4385         consistent with other methods.
4386
4387 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
4388
4389         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
4390         
4391 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
4392
4393         * attribute.cs: only set GuidAttr to true when we have a
4394         GuidAttribute.
4395
4396 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4397
4398         * ecore.cs:
4399         * expression.cs:
4400         * typemanager.cs: fixes to allow mcs compile corlib with the new
4401         Type.IsSubclassOf fix.
4402
4403 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
4404
4405         * expression.cs (LocalVariableReference.DoResolve): Classify a
4406         constant as a value, not as a variable.   Also, set the type for
4407         the variable.
4408
4409         * cs-parser.jay (fixed_statement): take a type instead of a
4410         pointer_type, so we can produce a better error message later.
4411         
4412         * statement.cs (Fixed.Resolve): Flag types that are not pointers
4413         as an error.  
4414         
4415         (For.DoEmit): Make inifinite loops have a
4416         non-conditional branch back.
4417
4418         (Fixed.DoEmit): First populate the pinned variables, then emit the
4419         statement, then clear the variables.  Before I was emitting the
4420         code once for each fixed piece.
4421
4422
4423 2003-01-08  Martin Baulig  <martin@ximian.com>
4424
4425         * statement.cs (FlowBranching.MergeChild): A break in a
4426         SWITCH_SECTION does not leave a loop.  Fixes #36155.
4427
4428 2003-01-08  Martin Baulig  <martin@ximian.com>
4429
4430         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
4431         lives in the same number space than `param_map'.  Fixes #36154.
4432
4433 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
4434
4435         * cs-parser.jay (constructor_declaration): Set the
4436         Constructor.ModFlags before probing for it.  This makes the
4437         compiler report 514, 515 and 132 (the code was there, but got
4438         broken). 
4439
4440         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
4441         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
4442         (GotoCase.Resolve): Set `Returns' to ALWAYS.
4443
4444 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
4445
4446         * enum.cs: create the enum static fields using the enum type.
4447
4448 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
4449
4450         * class.cs: don't try to create the ParamBuilder for the return
4451         type if it's not needed (and handle it breaking for the ms runtime
4452         anyway).
4453
4454 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
4455
4456         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
4457
4458 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
4459
4460         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
4461         the command.   This showed up while compiling the JANET source
4462         code, which used \r as its only newline separator.
4463
4464 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
4465
4466         * class.cs (Method.Define): If we are an operator (because it
4467         reuses our code), then set the SpecialName and HideBySig.  #36128
4468
4469 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
4470
4471         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
4472         exception, report error 120 `object reference required'.
4473
4474         * driver.cs: Add --pause option, used during to measure the size
4475         of the process as it goes with --timestamp.
4476
4477         * expression.cs (Invocation.DoResolve): Do not allow methods with
4478         SpecialName to be invoked.
4479
4480 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
4481
4482         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
4483         number before adding it.
4484
4485 2002-12-21  Ravi Pratap  <ravi@ximian.com>
4486
4487         * ecore.cs (StandardImplicitConversion): When in an unsafe
4488         context, we allow conversion between void * to any other pointer
4489         type. This fixes bug #35973.
4490
4491 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
4492
4493         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
4494         is not thrown when extensionless outputs are used 
4495
4496 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4497
4498         * rootcontext.cs: fixed compilation of corlib.
4499
4500 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
4501
4502         * attribute.cs (Attributes.Contains): Add new method.
4503
4504         * class.cs (MethodCore.LabelParameters): if the parameter is an
4505         `out' parameter, check that no attribute `[In]' has been passed.
4506
4507         * enum.cs: Handle the `value__' name in an enumeration.
4508
4509 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
4510
4511         * decl.cs: Added special case to allow overrides on "protected
4512         internal" methods
4513         
4514 2002-12-18  Ravi Pratap  <ravi@ximian.com>
4515
4516         * attribute.cs (Attributes.AddAttributeSection): Rename to this
4517         since it makes much more sense.
4518
4519         (Attributes.ctor): Don't require a Location parameter.
4520         
4521         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
4522
4523         * attribute.cs (ApplyAttributes): Remove extra Location parameters
4524         since we already have that information per attribute.
4525
4526         * everywhere : make appropriate changes.
4527
4528         * class.cs (LabelParameters): Write the code which actually
4529         applies attributes to the return type. We can't do this on the MS
4530         .NET runtime so we flag a warning in the case an exception is
4531         thrown.
4532
4533 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
4534
4535         * const.cs: Handle implicit null conversions here too.
4536
4537 2002-12-17  Ravi Pratap  <ravi@ximian.com>
4538
4539         * class.cs (MethodCore.LabelParameters): Remove the extra
4540         Type [] parameter since it is completely unnecessary. Instead
4541         pass in the method's attributes so that we can extract
4542         the "return" attribute.
4543
4544 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
4545
4546         * cs-parser.jay (parse): Use Report.Error to flag errors instead
4547         of ignoring it and letting the compile continue.
4548
4549         * typemanager.cs (ChangeType): use an extra argument to return an
4550         error condition instead of throwing an exception.
4551
4552 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
4553
4554         * expression.cs (Unary.TryReduce): mimic the code for the regular
4555         code path.  Perform an implicit cast in the cases where we can
4556         implicitly convert to one of the integral types, and then reduce
4557         based on that constant.   This fixes bug #35483.
4558
4559 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4560
4561         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
4562
4563 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4564
4565         * namespace.cs: fixed bug #35489.
4566
4567 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
4568
4569         * class.cs: Remove some dead code.
4570
4571         * cs-parser.jay: Estimate the number of methods needed
4572         (RootContext.MethodCount);
4573
4574         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
4575         numbers instead of StringBuilders.
4576
4577         * support.cs (PtrHashtable): Add constructor with initial size;
4578         We can now reduce reallocations of the method table.
4579
4580 2002-12-10  Ravi Pratap  <ravi@ximian.com>
4581
4582         * attribute.cs (ApplyAttributes): Keep track of the emitted
4583         attributes on a per-target basis. This fixes bug #35413.
4584
4585 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
4586
4587         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
4588         default to the Windows 1252 encoding.
4589
4590         (UnixParseOption): Support version, thanks to Alp for the missing
4591         pointer. 
4592
4593         * AssemblyInfo.cs: Add nice assembly information.
4594
4595         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
4596         (bug 35169).
4597
4598         * cs-parser.jay: Allow a trailing comma before the close bracked
4599         in the attribute_section production.
4600
4601         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
4602         address of the instance was being taken, I will take this out,
4603         because we take the address of the object immediately here.
4604
4605 2002-12-09  Ravi Pratap  <ravi@ximian.com>
4606
4607         * typemanager.cs (AreMultipleAllowed): Take care of the most
4608         obvious case where attribute type is not in the current assembly -
4609         stupid me ;-)
4610
4611 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
4612
4613         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
4614         definitions, instead of doing that afterwards.  
4615
4616         Also we use a nice little hack, depending on the constructor, we
4617         know if we are a "composed" name or a simple name.  Hence, we
4618         avoid the IndexOf test, and we avoid 
4619
4620         * codegen.cs: Add code to assist in a bug reporter to track down
4621         the source of a compiler crash. 
4622
4623 2002-12-07  Ravi Pratap  <ravi@ximian.com>
4624
4625         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
4626         types have been emitted for a given element and flag an error
4627         if something which does not have AllowMultiple set is used more
4628         than once.
4629
4630         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
4631         attribute types and their corresponding AllowMultiple properties
4632
4633         (AreMultipleAllowed): Check the property for a given type.
4634
4635         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
4636         property in the case we have a TypeContainer.
4637
4638         (Attributes.AddAttribute): Detect duplicates and just skip on
4639         adding them. This trivial fix catches a pretty gross error in our
4640         attribute emission - global attributes were being emitted twice!
4641
4642         Bugzilla bug #33187 is now fixed.
4643
4644 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
4645
4646         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
4647         instead of pp_and).
4648
4649         * expression.cs (Binary.ResolveOperator): I can only use the
4650         Concat (string, string, string) and Concat (string, string,
4651         string, string) if the child is actually a concatenation of
4652         strings. 
4653
4654 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
4655
4656         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
4657         context where we need a 2-character lookahead.
4658
4659         * pending.cs (PendingImplementation): Rework so we can keep track
4660         of interface types all the time, and flag those which were
4661         implemented by parents as optional.
4662
4663 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
4664
4665         * expression.cs (Binary.ResolveOperator): Use
4666         String.Concat(string,string,string) or
4667         String.Concat(string,string,string,string) when possible. 
4668
4669         * typemanager: More helper methods.
4670
4671
4672 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
4673
4674         * pending.cs: remove the bogus return from GetMissingInterfaces()
4675         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
4676
4677 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4678
4679         * namespace.cs: avoid duplicated 'using xxx' being added to
4680         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
4681         when we get more than one 'using' statement for the same namespace.
4682         Report a CS0105 warning for it.
4683
4684 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
4685
4686         * cs-tokenizer.cs (consume_identifier): use read directly, instead
4687         of calling getChar/putback, uses internal knowledge of it.    
4688
4689         (xtoken): Reorder tokenizer so most common patterns are checked
4690         first.  This reduces the compilation time in another 5% (from 8.11s
4691         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
4692
4693         The parsing time is 22% of the compilation in mcs, and from that
4694         64% is spent on the tokenization process.  
4695
4696         I tried using a binary search for keywords, but this is slower
4697         than the hashtable.  Another option would be to do a couple of
4698         things:
4699
4700                 * Not use a StringBuilder, instead use an array of chars,
4701                   with a set value.  Notice that this way we could catch
4702                   the 645 error without having to do it *afterwards*.
4703
4704                 * We could write a hand-parser to avoid the hashtable
4705                   compares altogether.
4706
4707         The identifier consumption process takes 37% of the tokenization
4708         time.  Another 15% is spent on is_number.  56% of the time spent
4709         on is_number is spent on Int64.Parse:
4710
4711                 * We could probably choose based on the string length to
4712                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
4713                   computations. 
4714
4715         Another 3% is spend on wrapping `xtoken' in the `token' function.
4716
4717         Handle 0xa0 as whitespace (#34752)
4718         
4719 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
4720
4721         * typemanager.cs (IsCLRType): New routine to tell whether a type
4722         is one of the builtin types.  
4723
4724         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
4725         typecode in more places instead of doing pointer comparissions.
4726         We could leverage some knowledge about the way the typecodes are
4727         laid out.
4728
4729         New code to cache namespaces in assemblies, it is currently not
4730         invoked, to be used soon.
4731
4732         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
4733
4734         * expression.cs (Binary.ResolveOperator): specially handle
4735         strings, and do not perform user-defined operator overloading for
4736         built-in types.
4737
4738 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
4739
4740         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
4741         internalcall as it is a pretty simple operation;  Avoid whenever
4742         possible to call Char.IsLetter.
4743
4744         (consume_identifier): Cut by half the number of
4745         hashtable calls by merging the is_keyword and GetKeyword behavior.
4746
4747         Do not short-circuit, because if we do, we
4748         report errors (ie, #if false && true would produce an invalid
4749         directive error);
4750         
4751
4752 2002-11-24  Martin Baulig  <martin@ximian.com>
4753
4754         * expression.cs (Cast.TryReduce): If we're in checked syntax,
4755         check constant ranges and report a CS0221.  Fixes #33186.
4756
4757 2002-11-24  Martin Baulig  <martin@ximian.com>
4758
4759         * cs-parser.jay: Make this work for uninitialized variable
4760         declarations in the `for' initializer.  Fixes #32416.
4761
4762 2002-11-24  Martin Baulig  <martin@ximian.com>
4763
4764         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
4765         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
4766
4767 2002-11-24  Martin Baulig  <martin@ximian.com>
4768
4769         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
4770         argument; if true, we also check for user-defined conversions.
4771         This is only needed if both arguments are of a user-defined type.
4772         Fixes #30443, added test-175.cs.
4773         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
4774
4775         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
4776
4777 2002-11-24  Martin Baulig  <martin@ximian.com>
4778
4779         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
4780         function to get the store opcode.
4781         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
4782         only emit the Ldelema if the store opcode is Stobj.  You must run
4783         both test-34 and test-167 to test this.  Fixes #34529.
4784
4785 2002-11-23  Martin Baulig  <martin@ximian.com>
4786
4787         * ecore.cs (Expression.MemberLookup): Added additional
4788         `qualifier_type' argument which is used when we're being called
4789         from MemberAccess.DoResolve() and null if we're called from a
4790         SimpleName lookup.
4791         (Expression.MemberLookupFailed): New method to report errors; this
4792         does the CS1540 check and reports the correct error message.
4793
4794         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
4795         argument for the CS1540 check and redone the way how we're dealing
4796         with private members.  See the comment in the source code for details.
4797         (FilterWithClosure): Reverted this back to revision 1.197; renamed
4798         `closure_start_type' to `closure_qualifier_type' and check whether
4799         it's not null.  It was not this filter being broken, it was just
4800         being called with the wrong arguments.
4801
4802         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
4803         and pass it the correct `qualifier_type'; this also does the error
4804         handling for us.
4805
4806 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
4807
4808         * expression.cs (Invocation.EmitParams): If the we are dealing
4809         with a non-built-in value type, load its address as well.
4810
4811         (ArrayCreation): Use a a pretty constant instead
4812         of the hardcoded value 2.   Use 6 instead of 2 for the number of
4813         static initializers.  
4814
4815         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
4816         because they are not really value types, just glorified integers. 
4817
4818         * driver.cs: Do not append .exe, the CSC compiler does not do it.
4819
4820         * ecore.cs: Remove redundant code for enumerations, make them use
4821         the same code path as everything else, fixes the casting issue
4822         with enumerations in Windows.Forms.
4823
4824         * attribute.cs: Do only cast to string if it is a string, the
4825         validation happens later.
4826
4827         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
4828         people upgrade their corlibs.
4829
4830         * ecore.cs: Oops, enumerations were not following the entire code path
4831
4832 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
4833
4834         * typemanager.cs (FilterWithClosure): Commented out the test for
4835         1540 in typemanager.cs, as it has problems when accessing
4836         protected methods from a parent class (see test-174.cs). 
4837
4838         * attribute.cs (Attribute.ValidateGuid): new method.
4839         (Attribute.Resolve): Use above.
4840
4841 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
4842
4843         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
4844
4845         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
4846         handling for enumerations, as we only needed the TypeContainer
4847         functionality to begin with (this is required for the fix below to
4848         work for enums that reference constants in a container class for
4849         example). 
4850
4851         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
4852
4853         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
4854         a valid TypeBuilder to perform lookups on.o
4855
4856         * class.cs (InheritableMemberSignatureCompare): Use true in the
4857         call to GetGetMethod and GetSetMethod, because we are comparing
4858         the signature, and we need to get the methods *even* if they are
4859         private. 
4860
4861         (PropertyBase.CheckBase): ditto.
4862
4863         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
4864         GotoCase.Resolve): Use Peel on EmpytCasts.
4865
4866         * ecore.cs (EmptyCast): drop child, add Peel method.
4867
4868 2002-11-17  Martin Baulig  <martin@ximian.com>
4869
4870         * ecore.cs (EmptyCast.Child): New public property.
4871
4872         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
4873         label resolved to an EmptyCast.  Fixes #34162.
4874         (GotoCase.Resolve): Likewise.
4875         (Block.EmitMeta): Likewise.
4876
4877 2002-11-17  Martin Baulig  <martin@ximian.com>
4878
4879         * expression.cs (Invocation.BetterConversion): Prefer int over
4880         uint; short over ushort; long over ulong for integer literals.
4881         Use ImplicitConversionExists instead of StandardConversionExists
4882         since we also need to check for user-defined implicit conversions.
4883         Fixes #34165.  Added test-173.cs.
4884
4885 2002-11-16  Martin Baulig  <martin@ximian.com>
4886
4887         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
4888         with the `true' and `false' literals.  Fixes #33151.
4889
4890 2002-11-16  Martin Baulig  <martin@ximian.com>
4891
4892         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
4893         October 22nd; don't do the cs1540 check for static members.
4894
4895         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
4896         now using our own filter here and doing the cs1540 check again.
4897
4898 2002-11-16  Martin Baulig  <martin@ximian.com>
4899
4900         * support.cs (InternalParameters): Don't crash if we don't have
4901         any fixed parameters.  Fixes #33532.
4902
4903 2002-11-16  Martin Baulig  <martin@ximian.com>
4904
4905         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
4906         when looking up static methods to make this work on Windows.
4907         Fixes #33773.
4908
4909 2002-11-16  Martin Baulig  <martin@ximian.com>
4910
4911         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
4912         a setter rather than using PropertyInfo.CanWrite.
4913
4914 2002-11-15  Nick Drochak  <ndrochak@gol.com>
4915
4916         * class.cs: Allow acces to block member by subclasses. Fixes build
4917         breaker.
4918
4919 2002-11-14  Martin Baulig  <martin@ximian.com>
4920
4921         * class.cs (Constructor.Emit): Added the extern/block check.
4922         Fixes bug #33678.
4923
4924 2002-11-14  Martin Baulig  <martin@ximian.com>
4925
4926         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
4927         iteration while looking for indexers, this is needed because the
4928         indexer may have a different name in our base classes.  Fixed the
4929         error reporting (no indexers at all, not get accessor, no
4930         overloaded match).  Fixes bug #33089.
4931         (IndexerAccess.DoResolveLValue): Likewise.
4932
4933 2002-11-14  Martin Baulig  <martin@ximian.com>
4934
4935         * class.cs (PropertyBase.CheckBase): Make this work for multiple
4936         indexers.  Fixes the first part of bug #33089.
4937         (MethodSignature.InheritableMemberSignatureCompare): Added support
4938         for properties.
4939
4940 2002-11-13  Ravi Pratap  <ravi@ximian.com>
4941
4942         * attribute.cs (Attribute.Resolve): Catch the
4943         NullReferenceException and report it since it isn't supposed to
4944         happen. 
4945         
4946 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
4947
4948         * expression.cs (Binary.EmitBranchable): Also handle the cases for
4949         LogicalOr and LogicalAnd that can benefit from recursively
4950         handling EmitBranchable.  The code now should be nice for Paolo.
4951
4952 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
4953
4954         * typemanager.cs (LookupType): Added a negative-hit hashtable for
4955         the Type lookups, as we perform quite a number of lookups on
4956         non-Types.  This can be removed once we can deterministically tell
4957         whether we have a type or a namespace in advance.
4958
4959         But this might require special hacks from our corlib.
4960
4961         * TODO: updated.
4962
4963         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
4964         and double which avoids a conversion from an integer to a double.
4965
4966         * expression.cs: tiny optimization, avoid calling IsConstant,
4967         because it effectively performs the lookup twice.
4968
4969 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
4970
4971         But a bogus return here to keep the semantics of the old code
4972         until the Mono runtime is fixed.
4973         
4974         * pending.cs (GetMissingInterfaces): New method used to remove all
4975         the interfaces that are already implemented by our parent
4976         classes from the list of pending methods. 
4977
4978         * interface.cs: Add checks for calls after ResolveTypeExpr.
4979
4980 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
4981
4982         * class.cs (Class.Emit): Report warning 67: event not used if the
4983         warning level is beyond 3.
4984
4985         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
4986         being a NullLiteral.
4987
4988         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
4989         specifiers. 
4990
4991         * class.cs (TypeContainer.GetClassBases): Cover a missing code
4992         path that might fail if a type can not be resolved.
4993
4994         * expression.cs (Binary.Emit): Emit unsigned versions of the
4995         operators. 
4996
4997         * driver.cs: use error 5.
4998         
4999 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
5000
5001         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
5002
5003 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
5004
5005         * cs-parser.jay (switch_section): A beautiful patch from Martin
5006         Baulig that fixed 33094.
5007
5008 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
5009
5010         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
5011         Check whether the base is abstract and report an error if so.
5012
5013         * expression.cs (IndexerAccess.DoResolveLValue,
5014         IndexerAccess.DoResolve): ditto. 
5015
5016         (Invocation.DoResolve): ditto.
5017         
5018         (Invocation.FullMethodDesc): Improve the report string.
5019
5020         * statement.cs (Block): Eliminate IsVariableDefined as it is
5021         basically just a wrapper for GetVariableInfo.
5022
5023         * ecore.cs (SimpleName): Use new 
5024
5025         * support.cs (ReflectionParamter.ParameterType): We unwrap the
5026         type, as we return the actual parameter ref/unref state on a
5027         different call.
5028
5029 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
5030
5031         * support.cs: Return proper flags REF/OUT fixing the previous
5032         commit.  
5033
5034         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
5035         not used to mean `ref' but `ref or out' in ParameterReference
5036         
5037         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
5038         full type signature instead of calling TypeManger.CSharpName
5039         ourselves. 
5040
5041         * support.cs (InternalParameters.ParameterDesc): Do not compare
5042         directly to the modflags, because REF/OUT will actually be bitsets
5043         if set. 
5044
5045         * delegate.cs (VerifyMethod): Check also the modifiers.
5046
5047         * cs-tokenizer.cs: Fix bug where floating point values with an
5048         exponent where a sign was missing was ignored.
5049
5050         * driver.cs: Allow multiple assemblies to be specified in a single
5051         /r: argument
5052
5053 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
5054
5055         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
5056         because identifiers after a parenthesis would end up in this kind
5057         of production, and we needed to desamiguate it for having casts
5058         like:
5059
5060                 (UserDefinedType *) xxx
5061
5062 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
5063
5064         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
5065         we should set on the Bindingflags.NonPublic, but not turn on
5066         private_ok.  private_ok controls whether a Private member is
5067         returned (this is chekced on the filter routine), while the
5068         BindingFlags.NonPublic just controls whether private/protected
5069         will be allowed.   This fixes the problem part of the problem of
5070         private properties being allowed to be used in derived classes.
5071
5072         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
5073         so we can call the children DoResolveLValue method (this will
5074         properly signal errors on lvalue assignments to base properties)
5075         
5076         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
5077         getter are null, and we have a property info, we know that this
5078         happened because the lookup failed, so we report an error 122 for
5079         protection level violation.
5080
5081         We also silently return if setter and getter are null in the
5082         resolve functions, this condition only happens if we have flagged
5083         the error before.  This is the other half of the problem. 
5084
5085         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
5086         not have accessibility information, that is why we were returning
5087         true in the filter function in typemanager.cs.
5088
5089         To properly report 122 (property is inaccessible because of its
5090         protection level) correctly, we report this error in ResolveAccess
5091         by failing if both the setter and the getter are lacking (ie, the
5092         lookup failed). 
5093
5094         DoResolve and DoLResolve have been modified to check for both
5095         setter/getter being null and returning silently, the reason being
5096         that I did not want to put the knowledge about this error in upper
5097         layers, like:
5098
5099         int old = Report.Errors;
5100         x = new PropertyExpr (...);
5101         if (old != Report.Errors)
5102                 return null;
5103         else
5104                 return x;
5105
5106         So the property expr is returned, but it is invalid, so the error
5107         will be flagged during the resolve process. 
5108
5109         * class.cs: Remove InheritablePropertySignatureCompare from the
5110         class, as we no longer depend on the property signature to compute
5111         whether it is possible to implement a method or not.
5112
5113         The reason is that calling PropertyInfo.GetGetMethod will return
5114         null (in .NET, in Mono it works, and we should change this), in
5115         cases where the Get Method does not exist in that particular
5116         class.
5117
5118         So this code:
5119
5120         class X { public virtual int A { get { return 1; } } }
5121         class Y : X { }
5122         class Z : Y { public override int A { get { return 2; } } }
5123
5124         Would fail in Z because the parent (Y) would not have the property
5125         defined.  So we avoid this completely now (because the alternative
5126         fix was ugly and slow), and we now depend exclusively on the
5127         method names.
5128
5129         (PropertyBase.CheckBase): Use a method-base mechanism to find our
5130         reference method, instead of using the property.
5131
5132         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
5133         routines are gone now.
5134
5135         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
5136         names, they were incorrectly named.
5137
5138         * cs-tokenizer.cs: Return are more gentle token on failure. 
5139
5140         * pending.cs (PendingImplementation.InterfaceMethod): This routine
5141         had an out-of-sync index variable, which caused it to remove from
5142         the list of pending methods the wrong method sometimes.
5143
5144 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
5145
5146         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
5147         CanWrite, because those refer to this particular instance of the
5148         property, and do not take into account the fact that we can
5149         override single members of a property.
5150
5151         Constructor requires an EmitContext.  The resolution process does
5152         not happen here, but we need to compute the accessors before,
5153         because the resolution does not always happen for properties.
5154         
5155         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
5156         subclass, before we did not update this flag, but we did update
5157         bindingflags. 
5158
5159         (GetAccessors): Drop this routine, as it did not work in the
5160         presence of partially overwritten set/get methods. 
5161
5162         Notice that this broke the cs1540 detection, but that will require
5163         more thinking. 
5164         
5165 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5166
5167         * class.cs:
5168         * codegen.cs:
5169         * driver.cs: issue a warning instead of an error if we don't support
5170         debugging for the platform. Also ignore a couple of errors that may
5171         arise when trying to write the symbols. Undo my previous patch.
5172
5173 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5174
5175         * driver.cs: ignore /debug switch except for Unix platforms.
5176
5177 2002-10-23  Nick Drochak  <ndrochak@gol.com>
5178
5179         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
5180
5181 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
5182
5183         * driver.cs: Do not make mcs-debug conditional, so we do not break
5184         builds that use it.
5185
5186         * statement.cs (UsageVector.MergeChildren): I would like Martin to
5187         review this patch.  But basically after all the children variables
5188         have been merged, the value of "Breaks" was not being set to
5189         new_breaks for Switch blocks.  I think that it should be set after
5190         it has executed.  Currently I set this to the value of new_breaks,
5191         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
5192         conservative, but I do not understand this code very well.
5193
5194         I did not break anything in the build, so that is good ;-)
5195
5196         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
5197
5198 2002-10-20  Mark Crichton  <crichton@gimp.org>
5199
5200         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
5201
5202 2002-10-20  Nick Drochak  <ndrochak@gol.com>
5203
5204         * cfold.cs: Fixed compile blocker.
5205
5206 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
5207
5208         * driver.cs: I was chekcing the key, not the file.
5209
5210 2002-10-19  Ravi Pratap  <ravi@ximian.com>
5211
5212         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
5213         message that we were generating - we just need to silently return
5214         a null.
5215
5216 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
5217
5218         * class.cs (Event.Define): Change my previous commit, as this
5219         breaks the debugger.  This is a temporary hack, as it seems like
5220         the compiler is generating events incorrectly to begin with.
5221
5222         * expression.cs (Binary.ResolveOperator): Added support for 
5223         "U operator - (E x, E y)"
5224
5225         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
5226         y)".
5227
5228         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
5229         init-only variables, but this path did not take into account that
5230         there might be also instance readonly variables.  Correct this
5231         problem. 
5232
5233         This fixes bug 32253
5234
5235         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
5236         delegates as well.
5237
5238         * driver.cs: Change the extension for modules to `netmodule'
5239
5240         * cs-parser.jay: Improved slightly the location tracking for
5241         the debugger symbols.
5242
5243         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
5244         modifiers that were specified instead of the hardcoded value
5245         (FamAndAssem).  This was basically ignoring the static modifier,
5246         and others.  Fixes 32429.
5247
5248         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
5249         fixed a bug in the process (32476)
5250
5251         * expression.cs (ArrayAccess.EmitAssign): Patch from
5252         hwang_rob@yahoo.ca that fixes bug 31834.3
5253
5254 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
5255
5256         * driver.cs: Make the module extension .netmodule.
5257
5258 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
5259
5260         * driver.cs: Report an error if the resource file is not found
5261         instead of crashing.
5262
5263         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
5264         false, like Emit does.
5265
5266 2002-10-16  Nick Drochak  <ndrochak@gol.com>
5267
5268         * typemanager.cs: Remove unused private member.  Also reported mcs
5269         bug to report this as a warning like csc.
5270
5271 2002-10-15  Martin Baulig  <martin@gnome.org>
5272
5273         * statement.cs (Statement.Emit): Made this a virtual method; emits
5274         the line number info and calls DoEmit().
5275         (Statement.DoEmit): New protected abstract method, formerly knows
5276         as Statement.Emit().
5277
5278         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
5279
5280 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
5281
5282         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
5283         have fixed a remaining problem: not every AddXXXX was adding a
5284         fully qualified name.  
5285
5286         Now everyone registers a fully qualified name in the DeclSpace as
5287         being defined instead of the partial name.  
5288
5289         Downsides: we are slower than we need to be due to the excess
5290         copies and the names being registered this way.  
5291
5292         The reason for this is that we currently depend (on the corlib
5293         bootstrap for instance) that types are fully qualified, because
5294         we dump all the types in the namespace, and we should really have
5295         types inserted into the proper namespace, so we can only store the
5296         basenames in the defined_names array.
5297
5298 2002-10-10  Martin Baulig  <martin@gnome.org>
5299
5300         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
5301         from bug #31834, see the bug report for a testcase which is
5302         miscompiled.
5303
5304 2002-10-10  Martin Baulig  <martin@gnome.org>
5305
5306         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
5307         flow analysis code for this.
5308
5309         * statement.cs (Do, While, For): Tell the flow analysis code about
5310         infinite loops.
5311         (FlowBranching.UsageVector): Added support for infinite loops.
5312         (Block.Resolve): Moved the dead code elimination here and use flow
5313         analysis to do it.
5314
5315 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
5316
5317         * class.cs (Field.Define): Catch cycles on struct type
5318         definitions. 
5319
5320         * typemanager.cs (IsUnmanagedtype): Do not recursively check
5321         fields if the fields are static.  We only need to check instance
5322         fields. 
5323
5324         * expression.cs (As.DoResolve): Test for reference type.
5325
5326         * statement.cs (Using.ResolveExpression): Use
5327         ConvertImplicitRequired, not ConvertImplicit which reports an
5328         error on failture
5329         (Using.ResolveLocalVariableDecls): ditto.
5330
5331         * expression.cs (Binary.ResolveOperator): Report errors in a few
5332         places where we had to.
5333
5334         * typemanager.cs (IsUnmanagedtype): Finish implementation.
5335
5336 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
5337
5338         * expression.cs: Use StoreFromPtr instead of extracting the type
5339         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
5340
5341         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
5342         an enumeration value to a System.Enum, but System.Enum is not a
5343         value type, but an class type, so we need to box.
5344
5345         (Expression.ConvertExplicit): One codepath could return
5346         errors but not flag them.  Fix this.  Fixes #31853
5347
5348         * parameter.cs (Resolve): Do not allow void as a parameter type.
5349
5350 2002-10-06  Martin Baulig  <martin@gnome.org>
5351
5352         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
5353         if it's a class type and not a struct.  Fixes #31815.
5354
5355 2002-10-06  Martin Baulig  <martin@gnome.org>
5356
5357         * statement.cs: Reworked the flow analysis code a bit to make it
5358         usable for dead code elimination.
5359
5360 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5361
5362         * cs-parser.jay: allow empty source files. Fixes bug #31781.
5363
5364 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
5365
5366         * expression.cs (ComposedCast.DoResolveType): A quick workaround
5367         to fix the test 165, will investigate deeper.
5368
5369 2002-10-04  Martin Baulig  <martin@gnome.org>
5370
5371         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
5372         finally blocks actually work.
5373         (Try.Resolve): We don't need to create a sibling for `finally' if
5374         there is no finally block.
5375
5376 2002-10-04  Martin Baulig  <martin@gnome.org>
5377
5378         * class.cs (Constructor.Define): The default accessibility for a
5379         non-default constructor is private, not public.
5380
5381 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
5382
5383         * class.cs (Constructor): Make AllowedModifiers public, add
5384         EXTERN.
5385
5386         * cs-parser.jay: Perform the modifiers test here, as the
5387         constructor for the Constructor class usually receives a zero
5388         because of the way we create it (first we create, later we
5389         customize, and we were never checking the modifiers).
5390
5391         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
5392         is a version of LookupTypeReflection that includes the type-name
5393         cache.  This can be used as a fast path for functions that know
5394         the fully qualified name and are only calling into *.GetType() to
5395         obtain a composed type.
5396
5397         This is also used by TypeManager.LookupType during its type
5398         composition.
5399
5400         (LookupType): We now also track the real type name, as sometimes
5401         we can get a quey for the real type name from things like
5402         ComposedCast.  This fixes bug 31422.
5403         
5404         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
5405         complete type fullname, it does not have to go through the type
5406         resolution system to obtain the composed version of the type (for
5407         obtaining arrays or pointers).
5408         
5409         (Conditional.Emit): Use the EmitBoolExpression to
5410         generate nicer code, as requested by Paolo.
5411
5412         (ArrayCreation.CheckIndices): Use the patch from
5413         hwang_rob@yahoo.ca to validate the array initializers. 
5414
5415 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
5416
5417         * class.cs (ConstructorInitializer.Emit): simplify code by using
5418         Invocation.EmitCall, and at the same time, fix the bugs in calling
5419         parent constructors that took variable arguments. 
5420
5421         * ecore.cs (Expression.ConvertNumericExplicit,
5422         Expression.ImplicitNumericConversion): Remove the code that
5423         manually wrapped decimal (InternalTypeConstructor call is now gone
5424         as well).
5425
5426         * expression.cs (Cast.TryReduce): Also handle decimal types when
5427         trying to perform a constant fold on the type.
5428
5429         * typemanager.cs (IsUnmanagedtype): Partially implemented.
5430
5431         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
5432         that only turned off an error report, and did nothing else. 
5433
5434 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
5435
5436         * driver.cs: Handle and ignore /fullpaths
5437
5438 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
5439
5440         * expression.cs (Binary.ResolveOperator): Catch the case where
5441         DoNumericPromotions returns true, 
5442
5443         (Binary.DoNumericPromotions): Simplify the code, and the tests.
5444
5445 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
5446
5447         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
5448         report error 70.
5449
5450 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
5451
5452         * ecore.cs (ConvertNumericExplicit): It is not enough that the
5453         conversion exists, but it is also required that the conversion be
5454         performed.  This manifested in "(Type64Enum) 2".  
5455
5456         * class.cs (TypeManager.AddMethod): The fix is not to change
5457         AddEnum, because that one was using a fully qualified name (every
5458         DeclSpace derivative does), but to change the AddMethod routine
5459         that was using an un-namespaced name.  This now correctly reports
5460         the duplicated name.
5461
5462         Revert patch until I can properly fix it.  The issue
5463         is that we have a shared Type space across all namespaces
5464         currently, which is wrong.
5465
5466         Options include making the Namespace a DeclSpace, and merge
5467         current_namespace/current_container in the parser.
5468
5469 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
5470
5471         * cs-parser.jay: Improve error reporting when we get a different
5472         kind of expression in local_variable_type and
5473         local_variable_pointer_type. 
5474
5475         Propagate this to avoid missleading errors being reported.
5476
5477         * ecore.cs (ImplicitReferenceConversion): treat
5478         TypeManager.value_type as a target just like object_type.   As
5479         code like this:
5480
5481         ValueType v = 1;
5482
5483         Is valid, and needs to result in the int 1 being boxed before it
5484         is assigned to the value type v.
5485
5486         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
5487         to validate the enumeration name.
5488
5489         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
5490         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
5491         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
5492
5493         * ecore.cs (TryImplicitIntConversion): When doing an
5494         implicit-enumeration-conversion, check if the type is 64-bits and
5495         perform a conversion before passing to EnumConstant.
5496
5497 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
5498
5499         * decl.cs (Error_AmbiguousTypeReference); New routine used to
5500         report ambiguous type references.  Unlike the MS version, we
5501         report what the ambiguity is.   Innovation at work ;-)
5502
5503         (DeclSpace.FindType): Require a location argument to
5504         display when we display an ambiguous error.
5505
5506         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
5507
5508         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
5509
5510         * expression.cs (EmitDynamicInitializers): Apply patch from
5511         hwang_rob@yahoo.ca that fixes the order in which we emit our
5512         initializers. 
5513
5514 2002-09-21  Martin Baulig  <martin@gnome.org>
5515
5516         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
5517         delegate takes no arguments.
5518
5519 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
5520
5521         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
5522         from integers.
5523
5524         * expression.cs: Extract the underlying type.
5525
5526         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
5527
5528         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
5529
5530 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
5531
5532         * class.cs (TypeContainer.DefineType): We can not use the nice
5533         PackingSize with the size set to 1 DefineType method, because it
5534         will not allow us to define the interfaces that the struct
5535         implements.
5536
5537         This completes the fixing of bug 27287
5538
5539         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
5540         means also structs.  This fixes part of the problem. 
5541         (Expresion.ImplicitReferenceConversionExists): ditto.
5542
5543         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
5544         error if there were no errors reported during the type lookup
5545         process, to avoid duplicates or redundant errors.  Without this
5546         you would get an ambiguous errors plus a type not found.  We have
5547         beaten the user enough with the first error.  
5548
5549         (DeclSparce.FindType): Emit a warning if we have an ambiguous
5550         reference. 
5551
5552         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
5553         during the resolution process, stop the lookup, this avoids
5554         repeated error reports (same error twice).
5555
5556         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
5557
5558         * typemanager.cs (LookupType): Redo the type lookup code to match
5559         the needs of System.Reflection.  
5560
5561         The issue is that System.Reflection requires references to nested
5562         types to begin with a "+" sign instead of a dot.  So toplevel
5563         types look like: "NameSpace.TopLevelClass", and nested ones look
5564         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
5565         levels. 
5566
5567 2002-09-19  Martin Baulig  <martin@gnome.org>
5568
5569         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
5570         says that a method always returns or always throws an exception,
5571         don't report the CS0161.
5572
5573         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
5574         set `Returns = new_returns'.
5575
5576 2002-09-19  Martin Baulig  <martin@gnome.org>
5577
5578         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
5579         to an enum constant, check for a CS0176.
5580
5581 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
5582
5583         * class.cs (TypeContainer.CheckPairedOperators): Now we check
5584         for operators that must be in pairs and report errors.
5585
5586         * ecore.cs (SimpleName.DoResolveType): During the initial type
5587         resolution process, when we define types recursively, we must
5588         check first for types in our current scope before we perform
5589         lookups in the enclosing scopes.
5590
5591         * expression.cs (MakeByteBlob): Handle Decimal blobs.
5592
5593         (Invocation.VerifyArgumentsCompat): Call
5594         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
5595         I thought we were supposed to always call this, but there are a
5596         few places in the code where we dont do it.
5597
5598 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
5599
5600         * driver.cs: Add support in -linkres and -resource to specify the
5601         name of the identifier.
5602
5603 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
5604
5605         * ecore.cs (StandardConversionExists): Sync with the conversion
5606         code: allow anything-* to void* conversions.
5607
5608         (FindMostSpecificSource): Use an Expression argument
5609         instead of a Type, because we might be handed over a Literal which
5610         gets a few more implicit conversions that plain types do not.  So
5611         this information was being lost.
5612
5613         Also, we drop the temporary type-holder expression when not
5614         required.
5615
5616 2002-09-17  Martin Baulig  <martin@gnome.org>
5617
5618         * class.cs (PropertyBase.CheckBase): Don't check the base class if
5619         this is an explicit interface implementation.
5620
5621 2002-09-17  Martin Baulig  <martin@gnome.org>
5622
5623         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
5624         different `IndexerName' attributes.
5625
5626         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
5627         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
5628         virtual CommonResolve().
5629
5630 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
5631
5632         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
5633         and convert that to the UnderlyingType.
5634
5635         * statement.cs (Foreach.Resolve): Indexers are just like variables
5636         or PropertyAccesses.
5637
5638         * cs-tokenizer.cs (consume_string): Track line numbers and columns
5639         inside quoted strings, we were not doing this before.
5640
5641 2002-09-16  Martin Baulig  <martin@gnome.org>
5642
5643         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
5644         resolve it.  This is needed for the definite assignment check of the
5645         instance expression, fixes bug #29846.
5646         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
5647
5648 2002-09-16  Nick Drochak  <ndrochak@gol.com>
5649
5650         * parameter.cs: Fix compile error.  Cannot reference static member
5651         from an instance object.  Is this an mcs bug?
5652
5653 2002-09-14  Martin Baulig  <martin@gnome.org>
5654
5655         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
5656         multiple times.  Fixes bug #30295, added test-166.cs.
5657
5658 2002-09-14  Martin Baulig  <martin@gnome.org>
5659
5660         * statement.cs (Block.Emit): Don't emit unreachable code.
5661         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
5662         `break' statements.
5663         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
5664
5665 2002-09-14  Martin Baulig  <martin@gnome.org>
5666
5667         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
5668         is set.
5669
5670 2002-09-14  Martin Baulig  <martin@gnome.org>
5671
5672         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
5673         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
5674         be false on the ms runtime.
5675
5676 2002-09-13  Martin Baulig  <martin@gnome.org>
5677
5678         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
5679         the CS0038 error message.
5680
5681 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
5682
5683         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
5684         constant inside, return it.
5685
5686 2002-09-12  Martin Baulig  <martin@gnome.org>
5687
5688         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
5689         implicit conversion can be done between enum types.
5690
5691         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
5692         check whether an implicit conversion to the current enum's UnderlyingType
5693         exists and report an error if not.
5694
5695         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
5696         without debugging support.
5697
5698         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
5699         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
5700
5701 2002-09-12  Martin Baulig  <martin@gnome.org>
5702
5703         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
5704
5705         * ecore.cs (IMemberExpr.DeclaringType): New property.
5706         (SimpleName.SimpleNameResolve): Check whether we're accessing a
5707         nonstatic member of an outer type (CS0038).
5708
5709 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
5710
5711         * driver.cs: Activate the using-error detector at warning level
5712         4 (at least for MS-compatible APIs).
5713
5714         * namespace.cs (VerifyUsing): Small buglett fix.
5715
5716         * pending.cs (PendingImplementation): pass the container pointer. 
5717
5718         * interface.cs (GetMethods): Allow for recursive definition.  Long
5719         term, I would like to move every type to support recursive
5720         definitions, not the current ordering mechanism that we have right
5721         now.
5722
5723         The situation is this: Attributes are handled before interfaces,
5724         so we can apply attributes to interfaces.  But some attributes
5725         implement interfaces, we will now handle the simple cases
5726         (recursive definitions will just get an error).  
5727
5728         * parameter.cs: Only invalidate types at the end if we fail to
5729         lookup all types.  
5730
5731 2002-09-09  Martin Baulig  <martin@gnome.org>
5732
5733         * ecore.cs (PropertyExpr.Emit): Also check for
5734         TypeManager.system_int_array_get_length so this'll also work when
5735         compiling corlib.  Fixes #30003.
5736
5737 2002-09-09  Martin Baulig  <martin@gnome.org>
5738
5739         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
5740         and throw an exception if we can't get the type's size.  Fixed #30040,
5741         added test-165.cs.
5742
5743 2002-09-09  Martin Baulig  <martin@gnome.org>
5744
5745         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
5746
5747         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
5748         context.  Fixes bug #30027.
5749
5750         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
5751         virtual functions.  Fixes bug #30043, added test-164.cs.
5752
5753 2002-09-08  Ravi Pratap  <ravi@ximian.com>
5754
5755         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
5756
5757 2002-09-08  Nick Drochak  <ndrochak@gol.com>
5758
5759         * driver.cs: Use an object to get the windows codepage since it's not a
5760         static property.
5761
5762 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
5763
5764         * statement.cs (For.Emit): for infinite loops (test == null)
5765         return whether there is a break inside, not always "true".
5766
5767         * namespace.cs (UsingEntry): New struct to hold the name of the
5768         using definition, the location where it is defined, and whether it
5769         has been used in a successful type lookup.
5770         
5771         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
5772         strings.
5773
5774         * decl.cs: ditto.
5775
5776 2002-09-06  Ravi Pratap  <ravi@ximian.com>
5777
5778         * attribute.cs : Fix incorrect code which relied on catching
5779         a NullReferenceException to detect a null being passed in
5780         where an object was expected.
5781
5782 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
5783
5784         * statement.cs (Try): flag the catch variable as assigned
5785
5786         * expression.cs (Cast): Simplified by using ResolveType instead of
5787         manually resolving.
5788
5789         * statement.cs (Catch): Fix bug by using ResolveType.
5790
5791 2002-09-06  Ravi Pratap  <ravi@ximian.com>
5792
5793         * expression.cs (BetterConversion): Special case for when we have
5794         a NullLiteral as the argument and we have to choose between string
5795         and object types - we choose string the way csc does.
5796
5797         * attribute.cs (Attribute.Resolve): Catch the
5798         NullReferenceException and report error #182 since the Mono
5799         runtime no more has the bug and having this exception raised means
5800         we tried to select a constructor which takes an object and is
5801         passed a null.
5802
5803 2002-09-05  Ravi Pratap  <ravi@ximian.com>
5804
5805         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
5806         message (1502, 1503) when we can't locate a method after overload
5807         resolution. This is much more informative and closes the bug
5808         Miguel reported.
5809
5810         * interface.cs (PopulateMethod): Return if there are no argument
5811         types. Fixes a NullReferenceException bug.
5812
5813         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
5814         expressions too. Previously we were checking only in one place for
5815         positional arguments leaving out named arguments.
5816
5817         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
5818         type to the enum type is not allowed. Remove code corresponding to
5819         that.
5820
5821         (ConvertNumericExplicit): Allow explicit conversions from
5822         the underlying type to enum type. This precisely follows the spec
5823         and closes a bug filed by Gonzalo.
5824         
5825 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5826
5827         * compiler.csproj:
5828         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
5829
5830 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
5831
5832         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
5833         it was important that we stored the right value after the
5834         reduction in `converted'.
5835
5836 2002-09-04  Martin Baulig  <martin@gnome.org>
5837
5838         * location.cs (Location.SymbolDocument): Use full pathnames for the
5839         source files.
5840
5841 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
5842
5843         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
5844         of the expression resolve mechanism, because that will catch the
5845         SimpleName error failures.
5846
5847         (Conditional): If we can not resolve the
5848         expression, return, do not crash.
5849
5850 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5851
5852         * cs-tokenizer.cs:
5853         (location): display token name instead of its number.
5854
5855 2002-08-28  Martin Baulig  <martin@gnome.org>
5856
5857         * expression.cs (Binary.ResolveOperator): Don't silently return
5858         but return an error if an operator cannot be applied between two
5859         enum types.
5860
5861 2002-08-28  Martin Baulig  <martin@gnome.org>
5862
5863         * class.cs (Constructor.Define): Set the permission attributes
5864         correctly instead of making all constructors public.
5865
5866 2002-08-28  Martin Baulig  <martin@gnome.org>
5867
5868         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
5869         for private members before reporting a CS0103; if we find anything,
5870         it's a CS0122.
5871
5872 2002-08-28  Martin Baulig  <martin@gnome.org>
5873
5874         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
5875         to check whether `closure_start_type == closure_invocation_type',
5876         we also need to check whether `m.DeclaringType == closure_invocation_type'
5877         before bypassing the permission checks.  We might be accessing
5878         protected/private members from the base class.
5879         (TypeManager.RealMemberLookup): Only set private_ok if private
5880         members were requested via BindingFlags.NonPublic.
5881
5882         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
5883
5884         * expression.cs (MemberAccess.ResolveMemberAccess): Set
5885         MethodGroupExpr.IsExplicitImpl if appropriate.
5886         (Invocation.DoResolve): Don't report the CS0120 for explicit
5887         interface implementations.
5888
5889 2002-08-27  Martin Baulig  <martin@gnome.org>
5890
5891         * expression.cs (Invocation.DoResolve): If this is a static
5892         method and we don't have an InstanceExpression, we must report
5893         a CS0120.
5894
5895 2002-08-25  Martin Baulig  <martin@gnome.org>
5896
5897         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
5898         `==' between a valuetype and an object.
5899
5900 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
5901
5902         * ecore.cs (TypeExpr): Provide a ToString method.
5903
5904 2002-08-24  Martin Baulig  <martin@gnome.org>
5905
5906         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
5907         now called proggie.dbg and it's a binary file.
5908
5909 2002-08-23  Martin Baulig  <martin@gnome.org>
5910
5911         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
5912
5913 2002-08-23  Martin Baulig  <martin@gnome.org>
5914
5915         * struct.cs (MyStructInfo.ctor): Make this work with empty
5916         structs; it's not allowed to use foreach() on null.
5917
5918 2002-08-23  Martin Baulig  <martin@gnome.org>
5919
5920         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
5921         writer the full pathname of the generated assembly.
5922
5923 2002-08-23  Martin Baulig  <martin@gnome.org>
5924
5925         * statements.cs (FlowBranching.UsageVector.MergeChildren):
5926         A `finally' block never returns or breaks; improved handling of
5927         unreachable code.
5928
5929 2002-08-23  Martin Baulig  <martin@gnome.org>
5930
5931         * statement.cs (Throw.Resolve): Allow `throw null'.
5932
5933 2002-08-23  Martin Baulig  <martin@gnome.org>
5934
5935         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
5936         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
5937         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
5938         MemberLookup would return a wrong event if this is an explicit
5939         interface implementation and the class has an event with the same
5940         name.
5941
5942 2002-08-23  Martin Baulig  <martin@gnome.org>
5943
5944         * statement.cs (Block.AddChildVariableNames): New public method.
5945         (Block.AddChildVariableName): Likewise.
5946         (Block.IsVariableNameUsedInChildBlock): Likewise.
5947         (Block.AddVariable): Check whether a variable name has already
5948         been used in a child block.
5949
5950         * cs-parser.jay (declare_local_variables): Mark all variable names
5951         from the current block as being used in a child block in the
5952         implicit block.
5953
5954 2002-08-23  Martin Baulig  <martin@gnome.org>
5955
5956         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
5957         find the symbol writer.
5958
5959         * driver.cs: csc also allows the arguments to /define being
5960         separated by commas, not only by semicolons.
5961
5962 2002-08-23  Martin Baulig  <martin@gnome.org>
5963
5964         * interface.cs (Interface.GetMembers): Added static check for events.
5965
5966 2002-08-15  Martin Baulig  <martin@gnome.org>
5967
5968         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
5969         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
5970
5971         * ecore.cs (Expression.MemberLookup): Added documentation and explained
5972         why the MethodData.EmitDestructor() change was necessary.
5973
5974 2002-08-20  Martin Baulig  <martin@gnome.org>
5975
5976         * class.cs (TypeContainer.FindMembers): Added static check for events.
5977
5978         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
5979
5980         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
5981         use Type.GetEvents(), not Type.FindMembers().
5982
5983 2002-08-20  Martin Baulig  <martin@gnome.org>
5984
5985         * decl.cs (MemberCache): Added a special method cache which will
5986         be used for method-only searched.  This ensures that a method
5987         search will return a MethodInfo with the correct ReflectedType for
5988         inherited methods.      
5989
5990 2002-08-20  Martin Baulig  <martin@gnome.org>
5991
5992         * decl.cs (DeclSpace.FindMembers): Made this public.
5993
5994 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
5995
5996         * delegate.cs: fixed build on windows.
5997         [FIXME:  Filed as bug #29150: MCS must report these errors.]
5998
5999 2002-08-19  Ravi Pratap  <ravi@ximian.com>
6000
6001         * ecore.cs (StandardConversionExists): Return a false
6002         if we are trying to convert the void type to anything else
6003         since that is not allowed.
6004
6005         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
6006         we flag error 70 in the event an event is trying to be accessed
6007         directly from outside the declaring type.
6008
6009 2002-08-20  Martin Baulig  <martin@gnome.org>
6010
6011         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
6012         MemberCache from typemanager.cs to decl.cs.
6013
6014 2002-08-19  Martin Baulig  <martin@gnome.org>
6015
6016         * class.cs (TypeContainer): Implement IMemberContainer.
6017         (TypeContainer.DefineMembers): Create the MemberCache.
6018         (TypeContainer.FindMembers): Do better BindingFlags checking; only
6019         return public members if BindingFlags.Public was given, check
6020         whether members are static.
6021
6022 2002-08-16  Martin Baulig  <martin@gnome.org>
6023
6024         * decl.cs (DeclSpace.Define): Splitted this in Define and
6025         DefineMembers.  DefineMembers is called first and initializes the
6026         MemberCache.
6027
6028         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
6029         DefineMembers() on all our DeclSpaces.
6030
6031         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
6032         but call DefineMembers() on all nested interfaces.  We call their
6033         Define() in our new Define() function.
6034
6035         * interface.cs (Interface): Implement IMemberContainer.
6036         (Interface.Define): Moved all code except the attribute stuf to
6037         DefineMembers().
6038         (Interface.DefineMembers): Initialize the member cache.
6039
6040         * typemanager.cs (IMemberFinder): Removed this interface, we don't
6041         need this anymore since we can use MemberCache.FindMembers directly.
6042
6043 2002-08-19  Martin Baulig  <martin@gnome.org>
6044
6045         * typemanager.cs (MemberCache): When creating the cache for an
6046         interface type, add all inherited members.
6047         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
6048         to `out bool used_cache' and documented it.
6049         (TypeManager.MemberLookup): If we already used the cache in the first
6050         iteration, we don't need to do the interfaces check.
6051
6052 2002-08-19  Martin Baulig  <martin@gnome.org>
6053
6054         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
6055         here from IMemberFinder and don't implement this interface anymore.
6056         (DeclSpace.MemberCache): Moved here from IMemberFinder.
6057
6058         * typemanager.cs (IMemberFinder): This interface is now only used by
6059         classes which actually support the member cache.
6060         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
6061         since we only put DeclSpaces into this Hashtable.
6062         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
6063         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
6064
6065 2002-08-16  Martin Baulig  <martin@gnome.org>
6066
6067         * typemanager.cs (ICachingMemberFinder): Removed.
6068         (IMemberFinder.MemberCache): New property.
6069         (TypeManager.FindMembers): Merged this with RealFindMembers().
6070         This function will never be called from TypeManager.MemberLookup()
6071         so we can't use the cache here, just the IMemberFinder.
6072         (TypeManager.MemberLookup_FindMembers): Check whether the
6073         IMemberFinder has a MemberCache and call the cache's FindMembers
6074         function.
6075         (MemberCache): Rewrote larger parts of this yet another time and
6076         cleaned it up a bit.
6077
6078 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
6079
6080         * driver.cs (LoadArgs): Support quoting.
6081
6082         (Usage): Show the CSC-like command line arguments.
6083
6084         Improved a few error messages.
6085
6086 2002-08-15  Martin Baulig  <martin@gnome.org>
6087
6088         * typemanager.cs (IMemberContainer.Type): New property.
6089         (IMemberContainer.IsInterface): New property.
6090
6091         The following changes are conditional to BROKEN_RUNTIME, which is
6092         defined at the top of the file.
6093
6094         * typemanager.cs (MemberCache.MemberCache): Don't add the base
6095         class'es members, but add all members from TypeHandle.ObjectType
6096         if we're an interface.
6097         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
6098         is the current type.
6099         (MemberCache.CacheEntry.Container): Removed this field.
6100         (TypeHandle.GetMembers): Include inherited members.
6101
6102 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6103
6104         * typemanager.cs: fixed compilation and added a comment on a field that
6105         is never used.
6106
6107 2002-08-15  Martin Baulig  <martin@gnome.org>
6108
6109         * class.cs (ConstructorInitializer.Resolve): In the
6110         Expression.MemberLookup call, use the queried_type as
6111         invocation_type.
6112
6113         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
6114         declared' attribute, it's always true.
6115         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
6116         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
6117         temporary wrapper for FindMembers which tells MemberLookup whether
6118         members from the base classes are included in the return value.
6119         This will go away soon.
6120         (TypeManager.MemberLookup): Use this temporary hack here; once the
6121         new MemberCache is completed, we don't need to do the DeclaredOnly
6122         looping here anymore since the MemberCache will take care of this.
6123         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
6124         (MemberCache): When creating the MemberCache for a class, get
6125         members from the current class and all its base classes.
6126         (MemberCache.CacheEntry.Container): New field.  This is a
6127         temporary hack until the Mono runtime is fixed to distinguish
6128         between ReflectedType and DeclaringType.  It allows us to use MCS
6129         with both the MS runtime and the unfixed Mono runtime without
6130         problems and without accecting performance.
6131         (MemberCache.SearchMembers): The DeclaredOnly looping from
6132         TypeManager.MemberLookup is now done here.      
6133
6134 2002-08-14  Martin Baulig  <martin@gnome.org>
6135
6136         * statement.cs (MyStructInfo.MyStructInfo): Don't call
6137         Type.GetFields on dynamic types but get the fields from the
6138         corresponding TypeContainer.
6139         (MyStructInfo.GetStructInfo): Added check for enum types.
6140
6141         * typemanager.cs (MemberList.IsSynchronized): Implemented.
6142         (MemberList.SyncRoot): Implemented.
6143         (TypeManager.FilterWithClosure): No need to check permissions if
6144         closure_start_type == closure_invocation_type, don't crash if
6145         closure_invocation_type is null.
6146
6147 2002-08-13  Martin Baulig  <martin@gnome.org>
6148
6149         Rewrote TypeContainer.FindMembers to use a member cache.  This
6150         gives us a speed increase of about 35% for the self-hosting MCS
6151         build and of about 15-20% for the class libs (both on GNU/Linux).
6152
6153         * report.cs (Timer): New class to get enhanced profiling.  This
6154         whole class is "TIMER" conditional since it remarkably slows down
6155         compilation speed.
6156
6157         * class.cs (MemberList): New class.  This is an IList wrapper
6158         which we're now using instead of passing MemberInfo[]'s around to
6159         avoid copying this array unnecessarily.
6160         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
6161         (ICachingMemberFinder, IMemberContainer): New interface.
6162         (TypeManager.FilterWithClosure): If `criteria' is null, the name
6163         has already been checked, otherwise use it for the name comparision.
6164         (TypeManager.FindMembers): Renamed to RealMemberFinder and
6165         provided wrapper which tries to use ICachingMemberFinder.FindMembers
6166         if possible.  Returns a MemberList, not a MemberInfo [].
6167         (TypeHandle): New class, implements IMemberContainer.  We create
6168         one instance of this class per type, it contains a MemberCache
6169         which is used to do the member lookups.
6170         (MemberCache): New class.  Each instance of this class contains
6171         all members of a type and a name-based hash table.
6172         (MemberCache.FindMembers): This is our new member lookup
6173         function.  First, it looks up all members of the requested name in
6174         the hash table.  Then, it walks this list and sorts out all
6175         applicable members and returns them.
6176
6177 2002-08-13  Martin Baulig  <martin@gnome.org>
6178
6179         In addition to a nice code cleanup, this gives us a performance
6180         increase of about 1.4% on GNU/Linux - not much, but it's already
6181         half a second for the self-hosting MCS compilation.
6182
6183         * typemanager.cs (IMemberFinder): New interface.  It is used by
6184         TypeManager.FindMembers to call FindMembers on a TypeContainer,
6185         Enum, Delegate or Interface.
6186         (TypeManager.finder_to_member_finder): New PtrHashtable.
6187         (TypeManager.finder_to_container): Removed.
6188         (TypeManager.finder_to_delegate): Removed.
6189         (TypeManager.finder_to_interface): Removed.
6190         (TypeManager.finder_to_enum): Removed.
6191
6192         * interface.cs (Interface): Implement IMemberFinder.
6193
6194         * delegate.cs (Delegate): Implement IMemberFinder.
6195
6196         * enum.cs (Enum): Implement IMemberFinder.
6197
6198         * class.cs (TypeContainer): Implement IMemberFinder.
6199
6200 2002-08-12  Martin Baulig  <martin@gnome.org>
6201
6202         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
6203
6204 2002-08-12  Martin Baulig  <martin@gnome.org>
6205
6206         * ecore.cs (ITypeExpression): New interface for expressions which
6207         resolve to a type.
6208         (TypeExpression): Renamed to TypeLookupExpression.
6209         (Expression.DoResolve): If we're doing a types-only lookup, the
6210         expression must implement the ITypeExpression interface and we
6211         call DoResolveType() on it.
6212         (SimpleName): Implement the new ITypeExpression interface.
6213         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
6214         hack, the situation that we're only looking up types can't happen
6215         anymore when this method is called.  Moved the type lookup code to
6216         DoResolveType() and call it.
6217         (SimpleName.DoResolveType): This ITypeExpression interface method
6218         is now doing the types-only lookup.
6219         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
6220         (ResolveFlags): Added MaskExprClass.
6221
6222         * expression.cs (MemberAccess): Implement the ITypeExpression
6223         interface.
6224         (MemberAccess.DoResolve): Added support for a types-only lookup
6225         when we're called via ITypeExpression.DoResolveType().
6226         (ComposedCast): Implement the ITypeExpression interface.
6227
6228         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
6229         Expression.Resolve() with ResolveFlags.Type instead.
6230
6231 2002-08-12  Martin Baulig  <martin@gnome.org>
6232
6233         * interface.cs (Interface.Define): Apply attributes.
6234
6235         * attribute.cs (Attribute.ApplyAttributes): Added support for
6236         interface attributes.
6237
6238 2002-08-11  Martin Baulig  <martin@gnome.org>
6239
6240         * statement.cs (Block.Emit): Only check the "this" variable if we
6241         do not always throw an exception.
6242
6243         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
6244         whether the property has a set accessor.
6245
6246 2002-08-11  Martin Baulig  <martin@gnome.org>
6247
6248         Added control flow analysis support for structs.
6249
6250         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
6251         with control flow analysis turned off.
6252         (IVariable): New interface.
6253         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
6254         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
6255         (FieldExpr.DoResolve): Resolve the instance expression with flow
6256         analysis turned off and do the definite assignment check after the
6257         resolving when we know what the expression will resolve to.
6258
6259         * expression.cs (LocalVariableReference, ParameterReference):
6260         Implement the new IVariable interface, only call the flow analysis
6261         code if ec.DoFlowAnalysis is true.
6262         (This): Added constructor which takes a Block argument.  Implement
6263         the new IVariable interface.
6264         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
6265         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
6266         This does the definite assignment checks for struct members.
6267
6268         * class.cs (Constructor.Emit): If this is a non-static `struct'
6269         constructor which doesn't have any initializer, call
6270         Block.AddThisVariable() to tell the flow analysis code that all
6271         struct elements must be initialized before control returns from
6272         the constructor.
6273
6274         * statement.cs (MyStructInfo): New public class.
6275         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
6276         argument to this indexer.  If non-zero, check an individual struct
6277         member, not the whole struct.
6278         (FlowBranching.CheckOutParameters): Check struct members.
6279         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
6280         overloaded versions of these methods which take an additional
6281         `int field_idx' argument to check struct members.
6282         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
6283         overloaded versions of these methods which take an additional
6284         `string field_name' argument to check struct member.s
6285         (VariableInfo): Implement the IVariable interface.
6286         (VariableInfo.StructInfo): New public property.  Returns the
6287         MyStructInfo instance of the variable if it's a struct or null.
6288         (Block.AddThisVariable): New public method.  This is called from
6289         Constructor.Emit() for non-static `struct' constructor which do
6290         not have any initializer.  It creates a special variable for the
6291         "this" instance variable which will be checked by the flow
6292         analysis code to ensure that all of the struct's fields are
6293         initialized before control returns from the constructor.
6294         (UsageVector): Added support for struct members.  If a
6295         variable/parameter is a struct with N members, we reserve a slot
6296         in the usage vector for each member.  A struct is considered fully
6297         initialized if either the struct itself (slot 0) or all its
6298         members are initialized.
6299
6300 2002-08-08  Martin Baulig  <martin@gnome.org>
6301
6302         * driver.cs (Driver.MainDriver): Only report an error CS5001
6303         if there were no compilation errors.
6304
6305         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
6306         `UnsafeContext' property to determine whether the parent is in
6307         unsafe context rather than checking the parent's ModFlags:
6308         classes nested in an unsafe class are unsafe as well.
6309
6310 2002-08-08  Martin Baulig  <martin@gnome.org>
6311
6312         * statement.cs (UsageVector.MergeChildren): Distinguish between
6313         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
6314         we return.  Added test17() and test18() to test-154.cs.
6315
6316 2002-08-08  Martin Baulig  <martin@gnome.org>
6317
6318         * typemanager.cs (TypeManager.FilterWithClosure): If we have
6319         Family access, make sure the invoking type isn't a subclass of the
6320         queried type (that'd be a CS1540).
6321
6322         * ecore.cs (Expression.MemberLookup): Added overloaded version of
6323         this method which takes an additional `Type invocation_type'.
6324
6325         * expression.cs (BaseAccess.DoResolve): Use the base type as
6326         invocation and query type.
6327         (MemberAccess.DoResolve): If the lookup failed and we're about to
6328         report a CS0122, try a lookup with the ec.ContainerType - if this
6329         succeeds, we must report a CS1540.
6330
6331 2002-08-08  Martin Baulig  <martin@gnome.org>
6332
6333         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
6334         (MethodGroupExpr): Implement the IMemberExpr interface.
6335
6336         * expression (MemberAccess.ResolveMemberAccess): No need to have
6337         any special code for MethodGroupExprs anymore, they're now
6338         IMemberExprs.   
6339
6340 2002-08-08  Martin Baulig  <martin@gnome.org>
6341
6342         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
6343         Family, FamANDAssem and FamORAssem permissions.
6344         (TypeManager.IsSubclassOrNestedChildOf): New public method.
6345
6346 2002-08-08  Martin Baulig  <martin@gnome.org>
6347
6348         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
6349         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
6350         or loop block.
6351
6352 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
6353
6354         * driver.cs: implemented /resource option to embed managed resources.
6355
6356 2002-08-07  Martin Baulig  <martin@gnome.org>
6357
6358         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
6359         (FieldBase.HasFieldInitializer): New public property.
6360         (FieldBase.GetInitializerExpression): New public method.  Resolves and
6361         returns the field initializer and makes sure it is only resolved once.
6362         (TypeContainer.EmitFieldInitializers): Call
6363         FieldBase.GetInitializerExpression to get the initializer, this ensures
6364         that it isn't resolved multiple times.
6365
6366         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
6367         the resolving process (SimpleName/MemberLookup) that we're currently
6368         emitting a field initializer (which must not access any instance members,
6369         this is an error CS0236).
6370
6371         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
6372         argument, if the `IsFieldInitializer' flag is set, we must report and
6373         error CS0236 and not an error CS0120.   
6374
6375 2002-08-07  Martin Baulig  <martin@gnome.org>
6376
6377         * ecore.cs (IMemberExpr): New public interface.
6378         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
6379         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
6380         if the expression is an IMemberExpr.
6381
6382         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
6383         to be null, implicitly default to `this' if we're non-static in
6384         this case.  Simplified the code a lot by using the new IMemberExpr
6385         interface.  Also fixed bug #28176 here.
6386
6387 2002-08-06  Martin Baulig  <martin@gnome.org>
6388
6389         * cs-parser.jay (SimpleLookup): Removed.  We need to create
6390         ParameterReferences during semantic analysis so that we can do a
6391         type-only search when resolving Cast, TypeOf and SizeOf.
6392         (block): Pass the `current_local_parameters' to the Block's
6393         constructor.
6394
6395         * class.cs (ConstructorInitializer): Added `Parameters parameters'
6396         argument to the constructor.
6397         (ConstructorInitializer.Resolve): Create a temporary implicit
6398         block with the parameters.
6399
6400         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
6401         references here if we aren't doing a type-only search.
6402
6403         * statement.cs (Block): Added constructor which takes a
6404         `Parameters parameters' argument.
6405         (Block.Parameters): New public property.
6406
6407         * support.cs (InternalParameters.Parameters): Renamed `parameters'
6408         to `Parameters' and made it public readonly.
6409
6410 2002-08-06  Martin Baulig  <martin@gnome.org>
6411
6412         * ecore.cs (Expression.Warning): Made this public as well.
6413
6414         * report.cs (Report.Debug): Print the contents of collections.
6415
6416 2002-08-06  Martin Baulig  <martin@gnome.org>
6417
6418         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
6419         used to tell Resolve() which kinds of expressions it may return.
6420         (Expression.Resolve): Added overloaded version of this method which
6421         takes a `ResolveFlags flags' argument.  This can be used to tell
6422         Resolve() which kinds of expressions it may return.  Reports a
6423         CS0118 on error.
6424         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
6425         ResolveFlags.SimpleName.
6426         (Expression.Error118): Added overloaded version of this method which
6427         takes a `ResolveFlags flags' argument.  It uses the flags to determine
6428         which kinds of expressions are allowed.
6429
6430         * expression.cs (Argument.ResolveMethodGroup): New public method.
6431         Resolves an argument, but allows a MethodGroup to be returned.
6432         This is used when invoking a delegate.
6433
6434         * TODO: Updated a bit.
6435
6436 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6437
6438         Fixed compilation with csc.
6439
6440         * ecore.cs: Expression.Error made public. Is this correct? Should
6441         Warning be made public too?
6442
6443         * expression.cs: use ea.Location instead of ea.loc.
6444         [FIXME:  Filed as bug #28607: MCS must report these errors.]
6445
6446 2002-08-06  Martin Baulig  <martin@gnome.org>
6447
6448         * ecore.cs (Expression.loc): Moved the location here instead of
6449         duplicating it in all derived classes.
6450         (Expression.Location): New public property.
6451         (Expression.Error, Expression.Warning): Made them non-static and
6452         removed the location argument.
6453         (Expression.Warning): Added overloaded version which takes an
6454         `int level' argument.
6455         (Expression.Error118): Make this non-static and removed the
6456         expression and location arguments.
6457         (TypeExpr): Added location argument to the constructor.
6458
6459         * expression.cs (StaticCallExpr): Added location argument to
6460         the constructor.
6461         (Indirection, PointerArithmetic): Likewise.
6462         (CheckedExpr, UnCheckedExpr): Likewise.
6463         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
6464         (StringPtr): Likewise.
6465
6466
6467 2002-08-05  Martin Baulig  <martin@gnome.org>
6468
6469         * expression.cs (BaseAccess.DoResolve): Actually report errors.
6470
6471         * assign.cs (Assign.DoResolve): Check whether the source
6472         expression is a value or variable.
6473
6474         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
6475         while resolving the corresponding blocks.
6476
6477         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
6478         an error, don't silently return null.
6479
6480         * statement.cs (Block.AddVariable): Do the error reporting here
6481         and distinguish between CS0128 and CS0136.
6482         (Block.DoResolve): Report all unused labels (warning CS0164).
6483         (LabeledStatement): Pass the location to the constructor.
6484         (LabeledStatement.HasBeenReferenced): New property.
6485         (LabeledStatement.Resolve): Set it to true here.
6486
6487         * statement.cs (Return.Emit): Return success even after reporting
6488         a type mismatch error (CS0126 or CS0127), this is what csc does and
6489         it avoids confusing the users with any consecutive errors.
6490
6491 2002-08-05  Martin Baulig  <martin@gnome.org>
6492
6493         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
6494
6495         * const.cs (Const.LookupConstantValue): Catch circular definitions.
6496
6497         * expression.cs (MemberAccess.DoResolve): Silently return if an
6498         error has already been reported.
6499
6500         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
6501         error has already been reported.
6502
6503 2002-08-05  Martin Baulig  <martin@gnome.org>
6504
6505         * statement.cs (UsageVector): Only initialize the `parameters'
6506         vector if we actually have any "out" parameters.
6507
6508 2002-08-05  Martin Baulig  <martin@gnome.org>
6509
6510         * expression.cs (Binary.ResolveOperator): When combining delegates,
6511         they must have the same type.
6512
6513 2002-08-05  Martin Baulig  <martin@gnome.org>
6514
6515         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
6516         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
6517         work with the ms runtime and we also don't need it: if we're a
6518         PropertyBuilder and not in the `indexer_arguments' hash, then we
6519         are a property and not an indexer.
6520
6521         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
6522         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
6523         since the latter one doesn't work with the ms runtime.
6524
6525 2002-08-03  Martin Baulig  <martin@gnome.org>
6526
6527         Fixed bugs #27998 and #22735.
6528
6529         * class.cs (Method.IsOperator): New public field.
6530         (Method.CheckBase): Report CS0111 if there's already a method
6531         with the same parameters in the current class.  Report CS0508 when
6532         attempting to change the return type of an inherited method.
6533         (MethodData.Emit): Report CS0179 if a method doesn't have a body
6534         and it's not marked abstract or extern.
6535         (PropertyBase): New abstract base class for Property and Indexer.
6536         (PropertyBase.CheckBase): Moved here from Property and made it work
6537         for indexers.
6538         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
6539         the same so we can reuse it there.
6540         (Property, Indexer): Derive from PropertyBase.
6541         (MethodSignature.inheritable_property_signature_filter): New delegate
6542         to find properties and indexers.
6543
6544         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
6545         argument and improved error reporting.
6546
6547         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
6548         EmptyReadOnlyParameters and made it a property.
6549
6550         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
6551         version of this method which takes a `PropertyInfo indexer'.
6552         (TypeManager.RegisterIndexer): New method.
6553
6554         * class.cs: Added myself as author of this file :-)
6555
6556 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6557
6558         * class.cs: fixed compilation on windoze.
6559
6560 2002-08-03  Martin Baulig  <martin@gnome.org>
6561
6562         * interface.cs (Interface.GetInterfaceBases): Check whether all
6563         base interfaces are at least as accessible than the current one.
6564
6565         * class.cs (TypeContainer.GetClassBases): Check whether base types
6566         are at least as accessible than the current type.
6567         (TypeContainer.AsAccessible): Implemented and made non-static.
6568         (MemberBase.CheckParameters): Report errors if the accessibility
6569         checks fail.
6570
6571         * delegate.cs (Delegate.Delegate): The default visibility is
6572         internal for top-level types and private for nested types.
6573         (Delegate.Define): Report errors if the accessibility checks fail.
6574
6575         * enum.cs (Enum.Enum): The default visibility is internal for
6576         top-level types and private for nested types.
6577         (Enum.DefineType): Compute the correct visibility.
6578
6579         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
6580         function which takes a `bool is_toplevel' instead of a TypeContainer.
6581
6582         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
6583         builtin type.
6584
6585 2002-08-02  Martin Baulig  <martin@gnome.org>
6586
6587         * expression.cs (LocalVariableReferenc): Added constructor which
6588         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
6589         (LocalVariableReference.IsReadOnly): New property.
6590         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
6591         variable is readonly, use our own readonly flag to do this; you can
6592         use the new constructor to get a writable reference to a read-only
6593         variable.
6594
6595         * cs-parser.jay (foreach_statement, using_statement): Get a writable
6596         reference to the local variable.
6597
6598 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
6599
6600         * rootcontext.cs (ResolveCore): Also include System.Exception
6601
6602         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
6603         we reach an EmptyStatement.
6604
6605         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
6606         is also fine.
6607
6608         * expression.cs (Binary.ResolveOperator): Check error result in
6609         two places.
6610
6611         use brtrue/brfalse directly and avoid compares to null.
6612
6613 2002-08-02  Martin Baulig  <martin@gnome.org>
6614
6615         * class.cs (TypeContainer.Define): Define all nested interfaces here.
6616         Fixes bug #28407, added test-155.cs.
6617
6618 2002-08-01  Martin Baulig  <martin@gnome.org>
6619
6620         * class.cs (Event.EmitDefaultMethod): Make this work with static
6621         events.  Fixes #28311, added verify-3.cs.
6622
6623 2002-08-01  Martin Baulig  <martin@gnome.org>
6624
6625         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
6626         `is_disposable' fields.
6627         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
6628         `hm.is_disposable' if we're using the collection pattern.
6629         (Foreach.EmitCollectionForeach): Use the correct type for the
6630         enumerator's local variable, only emit the try/finally block if
6631         necessary (fixes #27713).
6632
6633 2002-08-01  Martin Baulig  <martin@gnome.org>
6634
6635         * ecore.cs (Expression.report118): Renamed to Error118 and made
6636         it public static.
6637
6638         * statement.cs (Throw.Resolve): Check whether the expression is of
6639         the correct type (CS0118) and whether the type derives from
6640         System.Exception (CS0155).
6641         (Catch.Resolve): New method.  Do the type lookup here and check
6642         whether it derives from System.Exception (CS0155).
6643         (Catch.CatchType, Catch.IsGeneral): New public properties.
6644
6645         * typemanager.cs (TypeManager.exception_type): Added.
6646
6647 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
6648
6649         * driver.cs: Updated About function.
6650
6651 2002-07-31  Martin Baulig  <martin@gnome.org>
6652
6653         Implemented Control Flow Analysis.
6654
6655         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
6656         (EmitContext.CurrentBranching): Added.
6657         (EmitContext.StartFlowBranching): Added.
6658         (EmitContext.EndFlowBranching): Added.
6659         (EmitContext.KillFlowBranching): Added.
6660         (EmitContext.IsVariableAssigned): Added.
6661         (EmitContext.SetVariableAssigned): Added.
6662         (EmitContext.IsParameterAssigned): Added.
6663         (EmitContext.SetParameterAssigned): Added.
6664         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
6665         Added control flow analysis stuff here.
6666
6667         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
6668         resolve the expression as lvalue.
6669         (LocalVariableReference.DoResolve): Check whether the variable has
6670         already been assigned.
6671         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
6672         the parameter as assigned here.
6673         (ParameterReference.DoResolve): Check whether the parameter has already
6674         been assigned.
6675         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
6676         expression as lvalue.
6677
6678         * statement.cs (FlowBranching): New class for the flow analysis code.
6679         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
6680         (LabeledStatement.IsDefined): New public property.
6681         (LabeledStatement.AddUsageVector): New public method to tell flow
6682         analyis that the label may be reached via a forward jump.
6683         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
6684         flow analysis.
6685         (VariableInfo.Number): New public field.  This is used by flow analysis
6686         to number all locals of a block.
6687         (Block.CountVariables): New public property.  This is the number of
6688         local variables in this block (including the locals from all parent
6689         blocks).
6690         (Block.EmitMeta): Number all the variables.
6691
6692         * statement.cs: Added flow analysis support to all classes.
6693
6694 2002-07-31  Martin Baulig  <martin@gnome.org>
6695
6696         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
6697         To get debugging messages, compile mcs with /define:MCS_DEBUG and
6698         then use this argument.
6699
6700         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
6701
6702         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
6703         use this to specify /define options.
6704
6705 2002-07-29  Martin Baulig  <martin@gnome.org>
6706
6707         * statement.cs (Fixed): Moved all code that does variable lookups
6708         and resolvings from Emit to Resolve.
6709
6710         * statement.cs (For): Moved all code that does variable lookups
6711         and resolvings from Emit to Resolve.
6712
6713         * statement.cs (Using): Moved all code that does variable lookups
6714         and resolvings from Emit to Resolve.
6715
6716 2002-07-29  Martin Baulig  <martin@gnome.org>
6717
6718         * attribute.cs (Attribute.Resolve): Explicitly catch a
6719         System.NullReferenceException when creating the
6720         CustromAttributeBuilder and report a different warning message.
6721
6722 2002-07-29  Martin Baulig  <martin@gnome.org>
6723
6724         * support.cs (ParameterData.ParameterName): Added method to
6725         get the name of a parameter.
6726
6727         * typemanager.cs (TypeManager.IsValueType): New public method.
6728
6729 2002-07-29  Martin Baulig  <martin@gnome.org>
6730
6731         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
6732         is a flag which specifies that it's either ref or out.
6733         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
6734         the out parameter to `out Parameter.Modifier mod', also set the
6735         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
6736
6737         * support.cs (InternalParameters.ParameterModifier): Distinguish
6738         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
6739         Parameter.Modifier.ISBYREF flag if it's either ref or out.
6740
6741         * expression.cs (Argument.GetParameterModifier): Distinguish
6742         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
6743         Parameter.Modifier.ISBYREF flag if it's either ref or out.
6744
6745 2002-07-29  Martin Baulig  <martin@gnome.org>
6746
6747         * expression.cs (ParameterReference.ParameterReference): Added
6748         `Location loc' argument to the constructor.
6749
6750         * cs-parser.jay: Pass location to ParameterReference.
6751
6752 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
6753
6754         * statement.cs (Try): Initialize the location.
6755
6756         * cs-parser.jay: pass location to Try.
6757
6758         * expression.cs (Unary.Reduce): Change the prototype to return
6759         whether a constant fold could be performed or not.  The result is
6760         returned in an out parameters.  In the case of Indirection and
6761         AddressOf, we want to perform the full tests.
6762
6763 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
6764
6765         * statement.cs (Statement.Emit): Flag dead code.
6766
6767 2002-07-27  Andrew Birkett  <andy@nobugs.org>
6768
6769         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
6770
6771 2002-07-27  Martin Baulig  <martin@gnome.org>
6772
6773         * class.cs (MethodData.Define): Put back call to
6774         TypeManager.AddMethod(), accidentally commented this out.
6775
6776         * report.cs (Debug): New public method to print debugging information,
6777         this is `[Conditional ("DEBUG")]'.
6778
6779 2002-07-26  Martin Baulig  <martin@gnome.org>
6780
6781         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
6782         (switch_statement): Push the current_block to the switch_stack and
6783         pop it again when we're done with the switch.
6784         (switch_section): The new block is a child of the current_block.
6785         Fixes bug #24007, added test-152.cs.
6786
6787 2002-07-27  Martin Baulig  <martin@gnome.org>
6788
6789         * expression.cs (Invocation.EmitArguments): When calling a varargs
6790         function with only its fixed arguments, we need to pass an empty
6791         array.
6792
6793 2002-07-27  Martin Baulig  <martin@gnome.org>
6794
6795         Mono 0.13 has been released.
6796
6797 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
6798
6799         * driver.cs: Rename --resource to --linkres, because that is what
6800         we do currently, we dont support --resource yet.
6801
6802         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
6803
6804 2002-07-25  Martin Baulig  <martin@gnome.org>
6805
6806         * class.cs (MethodData): New public class.  This is a `method builder'
6807         class for a method or one accessor of a Property/Indexer/Event.
6808         (MethodData.GetMethodFlags): Moved here from MemberBase.
6809         (MethodData.ApplyAttributes): Likewise.
6810         (MethodData.ApplyObsoleteAttribute): Likewise.
6811         (MethodData.ApplyConditionalAttribute): Likewise.
6812         (MethodData.ApplyDllImportAttribute): Likewise.
6813         (MethodData.CheckAbstractAndExternal): Likewise.
6814         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
6815         (MethodData.Emit): Formerly known as Method.Emit().
6816         (MemberBase): Moved everything which was specific to a single
6817         accessor/method to MethodData.
6818         (Method): Create a new MethodData and call Define() and Emit() on it.
6819         (Property, Indexer, Event): Create a new MethodData objects for each
6820         accessor and call Define() and Emit() on them.
6821
6822 2002-07-25  Martin Baulig  <martin@gnome.org>
6823
6824         Made MethodCore derive from MemberBase to reuse the code from there.
6825         MemberBase now also checks for attributes.
6826
6827         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
6828         (MemberBase.GetMethodFlags): Moved here from class Method and marked
6829         as virtual.
6830         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
6831         `CallingConventions cc' and `Attributes opt_attrs' arguments.
6832         (MemberBase.ApplyAttributes): New virtual method; applies the
6833         attributes to a method or accessor.
6834         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
6835         (MemberBase.ApplyConditionalAttribute): Likewise.
6836         (MemberBase.ApplyDllImportAttribute): Likewise.
6837         (MemberBase.CheckAbstractAndExternal): Likewise.
6838         (MethodCore.ParameterTypes): This is now a property instead of a
6839         method, it's initialized from DoDefineParameters().
6840         (MethodCore.ParameterInfo): Removed the set accessor.
6841         (MethodCore.DoDefineParameters): New protected virtual method to
6842         initialize ParameterTypes and ParameterInfo.
6843         (Method.GetReturnType): We can now simply return the MemberType.
6844         (Method.GetMethodFlags): Override the MemberBase version and add
6845         the conditional flags.
6846         (Method.CheckBase): Moved some code from Define() here, call
6847         DoDefineParameters() here.
6848         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
6849         here to avoid some larger code duplication.
6850         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
6851         ensure that abstract and external accessors don't declare a body.
6852
6853         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
6854         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
6855         lookup in the attribute's parent classes, so we need to abort as soon
6856         as we found the first match.
6857         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
6858         the attribute has no arguments.
6859
6860         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
6861         of a Method.
6862
6863 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6864
6865         * cs-parser.jay: reverted previous patch.
6866
6867 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6868
6869         * cs-parser.jay: fixed bug #22119.
6870
6871 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6872
6873         * attribute.cs: fixed compilation. The error was:
6874         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
6875         be assigned to before control leaves the current method."
6876         [FIXME:  Filed as bug #28186: MCS must report this error.]
6877
6878 2002-07-25  Martin Baulig  <martin@gnome.org>
6879
6880         * attribute.cs (Attribute.Conditional_GetConditionName): New static
6881         method to pull the condition name ouf of a Conditional attribute.
6882         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
6883         the obsolete message and error flag out of an Obsolete attribute.
6884
6885         * class.cs (Method.GetMethodFlags): New public method to get the
6886         TypeManager.MethodFlags for this method.
6887         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
6888         private methods.
6889         (Method.Define): Get and apply the Obsolete and Conditional attributes;
6890         if we're overriding a virtual function, set the new private variable
6891         `parent_method'; call the new TypeManager.AddMethod().
6892
6893         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
6894         the MethodBuilder and the Method in a PtrHashtable.
6895         (TypeManager.builder_to_method): Added for this purpose.
6896         (TypeManager.MethodFlags): Added IsObsoleteError.
6897         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
6898         Obsolete and Conditional arguments in MethodBuilders.  If we discover
6899         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
6900         the message from the attribute.
6901
6902 2002-07-24  Martin Baulig  <martin@gnome.org>
6903
6904         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
6905         preprocessor directives, ensure that the argument to #define/#undef is
6906         exactly one identifier and that it's actually an identifier.
6907
6908         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
6909         did not work ....
6910
6911 2002-07-24  Martin Baulig  <martin@gnome.org>
6912
6913         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
6914         initialize it to TypeManager.object_type in the constructor.
6915         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
6916         of the `hm.get_current' method if we're using the collection pattern.
6917         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
6918         for the explicit conversion to make it work when we're using the collection
6919         pattern and the `Current' property has a different return type than `object'.
6920         Fixes #27713.
6921
6922 2002-07-24  Martin Baulig  <martin@gnome.org>
6923
6924         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
6925         does not match, but don't report any errors.  This method is called in
6926         order for all methods in a MethodGroupExpr until a matching method is
6927         found, so we don't want to bail out if the first method doesn't match.
6928         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
6929         matches, report the 123.  Fixes #28070.
6930
6931 2002-07-24  Martin Baulig  <martin@gnome.org>
6932
6933         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
6934         TypeManager.TypeToCoreType() to the top of the method so the
6935         following equality checks will work.  Fixes #28107.
6936
6937 2002-07-24  Martin Baulig  <martin@gnome.org>
6938
6939         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
6940         operand is of type uint, and the other operand is of type sbyte,
6941         short or int, the operands are converted to type long." -
6942         Actually do what this comment already told us.  Fixes bug #28106,
6943         added test-150.cs.
6944
6945 2002-07-24  Martin Baulig  <martin@gnome.org>
6946
6947         * class.cs (MethodBase): New abstract class.  This is now a base
6948         class for Property, Indexer and Event to avoid some code duplication
6949         in their Define() and DefineMethods() methods.
6950         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
6951         generic methods for Define() and DefineMethods().
6952         (FieldBase): Derive from MemberBase, not MemberCore.
6953         (Property): Derive from MemberBase, not MemberCore.
6954         (Property.DefineMethod): Moved all the code from this method to the
6955         new MethodBase.DefineAccessor(), just call it with appropriate
6956         argumetnts.
6957         (Property.Define): Call the new Property.DoDefine(), this does some
6958         sanity checks and we don't need to duplicate the code everywhere.
6959         (Event): Derive from MemberBase, not MemberCore.
6960         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
6961         accessors, this will also make them work with interface events.
6962         (Indexer): Derive from MemberBase, not MemberCore.
6963         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
6964         (Indexer.Define): Use the new MethodBase functions.
6965
6966         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
6967         argument to the constructor.
6968         (Interface.FindMembers): Added support for interface events.
6969         (Interface.PopluateEvent): Implemented.
6970
6971         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
6972
6973 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
6974
6975         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
6976         but this is required to check for a method name being the same as
6977         the containing class.  
6978
6979         Handle this now.
6980
6981 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
6982
6983         * interface.cs: initialize variable.
6984
6985 2002-07-23  Martin Baulig  <martin@gnome.org>
6986
6987         Implemented the IndexerName attribute in interfaces.
6988
6989         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
6990         name if this is an explicit interface implementation.
6991         (Indexer.InterfaceIndexerName): New public variable.  If we're
6992         implementing an interface indexer, this is the IndexerName in that
6993         interface.  Otherwise, it's the IndexerName.
6994         (Indexer.DefineMethod): If we're implementing interface indexer,
6995         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
6996         and Pending.ImplementIndexer methods.
6997         (Indexer.Define): Also define the PropertyBuilder if we're
6998         implementing an interface indexer and this is neither an explicit
6999         interface implementation nor do the IndexerName match the one in
7000         the interface.
7001
7002         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
7003         If a method is defined here, then we always need to create a proxy
7004         for it.  This is used when implementing interface indexers.
7005         (Pending.IsInterfaceIndexer): New public method.
7006         (Pending.ImplementIndexer): New public method.
7007         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
7008         This is used when implementing interface indexers to define a proxy
7009         if necessary.
7010         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
7011         define a proxy if necessary.
7012
7013         * interface.cs (Interface.IndexerName): New public variable.
7014         (Interface.PopulateIndexer): Set the IndexerName.
7015         (Interface.DefineIndexers): New private method.  Populate all the
7016         indexers and make sure their IndexerNames match.
7017
7018         * typemanager.cs (IndexerPropertyName): Added support for interface
7019         indexers.
7020
7021 2002-07-22  Martin Baulig  <martin@gnome.org>
7022
7023         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
7024         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
7025         ret if HasReturnLabel.
7026         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
7027         variables.
7028
7029         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
7030         and set the ec.LoopBeginTryCatchLevel.
7031         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
7032         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
7033         the current ec.TryCatchLevel, the branch goes out of an exception
7034         block.  In this case, we need to use Leave and not Br.
7035
7036 2002-07-22  Martin Baulig  <martin@gnome.org>
7037
7038         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
7039         block unless the block does not always return or it is contained in
7040         another try { ... } catch { ... } block.  Fixes bug #26506.
7041         Added verify-1.cs to the test suite.
7042
7043 2002-07-22  Martin Baulig  <martin@gnome.org>
7044
7045         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
7046         then we do not always return.  Fixes bug #24985.
7047
7048 2002-07-22  Martin Baulig  <martin@gnome.org>
7049
7050         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
7051         lookup on a per-class level; ie. walk up the class hierarchy until we
7052         found at least one applicable method, then choose the best among them.
7053         Fixes bug #24463 and test-29.cs.
7054
7055 2002-07-22  Martin Baulig  <martin@gnome.org>
7056
7057         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
7058         return types of the methods.  The return type is not part of the
7059         signature and we must not check it to make the `new' modifier work.
7060         Fixes bug #27999, also added test-147.cs.
7061         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
7062
7063         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
7064         on the method's return type.
7065
7066 2002-07-21  Martin Baulig  <martin@gnome.org>
7067
7068         * assign.cs: Make this work if the rightmost source is a constant and
7069         we need to do an implicit type conversion.  Also adding a few more tests
7070         to test-38.cs which should have caught this.
7071
7072         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
7073         target in the makefile for this.  The makefile.gnu is primarily intended
7074         for end-users who don't want to debug the compiler.
7075
7076 2002-07-21  Martin Baulig  <martin@gnome.org>
7077
7078         * assign.cs: Improved the Assign class so it can now handle embedded
7079         assignments (X = Y = Z = something).  As a side-effect this'll now also
7080         consume less local variables.  test-38.cs now passes with MCS, added
7081         a few new test cases to that test.
7082
7083 2002-07-20  Martin Baulig  <martin@gnome.org>
7084
7085         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
7086         instructions.  Fixes bug #27977, also added test-146.cs.
7087
7088 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7089
7090         * cs-tokenizer.cs: fixed getHex ().
7091
7092 2002-07-19  Martin Baulig  <martin@gnome.org>
7093
7094         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
7095         not Type.GetType() to lookup the array type.  This is needed when
7096         we're constructing an array of a user-defined type.
7097         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
7098         single-dimensional arrays, but also for single-dimensial arrays of
7099         type decimal.
7100
7101 2002-07-19  Martin Baulig  <martin@gnome.org>
7102
7103         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
7104         this function is called, it's not allowed to share LocalBuilders
7105         among ILGenerators.
7106
7107 2002-07-19  Martin Baulig  <martin@gnome.org>
7108
7109         * expression.cs (Argument.Resolve): Report an error 118 when trying
7110         to pass a type as argument.
7111
7112 2002-07-18  Martin Baulig  <martin@gnome.org>
7113
7114         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
7115         Conv_R_Un for the signed `long' type.
7116
7117 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
7118
7119         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
7120         `expr' for the temporary result, as that will fail if we do
7121         multiple resolves on the same expression.
7122
7123 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
7124
7125         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
7126         ec.TypeContainer for looking up aliases. 
7127
7128         * class.cs (TypeContainer): Remove LookupAlias from here.
7129
7130         * decl.cs (DeclSpace); Move here.
7131
7132 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
7133
7134         * class.cs (FindMembers): Only call filter if the constructor
7135         bulider is not null.
7136
7137         Also handle delegates in `NestedTypes' now.  Now we will perform
7138         type lookups using the standard resolution process.  This also
7139         fixes a bug.
7140
7141         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
7142         This uses Expressions (the limited kind that can be parsed by the
7143         tree) instead of strings.
7144
7145         * expression.cs (ComposedCast.ToString): Implement, used to flag
7146         errors since now we have to render expressions.
7147
7148         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
7149         FormArrayType. 
7150
7151         * ecore.cs (SimpleName.ToString): ditto.
7152
7153         * cs-parser.jay: Instead of using strings to assemble types, use
7154         Expressions to assemble the type (using SimpleName, ComposedCast,
7155         MemberAccess).  This should fix the type lookups in declarations,
7156         because we were using a different code path for this.
7157
7158         * statement.cs (Block.Resolve): Continue processing statements
7159         even when there is an error.
7160
7161 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
7162
7163         * class.cs (Event.Define): Also remove the `remove' method from
7164         the list of pending items.
7165
7166         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
7167         generate more compact code. 
7168
7169 2002-07-17  Martin Baulig  <martin@gnome.org>
7170
7171         * const.cs (Const.LookupConstantValue): Add support for constant
7172         `unchecked' and `checked' expressions.
7173         Also adding test case test-140.cs for this.
7174
7175 2002-07-17  Martin Baulig  <martin@gnome.org>
7176
7177         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
7178         check whether mi.ReturnType implements the IEnumerator interface; the
7179         `==' and the IsAssignableFrom() will fail in this situation.
7180
7181 2002-07-16  Ravi Pratap  <ravi@ximian.com>
7182
7183         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
7184         here too.
7185
7186 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7187
7188         * expression.cs: fixed bug #27811.
7189
7190 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
7191
7192         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
7193         Molaro: when we are a ref, the value already contains a pointer
7194         value, do not take the address of it.
7195
7196 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
7197         * removed mb-parser.jay and mb-tokenizer.cs
7198
7199 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7200
7201         * expression.cs: check against the building corlib void type.
7202
7203 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
7204
7205         * ecore.cs: fix for valuetype static readonly fields: when 
7206         initializing them, we need their address, not the address of a copy.
7207
7208 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
7209
7210         * typemanager.cs: register also enum_type in corlib.
7211
7212 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7213
7214         * class.cs: allow calling this (but not base) initializers in structs.
7215
7216 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
7217
7218         * ecore.cs: make sure we compare against the building base types
7219         in GetTypeSize ().
7220
7221 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
7222
7223         * typemanager.cs: fix TypeToCoreType() to handle void and object
7224         (corlib gets no more typerefs after this change).
7225
7226 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
7227
7228         * expression.cs (ArrayCreation.EmitArrayArguments): use
7229         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
7230
7231         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
7232         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
7233         array indexes, the runtime actually forbids them.
7234
7235         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
7236         for array arguments here.
7237
7238         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
7239         instead of the default for ValueTypes.
7240
7241         (New.DoEmit): Use IsValueType instead of
7242         IsSubclassOf (value_type)
7243         (New.DoResolve): ditto.
7244         (Invocation.EmitCall): ditto.
7245
7246         * assign.cs (Assign): ditto.
7247
7248         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
7249         Statements *are* currently doing part of their resolution during
7250         Emit.  
7251
7252         Expressions do always resolve during resolve, but statements are
7253         only required to propagate resolution to their children.
7254
7255 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
7256
7257         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
7258
7259         (LoadAssembly): Do not add the dll if it is already specified
7260         
7261         (MainDriver): Add the System directory to the link path at the end,
7262         after all the other -L arguments. 
7263
7264         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
7265         wrong opcode for loading bytes and bools (ldelem.i1 instead of
7266         ldelem.u1) and using the opposite for sbytes.
7267
7268         This fixes Digger, and we can finally run it.
7269
7270         * driver.cs (UnixParseOption): Move the option parsing here.  
7271         (CSCParseOption): Implement CSC-like parsing of options.
7272
7273         We now support both modes of operation, the old Unix way, and the
7274         new CSC-like way.  This should help those who wanted to make cross
7275         platform makefiles.
7276
7277         The only thing broken is that /r:, /reference: and /lib: are not
7278         implemented, because I want to make those have the same semantics
7279         as the CSC compiler has, and kill once and for all the confussion
7280         around this.   Will be doing this tomorrow.
7281
7282         * statement.cs (Unsafe.Resolve): The state is checked during
7283         resolve, not emit, so we have to set the flags for IsUnsfe here.
7284
7285 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
7286
7287         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
7288         not catch the Error_ObjectRefRequired in SimpleName (as it is
7289         possible to have a class/instance variable name that later gets
7290         deambiguated), we have to check this here.      
7291
7292 2002-07-10  Ravi Pratap  <ravi@ximian.com>
7293
7294         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
7295         make static and put into Expression.
7296
7297         (Event.Define): Register the private field of the event with the 
7298         TypeManager so that GetFieldFromEvent can get at it.
7299
7300         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
7301         keep track of the private field associated with an event which
7302         has no accessors.
7303
7304         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
7305         private field.
7306
7307         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
7308         
7309 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
7310
7311         * expression.cs (Binary.EmitBranchable): this routine emits the
7312         Binary expression in a branchable context.  This basically means:
7313         we need to branch somewhere, not just get the value on the stack.
7314
7315         This works together with Statement.EmitBoolExpression.
7316
7317         * statement.cs (Statement.EmitBoolExpression): Use
7318         EmitBranchable. 
7319
7320 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
7321
7322         * statement.cs (For): Reduce the number of jumps in loops.
7323
7324         (For): Implement loop inversion for the For statement.
7325
7326         (Break): We can be breaking out of a Try/Catch controlled section
7327         (foreach might have an implicit try/catch clause), so we need to
7328         use Leave instead of Br.
7329
7330         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
7331         now).  If the instace expression supports IMemoryLocation, we use
7332         the AddressOf method from the IMemoryLocation to extract the
7333         address instead of emitting the instance.
7334
7335         This showed up with `This', as we were emitting the instance
7336         always (Emit) instead of the Address of This.  Particularly
7337         interesting when This is a value type, as we dont want the Emit
7338         effect (which was to load the object).
7339         
7340 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
7341
7342         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
7343
7344         * statement.cs (Checked): Set the CheckedState during the resolve
7345         process too, as the ConvCast operations track the checked state on
7346         the resolve process, and not emit.
7347
7348         * cs-parser.jay (namespace_member_declaration): Flag that we have
7349         found a declaration when we do.  This is used to flag error 1529
7350
7351         * driver.cs: Report ok when we display the help only.
7352
7353 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
7354
7355         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
7356
7357 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
7358
7359         * cs-tokenizer.cs (define): We also have to track locally the
7360         defines.  AllDefines is just used for the Conditional Attribute,
7361         but we also need the local defines for the current source code. 
7362
7363 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
7364
7365         * statement.cs (While, For, Do): These loops can exit through a
7366         Break statement, use this information to tell whether the
7367         statement is the last piece of code.
7368
7369         (Break): Flag that we break.
7370
7371         * codegen.cs (EmitContexts): New `Breaks' state variable.
7372
7373 2002-07-03  Martin Baulig  <martin@gnome.org>
7374
7375         * class.cs (TypeContainer.MethodModifiersValid): Allow override
7376         modifiers in method declarations in structs.  Otherwise, you won't
7377         be able to override things like Object.Equals().
7378
7379 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
7380
7381         * class.cs (Method, Property, Indexer): Do not allow the public
7382         modifier to be used in explicit interface implementations.
7383
7384         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
7385         override modifiers in method declarations in structs
7386
7387 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
7388
7389         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
7390         integer or real overflow, report an error
7391
7392 2002-07-02  Martin Baulig  <martin@gnome.org>
7393
7394         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
7395         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
7396         to tell the runtime about our newly created System.Object and
7397         System.ValueType types.
7398
7399 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
7400
7401         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
7402         struct instead of Ldarg/Starg.
7403
7404 2002-07-02  Martin Baulig  <martin@gnome.org>
7405
7406         * expression.cs (Indirection.Indirection): Call
7407         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
7408
7409 2002-07-02  Martin Baulig  <martin@gnome.org>
7410
7411         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
7412         ValueType, call TypeManager.TypeToCoreType() on it.
7413         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
7414         the OpCodes.Newarr argument.
7415
7416 2002-07-02  Martin Baulig  <martin@gnome.org>
7417
7418         * expression.cs (Invocation.EmitCall): When compiling corlib,
7419         replace all calls to the system's System.Array type to calls to
7420         the newly created one.
7421
7422         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
7423         System.Array methods.
7424         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
7425         from the system's System.Array type which must be replaced.
7426
7427 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
7428
7429         * typemanager.cs: load unverifiable_code_ctor so we can build
7430         corlib using the correct type. Avoid using GetTypeCode() with
7431         TypeBuilders.
7432         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
7433         TypeManager.object_type to allow building corlib.
7434
7435 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
7436
7437         * ecore.cs: handle System.Enum separately in LoadFromPtr().
7438
7439 2002-07-01  Martin Baulig  <martin@gnome.org>
7440
7441         * class.cs: Make the last change actually work, we need to check
7442         whether `ifaces != null' to avoid a crash.
7443
7444 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
7445
7446         * class.cs: when we build structs without fields that implement
7447         interfaces, we need to add the interfaces separately, since there is
7448         no API to both set the size and add the interfaces at type creation
7449         time.
7450
7451 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
7452
7453         * expression.cs: the dimension arguments to the array constructors
7454         need to be converted if they are a long.
7455
7456 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
7457
7458         * class.cs: don't emit ldarg.0 if there is no parent constructor
7459         (fixes showstopper for corlib).
7460
7461 2002-06-29  Martin Baulig  <martin@gnome.org>
7462
7463         MCS now compiles corlib on GNU/Linux :-)
7464
7465         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
7466         ie. check for MethodImplOptions.InternalCall.
7467
7468         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
7469         and TypeManager.attribute_type are null, so we must explicitly check
7470         whether parent is not null to find out whether it's an attribute type.
7471         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
7472         and SetBuilder, not only if the property is neither abstract nor external.
7473         This is necessary to set the MethodImplOptions on the accessor methods.
7474         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
7475         SetBuilder, see Property.Emit().
7476
7477         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
7478         populate "System.Object", "System.ValueType" and "System.Attribute" since
7479         they've already been populated from BootCorlib_PopulateCoreTypes().
7480
7481 2002-06-29  Martin Baulig  <martin@gnome.org>
7482
7483         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
7484         is the NullLiteral, we also need to make sure that target_type is not
7485         an enum type.   
7486
7487 2002-06-29  Martin Baulig  <martin@gnome.org>
7488
7489         * rootcontext.cs (RootContext.ResolveCore): We must initialize
7490         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
7491         before calling BootstrapCorlib_ResolveDelegate ().
7492
7493 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
7494
7495         * statement.cs: fixed build-breaker. All tests passed ok.
7496
7497 2002-06-27  Martin Baulig  <martin@gnome.org>
7498
7499         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
7500         for System.Decimal when compiling corlib.
7501
7502 2002-06-27  Martin Baulig  <martin@gnome.org>
7503
7504         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
7505         switch blocks which contain nothing but a default clause.
7506
7507 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
7508
7509        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
7510
7511 2002-06-27  Martin Baulig  <martin@gnome.org>
7512
7513         * ecore.cs (PropertyExpr.PropertyExpr): Call
7514         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
7515
7516         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
7517         is already a TypeBuilder.
7518
7519 2002-06-27  Martin Baulig  <martin@gnome.org>
7520
7521         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
7522         `target_type == TypeManager.array_type', not IsAssignableFrom() in
7523         the "from an array-type to System.Array" case.  This makes it work
7524         when compiling corlib.
7525
7526 2002-06-27  Martin Baulig  <martin@gnome.org>
7527
7528         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
7529         non-static PropertyExpr, set its InstanceExpression.  This makes
7530         the `ICollection.Count' property work in System/Array.cs.
7531
7532 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
7533
7534         * driver.cs: Made error handling more consistent.  Errors now
7535         tracked by Report class, so many methods which used to return int
7536         now return void.  Main() now prints success/failure and 
7537         errors/warnings message.
7538
7539         Renamed '--probe' compiler argument to '--expect-error'.  Removed
7540         the magic number return values (123 and 124).  Now, if the
7541         expected error occurs, the compiler exits with success (exit value
7542         0).  If the compilation completes without seeing that particular
7543         error, the compiler exits with failure (exit value 1).  The
7544         makefile in mcs/errors has been changed to handle the new behaviour.
7545
7546         * report.cs: Made 'expected error' number a property and renamed
7547         it from 'Probe' to 'ExpectedError'.
7548
7549         * genericparser.cs: Removed error handling support, since it is
7550         now all done by Report class.
7551
7552         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
7553         class, so parse() no longer returns an int.
7554
7555         * namespace.cs: Use Report.Error instead of GenericParser.error
7556
7557 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
7558
7559         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
7560         TypeContainer.AddOperator): At the front of the list put the
7561         explicit implementations, so they get resolved/defined first. 
7562
7563 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
7564
7565         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
7566         interface type is implemented by this TypeContainer.  Used during
7567         explicit interface implementation.
7568
7569         (Property.Define, Indexer.Define, Method.Define): Validate that
7570         the given interface in the explicit implementation is one of the
7571         base classes for the containing type.
7572
7573         Also if we are explicitly implementing an interface, but there is
7574         no match in the pending implementation table, report an error.
7575
7576         (Property.Define): Only define the property if we are
7577         not explicitly implementing a property from an interface.  Use the
7578         correct name also for those properties (the same CSC uses,
7579         although that is really not needed).
7580         
7581         (Property.Emit): Do not emit attributes for explicitly implemented
7582         properties, as there is no TypeBuilder.
7583
7584         (Indexer.Emit): ditto.
7585
7586         Hiding then means that we do not really *implement* a pending
7587         implementation, which makes code fail.
7588
7589 2002-06-22  Martin Baulig  <martin@gnome.org>
7590
7591         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
7592         the return value of Object.GetType().  [FIXME: we need to do this whenever
7593         we get a type back from the reflection library].
7594
7595 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
7596
7597         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
7598
7599 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
7600
7601         * attribute.cs: Return null if we can not look up the type.
7602
7603         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
7604         the interface types found.
7605
7606         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
7607         interface types found.
7608
7609         * typemanager.cs (GetInterfaces): Make this routine returns alll
7610         the interfaces and work around the lame differences between
7611         System.Type and System.Reflection.Emit.TypeBuilder in the results
7612         result for GetInterfaces.
7613         
7614         (ExpandInterfaces): Given an array of interface types, expand and
7615         eliminate repeated ocurrences of an interface.  This expands in
7616         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
7617         be IA, IB, IC.
7618         
7619 2002-06-21  Martin Baulig  <martin@gnome.org>
7620
7621         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
7622         on System.Enum.
7623
7624 2002-06-21  Martin Baulig  <martin@gnome.org>
7625
7626         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
7627         and called with one of the core types, return the corresponding typebuilder for
7628         that type.
7629
7630         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
7631         element type.
7632
7633 2002-06-21  Martin Baulig  <martin@gnome.org>
7634
7635         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
7636         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
7637         (Expression.ConvertReferenceExplicit): Likewise.
7638
7639         * expression.cs (ElementAccess.DoResolve): Likewise.
7640         (ElementAccess.DoResolveLValue): Likewise.
7641
7642 2002-06-10  Martin Baulig  <martin@gnome.org>
7643
7644         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
7645         add the "value" parameter to the parameter list.
7646
7647         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
7648         to our caller.
7649
7650 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
7651
7652         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
7653         the argument to an int, uint, long or ulong, per the spec.  Also
7654         catch negative constants in array creation.
7655
7656 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
7657
7658         * class.cs: do not allow the same interface to appear twice in
7659         the definition list.
7660
7661 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
7662
7663         * ecore.cs: don't use ldlen with System.Array.
7664
7665 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
7666
7667         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
7668
7669 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
7670
7671         * modifiers.cs: produce correct field attributes for protected
7672         internal. Easy fix so miguel can work on ther harder stuff:-)
7673
7674 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
7675
7676         * pending.cs: New file.  Move the code from class.cs here.
7677         Support clearning the pending flag for all methods (when not doing
7678         explicit interface implementation).
7679
7680 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
7681
7682         * rootcontext.cs: added a couple more types needed to bootstrap.
7683
7684 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
7685
7686         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
7687         constructor in the type, instead of any constructor in the type
7688         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
7689         a bug in the Mono runtime when applying the params attribute). 
7690
7691 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
7692         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
7693
7694 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
7695
7696         * expression.cs (Unary.ResolveOperator): Use TypeManager
7697         to resolve the type.
7698         
7699 2002-06-13  Ravi Pratap  <ravi@ximian.com>
7700
7701         * cs-parser.jay (enum_member_declaration): Pass in the attributes
7702         attached.
7703
7704         * enum.cs (AddEnumMember): Add support to store the attributes associated 
7705         with each member too.
7706
7707         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
7708         field builders too - this takes care of the enum member case.
7709
7710 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
7711
7712         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
7713         address-of operator on both value types and pointers.
7714         
7715 2002-06-10  Martin Baulig  <martin@gnome.org>
7716
7717         * interface.cs (Interface.PopulateIndexer): Add the indexer's
7718         PropertyBuilder to the `property_builders' list.
7719
7720         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
7721         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
7722         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
7723         find any indexers which are inherited from an interface.
7724
7725 2002-06-09  Martin Baulig  <martin@gnome.org>
7726
7727         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
7728         the same type as the constant if necessary.  There's also a test-130.cs
7729         for this.
7730
7731         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
7732
7733         * typemanager.cs (TypeManager.ChangeType): Previously known as
7734         Enum.ChangeEnumType().
7735
7736 2002-06-09  Martin Baulig  <martin@gnome.org>
7737
7738         * expression.cs (Cast.TryReduce): Added support for consts.
7739
7740 2002-06-08  Ravi Pratap  <ravi@ximian.com>
7741
7742         * class.cs (Accessor): Hold attributes information so we can pass
7743         it along.
7744
7745         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
7746         Modify to pass in attributes attached to the methods.
7747
7748         (add_accessor_declaration, remove_accessor_declaration): Ditto.
7749
7750         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
7751         to handle the Accessor kind :-)
7752
7753         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
7754         
7755 2002-06-08  Martin Baulig  <martin@gnome.org>
7756
7757         * expression.cs (Unary.TryReduceNegative): Added support for
7758         ULongConstants.
7759
7760 2002-06-08  Martin Baulig  <martin@gnome.org>
7761
7762         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
7763         name can't be found in the `defined_names' - the caller will do a
7764         MemberLookup in this case and thus find methods in System.Enum
7765         such as Enum.IsDefined().
7766
7767 2002-06-08  Martin Baulig  <martin@gnome.org>
7768
7769         * enum.cs (Enum.ChangeEnumType): This is a custom version of
7770         Convert.ChangeType() which works with TypeBuilder created types.
7771         (Enum.LookupEnumValue, Enum.Define): Use it here.
7772
7773         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
7774         `TypeBuilder.BaseType != null' check.
7775         (TypeContainer.FindMembers): Only lookup parent members if we
7776         actually have a parent.
7777         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
7778         (ConstructorInitializer.Resolve): Likewise.
7779
7780         * interface.cs (Interface.FindMembers): Added
7781         `TypeBuilder.BaseType != null' check.
7782
7783         * rootcontext.cs (RootContext.ResolveCore): Added
7784         "System.Runtime.CompilerServices.IndexerNameAttribute" to
7785         classes_second_stage.
7786
7787         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
7788         debug_type and trace_type when compiling with --nostdlib.       
7789
7790 2002-06-07  Martin Baulig  <martin@gnome.org>
7791
7792         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
7793         (AddField): Set it to true when adding a non-static field.
7794         (DefineType): Use `have_nonstatic_fields' to find out whether we
7795         have non-static fields, not `Fields != null'.
7796
7797 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
7798
7799         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
7800         dereferencing a null on the static-field code path)
7801
7802 2002-05-30  Martin Baulig  <martin@gnome.org>
7803
7804         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
7805         to take command line arguments.  Use reflection to call the new
7806         custom `Initialize' function on the symbol writer and pass it the
7807         command line arguments.
7808
7809         * driver.cs (--debug-args): New command line argument to pass command
7810         line arguments to the symbol writer.
7811
7812 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
7813
7814         * assign.cs (DoResolve): Forgot to do the implicit conversion to
7815         the target type for indexers and properties.  Thanks to Joe for
7816         catching this.
7817
7818 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
7819
7820         * typemanager.cs (MethodFlags): returns the method flags
7821         (Obsolete/ShouldIgnore) that control warning emission and whether
7822         the invocation should be made, or ignored. 
7823
7824         * expression.cs (Invocation.Emit): Remove previous hack, we should
7825         not do this on matching a base type, we should do this based on an attribute
7826
7827         Only emit calls to System.Diagnostics.Debug and
7828         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
7829         on the command line.
7830
7831         * rootcontext.cs: Global settings for tracing and debugging.
7832
7833         * cs-tokenizer.cs (define): New utility function to track
7834         defines.   Set the global settings for TRACE and DEBUG if found.
7835
7836 2002-05-25  Ravi Pratap  <ravi@ximian.com>
7837
7838         * interface.cs (Populate*): Pass in the TypeContainer as well as
7839         the DeclSpace as parameters so that we can create EmitContexts and
7840         then use that to apply attributes etc.
7841
7842         (PopulateMethod, PopulateEvent, PopulateProperty)
7843         (PopulateIndexer): Apply attributes everywhere.
7844
7845         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
7846         etc.
7847
7848         (ApplyAttributes): Update accordingly.
7849
7850         We now apply interface attributes for all members too.
7851
7852 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
7853
7854         * class.cs (Indexer.Define); Correctly check if we are explicit
7855         implementation (instead of checking the Name for a ".", we
7856         directly look up if the InterfaceType was specified).
7857
7858         Delay the creation of the PropertyBuilder.
7859
7860         Only create the PropertyBuilder if we are not an explicit
7861         interface implementation.   This means that explicit interface
7862         implementation members do not participate in regular function
7863         lookups, and hence fixes another major ambiguity problem in
7864         overload resolution (that was the visible effect).
7865
7866         (DefineMethod): Return whether we are doing an interface
7867         implementation. 
7868         
7869         * typemanager.cs: Temporary hack until we get attributes in
7870         interfaces (Ravi is working on that) and we get IndexerName
7871         support in interfaces.
7872
7873         * interface.cs: Register the indexers as properties.
7874
7875         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
7876         warning, I have verified that this is a bug in the .NET runtime
7877         (JavaScript suffers of the same problem).
7878
7879         * typemanager.cs (MemberLookup): When looking up members for
7880         interfaces, the parent of an interface is the implicit
7881         System.Object (so we succeed in searches of Object methods in an
7882         interface method invocation.  Example:  IEnumerable x;  x.ToString
7883         ()) 
7884
7885 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
7886
7887         * class.cs (Event): Events should also register if they do
7888         implement the methods that an interface requires.
7889
7890         * typemanager.cs (MemberLookup); use the new GetInterfaces
7891         method. 
7892
7893         (GetInterfaces): The code used to lookup interfaces for a type is
7894         used in more than one place, factor it here. 
7895
7896         * driver.cs: Track the errors at the bottom of the file, we kept
7897         on going.
7898
7899         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
7900         instance if the method we are calling is static!
7901
7902 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
7903
7904         * attribute.cs (ApplyAttributes): Make this function filter out
7905         the IndexerName attribute (as that attribute in reality is never
7906         applied) and return the string constant for the IndexerName
7907         attribute. 
7908
7909         * class.cs (TypeContainer.Emit): Validate that all the indexers
7910         have the same IndexerName attribute, and if so, set the
7911         DefaultName attribute on the class. 
7912
7913         * typemanager.cs: The return value might contain other stuff (not
7914         only methods).  For instance, consider a method with an "Item"
7915         property and an Item method.
7916
7917         * class.cs: If there is a problem with the parameter types,
7918         return. 
7919
7920 2002-05-24  Ravi Pratap  <ravi@ximian.com>
7921
7922         * ecore.cs (ImplicitConversionExists): Wrapper function which also
7923         looks at user defined conversion after making a call to 
7924         StandardConversionExists - we need this for overload resolution.
7925
7926         * expression.cs : Update accordingly the various method calls.
7927
7928         This fixes 2 bugs filed against implicit user defined conversions 
7929
7930 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
7931
7932         * statement.cs: Track the result of the assignment.
7933
7934 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
7935
7936         * expression.cs (MemberAccess): Improved error reporting for
7937         inaccessible members.
7938
7939 2002-05-22  Martin Baulig  <martin@gnome.org>
7940
7941         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
7942         itself with debugging support.
7943
7944 2002-05-22  Martin Baulig  <martin@gnome.org>
7945
7946         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
7947         Removed, this isn't needed anymore.
7948
7949 2002-05-20  Martin Baulig  <martin@gnome.org>
7950
7951         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
7952         be underlying type for an enum.
7953
7954 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
7955
7956         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
7957         that splits out the loading of just the core types.
7958
7959         * rootcontext.cs (ResolveCore): Split the struct resolution in
7960         two, so we can load the enumeration underlying types before any
7961         enums are used.
7962
7963         * expression.cs (Is): Bandaid until we fix properly Switch (see
7964         bug #24985 for details).
7965
7966         * typemanager.cs (ImplementsInterface): The hashtable will contain
7967         a null if there are no interfaces implemented.
7968
7969 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
7970
7971         * cs-parser.jay (indexer_declarator): It is fine to have array
7972         parameters
7973
7974 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
7975
7976         * typemanager.cs: (RegisterBuilder): New function used to register
7977         TypeBuilders that implement interfaces.  Since
7978         TypeBuilder.GetInterfaces (as usual) does not work with lame
7979         Reflection.Emit. 
7980         (AddUserType): register interfaces.
7981
7982         (ImplementsInterface): Use the builder_to_ifaces hash if we are
7983         dealing with TypeBuilder.  Also, arrays are showing up as
7984         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
7985         methods can not be invoked on them!
7986
7987         * ecore.cs (ExplicitReferenceConversionExists): Made public.
7988         (ImplicitReferenceConversionExists): Split out from
7989         StandardConversionExists. 
7990
7991         * expression.cs (As): We were only implementing one of the three
7992         cases for the as operator.  We now implement them all.
7993         (Is): Implement the various other cases for Is as well.
7994
7995         * typemanager.cs (CACHE): New define used to control if we want or
7996         not the FindMembers cache.  Seems to have a negative impact on
7997         performance currently
7998
7999         (MemberLookup): Nested types have full acess to
8000         enclosing type members
8001
8002         Remove code that coped with instance/static returns for events, we
8003         now catch this in RealFindMembers.
8004
8005         (RealFindMembers): only perform static lookup if the instance
8006         lookup did not return a type or an event.  
8007
8008 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
8009
8010         * assign.cs (CompoundAssign): We pass more semantic information
8011         now to Compound Assignments than we did before: now we have all
8012         the information at hand, and now we resolve the target *before* we
8013         do the expression expansion, which allows the "CacheValue" method
8014         to have the effect we intended (before, a [x] += 1 would generate
8015         two differen ArrayAccess expressions from the ElementAccess,
8016         during the resolution process).
8017
8018         (CompoundAssign.DoResolve): Resolve target and original_source here.
8019
8020 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
8021
8022         * expression.cs (ArrayAccess): dropped debugging information. 
8023
8024         * typemanager.cs: Small bug fix: I was always returning i_members,
8025         instead of one of i_members or s_members (depending on which had
8026         the content).
8027
8028         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
8029         method is invoked before any code generation takes place, and it
8030         is a mechanism to inform that the expression will be invoked more
8031         than once, and that the method should use temporary values to
8032         avoid having side effects
8033
8034         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
8035         
8036         * ecore.cs (Expression.CacheTemporaries): Provide empty default
8037         implementation.
8038
8039         * expression.cs (Indirection, ArrayAccess): Add support for
8040         CacheTemporaries in these two bad boys. 
8041
8042         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
8043         ldobj or ldind_ref.  
8044         (StoreFromPtr): Handle stobj as well.
8045
8046         * expression.cs (UnaryMutator): Share more code.
8047         
8048         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
8049         down: I was not tracking the Filter function as well, which
8050         was affecting the results of the cache.
8051
8052 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
8053
8054         * attribute.cs: Remove the hack to handle the CharSet property on
8055         StructLayouts. 
8056
8057 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
8058
8059         * attribute.cs (DoResolve): More uglyness, we now only try to
8060         resolve the attribute partially, to extract the CharSet
8061         information (only if we are a StructLayout attribute).  Otherwise 
8062
8063         (GetExtraTypeInfo): Add some code to conditionally kill in the
8064         future this.   I am more and more convinced that the .NET
8065         framework has special code to handle the attribute setting on
8066         certain elements.
8067
8068         * expression.cs (IsParamsMethodApplicable): Revert my previous
8069         foreach change here, it was wrong.
8070
8071 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
8072
8073         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
8074         (pp_expr): do not abort on unknown input, just return.
8075         (eval): abort if there are pending chars.
8076
8077         * attribute.cs (Attribute.Resolve): Positional parameters are
8078         optional.  Deal with that case.
8079
8080         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
8081         the Ansi/Unicode/Auto information for the type.
8082
8083         (TypeContainer.DefineType): instantiate the EmitContext here, as
8084         we will be using it during the type definition (to resolve
8085         attributes) and during the emit phase.
8086
8087         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
8088         to pull type information out of the attributes
8089
8090         (Attribute.Resolve): track the constructor builder, and allow for
8091         multiple invocations (structs and classes will use this).
8092
8093         * ecore.cs (MemberLookupFinal): new version with all the
8094         parameters customizable.
8095
8096         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
8097         constructors.  Return if the result value is null (as the error
8098         would have been flagged already by MemberLookupFinal)
8099
8100         Do not allow instances of abstract classes or interfaces to be
8101         created.
8102         
8103         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
8104         We have to compare the assembly property here when dealing with
8105         FamANDAssem and Assembly access modifiers, because we might be
8106         creating an assembly from *modules* (that means that we are not
8107         getting TypeBuilders for types defined in other modules that are
8108         part of this assembly).
8109
8110         (Method.Emit): If the method is marked abstract and has a body,
8111         emit an error. 
8112
8113         (TypeContainer.DefineMembers): If both the defined member and the
8114         parent name match are methods, then do not emit any warnings: let
8115         the Method.Define routine take care of flagging warnings.  But if
8116         there is a mismatch (method overrides something else, or method is
8117         overriwritten by something, then emit warning).
8118
8119         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
8120         set to null, this means `do not check for the return type on the
8121         signature'. 
8122
8123         (Method.Define): set the return type for the method signature to
8124         null, so that we get methods with the same name and parameters and
8125         different return types.  This is used to flag warning 114 (you are
8126         hiding a method, and you probably want to use the new/override
8127         keywords instead).
8128
8129         * typemanager.cs (MemberLookup): Implemented proper access
8130         control, closing a long standing set of bug reports.  The problem
8131         was that the Framework only has two bits: Public and NonPublic,
8132         and NonPublic includes private and protected methods, but we need
8133         to enforce the FamANDAssem, FamOrAssem and Family. 
8134
8135 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
8136
8137         * statement.cs (GotoCase): Return true: Ammounts to giving up
8138         knowledge on whether we return or not, and letting the other case
8139         be responsible for it.
8140
8141 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
8142
8143         * driver.cs: Do not load directories for each file processed, only
8144         do it if there is a pattern.
8145
8146         * ecore.cs: Report readonly assigns here as well, as we might have
8147         been resolved only by MemberAccess.
8148
8149         (SimpleName.SimpleNameResolve): Also be useful for LValue
8150         resolution.   We need this to propagate assign to local readonly variables
8151
8152         * typemanager.cs: Use a ptrhashtable for the criteria, because we
8153         do not want to reuse potential criteria memory.
8154
8155         * class.cs (MyEventBuilder): Set reflected_type;
8156
8157         * ecore.cs (Constantify): Added support for constifying bools.
8158
8159         (RootContext.LookupType): Added a cache for values looked up in
8160         the declaration space.
8161
8162         * typemanager.cs (FindMembers): Now is a front-end to
8163         RealFindMembers, and provides a two-level hashtable-based cache to
8164         the request.  
8165
8166         15% performance improvement: from 22.5 to 19.2 seconds.
8167
8168         * expression.cs (IsParamsMethodApplicable): use foreach.
8169         (Invocation.DoResolve): ditto.
8170         (New.DoResolve): ditto.
8171         (ArrayCreation.DoResolve): ditto.
8172
8173         * ecore.cs (FindMostEncompassingType): use foreach.
8174
8175         * delegate.cs (NewDelegate.DoResolve): Use foreach
8176
8177         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
8178         (RemoveMethods): use foreach.
8179
8180         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
8181         nested foreach statements instead of for, and also break out of
8182         the inner loop once a match is found.
8183         
8184         (Invocation.OverloadResolve): Use foreach, simplify the code. 
8185
8186 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
8187
8188         * cfold.cs (BinaryFold): During an enumeration evaluation context,
8189         we actually unwrap the expression to allow for extra information
8190         to be extracted. 
8191
8192         * expression.cs: Use Shr_Un on unsigned operations. 
8193
8194 2002-05-08  Ravi Pratap  <ravi@ximian.com>
8195
8196         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
8197         applicable operators was not being considered correctly. This closes
8198         the bug Miguel reported.
8199
8200 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
8201
8202         * attribute.cs: check that the type derives from System.Attribute
8203         and report the correct error in that case (moved the duplicate code to
8204         its own method, too).
8205
8206 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
8207
8208         * attribute.cs: lookup attribute type name as the spec says: first the
8209         bare attribute name and then name + "Attribute" (nant compiles with
8210         mcs after this fix).
8211
8212 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
8213
8214         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
8215         Because of the way we parse things, we should try to see if a
8216         UIntConstant can fit in an integer.
8217
8218 2002-05-07  Ravi Pratap  <ravi@ximian.com>
8219
8220         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
8221         when we are in an explicit context.
8222
8223         (ConvertReferenceExplicit): When converting from Iface type S to Class
8224         T make sure the rules are implemented as an OR.
8225
8226         * parameter.cs (ParameterType): Make it a property for now although the
8227         purpose really isn't anything immediate.
8228         
8229         * expression.cs (Is*Applicable): Do better checking on the parameter type
8230         of a ref/out parameter. The ones from the system assemblies are already 
8231         marked with the correct type so we don't need to do any correction.
8232
8233         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
8234         the object type is standard too so include that.
8235
8236 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8237
8238         * ecore.cs (StandardConversionExists): Augment with missing code:
8239         deal with IntConstant, LongConstants and Enumerations.
8240
8241         * assign.cs: Report the error, instead of failing silently
8242
8243         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
8244         typecontainer that they are declared, because the
8245         typecontainer/namespace will have the list of using clauses that
8246         need to be applied.
8247
8248         Assembly Attributes were escaping the normal registration
8249         mechanism. 
8250
8251         (EmitCode): Apply attributes within an EmitContext that represents
8252         the container they were declared on.
8253         
8254         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
8255
8256 2002-05-06  Ravi Pratap  <ravi@ximian.com>
8257
8258         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
8259         Revamp completely - make much cleaner as we now operate only
8260         on a set of Types.
8261
8262         (FindMostSpecificSource, FindMostSpecificTarget): New methods
8263         to implement the logic detailed in the spec more correctly.
8264
8265         (UserDefinedConversion): Update accordingly.
8266
8267 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8268
8269         * statement.cs: Return flow analysis information up.
8270
8271         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
8272         and the default.
8273
8274         (token): Do not consume an extra character before calling
8275         decimal_digits.
8276
8277 2002-05-06  Piers Haken <piersh@friskit.com>
8278
8279         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
8280
8281 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
8282
8283         * class.cs (Constructor.Emit): Set the IsStatic flag in the
8284         EmitContext during the instance constructor initializer
8285         resolution, to stop access to instance variables.
8286
8287         This is mandated by the spec, last paragraph of the `constructor
8288         initializers' section. 
8289
8290 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
8291
8292         * cs-parser.jay, class.cs (Accessor): new class used to represent
8293         an accessor (get or set).  In the past we used `null' to represent
8294         a missing accessor.  But this is ambiguous because there was no
8295         way to tell in abstract indexers/properties if one of them was
8296         specified.
8297
8298         Now there is a way of addressing that.
8299
8300         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
8301         instead of FindMembers.
8302
8303         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
8304         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
8305
8306         * attribute.cs: Treat indexers and properties as the same in terms
8307         of applying attributes
8308
8309         * ecore.cs (FindMostEncompassedType): Use statically initialized
8310         EmptyExpressions()s like we do elsewhere to avoid creating useless
8311         objects (and we take this out of the tight loop).
8312
8313         (GetConversionOperators): Move the code to extract the actual
8314         operators to a separate routine to clean things up.
8315
8316 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
8317
8318         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
8319         events are always registered FieldBuilders.
8320         
8321         * class.cs (FieldBase): New class shared by Fields 
8322
8323         * delegate.cs: If we are a toplevel delegate, use our full name.
8324         If we are a nested delegate, then only use our tail name.
8325
8326 2002-05-02  Ravi Pratap  <ravi@ximian.com>
8327
8328         * expression.cs (IsApplicable): Ensure that we add the "&" to
8329         ref/out types before comparing it with the type of the argument.
8330
8331         (IsParamsMethodApplicable): Ditto.
8332
8333         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
8334         silly me ;-)
8335
8336         * delegate.cs : Handle the case when we have more than one applicable
8337         method. Flag an error only when we finish checking all.
8338
8339 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
8340
8341         * expression.cs: Add support for boolean static initializers.
8342
8343 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
8344
8345         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
8346
8347         * parameter.cs (ComputeParameterTypes,
8348         ComputeAndDefineParameterTypes): Better error handling: now we
8349         clear the `types' cache if we fail during any of the type lookups.
8350         We also return the status code correctly to our caller
8351
8352         * delegate.cs: If we fail to define a delegate, abort the extra
8353         steps. 
8354
8355         * expression.cs (Binary.ResolveOperator): for
8356         operator==(object,object) and operator !=(object, object) we also
8357         have to verify that there is an implicit conversion from one to
8358         the other.
8359
8360         (ArrayAccess.DoResolve): Array Access can operate on
8361         non-variables. 
8362
8363 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
8364
8365         * assign.cs (CompoundAssign): A new class used as a "flag" that
8366         the assignment actually is happening as part of a compound
8367         assignment operator.
8368
8369         During compound assignment, a few new rules exist to enable things
8370         like:
8371
8372         byte b |= 1 + 2
8373
8374         From the spec:
8375         
8376         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
8377         to the type of x) if y is implicitly convertible to the type of x,
8378         and the operator is a builtin operator and the return type of the
8379         operator is explicitly convertible to the type of x. 
8380
8381         * rootcontext.cs: Reset warning level to 2.  4 catches various
8382         "interesting" features in mcs, we must clean this up at some
8383         point, but currently am trying to kill other bugs ;-)
8384
8385         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
8386         in container classes as well.  
8387
8388         * expression.cs (Binary.ResolveOperator): Handle string case
8389         before anything else (as operator overloading does emit an error
8390         before doing anything else).
8391
8392         This code could go away when we move to a table driven model, but
8393         i could not come up with a good plan last night.
8394         
8395 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
8396
8397         * typemanager.cs (CSharpName): reimplementation using regex.
8398         * class.cs: added null check for fields in Emit
8399         * rootcontext.cs: set warninglevel to 4
8400
8401 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
8402
8403         * typemanager.cs (CSharpName): reimplemented with Lupus
8404         suggestion.
8405
8406 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
8407
8408         * statement.cs (If): correclty implement Resolve, because we were
8409         not catching sem errors in there.  The same process is needed
8410         everywhere else. 
8411         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
8412         
8413
8414         (Statement.Warning_DeadCodeFound): Factorize code.
8415         (While): Report dead code here too.
8416
8417         (Statement): Added Resolve virtual method to allow
8418         for resolution split from the emit code.
8419
8420 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
8421
8422         * statement.cs (EmitBoolExpression): No longer try to resolve the
8423         expression here.    
8424         (MakeBoolean): New utility function that resolve, implicitly
8425         converts to boolean and tags the expression. 
8426         
8427
8428         (If, Do): Implement dead code elimination.
8429         (While): Implement loop inversion
8430
8431         (Do, While, For, If): Resolve the expression prior to calling our
8432         code generation.
8433
8434 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
8435
8436         * class.cs:
8437           - added method Report28 (warning: program has more than one entry point)
8438           - added method IsEntryPoint, implements paragraph 10.1 of the spec
8439           - modified method Method.Define, the part at the end of the method
8440
8441         * rootcontext.cs: added static public Location EntryPointLocation;
8442           
8443         * ../errors/cs0028.cs : Add test case for the above warning.              
8444
8445         * typemanager.cs:
8446           - modified method CSharpName to allow arrays of primitive type to
8447             be printed nicely (e.g. instead of System.Int32[][] it now prints
8448             int[][])
8449           - added method CSharpSignature: returns the signature of a method
8450             in string format to be used in reporting errors, warnings, etc.
8451
8452         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
8453         with String.Empty.
8454         
8455 2002-04-26  Ravi Pratap  <ravi@ximian.com>
8456
8457         * delegate.cs (Define): Fix extremely silly bug where I was
8458         setting the type of the 'object' parameter of the BeginInvoke
8459         method to System.IAsyncResult instead of System.Object ;-)
8460
8461 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
8462
8463         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
8464         here. 
8465
8466         (Constructor.Emit): return if we fail to initialize the
8467         constructor.  Another door closed!  
8468
8469         * expression.cs (New.DoResolve): Improve error message (from -6 to
8470         1501).  Use DeclaredOnly lookup to find the exact constructor.
8471
8472         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
8473         loop.  This is useful.
8474
8475         * cs-parser.jay: Adjust the default parameters so that destructors
8476         have the proper signature.
8477
8478 2002-04-26  Martin Baulig  <martin@gnome.org>
8479
8480         * driver.cs (LoadAssembly): If `assembly' contains any characters
8481         which are only valid in path names and not in assembly names
8482         (currently slash, backslash and point), use Assembly.LoadFrom ()
8483         instead of Assembly.Load () on the `assembly' (before iteration
8484         over the link_paths).
8485
8486 2002-04-26  Martin Baulig  <martin@gnome.org>
8487
8488         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
8489
8490 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
8491
8492         * class.cs (Property): use the new typemanager.MemberLookup
8493
8494         (TypeContainer.MemberLookup): Implement using the
8495         TypeManager.MemberLookup now. 
8496         
8497         * typemanager.cs: Make MemberLookup a function of the TypeManager,
8498         and return MemberInfos, so that these can be used without an
8499         EmitContext (what we had before).
8500
8501 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
8502
8503         * expression.cs: Fix the case where the argument to params if the
8504         type of the params.  I omitted handling this before.   Fixed
8505
8506 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
8507
8508         * driver.cs: Call BootCorlib_PopulateCoreType
8509
8510         * class.cs (Property.CheckBase): Check for properties only, not
8511         for all members. 
8512
8513         * interface.cs: Temporary hack: try/catch around the
8514         CustomAttributeBuilder, because I am getting an exception that I
8515         do not understand.
8516
8517         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
8518         types whose definitions are required to be there (attributes are
8519         defined before standard types).
8520
8521         Compute definitions as we boot the various types, as they are used
8522         immediately (value_type class will need object_type, but if we do
8523         not initialize object_type, we will pass a null, which will let
8524         the runtime pick the System.Object from the existing corlib, which
8525         is not what we want).
8526
8527 2002-04-22  Patrik Torstensson <totte@labs2.com>
8528
8529         * cs-tokenizer.cs: fixed a number of trim() issues.
8530
8531 2002-04-22  Ravi Pratap  <ravi@ximian.com>
8532
8533         * expression.cs (Argument.Type): Ensure that we return the correct
8534         type when we have out or ref parameters [in which case we 
8535         append a "&"].
8536         
8537 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
8538
8539         * class.cs (Property, Indexer): Allow extern modifier in there. 
8540
8541         * typemanager.cs (InitBaseTypes): Initializes object_type and
8542         value_type, since those will be used early on during the bootstrap
8543         process to compile corlib.
8544
8545         (InitCoreTypes): Move code from here to InitBaseTypes.
8546
8547 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
8548
8549         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
8550         single-dimension arrays as using the ldlen opcode.  
8551
8552         Daniel Lewis discovered this optimization.  
8553
8554         * typemanager.cs: Add signature for System.Array::get_Length
8555
8556 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8557
8558         * statement.cs: report the error when the foreach does not apply to an
8559         array nor a collection.
8560
8561 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
8562
8563         * expression.cs: Add implicit conversions to the operator ~.
8564
8565         * constant.cs (DecimalConstant.Emit): Emit decimal value.
8566
8567         * typemanager.cs: Locate the decimal constructor.
8568
8569 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8570
8571         * attribute.cs: use the new property of TypeOf.
8572         * expression.cs: added 'get' property around typearg.
8573
8574         These changes fix a build breaker reported by NickD. Is this the
8575         correct way to fix?  If not, please, revert my changes and make it
8576         work :-).
8577
8578 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
8579
8580         * attribute.cs: Add support for typeof in attribute invocations.
8581         I am not sure that this is right though.
8582
8583 2002-04-14  Duncan Mak  <duncan@ximian.com>
8584
8585         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
8586         Binary.Operator.Division case.
8587
8588 2002-04-13  Ravi Pratap  <ravi@ximian.com>
8589
8590         * class.cs (DefineType): Ensure that we do a proper check on
8591         attribute types and also register it with the TypeManager.
8592
8593         (TypeContainer.Targets): The default for attribute types is
8594         AttributeTargets.All.
8595         
8596         * attribute.cs (ApplyAttributes): Registering the attribute type
8597         is done elsewhere, not when we discover we have a Usage attribute.
8598
8599 2002-04-12  Ravi Pratap  <ravi@ximian.com>
8600
8601         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
8602         and get rid of is_delegate parameter.
8603
8604         * everywhere : update.
8605         
8606 2002-04-12  Ravi Pratap  <ravi@ximian.com>
8607
8608         * cs-parser.jay (compilation_unit): Revamp completely to use
8609         some new ideas that I got from Rhys' grammar to solve the problems
8610         with assembly level attributes.
8611
8612         (outer_declaration): New grammar production.
8613
8614         (attribute_sections): Add.
8615
8616         (opt_attributes): Base on attribute_sections
8617
8618         (namespace_declaration): Allow opt_attributes to tackle the case
8619         when we have assembly level attributes - we are clever in this
8620         regard now ;-)
8621
8622         * attribute.cs (ApplyAttributes): Do not worry about assembly 
8623         attributes in the non-global context.
8624
8625         * rootcontext.cs (AddGlobalAttributes): Go back to using this
8626         instead of SetGlobalAttributes.
8627
8628         * class.cs, rootcontext.cs : Ensure we define and generate 
8629         attribute types before anything else.
8630
8631         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
8632         and flag the new error -20 for the case when the attribute type
8633         does not have valid targets specified. csc does not catch this.
8634
8635         * ../errors/errors.txt : update for error # -20
8636
8637 2002-04-11  Ravi Pratap  <ravi@ximian.com>
8638
8639         * support.cs (InternalParameters.ParameterModifier): Do some null
8640         checking and return sane values.
8641
8642         * class.cs (Method.Define): If we are a PInvoke method, ensure
8643         that we are static and extern. Report error # 601
8644
8645         * ../errors/cs0601.cs : Add test case for the above error.
8646
8647 2002-04-07  Ravi Pratap  <ravi@ximian.com>
8648
8649         * rootcontext.cs (attribute_types): We need to keep type of
8650         all attribute types separately and emit code for them first.
8651
8652         (RegisterAttribute) : Implement.
8653
8654         * class.cs (DefineType): Check if the current Type is a custom
8655         attribute type and register it accordingly.
8656
8657         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
8658         adding the first attribute twice and rename to
8659
8660         (SetGlobalAttributes): this.
8661
8662         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
8663         lookups.
8664
8665         * attribute.cs (ApplyAttributes): Take an additional argument telling us
8666         if we are processing global arguments. Hmm, I am unsure of this.
8667
8668 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
8669
8670         * expression.cs: added static array of strings to avoid calling
8671         Enum.ToString () for Operator in Binary. Significant recover of
8672         performance.
8673
8674 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
8675
8676         * class.cs (FindMembers): Allow the Builders of the various
8677         members to be null.  If they are skip them.  This only happens
8678         during the PInvoke declaration.
8679
8680 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
8681
8682         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
8683         failure, so we do not keep going afterwards.
8684
8685         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
8686         wanted to pass `false' as the `is_delegate' argument.  If this is
8687         the case, why not use delegate_type == null to mean `is_delegate =
8688         false' and anything else as is_delegate = true.
8689
8690 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
8691
8692         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
8693         code for the section, not the beginning of the tests.
8694
8695 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
8696
8697         * cfold.cs: Handle operator + (Enum x, Underlying x) 
8698
8699         * expression.cs (Binary): same.  Warn about errors where we have
8700         Enum/Enum in operator + as well.
8701
8702 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
8703
8704         * statement.cs:
8705                 - added support for switch(bool)
8706                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
8707                 - add TableSwitchEmit() to handle table-based switch statements
8708
8709 2002-04-05  Ravi Pratap  <ravi@ximian.com>
8710
8711         * expression.cs (Invocation.OverloadResolve): Factor out code which
8712         does parameter compatibility checking with arguments so that we can 
8713         re-use the code even from Delegate.VerifyApplicability
8714
8715         (VerifyArgumentsCompat): Move above code here.
8716
8717         * delegate.cs (VerifyApplicability): Get rid of duplicate code
8718         and instead make a call to the above method.
8719
8720 2002-03-31  Ravi Pratap  <ravi@ximian.com>
8721
8722         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
8723         We use it to keep track of classes which are attribute types.
8724
8725 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
8726
8727         * delegate.cs (Delegate.Define): Correctly define the types in the
8728         presence of fixed and array parameters.
8729
8730         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
8731         doing FindMembers.
8732
8733         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
8734         include NonPublic after the first iteration.
8735
8736         * class.cs (Indexer.CheckBase): Only check if both parents are
8737         non-null. 
8738         
8739         * cs-parser.jay (accessor_body): If empty, set to null.
8740
8741         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
8742         same code path here to resolve constants names that we did have in
8743         MemberAccess.DoResolve.  There is too much code duplicated here.
8744
8745 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
8746
8747         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
8748
8749         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
8750         to MakeUnionSet.
8751
8752         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
8753         tokens, numbers and strings.
8754
8755         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
8756         parenthesis.
8757
8758         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
8759         asyncronous parameters and the regular parameters.  
8760
8761         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
8762         specify the target directory.
8763
8764         * expression.cs: (This.DoResolve): Simplify
8765         (As.Emit): Optimize, do not generate IsInst if the expression is
8766         always of the given type.
8767
8768         (Is.DoResolve): Bug fix, we were reporting both always/never for
8769         the is expression.
8770
8771         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
8772         creating too many unnecessary arrays.
8773
8774 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
8775
8776         * class.cs (EmitFieldInitializer): Use Assign expression to assign
8777         fields instead of rolling our own initializer.   Takes care of all
8778         implicit conversions, and drops unnecessary static checks/argument.
8779
8780 2002-03-31  Dick Porter  <dick@ximian.com>
8781
8782         * driver.cs: use the GetDirectories() return values properly, and
8783         use "/" as path separator.
8784
8785 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
8786
8787         * expression.cs (Unary): Optimize - - expr into expr.
8788         (Binary): Optimize a + (-b) into a -b.
8789
8790         * codegen.cs (CodeGen): Made all methods static.
8791
8792 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
8793
8794         * rootcontext.cs: 
8795
8796         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
8797         TypeBuilder property.
8798
8799         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
8800         instead. 
8801
8802         * tree.cs: Removed the various RecordXXXX, and replaced with a
8803         single RecordDecl.  Removed all the accessor methods, and just
8804         left a single access point Type 
8805
8806         * enum.cs: Rename DefineEnum to DefineType.
8807
8808         * decl.cs: New abstract method `DefineType' used to unify the
8809         Defines for Enumerations, Interfaces, TypeContainers and
8810         Delegates.
8811
8812         (FindType): Moved LookupInterfaceOrClass here.  Moved the
8813         LookupBaseClasses method that used to live in class.cs and
8814         interface.cs here, and renamed to FindType.
8815         
8816         * delegate.cs: Implement DefineType.  Take advantage of the
8817         refactored pattern for locating the parent builder without taking
8818         the parent_builder argument (which we know does not work if we are
8819         nested, and triggering a toplevel definition).
8820
8821 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
8822
8823         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
8824         accessibility of a member has changed during override and report
8825         an error if so.
8826
8827         * class.cs (Method.Define, Property.Define): Only complain on
8828         overrides if the method is private, any other accessibility is
8829         fine (and since we just checked the permission is the same, we are
8830         good to go).
8831
8832         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
8833         and elif are processed always.  The other pre-processing
8834         directives are only processed if we are "taking" the path
8835
8836 2002-03-29  Martin Baulig  <martin@gnome.org>
8837
8838         * class.cs (Method.Emit): Only emit symbolic debugging info if the
8839         current location is not Null.
8840
8841         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
8842         a separate method so we can profile it.
8843
8844         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
8845         `span.Seconds' are just seconds, but no minutes or hours.
8846         (MainDriver): Profile the CodeGen.SaveSymbols calls.
8847
8848 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
8849
8850         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
8851         Remove the gratuitous set of Final:
8852
8853                                 // If an interface implementation, then we can set Final.
8854                                 if (((flags & MethodAttributes.Abstract) == 0) &&
8855                                     implementing.DeclaringType.IsInterface)
8856                                         flags |= MethodAttributes.Final;
8857
8858         I do not know what I was smoking when I used that.
8859         
8860
8861         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
8862         step into fixing the name resolution issues for delegates and
8863         unifying the toplevel name resolution.
8864
8865 2002-03-28  Martin Baulig  <martin@gnome.org>
8866
8867         * class.cs (Method.Emit): If we have a symbol writer, call its
8868         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
8869         tell it about the current method.
8870
8871         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
8872         writer that we're going to emit the first byte of IL code for a new
8873         statement (a new source line).
8874         (EmitContext.EmitTopBlock): If we have a symbol writer, call
8875         EmitContext.Mark() before emitting any code.
8876
8877         * location.cs (SymbolDocument): Return null when we're Null.
8878
8879         * statement.cs (Statement): Moved the `Location loc' variable here.
8880         (Statement.EmitBoolExpression): If we have a symbol writer, call
8881         ec.Mark() before emitting any code to tell it that we're at the
8882         beginning of a new statement.
8883         (StatementExpression): Added `Location' argument to the constructor.
8884         (Block): Added public readonly variable `StartLocation' and public
8885         variable `EndLocation'.  The latter is to be set using SetEndLocation().
8886         (Block): Added constructor which takes a start and end location.
8887         (Block.SetEndLocation): New method. This sets the end location.
8888         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
8889         local variables we create.
8890         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
8891         each statement and do also mark the begin and end of the block.
8892
8893         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
8894         tell it the current lexer.Location, use Location.Null for the end of the
8895         block.
8896         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
8897         current block, set its end location using SetEndLocation().
8898         (statement_expression): StatementExpression constructor now takes the
8899         lexer.Location as additional argument.
8900         (for_statement, declare_local_variables): Likewise.
8901         (declare_local_variables): When creating a new implicit block, use the
8902         new Block constructor and pass it the lexer.Location.
8903
8904 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
8905
8906         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
8907         members also on the parent interfaces recursively.
8908
8909 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
8910
8911         * report.cs: Use new formats, since Gonzalo finished the missing
8912         bits. 
8913
8914         * expression.cs (Binary.ResolveOperator): added missing operator|
8915         operator& and operator^ for bool/bool.
8916
8917         * cs-parser.jay: CheckDef now takes a Location argument that is
8918         used to report errors more precisly (instead of reporting the end
8919         of a definition, we try to track something which is a lot closer
8920         to the source of the problem).
8921
8922         * cs-tokenizer.cs: Track global token use, so we can properly flag
8923         the use of #define/#undef after the first token has been seen.
8924
8925         Also, rename the reportXXXX to Error_DescriptiveName
8926
8927         * decl.cs (DeclSpace.IsTopLevel): Move property here from
8928         TypeContainer, so that Enum and Interface can use this too.
8929
8930         * class.cs (TypeContainer.LookupInterfaceOrClass,
8931         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
8932         `builder' argument.  Typically this was used to pass the parent
8933         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
8934         the definition).  
8935
8936         The problem is that a nested class could trigger the definition of
8937         a toplevel class, and the builder would be obviously wrong in that
8938         case. 
8939
8940         So we drop this argument, and we compute dynamically the
8941         TypeBuilder/ModuleBuilder (the correct information was available
8942         to us anyways from DeclSpace.Parent)
8943
8944         * interface.cs (Interface.DefineInterface): Drop builder
8945         parameter cleanup like class.cs
8946
8947         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
8948         like class.cs
8949
8950         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
8951         values. 
8952
8953         (Try.Emit): Propagate the returns value from the statement.
8954
8955         (Return.Emit): Even if we are leavning 
8956
8957         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
8958
8959         * modifiers.cs: Fix the computation of MethodAttributes flags.
8960
8961 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
8962
8963         * driver.cs: allow compilation of files that start with '/'.
8964         Add a default case when checking the argument of --target.
8965
8966 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
8967
8968         * interface.cs: Implement the same search algorithm for types in
8969         the interface code.
8970
8971         * delegate.cs: Do not allow multiple definition.
8972
8973         * Recovered ChangeLog that got accidentally amputated
8974
8975         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
8976
8977         * rootcontext.cs: Load manually enum to allow core classes to
8978         contain enumerations.
8979
8980         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
8981         Update to new static methods in TypeManager.
8982
8983         * typemanager.cs (GetMethod, GetConstructor): Use our
8984         implementation of FindMembers to find the members, since during
8985         corlib compilation, the types are TypeBuilders and GetMethod and
8986         GetConstructor do not work.
8987
8988         Make all methods in TypeManager static.
8989
8990         (InitCodeHelpers): Split the functionality from
8991         the InitCodeTypes function.
8992
8993         * driver.cs: Call InitCodeHelpers after we have populated the
8994         types. 
8995
8996         * cs-parser.jay (delegate_declaration): we did not used to compute
8997         the delegate name correctly for void delegates.
8998
8999 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
9000
9001         * rootcontext.cs (RootContext): Init the interface_resolve_order
9002         and type_container_resolve_order always.
9003
9004         (ResolveCore, BootstrapCorlib_ResolveClass,
9005         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
9006         compiler when compiling with --nostdlib
9007
9008         * class.cs (TypeContainer.DefineType): Check that our parent is
9009         not null.  This test is most important when we are bootstraping
9010         the core types.
9011
9012         * codegen.cs: Split out the symbol writing code.
9013
9014 2002-03-25  Martin Baulig  <martin@gnome.org>
9015
9016         * driver.cs (-g): Made -g an alias for --debug.
9017
9018 2002-03-24  Martin Baulig  <martin@gnome.org>
9019
9020         * codegen.cs (SymbolWriter): New public variable. Returns the
9021         current symbol writer.
9022         (CodeGen): Added `bool want_debugging_support' argument to the
9023          constructor. If true, tell the ModuleBuild that we want debugging
9024         support and ask it for the ISymbolWriter.
9025         (Save): If we have a symbol writer, call it's Close() method after
9026         saving the assembly.
9027
9028         * driver.c (--debug): New command line argument to create a
9029         debugger information file.
9030
9031         * location.cs (SymbolDocument): New public property. Returns an
9032         ISymbolDocumentWriter object for the current source file or null
9033         if we don't have a symbol writer.
9034
9035 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
9036
9037         * driver.cs (LoadAssembly): Correctly return when all the paths
9038         have been tried and not before.
9039
9040         * statement.cs (Switch.Emit): return the actual coverage for this
9041         statement (returns/not-returns)
9042
9043         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
9044         switch of the statement if we are the last switch section.  That
9045         kills two problems: try/catch problems (we used to emit an empty
9046         nop at the end) and switch statements where all branches would
9047         return. 
9048
9049 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
9050
9051         * driver.cs: Add default assemblies (the equivalent to the
9052         Microsoft CSC.RSP file)
9053
9054         * cs-tokenizer.cs: When updating `cols and setting it to zero,
9055         also update tokens_seen and set it to false.
9056
9057         * driver.cs: Implement --recurse for Mike.
9058
9059         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
9060         correctly splitting out the paths.
9061
9062 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
9063
9064         * interface.cs (Interface.PopulateProperty): Instead of using
9065         `parent' as the declaration space for the set parameters, use
9066         `this' 
9067
9068         * support.cs (InternalParameters): InternalParameters constructor
9069         takes a DeclSpace instead of a TypeContainer.
9070
9071         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
9072         types are being initialized, load the address of it before calling
9073         the function.  
9074
9075         (New): Provide a mechanism to disable the generation of local
9076         value type temporaries when the caller will be providing us with
9077         an address to store it.
9078
9079         (ArrayCreation.EmitDynamicInitializers): Use it.
9080
9081 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
9082
9083         * expression.cs (Invocation.EmitArguments): Only probe for array
9084         property if there is more than one argument.  Sorry about that.
9085
9086         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
9087         empty param arrays.
9088         
9089         * class.cs (Method.LabelParameters): Fix incorrect code path that
9090         prevented the `ParamArrayAttribute' from being applied to the
9091         params attribute.
9092
9093 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
9094
9095         * support.cs (ReflectionParameters): Correctly compute whether the
9096         last argument is a params array.  Fixes the problem with
9097         string.Split ('a')
9098
9099         * typemanager.cs: Make the assemblies array always be non-null
9100         (empty, but non-null)
9101
9102         * tree.cs (RecordDecl): New function that abstracts the recording
9103         of names.  This reports error 101, and provides a pointer to the
9104         previous declaration.  Fixes a crash in the compiler.
9105
9106         * cs-parser.jay (constructor_declaration): Update to new grammar,
9107         and provide a constructor_body that can be empty.
9108
9109 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
9110
9111         * driver.cs: Add support for --resources.
9112
9113         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
9114         Make all types for the various array helper methods be integer.
9115
9116         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
9117         CheckState to ConvCast.
9118
9119         (ConvCast): Now it takes a `checked' state argument, to avoid
9120         depending on the emit context for the conversion, and just using
9121         the resolve time setting.
9122
9123         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
9124         instead of Invocation.EmitArguments.  We do not emit the original
9125         arguments, instead we emit those which have been converted to
9126         unsigned int expressions.
9127
9128         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
9129
9130         * codegen.cs: ditto.
9131
9132         * expression.cs (LocalVariableReference): Drop the use of the
9133         Store function that depended on the variable index.
9134
9135         * statement.cs (VariableInfo): Drop the `Idx' property from this
9136         class, as this is not taking into account the indexes for
9137         temporaries tat we generate during the execution, getting the
9138         indexes wrong.
9139
9140         * class.cs: First emit class initializers, then call the parent
9141         constructor. 
9142
9143         * expression.cs (Binary): Fix opcode emision.
9144         (UnaryMutator.EmitCode): Support checked code generation
9145
9146         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
9147         matches for events for both the Static and Instance scans,
9148         pointing to the same element.   Fix that.
9149
9150 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
9151
9152         * rootcontext.cs (ResolveTree): Always set the
9153         interface_resolve_order, because nested interfaces will be calling
9154         into us.
9155
9156         * class.cs (GetInterfaceOrClass): Track the same resolution
9157         process used by TypeManager.LookupType.  This fixes the nested
9158         type lookups in class declarations (separate path from
9159         LookupType). 
9160
9161         (TypeContainer.DefineType): Also define nested interfaces.
9162         (TypeContainer.RegisterOrder): New public function used to
9163         register the order in which child interfaces need to be closed.
9164
9165         Nested interfaces need to be closed after their parents have been
9166         created. 
9167         
9168         * interface.cs (InterfaceAttr): Put all the logic for computing
9169         the interface attribute here. 
9170
9171         (DefineInterface): Register our interface order with the
9172         RootContext or with the TypeContainer depending on the case.
9173
9174 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
9175
9176         * cs-parser.jay: rework foreach statement to work with the new
9177         changes to the policy on SimpleNames.
9178         
9179         * report.cs: support Stacktrace on warnings as well.
9180
9181         * makefile: drop --unsafe and /unsafe from the compile.
9182
9183 2002-03-13  Ravi Pratap  <ravi@ximian.com>
9184
9185         * ecore.cs (StandardConversionExists): Modify to take an Expression
9186         as the first parameter. Ensure we do null -> reference type conversion
9187         checking.
9188
9189         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
9190         temporary Expression objects.
9191
9192 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
9193
9194         * interface.cs: workaround bug in method overloading resolution
9195         (there is already a bugzilla bug for it).
9196
9197 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
9198
9199         We could also solve this problem by having a separate path for
9200         performing type lookups, instead of DoResolve, we could have a
9201         ResolveType entry point, and only participating pieces of the
9202         production (simplename, deref, array) would implement this. 
9203         
9204         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
9205         signal SimpleName to only resolve type names and not attempt to
9206         resolve anything else.
9207
9208         * expression.cs (Cast): Set the flag.
9209
9210         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
9211
9212         * class.cs: Only report 108 if there is no `new' modifier.
9213
9214         * cs-parser.jay: rework foreach statement to work with the new
9215         changes to the policy on SimpleNames.
9216         
9217         * report.cs: support Stacktrace on warnings as well.
9218
9219         * makefile: drop --unsafe and /unsafe from the compile.
9220
9221 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
9222
9223         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9224         lookups here, instead of doing that at parse time.  This means
9225         that our grammar will not introduce `LocalVariableReferences' as
9226         expressions at this point.  That solves the problem of code like
9227         this:
9228
9229         class X {
9230            static void Main ()
9231            { int X = 1;
9232             { X x = null }}}
9233
9234         This is only half the fix.  The full fix requires parameters to
9235         also be handled in this way.
9236
9237         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
9238         makes the use more obvious of the DeclSpace.  The
9239         ec.TypeContainer.TypeBuilder is now only used to pull the
9240         TypeBuilder for it.
9241
9242         My theory is that I can get rid of the TypeBuilder completely from
9243         the EmitContext, and have typecasts where it is used (from
9244         DeclSpace to where it matters).  
9245
9246         The only pending problem is that the code that implements Aliases
9247         is on TypeContainer, and probably should go in DeclSpace.
9248
9249         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
9250         lookups here, instead of doing that at parse time.  This means
9251         that our grammar will not introduce `LocalVariableReferences' as
9252         expressions at this point.  That solves the problem of code like
9253         this:
9254
9255         class X {
9256            static void Main ()
9257            { int X = 1;
9258             { X x = null }}}
9259
9260         This is only half the fix.  The full fix requires parameters to
9261         also be handled in this way.
9262
9263         * class.cs (Property.DefineMethod): When implementing an interface
9264         method, set newslot, when implementing an abstract method, do not
9265         set the flag (before we tried never setting it, or always setting
9266         it, which is the difference).
9267         (Indexer.DefineMethod): same.
9268         (Method.DefineMethod): same.
9269
9270         * ecore.cs: Only set the status used flag if we get back a Field.
9271
9272         * attribute.cs: Temporary hack, so Paolo can keep working.
9273
9274 2002-03-08  Ravi Pratap  <ravi@ximian.com>
9275
9276         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
9277         the unmanaged type in the case we have a MarshalAs attribute.
9278
9279         (Resolve): Handle the case when we are parsing the special MarshalAs
9280         attribute [we need to store the unmanaged type to use later]
9281         
9282         * typemanager.cs (marshal_as_attr_type): Built in type for the 
9283         MarshalAs Attribute.
9284
9285         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
9286         on parameters and accordingly set the marshalling info.
9287         
9288 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
9289
9290         * class.cs: Optimizing slightly by removing redundant code after
9291         we switched to the `NoTypes' return value.
9292         (Property.DefineMethod): use NoTypes here too.
9293
9294         This fixes the bug I introduced in my last batch of changes.
9295
9296 2002-03-05  Ravi Pratap  <ravi@ximian.com>
9297
9298         * tree.cs (RecordEnum): Add. We now keep track of enums too.
9299
9300         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
9301         Enums since those are types too. 
9302
9303         * cs-parser.jay (enum_declaration): Record enums as we parse them.
9304         
9305         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
9306         thanks to a call during the lookup process.
9307
9308 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
9309
9310         * statement.cs (Foreach): Lots of work to accomodate a particular
9311         kind of foreach statement that I had not kept in mind.  It is
9312         possible to have foreachs on classes that provide a GetEnumerator
9313         method that return objects that implement the "pattern" for using
9314         a foreach, there is no need to support GetEnumerator
9315         specifically. 
9316
9317         This is needed to compile nant.
9318
9319         * decl.cs: Only report 114 if the member is not `Finalize' and if
9320         the warning level is at least 2.
9321
9322         * class.cs: Moved the compare function from Method to
9323         MethodSignature. 
9324
9325         (MethodSignature.InheritableMemberSignatureCompare): Add new
9326         filter function that is used to extract inheritable methods from a
9327         class. 
9328
9329         (Method.Define): Use the new `inheritable_method_signature_filter'
9330         delegate
9331
9332         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
9333         command. 
9334
9335 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
9336
9337         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
9338
9339         * cs-parser.jay: Add opt_semicolon to the interface declaration.
9340
9341         * expression.cs: Pass location information to
9342         ConvertImplicitStandard. 
9343
9344         * class.cs: Added debugging code to track return values from
9345         interfaces. 
9346
9347 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
9348
9349         * expression.cs (Is.DoResolve): If either side of the `is' is an
9350         interface, do not flag the warning.
9351
9352         * ecore.cs (ImplicitReferenceConversion): We need a separate test
9353         for interfaces
9354
9355         * report.cs: Allow for --fatal to be used with --probe.
9356         
9357         * typemanager.cs (NoTypes): Move the definition for the empty Type
9358         array here. 
9359
9360         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
9361         properties. 
9362         (TypeContainer.DefineProxy): New function used to proxy to parent
9363         implementations when implementing interfaces.
9364         (TypeContainer.ParentImplements): used to lookup if our parent
9365         implements a public function that is required by an interface.
9366         (TypeContainer.VerifyPendingMethods): Hook this up.
9367
9368         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
9369         `modules' and `assemblies' arraylists into arrays.  We only grow
9370         these are the very early start up of the program, so this improves
9371         the speedof LookupType (nicely measured).
9372
9373         * expression.cs (MakeByteBlob): Replaced unsafe code with
9374         BitConverter, as suggested by Paolo.
9375
9376         * cfold.cs (ConstantFold.Binary): Special case: perform constant
9377         folding of string concatenation, but if either side is a string,
9378         and the other is not, then return null, and let the runtime use
9379         the concatenation on the string plus the object (using
9380         `Object.ToString'). 
9381
9382 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
9383
9384         Constant Folding has been implemented now.
9385         
9386         * expression.cs (Unary.Reduce): Do not throw an exception, catch
9387         the error instead on types that are not supported in one's
9388         complement. 
9389
9390         * constant.cs (Constant and all children): New set of functions to
9391         perform implict and explicit conversions.
9392         
9393         * ecore.cs (EnumConstant): Implement the new functions to perform
9394         conversion by proxying to the child expression.
9395
9396         * codegen.cs: (ConstantCheckState): Constant evaluation has its
9397         own separate setting that can not be turned off from the command
9398         line using --unchecked or --checked and is only controlled using
9399         the checked/unchecked statements and expressions.  This setting is
9400         used by the constant folder to flag errors.
9401
9402         * expression.cs (CheckedExpr, UncheckedExpr): Set the
9403         ConstantCheckState as well.   
9404
9405         During Resolve, they also have to flag the state, because the
9406         constant folder runs completely in the Resolve phase.
9407
9408         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
9409         well.
9410
9411 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
9412
9413         * cfold.cs: New file, this file contains the constant folder.
9414         
9415         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
9416         argument to track whether we are using the resulting address to
9417         load or store a value and provide better error messages. 
9418
9419         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
9420         new AddressOf arguments.
9421
9422         * statement.cs (Foreach.EmitCollectionForeach): Update
9423
9424         * expression.cs (Argument.Emit): Call AddressOf with proper
9425         arguments to track usage.
9426
9427         (New.DoEmit): Call AddressOf with new arguments.
9428
9429         (Unary.Emit): Adjust AddressOf call.
9430
9431 2002-03-01  Ravi Pratap  <ravi@ximian.com>
9432
9433         * cs-parser.jay (member_access): Change the case for pre-defined types
9434         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
9435         this suggestion.
9436
9437         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
9438         a method body.
9439
9440         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
9441         essentially like methods and apply attributes like MethodImplOptions to them too.
9442
9443         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
9444         not being null.
9445
9446         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
9447         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
9448         is the DeclSpace.
9449
9450         * Update code everywhere accordingly.
9451
9452         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
9453
9454         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
9455
9456 2002-02-28  Ravi Pratap  <ravi@ximian.com>
9457
9458         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
9459         try performing lookups against those instead of jumping straight into using
9460         the 'using' clauses.
9461
9462         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
9463
9464         (LookupType): Perform lookups in implicit parents too.
9465
9466         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
9467         sequence as RootContext.LookupType. 
9468
9469         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
9470         the various cases of namespace lookups into this method.
9471
9472 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
9473
9474         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
9475         in positional arguments)
9476
9477         * class.cs (Operator): Update the AllowedModifiers to contain
9478         extern. 
9479
9480         * cs-parser.jay: Update operator declaration to allow for the
9481         operator body to be empty.
9482
9483         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
9484         values. 
9485
9486 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
9487
9488         * class.cs (Method.Emit): Label parameters.
9489
9490         * driver.cs: Return 1 or 0 as the program exit code.
9491
9492 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
9493
9494         * expression.cs: Special case the `null' object when trying to
9495         auto-compute the type, as anything can be explicitly converted to
9496         that. 
9497
9498         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
9499         spotting this Paolo.
9500
9501         (Expression.ImplicitNumericConversion): Perform comparissions of
9502         the type using the underlying type in the case of an enumeration
9503         rather than using the enumeration type for the compare.
9504
9505         Cope with the underlying == type case, which is not possible to
9506         catch before. 
9507
9508         (Expression.ConvertNumericExplicit): Perform comparissions of
9509         the type using the underlying type in the case of an enumeration
9510         rather than using the enumeration type for the compare.
9511
9512         * driver.cs: If the user does not supply an extension, assume .exe
9513
9514         * cs-parser.jay (if_statement): Rewrote so that we can track the
9515         location for the if statement.
9516
9517         * expression.cs (Binary.ConstantFold): Only concat strings when
9518         the operation is "+", not everything ;-)
9519
9520         * statement.cs (Statement.EmitBoolExpression): Take a location
9521         argument. 
9522         (If, While, Do): Track location.
9523
9524         * expression.cs (Binary.ResolveOperator): In the object + string
9525         case, I was missing a call to ConvertImplicit
9526
9527 2002-02-25  Ravi Pratap  <ravi@ximian.com>
9528
9529         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
9530         Location arguments. Ensure we use RootContext.LookupType to do our work
9531         and not try to do a direct Type.GetType and ModuleBuilder.GetType
9532
9533         * interface.cs (PopulateMethod): Handle the type of the parameter being
9534         null gracefully.
9535
9536         * expression.cs (Invocation.BetterFunction): Handle the case when we 
9537         have a params method with no fixed arguments and a call is made with no
9538         arguments.
9539
9540 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
9541
9542         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
9543         the verbatim-string-literal
9544
9545         * support.cs (InternalParameters.ParameterModifier): handle null
9546         fixed parameters.
9547         (InternalParameters.ParameterType): ditto.
9548
9549         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
9550         duplicating the name of the variable parameter.
9551         (GetParameterByName): Fix bug where we were not looking up array
9552         paramters if they were the only present (thanks Paolo!).
9553         (GetParameterInfo): We only have an empty set of types if both
9554         fixed and array are set to null.
9555         (GetParameterInfo-idx): Handle FixedParameter == null
9556
9557         * cs-parser.jay: Handle the case where there is no catch
9558         statements (missing null test).
9559
9560 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
9561
9562         * driver.cs (MainDriver): Be conservative on our command line
9563         handling.
9564
9565         Catch DirectoryNotFoundException when calling GetFiles.
9566         
9567         (SplitPathAndPattern): Used to split the input specification into
9568         a path and a pattern that we can feed to Directory.GetFiles.
9569
9570 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
9571
9572         * statement.cs (Fixed): Implement the last case of the Fixed
9573         statement (string handling).
9574
9575         * expression.cs (StringPtr): New class used to return a char * to
9576         a string;  Used by the Fixed statement.
9577
9578         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
9579
9580         * expression.cs (Binary.ResolveOperator): Remove redundant
9581         MemberLookup pn parent type.
9582         Optimize union call, we do not need a union if the types are the same.
9583         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
9584         type.
9585
9586         Specialize the use of MemberLookup everywhere, instead of using
9587         the default settings. 
9588
9589         (StackAlloc): Implement stackalloc keyword.
9590
9591         * cs-parser.jay: Add rule to parse stackalloc.
9592         
9593         * driver.cs: Handle /h, /help, /?
9594
9595         * expression.cs (MakeByteBlob): Removed the hacks we had in place
9596         before we supported unsafe code.
9597         
9598         * makefile: add --unsafe to the self compilation of mcs.
9599
9600 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
9601
9602         * expression.cs (PointerArithmetic): New class that is used to
9603         perform pointer arithmetic.
9604         (Binary.Resolve): Handle pointer arithmetic
9605         Handle pointer comparission.
9606         (ArrayPtr): Utility expression class that is used to take the
9607         address of an array.
9608
9609         (ElementAccess): Implement array access for pointers
9610         
9611         * statement.cs (Fixed): Implement fixed statement for arrays, we
9612         are missing one more case before we are done.
9613
9614         * expression.cs (Indirection): Implement EmitAssign and set the
9615         ExprClass to Variable.  This allows pointer dereferences to be
9616         treated as variables, and to have values assigned to them.
9617         
9618         * ecore.cs (Expression.StoreFromPtr): New utility function to
9619         store values dereferencing.
9620
9621 2002-02-20  Ravi Pratap  <ravi@ximian.com>
9622
9623         * expression.cs (Binary.ResolveOperator): Ensure that we are
9624         not trying to operate on a void type - this fixes the reported
9625         bug.
9626
9627         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
9628         the parent implementation is sealed.
9629
9630         * ../errors/cs0239.cs : Add.
9631
9632         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
9633
9634         * typemanager.cs (unverifiable_code_type): Corresponds to 
9635         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
9636         which have unsafe code in them.
9637
9638         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
9639         unsafe context.
9640
9641 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
9642
9643         * cs-tokenizer.cs: Add support for @"litreal strings"
9644
9645         Make tokenizer accept pre-processor directives
9646         on any column (remove the old C-like limitation). 
9647
9648         * rootcontext.cs (EmitCode): Emit any global attributes.
9649         (AddGlobalAttributes): Used to keep track of assembly attributes. 
9650
9651         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
9652
9653         * cs-parser.jay: Add support for global attributes.  
9654
9655 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
9656
9657         * expression.cs (Indirection): New helper class.  Unary will
9658         create Indirection classes to be able to implement the
9659         IMemoryLocation interface on it.
9660
9661 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
9662
9663         * cs-parser.jay (fixed_statement): reference the right statement.
9664
9665         * statement.cs (Fixed.Emit): Finish implementing the fixed
9666         statement for the &x case.
9667
9668 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
9669
9670         * class.cs (Property.Define, Method.Define): Remove newslot when
9671         `implementing'.  
9672
9673         * modifiers.cs: My use of NewSlot when `Abstract' was set was
9674         wrong.  NewSlot should only be used if the `new' keyword is present.
9675
9676         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
9677         locating our system dir.  Sorry about this.
9678
9679 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
9680
9681         * driver.cs (GetSystemDir): Compute correctly the location of our
9682         system assemblies.  I was using the compiler directory instead of
9683         the library directory.
9684
9685 2002-02-13  Ravi Pratap  <ravi@ximian.com>
9686
9687         * expression.cs (BetterFunction): Put back in what Miguel commented out
9688         since it is the correct fix. The problem is elsewhere ;-)
9689
9690         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
9691         parameters of the parms method are themselves compatible or not !
9692
9693         (StandardConversionExists): Fix very dangerous bug where we were forgetting
9694         to check that a class implements an interface before saying that an implicit
9695         conversion was allowed. Use ImplementsInterface to do the checking.
9696
9697 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
9698
9699         * class.cs (Method.Define): Track whether we are an explicit
9700         implementation or not.  And only call DefineMethodOverride if we
9701         are an explicit implementation.
9702
9703         (Property.DefineMethod): Ditto.
9704
9705 2002-02-11  Ravi Pratap  <ravi@ximian.com>
9706
9707         * expression.cs (BetterFunction): Catch hideous bug which was
9708          preventing us from detecting ambiguous calls due to implicit casts i.e
9709         cs0121.
9710
9711 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
9712
9713         * support.cs (Pair): Remove un-needed method.  I figured why I was
9714         getting the error in cs-parser.jay, the variable in a foreach loop
9715         is readonly, and the compiler does not really treat this as a variable.
9716
9717         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
9718         instead of EQUALS in grammar.  
9719
9720         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
9721
9722         * expression.cs (Unary.DoResolve): Check whether the argument is
9723         managed or not.
9724
9725 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
9726
9727         * support.cs: Api for Pair to set a value.  Despite the fact that
9728         the variables are public the MS C# compiler refuses to compile
9729         code that accesses the field if the variable is part of a foreach
9730         statement. 
9731
9732         * statement.cs (Fixed): Begin implementation of the fixed
9733         statement.
9734
9735         (Block.AddVariable): Return the VariableInfo on success and null
9736         on failure instead of true/false. 
9737
9738         * cs-parser.jay (foreach): Catch errors on variables already
9739         defined (we were ignoring this value before) and properly unwind
9740         the block hierarchy
9741
9742         (fixed_statement): grammar for the fixed statement.
9743
9744 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
9745
9746         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
9747         pointer types to be incretemented.
9748
9749         (SizeOf): Implement.
9750
9751         * cs-parser.jay (pointer_member_access): Implement
9752         expr->IDENTIFIER production.
9753
9754         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
9755         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
9756         on safe contexts.
9757
9758         (Unary): Implement indirection.
9759
9760         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
9761         use in non-unsafe context).
9762
9763         (SimpleName.DoResolve): Check for pointers in field access on safe
9764         contexts. 
9765
9766         (Expression.LoadFromPtr): Factor the load-indirect code in this
9767         function.  This was duplicated in UnboxCast and ParameterReference
9768
9769 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
9770
9771         * expression.cs (ComposedCast): report an error if a pointer cast
9772         is used in a safe region.
9773
9774         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
9775         pointer type casts in unsafe context.
9776
9777         * codegen.cs (EmitContext): Set up IsUnsafe.
9778
9779         * cs-parser.jay (non_expression_type): Add productions for pointer
9780         casts. 
9781
9782         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
9783         code.  We should not use force into static mode if the method is
9784         not virtual.  Fixes bug in MIS
9785
9786         * statement.cs (Do.Emit, While.Emit, For.Emit,
9787         Statement.EmitBoolExpression): Add support to Do and While to
9788         propagate infinite loop as `I do return' semantics.
9789
9790         Improve the For case to also test for boolean constants.
9791
9792         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
9793         to the list of attributes we can add.
9794
9795         Remove `EmitContext' argument.
9796
9797         * class.cs (Method.Define): Apply parameter attributes.
9798         (Constructor.Define): Apply parameter attributes.
9799         (MethodCore.LabelParameters): Move here the core of labeling
9800         parameters. 
9801
9802         * support.cs (ReflectionParameters.ParameterModifier,
9803         InternalParameters.ParameterModifier): Use IsByRef on the type and
9804         only return the OUT bit for these parameters instead of in/out/ref
9805         flags.
9806
9807         This is because I miss-understood things.  The ParameterInfo.IsIn
9808         and IsOut represent whether the parameter has the [In] and [Out]
9809         attributes set.  
9810
9811 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
9812
9813         * ecore.cs (FieldExpr.Emit): Release temporaries.
9814
9815         * assign.cs (LocalTemporary.Release): new function.
9816
9817         * codegen.cs (EmitContext.GetTemporaryStorage,
9818         EmitContext.FreeTemporaryStorage): Rework the way we deal with
9819         temporary storage.  Now we can "put back" localbuilders when we
9820         are done with them
9821
9822 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
9823
9824         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
9825         need to make a copy of the variable to generate verifiable code.
9826
9827 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
9828
9829         * driver.cs: Compute dynamically the system directory.
9830
9831         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
9832         Slower, but more generally useful.  Used by the abstract
9833         registering implementation. 
9834
9835         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
9836         the rules for the special rule on Type/instances.  First check if
9837         we have the same name, and if so, try that special static path
9838         rather than the instance path.
9839         
9840 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
9841
9842         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
9843         for, while and if.
9844
9845         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
9846         Enum, ValueType, Delegate or Array for non-corlib compiles.
9847
9848         * cs-tokenizer.cs: Catch long identifiers (645)
9849
9850         * typemanager.cs (IndexerPropetyName): Ravi never tested this
9851         piece of code.
9852
9853         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
9854         fix, we were returning too early, so we were not registering
9855         pending methods from abstract classes.
9856
9857         Do not register pending methods if the class is abstract.
9858
9859         * expression.cs (Conditional.DoResolve): Report circular implicit
9860         conversions when we neecd to compute it for conditional
9861         expressions. 
9862
9863         (Is.DoResolve): If the expression is always of the provided type,
9864         flag warning 183.  If the expression can not ever be of the
9865         provided type flag warning 184.
9866
9867         * class.cs: Catch 169 as well.
9868
9869         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
9870         read. 
9871
9872 2002-01-18  Nick Drochak  <ndrochak@gol.com>
9873
9874         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
9875
9876 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
9877
9878         * interface.cs: (PopulateMethod): Check for pointers being defined
9879         only if the unsafe context is active.
9880         (PopulateProperty): ditto.
9881         (PopulateIndexer): ditto.
9882
9883         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
9884         specified.  If pointers are present, make sure that they are
9885         present in an unsafe context.
9886         (Constructor, Constructor.Define): ditto.
9887         (Field, Field.Define): ditto.
9888         (Property, Property.Define): ditto.
9889         (Event, Event.Define): ditto.
9890
9891         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
9892         hashtable if there are classes or structs defined.
9893
9894         * expression.cs (LocalVariableReference.DoResolve): Simplify this
9895         code, as the constant resolution moved.
9896
9897         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
9898         the metadata, so we can flag error 133. 
9899
9900         * decl.cs (MemberCore.UnsafeOK): New function to test that a
9901         pointer is being declared in an unsafe context.
9902
9903 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
9904
9905         * modifiers.cs (Modifiers.Check): Require a Location argument.
9906         Report error 227 for Unsafe use.
9907
9908         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
9909
9910         * statement.cs (For.Emit): If the test is null, then report that
9911         we do `return', as we wont reach anything afterwards.
9912
9913         (Switch.SwitchGoverningType): Track the expression that matched
9914         the conversion.
9915
9916         * driver.cs: Allow negative numbers as an error code to flag.
9917
9918         * cs-parser.jay: Handle 1551.
9919
9920         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
9921
9922 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
9923
9924         * cs-parser.jay: Report 1518 (type declaration can only contain
9925         class, struct, interface, enum or delegate)
9926
9927         (switch_label): Report 1523 (keywords `case' or `default' must
9928         preced code)
9929
9930         (opt_switch_sections): Report 1522 (empty switch)
9931
9932         * driver.cs: Report 1515 (response file specified multiple times)
9933         Report 1516 (Source file specified multiple times).
9934
9935         * expression.cs (Argument.Resolve): Signal 1510
9936
9937         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
9938         access not allowed in static code)
9939
9940 2002-01-11  Ravi Pratap  <ravi@ximian.com>
9941
9942         * typemanager.cs (IsPointerType): Utility method which we are going
9943         to need a lot.
9944
9945         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
9946         the object type, so we take care of that.
9947
9948         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
9949         
9950         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
9951         added to non-params parameters :-)
9952
9953         * typemanager.cs (CSharpName): Include 'void' type too. 
9954
9955         (void_ptr_type): Include in the set of core types.
9956
9957         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
9958         duplicating code.
9959
9960         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
9961         an unsafe context.
9962
9963         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
9964         completely forgotten about it.
9965
9966 2002-01-10  Ravi Pratap  <ravi@ximian.com>
9967
9968         * cs-parser.jay (pointer_type): Add. This begins our implementation
9969         of parsing rules for unsafe code.
9970
9971         (unsafe_statement): Implement.
9972
9973         (embedded_statement): Modify to include the above.
9974
9975         * statement.cs (Unsafe): Implement new class for unsafe blocks.
9976
9977         * codegen.cs (EmitContext.InUnsafe): Add. This determines
9978         if the current context is an unsafe one.
9979
9980         * cs-parser.jay (local_variable_pointer_type): Since local variable types
9981         are handled differently, we need separate rules for them.
9982
9983         (local_variable_declaration): Update to use local_variable_pointer_type
9984         to allow variable declarations of unmanaged pointer types.
9985
9986         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
9987         in unsafe contexts.
9988
9989         * ../errors/cs0214.cs : Add.
9990
9991 2002-01-16  Nick Drochak  <ndrochak@gol.com>
9992
9993         * makefile: remove 'response' file when cleaning.
9994
9995 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
9996
9997         * cs-parser.jay: Report 1524.
9998
9999 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
10000
10001         * typemanager.cs (RegisterMethod): drop checking if we have
10002         registered this from here
10003
10004 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
10005
10006         * class.cs (Method.EmitDestructor): Implement calling our base
10007         destructor. 
10008
10009         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
10010         value of InFinally.
10011
10012         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
10013         this routine and will wrap the call in a try/catch block.  Deal
10014         with the case.
10015
10016 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
10017
10018         * ecore.cs (Expression.MemberLookup): instead of taking a
10019         parameter `same_type' that was used to tell whether we could
10020         access private members we compute our containing type from the
10021         EmitContext.
10022
10023         (FieldExpr): Added partial support for volatile fields.  This does
10024         not work for volatile fields exposed from assemblies, as I can not
10025         figure out how to extract the modreq from it.
10026
10027         Updated all the source files to use this.
10028
10029         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
10030         because it is referenced by MemberLookup very often. 
10031
10032 2002-01-09  Ravi Pratap  <ravi@ximian.com>
10033
10034         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
10035         TypeBuilder.GetCustomAttributes to retrieve what we need.
10036
10037         Get rid of redundant default_member_attr_type as this is the same as
10038         default_member_type which already exists.
10039
10040         * interface.cs, attribute.cs : Update accordingly.
10041         
10042 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
10043
10044         * typemanager.cs: Enable IndexerPropertyName again.  It does not
10045         work for TYpeBuilders though.  Ravi, can you please fix this?
10046
10047         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
10048
10049         * expression.cs (Argument.Emit): Handle the case of ref objects
10050         being passed to ref functions;  
10051
10052         (ParameterReference.EmitLoad): Loads the content of the pointer
10053         without dereferencing.
10054
10055 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
10056
10057         * cs-tokenizer.cs: Implemented the pre-processing expressions.
10058
10059 2002-01-08  Ravi Pratap  <ravi@ximian.com>
10060
10061         * class.cs (Indexer.DefineMethod): Incorporate the interface
10062         type in the name of the method if we are doing explicit interface
10063         implementation.
10064
10065         * expression.cs (ConversionExists): Remove as it is completely obsolete.
10066
10067         (BetterConversion): Fix extremely trivial bug where we were referring to
10068         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
10069         again !
10070
10071         * ../errors/bug16.cs : Add although we have fixed it.
10072
10073 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
10074
10075         * expression.cs (BaseIndexer): Begin implementation.
10076
10077         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
10078
10079         * cs-parser.jay (indexer_declarator): Use qualified_identifier
10080         production directly to remove a shift/reduce, and implement
10081         explicit interface implementation.
10082
10083         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
10084         after a floating point suffix.
10085
10086         * expression.cs (DoNumericPromotions): Improved the conversion for
10087         uint/uint.  If we have a constant, we avoid doing a typecast to a
10088         larger type.
10089
10090         * class.cs (Indexer): Implement explicit interface implementation
10091         for indexers.
10092         
10093 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
10094
10095         * class.cs: make the default instance constructor public and hidebysig.
10096
10097 2001-01-03  Ravi Pratap  <ravi@ximian.com>
10098
10099         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
10100         so we can call it from elsewhere.
10101
10102         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
10103         we emit it internally if the class has a defined indexer; otherwise the user
10104         emits it by decorating the class definition with the DefaultMemberAttribute.
10105
10106         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
10107         attribute is not used on a type which defines an indexer.
10108
10109         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
10110         character when we skip whitespace.
10111
10112         * ../errors/cs0646.cs : Add.
10113
10114 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
10115
10116         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
10117         again. 
10118
10119         * makefile: Add practical target `mcs3.exe' which builds the third
10120         generation compiler. 
10121
10122         * expression.cs (New): Fix structures constructor calling.
10123
10124         * class.cs (Property, Method, Indexer): Emit Final flag on the
10125         method if we are an interface implementation and we are not
10126         abstract. 
10127
10128         * ecore.cs (PropertyExpr): New public field `IsBase', tells
10129         whether this property is referencing a `base' method.
10130
10131         * expression.cs (Invocation.EmitCall): take an extra argument:
10132         is_base, this is used to determine whether the `call' or
10133         `callvirt' opcode should be used.
10134
10135         
10136         * delegate.cs: update EmitCall.
10137
10138         * class.cs (Method.Define): Set NewSlot for the cases where we are
10139         not implementing an interface method.
10140
10141         (Property.Define): ditto.
10142
10143 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
10144
10145         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
10146         'r'.  Allows mcs to parse itself fully.
10147
10148 2002-01-02  Ravi Pratap  <ravi@ximian.com>
10149
10150         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
10151         of the number of initializers that require the InitializeArray method.
10152
10153         (CheckIndices): Store the Expression in all cases - not the plain value. Also
10154         update the above field where necessary.
10155
10156         (MakeByteBlob): Update accordingly.
10157
10158         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
10159         greater than 2.
10160
10161         (EmitDynamicInitializers): Update in accordance with the new optimization.
10162
10163         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
10164         same OpCode applies.
10165
10166         * cs-parser.jay : Fix some glaring errors I introduced.
10167
10168 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
10169
10170         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
10171         so that we can check for name clashes there too.
10172
10173         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
10174         for interface indexers.
10175
10176         * interfaces.cs (Define): Emit the default member attribute.
10177
10178         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
10179         variable was being referred to while setting the value ;-)
10180
10181 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
10182
10183         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
10184         byte-by-byte information when we know the data is zero.
10185
10186         Make the block always a multiple of 4, because
10187         DefineInitializedData has a bug.
10188
10189         * assign.cs: Fix, we should assign from the temporary, not from
10190         the source. 
10191
10192         * expression.cs (MakeByteBlob): Fix my incorrect code.
10193
10194 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
10195
10196         * typemanager.cs (EnumToUnderlying): This function is used to get
10197         the underlying type from an enumeration, because it does not
10198         always work. 
10199
10200         * constant.cs: Use the I4_S form for values between -128 and 127.
10201
10202         * statement.cs (Block.LookupLabel): Looks up a label.
10203         (Block): Drop support for labeled blocks.
10204
10205         (LabeledStatement): New kind of statement that represents a label
10206         only.
10207
10208         (Goto): Finally implement this bad boy.
10209         
10210         * cs-parser.jay: Update to reflect new mechanism to implement
10211         labels.
10212
10213 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
10214
10215         * codegen.cs (EmitContext.This): a codegen property that keeps the
10216         a single instance of this instead of creating many different this
10217         instances. 
10218
10219         * delegate.cs (Delegate.DoResolve): Update to use the property;
10220
10221         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
10222
10223         * expression.cs (BaseAccess.DoResolve): Ditto.
10224
10225 2001-12-29  Ravi Pratap  <ravi@ximian.com>
10226
10227         * typemanager.cs (methodimpl_attr_type): Add to hold the type
10228         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
10229
10230         (InitCoreTypes): Update accordingly.
10231
10232         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
10233         so we can quickly store the state.
10234
10235         (ApplyAttributes): Set the correct implementation flags
10236         for InternalCall methods.
10237
10238 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
10239
10240         * expression.cs (EmitCall): if a method is not virtual, then do
10241         not use callvirt on it.
10242
10243         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
10244         user defined stuff) requires the use of stobj, which takes an
10245         address on the stack instead of an array and an index.  So emit
10246         the Ldelema operation for it.
10247
10248         (EmitStoreOpcode): Use stobj for valuetypes.
10249
10250         (UnaryMutator.EmitCode): Use the right 1 value depending on
10251         whether we are dealing with int64/uint64, float or doubles.
10252
10253         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
10254         constructors that I implemented last night.
10255
10256         (Constructor.IsDefault): Fix to work properly for static
10257         constructors.
10258
10259         * cs-parser.jay (CheckDef): report method signature errors.
10260         Update error number 103 to be 132.
10261
10262         * decl.cs: New AdditionResult enumeration value: MethodExists.
10263         Although we do this check for methods later on in the semantic
10264         analysis, catching repeated default constructors is so easy that
10265         we catch these here. 
10266         
10267         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
10268         promotions code.
10269
10270         (ParameterReference.EmitAssign, Emit): handle
10271         bools as bytes.
10272
10273         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
10274         (ArrayAccess.EmitStoreOpcode): ditto.
10275
10276         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
10277
10278         * expression.cs (MakeByteBlob): Complete all the missing types
10279         (uint, short, ushort, byte, sbyte)
10280
10281         * class.cs: Only init instance field initializers on instance
10282         constructors. 
10283
10284         Rename `constructors' to instance_constructors. 
10285
10286         (TypeContainer.AddConstructor): Only add constructors to the list
10287         if it is not static.
10288
10289         Make sure that we handle default_static_constructor independently
10290         everywhere where we handle instance_constructors
10291
10292 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
10293
10294         * class.cs: Do not lookup or create a base initializer for a
10295         static constructor.
10296
10297         (ConstructorInitializer.Resolve): use the proper type to lookup
10298         for constructors.
10299
10300         * cs-parser.jay: Report error 1585 (modifiers between type and name).
10301
10302         * enum.cs, interface.cs: Remove CloseType, this is taken care by
10303         in DeclSpace. 
10304
10305         * decl.cs: CloseType is now an virtual method, the default
10306         implementation just closes this type.
10307         
10308 2001-12-28  Ravi Pratap  <ravi@ximian.com>
10309
10310         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
10311         to PreserveSig by default. Also emit HideBySig on such methods.
10312
10313         Basically, set the defaults to standard values.
10314
10315         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
10316         argument, if candidate is better, it can't be worse than the best !
10317
10318         (Invocation): Re-write bits to differentiate between methods being
10319         applicable in their expanded form and their normal form - for params
10320         methods of course.
10321
10322         Get rid of use_standard everywhere as only standard conversions are allowed
10323         in overload resolution. 
10324
10325         More spec conformance.
10326         
10327 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
10328
10329         * driver.cs: Add --timestamp, to see where the compiler spends
10330         most of its time.
10331
10332         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
10333         `this' in static code.
10334
10335         (SimpleName.DoResolve): Implement in terms of a helper function
10336         that allows static-references to be passed upstream to
10337         MemberAccess.
10338
10339         (Expression.ResolveWithSimpleName): Resolve specially simple
10340         names when called by MemberAccess to implement the special
10341         semantics. 
10342
10343         (Expression.ImplicitReferenceConversion): Handle conversions from
10344         Null to reference types before others, as Null's type is
10345         System.Object. 
10346
10347         * expression.cs (Invocation.EmitCall): Handle the special case of
10348         calling methods declared on a reference type from a ValueType
10349         (Base classes System.Object and System.Enum)
10350
10351         (MemberAccess.Resolve): Only perform lookups on Enumerations if
10352         the left hand side is a TypeExpr, not on every enumeration. 
10353
10354         (Binary.Resolve): If types are reference types, then do a cast to
10355         object on operators != and == of both arguments.
10356         
10357         * typemanager.cs (FindMembers): Extract instance and static
10358         members if requested.
10359
10360         * interface.cs (PopulateProperty): Use void_type instead of null
10361         as the return type for the setter method.
10362
10363         (PopulateIndexer): ditto.
10364
10365 2001-12-27  Ravi Pratap  <ravi@ximian.com>
10366
10367         * support.cs (ReflectionParameters): Fix minor bug where we
10368         were examining the wrong parameter for the ParamArray attribute.
10369
10370         Cope with requests for the type of the parameter at position
10371         greater than the params parameter's. We now return the element
10372         type of the params array as that makes more sense.
10373
10374         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
10375         accordingly as we no longer have to extract the element type
10376         ourselves.
10377
10378         (Invocation.OverloadResolve): Update.
10379
10380 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
10381
10382         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
10383         against IEnumerator, test whether the return value is a descendant
10384         of the IEnumerator interface.
10385
10386         * class.cs (Indexer.Define): Use an auxiliary method to implement
10387         the other bits of the method definition.  Begin support for
10388         explicit interface implementation.
10389
10390         (Property.DefineMethod): Use TypeManager.void_type instead of null
10391         for an empty return value.
10392
10393 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
10394
10395         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
10396         dealing with a FieldExpr which is composed of a FieldBuilder, in
10397         the code path we did extract the constant, but we should have
10398         obtained the underlying value to be able to cast it (otherwise we
10399         end up in an infinite loop, this is what Ravi was running into).
10400
10401         (ArrayCreation.UpdateIndices): Arrays might be empty.
10402
10403         (MemberAccess.ResolveMemberAccess): Add support for section
10404         14.5.4.1 that deals with the special case of E.I when E is a type
10405         and something else, that I can be a reference to a static member.
10406
10407         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
10408         handle a particular array type to create byte blobs, it is just
10409         something we dont generate byteblobs for.
10410
10411         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
10412         arguments. 
10413
10414         * location.cs (Push): remove the key from the hashtable that we
10415         are about to add.   This happens for empty files.
10416
10417         * driver.cs: Dispose files after we have parsed them.
10418
10419         (tokenize): new function that only runs the tokenizer on its
10420         input, for speed testing.
10421
10422 2001-12-26  Ravi Pratap  <ravi@ximian.com>
10423
10424         * class.cs (Event.Define): Define the private field only if there
10425         are no accessors defined.
10426
10427         * expression.cs (ResolveMemberAccess): If there is no associated
10428         field with the event, that means we have an event defined with its
10429         own accessors and we should flag error cs0070 since transforming
10430         ourselves into a field is not valid in that case.
10431
10432         * ecore.cs (SimpleName.DoResolve): Same as above.
10433
10434         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
10435         and charset to sane values.
10436
10437 2001-12-25  Ravi Pratap  <ravi@ximian.com>
10438
10439         * assign.cs (DoResolve): Perform check on events only if they 
10440         are being accessed outside the declaring type.
10441
10442         * cs-parser.jay (event_declarations): Update rules to correctly
10443         set the type of the implicit parameter etc.
10444
10445         (add_accessor, remove_accessor): Set current local parameters.
10446
10447         * expression.cs (Binary): For delegate addition and subtraction,
10448         cast the return value from the method into the appropriate delegate
10449         type.
10450
10451 2001-12-24  Ravi Pratap  <ravi@ximian.com>
10452
10453         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
10454         of these as the workaround is unnecessary.
10455
10456         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
10457         delegate data - none of that is needed at all.
10458
10459         Re-write bits to extract the instance expression and the delegate method
10460         correctly.
10461
10462         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
10463         on delegates too.
10464
10465         * attribute.cs (ApplyAttributes): New method to take care of common tasks
10466         of attaching attributes instead of duplicating code everywhere.
10467
10468         * everywhere : Update code to do attribute emission using the above method.
10469
10470 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
10471
10472         * expression.cs (IsParamsMethodApplicable): if there are not
10473         parameters, return immediately.
10474
10475         * ecore.cs: The 0 literal can be implicity converted to an enum
10476         type. 
10477
10478         (SimpleName.DoResolve): First lookup the type, then lookup the
10479         members. 
10480
10481         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
10482         want to get its address.  If the InstanceExpression is not
10483         addressable, store the result in a temporary variable, then get
10484         the address of it.
10485
10486         * codegen.cs: Only display 219 errors on warning level or above. 
10487
10488         * expression.cs (ArrayAccess): Make it implement the
10489         IMemoryLocation interface.
10490
10491         (Binary.DoResolve): handle the operator == (object a, object b)
10492         and operator != (object a, object b) without incurring into a
10493         BoxedCast (because 5 != o should never be performed).
10494
10495         Handle binary enumerator operators.
10496
10497         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
10498         value type, otherwise use Ldelem_ref.
10499
10500         Use precomputed names;
10501
10502         (AddressOf): Implement address of
10503
10504         * cs-parser.jay (labeled_statement): Fix recursive block
10505         addition by reworking the production.
10506
10507         * expression.cs (New.DoEmit): New has a special case:
10508                 
10509                  If we are dealing with a ValueType, we have a few
10510                  situations to deal with:
10511                 
10512                     * The target of New is a ValueType variable, that is
10513                       easy, we just pass this as the variable reference
10514                 
10515                     * The target of New is being passed as an argument,
10516                       to a boxing operation or a function that takes a
10517                       ValueType.
10518                 
10519                       In this case, we need to create a temporary variable
10520                       that is the argument of New.
10521
10522
10523 2001-12-23  Ravi Pratap  <ravi@ximian.com>
10524
10525         * rootcontext.cs (LookupType): Check that current_type is not null before
10526         going about looking at nested types.
10527
10528         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
10529         not implement the IAssignMethod interface any more.
10530
10531         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
10532         where we tranform them into FieldExprs if they are being resolved from within
10533         the declaring type.
10534
10535         * ecore.cs (SimpleName.DoResolve): Do the same here.
10536
10537         * assign.cs (DoResolve, Emit): Clean up code considerably. 
10538
10539         * ../errors/bug10.cs : Add.
10540
10541         * ../errors/cs0070.cs : Add.
10542
10543         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
10544
10545         * assign.cs : Get rid of EventIsLocal everywhere.
10546         
10547 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
10548
10549         * ecore.cs (ConvertIntLiteral): finished the implementation.
10550
10551         * statement.cs (SwitchLabel): Convert the value we are using as a
10552         key before looking up the table.
10553
10554 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
10555
10556         * codegen.cs (EmitTopBlock): Require a Location argument now.
10557
10558         * cs-parser.jay (constructor_declarator): We need to setup
10559         current_local_parameters before we parse the
10560         opt_constructor_initializer, to allow the variables to be bound
10561         to the constructor arguments.
10562
10563         * rootcontext.cs (LookupType): First lookup nested classes in our
10564         class and our parents before we go looking outside our class.
10565
10566         * expression.cs (ConstantFold): Extract/debox the values at the
10567         beginnning. 
10568
10569         * rootcontext.cs (EmitCode): Resolve the constants first before we
10570         resolve the types.  This is not really needed, but it helps debugging.
10571
10572         * statement.cs: report location.
10573         
10574         * cs-parser.jay: pass location to throw statement.
10575
10576         * driver.cs: Small bug fix.
10577
10578         * report.cs: Updated format to be 4-zero filled digits.
10579
10580 2001-12-22  Ravi Pratap  <ravi@ximian.com>
10581
10582         * expression.cs (CheckIndices): Fix minor bug where the wrong
10583         variable was being referred to ;-)
10584
10585         (DoEmit): Do not call EmitStaticInitializers when the 
10586         underlying type is System.Object.
10587
10588 2001-12-21  Ravi Pratap  <ravi@ximian.com>
10589
10590         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
10591         and do the usual workaround for SRE.
10592
10593         * class.cs (MyEventBuilder.EventType): New member to get at the type
10594         of the event, quickly.
10595
10596         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
10597
10598         * assign.cs (Assign.DoResolve): Handle the case when the target
10599         is an EventExpr and perform the necessary checks.
10600
10601         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
10602         interface.
10603
10604         (SimpleName.MemberStaticCheck): Include check for EventExpr.
10605
10606         (EventExpr): Set the type in the constructor itself since we 
10607         are meant to be born fully resolved.
10608
10609         (EventExpr.Define): Revert code I wrote earlier.
10610                 
10611         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
10612         instance expression is null. The instance expression is a This in that case
10613         or a null, depending on whether it is a static method or not.
10614
10615         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
10616         refers to more than one method.
10617
10618         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
10619         and accordingly flag errors.
10620
10621 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
10622
10623         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
10624
10625 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
10626
10627         * location.cs (ToString): Provide useful rutine.
10628
10629 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
10630
10631         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
10632         objects, return the actual integral boxed.
10633
10634         * statement.cs (SwitchLabel): define an ILLabel for each
10635         SwitchLabel. 
10636         
10637         (Switch.CheckSwitch): If the value is a Literal, extract
10638         the underlying literal.
10639         
10640         Also in the unused hashtable we had, add the SwitchLabel so we can
10641         quickly look this value up.
10642
10643         * constant.cs: Implement a bunch of new constants.  Rewrite
10644         Literal based on this.  Made changes everywhere to adapt to this.
10645         
10646         * expression.cs (Expression.MakeByteBlob): Optimize routine by
10647         dereferencing array only once, and also copes with enumrations.
10648
10649         bytes are two bytes wide, not one.
10650
10651         (Cast): Perform constant conversions.
10652         
10653         * ecore.cs (TryImplicitIntConversion): Return literals instead of
10654         wrappers to the literals here.
10655
10656         * expression.cs (DoNumericPromotions): long literals can converted
10657         to ulong implicity (this is taken care of elsewhere, but I was
10658         missing this spot).
10659
10660         * ecore.cs (Expression.Literalize): Make the return type Literal,
10661         to improve type checking.
10662
10663         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
10664
10665 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
10666
10667         * literal.cs: Revert code from ravi that checked the bounds.  The
10668         bounds are sane by the definition of the type itself. 
10669
10670         * typemanager.cs: Fix implementation of ImplementsInterface.  We
10671         need to actually look up in our parent hierarchy for interfaces
10672         implemented. 
10673
10674         * const.cs: Use the underlying type for enumerations
10675
10676         * delegate.cs: Compute the basename for the delegate creation,
10677         that should fix the delegate test case, and restore the correct
10678         Type Lookup semantics in rootcontext
10679
10680         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
10681         referencing a nested type with the Reflection API is using the "+"
10682         sign. 
10683
10684         * cs-parser.jay: Do not require EOF token at the end.
10685
10686 2001-12-20  Ravi Pratap  <ravi@ximian.com>
10687
10688         * rootcontext.cs (LookupType): Concatenate type names with
10689         a '.' instead of a '+' The test suite passes again.
10690
10691         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
10692         field of the enumeration.
10693
10694         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
10695         the case when the member is an EventExpr.
10696
10697         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
10698         static has an associated instance expression.
10699
10700         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
10701
10702         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
10703
10704         * class.cs (Event.Define): Register event and perform appropriate checks
10705         for error #111.
10706
10707         We define the Add and Remove methods even if the use provides none because
10708         in that case, we provide default implementations ourselves.
10709
10710         Define a private field of the type of the event. This is done by the CSC compiler
10711         and we should be doing it too ;-)
10712
10713         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
10714         More methods we use in code we generate.
10715
10716         (multicast_delegate_type, delegate_type): Two separate types since the distinction
10717         is important.
10718
10719         (InitCoreTypes): Update accordingly for the above.
10720
10721         * class.cs (Event.Emit): Generate code for default accessors that we provide
10722
10723         (EmitDefaultMethod): Do the job in the above.
10724
10725         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
10726         appropriate place.
10727
10728 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
10729
10730         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
10731         builders even if we were missing one.
10732
10733         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
10734         pass the Basename as our class name instead of the Name.  The
10735         basename will be correctly composed for us.
10736
10737         * parameter.cs (Paramters): Now takes a Location argument.
10738
10739         * decl.cs (DeclSpace.LookupType): Removed convenience function and
10740         make all the code call directly LookupType in RootContext and take
10741         this chance to pass the Location information everywhere.
10742
10743         * Everywhere: pass Location information.
10744
10745 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
10746
10747         * class.cs (Constructor.Define): Updated way of detecting the
10748         length of the parameters.
10749
10750         (TypeContainer.DefineType): Use basename as the type name for
10751         nested types.
10752
10753         (TypeContainer.Define): Do not recursively define types here, as
10754         definition is taken care in order by the RootContext.
10755
10756         * tree.cs: Keep track of namespaces in a per-file basis.
10757
10758         * parameter.cs (Parameter.ComputeSignature): Update to use
10759         DeclSpace. 
10760
10761         (Parameters.GetSignature): ditto.
10762
10763         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
10764         instead of a TypeContainer.
10765
10766         (Interface.SemanticAnalysis): Use `this' instead of our parent to
10767         resolve names.  Because we need to be resolve in our context, not
10768         our parents.
10769         
10770         * driver.cs: Implement response files.
10771
10772         * class.cs (TypeContainer.DefineType): If we are defined, do not
10773         redefine ourselves.
10774         
10775         (Event.Emit): Emit the code for add/remove handlers.
10776         (Event.Define): Save the MethodBuilders for add/remove.
10777
10778         * typemanager.cs: Use pair here too.
10779
10780         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
10781         DictionaryEntry requires the first argument to be non-null.  
10782         
10783         (enum_declaration): Compute full name for registering the
10784         enumeration.
10785         
10786         (delegate_declaration): Instead of using
10787         formal_parameter_list, use opt_formal_parameter_list as the list
10788         can be empty.
10789
10790         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
10791         (EventParsing): New property that controls whether `add' and
10792         `remove' are returned as tokens or identifiers (for events);
10793
10794 2001-12-19  Ravi Pratap  <ravi@ximian.com>
10795
10796         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
10797         use MyEventBuilder only and let it wrap the real builder for us.
10798
10799         (MyEventBuilder): Revamp constructor etc.
10800
10801         Implement all operations that we perform on EventBuilder in precisely the same
10802         way here too.
10803
10804         (FindMembers): Update to use the EventBuilder member.
10805
10806         (Event.Emit): Update accordingly.
10807
10808 2001-12-18  Ravi Pratap  <ravi@ximian.com>
10809
10810         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
10811         by calling the appropriate methods.
10812
10813         (GetCustomAttributes): Make stubs as they cannot possibly do anything
10814         useful.
10815
10816         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
10817
10818 2001-12-17  Ravi Pratap  <ravi@ximian.com>
10819
10820         * delegate.cs (Delegate.Populate): Check that the return type
10821         and various parameters types are indeed accessible.
10822
10823         * class.cs (Constructor.Define): Same here.
10824
10825         (Field.Define): Ditto.
10826
10827         (Event.Define): Ditto.
10828
10829         (Operator.Define): Check that the underlying Method defined itself
10830         correctly - so it's MethodBuilder should not be null.
10831
10832         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
10833         expression happens to be null.
10834
10835         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
10836         members but as of now we don't seem to be able to do anything really useful with it.
10837
10838         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
10839         not the EventBuilder.
10840
10841 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
10842
10843         * cs-tokenizer.cs: Add support for defines.
10844         Add support for #if, #elif, #else, #endif
10845         
10846         (eval_var): evaluates a variable.
10847         (eval): stubbed for evaluating functions.
10848
10849         * cs-parser.jay: Pass the defines information
10850
10851         * driver.cs: Add --define command line option.
10852
10853         * decl.cs: Move MemberCore here.
10854
10855         Make it the base class for DeclSpace.  This allows us to catch and
10856         report 108 and 109 for everything now.
10857
10858         * class.cs (TypeContainer.Define): Extract all the members
10859         before populating and emit the warning 108 (new keyword required
10860         to override) instead of having each member implement this.
10861
10862         (MemberCore.Define): New abstract method, we will be using this in
10863         the warning reporting engine in Populate.
10864         
10865         (Operator.Define): Adjust to new MemberCore protocol. 
10866
10867         * const.cs (Const): This does not derive from Expression, it is a
10868         temporary object we use to create fields, it is a MemberCore. 
10869
10870         * class.cs (Method.Define): Allow the entry point to be in a
10871         specific class.
10872
10873         * driver.cs: Rewrite the argument handler to clean it up a bit.
10874
10875         * rootcontext.cs: Made it just an auxiliary namespace feature by
10876         making everything static.
10877
10878         * driver.cs: Adapt code to use RootContext type name instead of
10879         instance variable.
10880
10881         * delegate.cs: Remove RootContext argument.
10882
10883         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
10884         argument. 
10885
10886         * class.cs (Event.Define): The lookup can fail.
10887         
10888         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
10889
10890         * expression.cs: Resolve the this instance before invoking the code.
10891
10892 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
10893
10894         * cs-parser.jay: Add a production in element_access that allows
10895         the thing to become a "type" reference.  This way we can parse
10896         things like "(string [])" as a type.
10897
10898         Note that this still does not handle the more complex rules of
10899         casts. 
10900         
10901
10902         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
10903
10904         * ecore.cs: (CopyNewMethods): new utility function used to
10905         assemble the list of methods from running FindMembers.
10906
10907         (MemberLookup): Rework FindMembers so that 
10908
10909 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
10910
10911         * class.cs (TypeContainer): Remove Delegates who fail to be
10912         defined.
10913
10914         * delegate.cs (Populate): Verify that we dont get null return
10915         values.   TODO: Check for AsAccessible.
10916
10917         * cs-parser.jay: Use basename to emit error 574 (destructor should
10918         have the same name as container class), not the full name.
10919
10920         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
10921         possible representation.  
10922
10923         Also implements integer type suffixes U and L.
10924
10925 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
10926
10927         * expression.cs (ArrayCreation.DoResolve): We need to do the
10928         argument resolution *always*.
10929
10930         * decl.cs: Make this hold the namespace.  Hold the root context as
10931         well.
10932         (LookupType): Move here.
10933
10934         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
10935
10936         * location.cs (Row, Name): Fixed the code, it was always returning
10937         references to the first file.
10938
10939         * interface.cs: Register properties defined through interfaces.
10940
10941         * driver.cs: Add support for globbing on the command line
10942
10943         * class.cs (Field): Make it derive from MemberCore as well.
10944         (Event): ditto.
10945
10946 2001-12-15  Ravi Pratap  <ravi@ximian.com>
10947
10948         * class.cs (Event::Define): Check that the type of the event is a delegate
10949         type else flag error #66.
10950
10951         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
10952         same.
10953
10954         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
10955         values of EntryPoint, CharSet etc etc.
10956
10957         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
10958
10959         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
10960         be null and we should ignore this. I am not sure if this is really clean. Apparently,
10961         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
10962         which needs this to do its work.
10963
10964         * ../errors/cs0066.cs : Add.
10965
10966 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
10967
10968         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
10969         helper functions.
10970
10971         * class.cs: (MethodSignature.MethodSignature): Removed hack that
10972         clears out the parameters field.
10973         (MemberSignatureCompare): Cleanup
10974
10975         (MemberCore): New base class used to share code between MethodCore
10976         and Property.
10977
10978         (RegisterRequiredImplementations) BindingFlags.Public requires
10979         either BindingFlags.Instace or Static.  Use instance here.
10980
10981         (Property): Refactored code to cope better with the full spec.
10982
10983         * parameter.cs (GetParameterInfo): Return an empty array instead
10984         of null on error.
10985
10986         * class.cs (Property): Abstract or extern properties have no bodies.
10987
10988         * parameter.cs (GetParameterInfo): return a zero-sized array.
10989
10990         * class.cs (TypeContainer.MethodModifiersValid): Move all the
10991         method modifier validation to the typecontainer so we can reuse
10992         this on properties.
10993
10994         (MethodCore.ParameterTypes): return an empty sized array of types.
10995
10996         (Property.Define): Test property modifier validity.
10997
10998         Add tests for sealed/override too.
10999
11000         (Method.Emit): abstract or extern methods have no bodies.
11001
11002 2001-12-14  Ravi Pratap  <ravi@ximian.com>
11003
11004         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
11005         thing.
11006
11007         (Method::Define, ::Emit): Modify accordingly.
11008
11009         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
11010
11011         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
11012
11013         * makefile: Pass in /unsafe.
11014
11015 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
11016
11017         * class.cs (MakeKey): Kill routine.
11018         
11019         * class.cs (TypeContainer.Define): Correctly define explicit
11020         method implementations (they require the full interface name plus
11021         the method name).
11022
11023         * typemanager.cs: Deply the PtrHashtable here and stop using the
11024         lame keys.  Things work so much better.
11025
11026         This of course broke everyone who depended on `RegisterMethod' to
11027         do the `test for existance' test.  This has to be done elsewhere.
11028
11029         * support.cs (PtrHashtable): A hashtable that avoid comparing with
11030         the object stupid Equals method (because, that like fails all over
11031         the place).  We still do not use it.
11032
11033         * class.cs (TypeContainer.SetRequiredInterface,
11034         TypeContainer.RequireMethods): Killed these two routines and moved
11035         all the functionality to RegisterRequiredImplementations.
11036
11037         (TypeContainer.RegisterRequiredImplementations): This routine now
11038         registers all the implementations required in an array for the
11039         interfaces and abstract methods.  We use an array of structures
11040         which can be computed ahead of time to reduce memory usage and we
11041         also assume that lookups are cheap as most classes will not
11042         implement too many interfaces.
11043
11044         We also avoid creating too many MethodSignatures.
11045
11046         (TypeContainer.IsInterfaceMethod): Update and optionally does not
11047         clear the "pending" bit if we find that there are problems with
11048         the declaration.
11049
11050         (TypeContainer.VerifyPendingMethods): Update to report errors of
11051         methods that look like implementations but are not.
11052
11053         (TypeContainer.Define): Add support for explicit interface method
11054         implementation. 
11055         
11056 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
11057
11058         * typemanager.cs: Keep track of the parameters here instead of
11059         being a feature of the TypeContainer.
11060
11061         * class.cs: Drop the registration of parameters here, as
11062         InterfaceMethods are also interface declarations.
11063
11064         * delegate.cs: Register methods with the TypeManager not only with
11065         the TypeContainer.  This code was buggy.
11066
11067         * interface.cs: Full registation here.
11068
11069 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
11070
11071         * expression.cs: Remove reducer for binary expressions, it can not
11072         be done this way.
11073
11074         * const.cs: Put here the code that used to go into constant.cs
11075
11076         * constant.cs: Put here the code for constants, this is a new base
11077         class for Literals.
11078
11079         * literal.cs: Make Literal derive from Constant.
11080
11081 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
11082
11083         * statement.cs (Return.Emit): Report error 157 if the user
11084         attempts to return from a finally block.
11085
11086         (Return.Emit): Instead of emitting a return, jump to the end of
11087         the function.
11088
11089         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
11090         LocalBuilder to store the result of the function.  ReturnLabel is
11091         the target where we jump.
11092         
11093
11094 2001-12-09  Radek Doulik  <rodo@ximian.com>
11095
11096         * cs-parser.jay: remember alias in current namespace
11097
11098         * ecore.cs (SimpleName::DoResolve): use aliases for types or
11099         namespaces
11100
11101         * class.cs (LookupAlias): lookup alias in my_namespace
11102
11103         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
11104         aliases hashtable
11105         (LookupAlias): lookup alias in this and if needed in parent
11106         namespaces
11107
11108 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
11109
11110         * support.cs: 
11111
11112         * rootcontext.cs: (ModuleBuilder) Made static, first step into
11113         making things static.  I need this to avoid passing the
11114         TypeContainer when calling ParameterType.
11115
11116         * support.cs (InternalParameters.ParameterType): Remove ugly hack
11117         that did string manipulation to compute the type and then call
11118         GetType.  Use Parameter.ParameterType instead.
11119
11120         * cs-tokenizer.cs: Consume the suffix for floating values.
11121
11122         * expression.cs (ParameterReference): figure out whether this is a
11123         reference parameter or not.  Kill an extra variable by computing
11124         the arg_idx during emission.
11125
11126         * parameter.cs (Parameters.GetParameterInfo): New overloaded
11127         function that returns whether a parameter is an out/ref value or not.
11128
11129         (Parameter.ParameterType): The type of the parameter (base,
11130         without ref/out applied).
11131         
11132         (Parameter.Resolve): Perform resolution here.
11133         (Parameter.ExternalType): The full type (with ref/out applied).
11134
11135         * statement.cs (Using.Emit, Using.EmitExpression): Implement
11136         support for expressions on the using statement.
11137
11138 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
11139
11140         * statement.cs (Using.EmitLocalVariableDecls): Split the
11141         localvariable handling of the using statement.
11142
11143         (Block.EmitMeta): Keep track of variable count across blocks.  We
11144         were reusing slots on separate branches of blocks.
11145
11146         (Try.Emit): Emit the general code block, we were not emitting it. 
11147
11148         Check the type of the declaration to be an IDisposable or
11149         something that can be implicity converted to it. 
11150
11151         Emit conversions if required.
11152
11153         * ecore.cs (EmptyExpression): New utility class.
11154         (Expression.ImplicitConversionExists): New utility function.
11155
11156 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
11157
11158         * statement.cs (Using): Implement.
11159
11160         * expression.cs (LocalVariableReference): Support read only variables.
11161
11162         * statement.cs: Remove the explicit emit for the Leave opcode.
11163         (VariableInfo): Add a readonly field.
11164
11165 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
11166
11167         * ecore.cs (ConvCast): new class used to encapsulate the various
11168         explicit integer conversions that works in both checked and
11169         unchecked contexts.
11170
11171         (Expression.ConvertNumericExplicit): Use new ConvCast class to
11172         properly generate the overflow opcodes.
11173
11174 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
11175
11176         * statement.cs: The correct type for the EmptyExpression is the
11177         element_type, not the variable type.  Ravi pointed this out.
11178
11179 2001-12-04  Ravi Pratap  <ravi@ximian.com>
11180
11181         * class.cs (Method::Define): Handle PInvoke methods specially
11182         by using DefinePInvokeMethod instead of the usual one.
11183
11184         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
11185         above to do the task of extracting information and defining the method.
11186         
11187 2001-12-04  Ravi Pratap  <ravi@ximian.com>
11188
11189         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
11190         of the condition for string type.
11191
11192         (Emit): Move that here. 
11193
11194         (ArrayCreation::CheckIndices): Keep string literals in their expression
11195         form.
11196
11197         (EmitDynamicInitializers): Handle strings appropriately.
11198
11199 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
11200
11201         * codegen.cs (EmitContext): Replace multiple variables with a
11202         single pointer to the current Switch statement.
11203
11204         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
11205         EmitContext.
11206
11207 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
11208
11209         * statement.cs 
11210
11211         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
11212         default'.
11213         
11214         (Foreach.Emit): Foreach on arrays was not setting
11215         up the loop variables (for break/continue).
11216
11217         (GotoCase): Semi-implented.
11218         
11219 2001-12-03  Ravi Pratap  <ravi@ximian.com>
11220
11221         * attribute.cs (CheckAttribute): Handle system attributes by using
11222         Attribute.GetAttributes to examine information we need.
11223
11224         (GetValidPlaces): Same here.
11225
11226         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
11227
11228         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
11229
11230         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
11231
11232         (Method::Define): Set appropriate flags if we have a DllImport attribute.
11233
11234         (Method::Emit): Handle the case when we are a PInvoke method.
11235
11236 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
11237
11238         * expression.cs: Use ResolveWithSimpleName on compound names.
11239
11240 2001-12-02  Ravi Pratap  <ravi@ximian.com>
11241
11242         * constant.cs (EmitConstant): Make sure we resolve the associated expression
11243         before trying to reduce it.
11244
11245         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
11246
11247         * constant.cs (LookupConstantValue): Implement.
11248
11249         (EmitConstant): Use the above in emitting the constant.
11250
11251         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
11252         that are user-defined by doing a LookupConstantValue on them.
11253
11254         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
11255         too, like above.
11256
11257 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
11258
11259         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
11260
11261         (BaseAccess.DoResolve): Implement.
11262
11263         (MemberAccess.DoResolve): Split this routine into a
11264         ResolveMemberAccess routine that can be used independently
11265
11266 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
11267
11268         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
11269         As that share bits of the implementation.  Is returns a boolean,
11270         while As returns the Type that is being probed.
11271
11272 2001-12-01  Ravi Pratap  <ravi@ximian.com>
11273
11274         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
11275         instead of a Literal - much easier.
11276
11277         (EnumInTransit): Remove - utterly useless :-)
11278
11279         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
11280
11281         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
11282
11283         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
11284         chain when we have no associated expression.
11285
11286 2001-11-30  Ravi Pratap  <ravi@ximian.com>
11287
11288         * constant.cs (Define): Use Location while reporting the errror.
11289
11290         Also emit a warning when 'new' is used and there is no inherited
11291         member to hide.
11292
11293         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
11294         populated.
11295
11296         (LookupEnumValue): Implement to lookup an enum member's value and define it
11297         if necessary.
11298
11299         (Populate): Re-write accordingly to use the above routine.
11300
11301 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
11302
11303         * expression.cs (This): Fix prototype for DoResolveLValue to
11304         override the base class DoResolveLValue.
11305
11306         * cs-parser.cs: Report errors cs574 and cs575 (destructor
11307         declarations) 
11308
11309         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
11310         (we need to load the address of the field here).  This fixes
11311         test-22. 
11312         
11313         (FieldExpr.DoResolveLValue): Call the DoResolve
11314         function to initialize the Instance expression.
11315         
11316         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
11317         correctly the GetEnumerator operation on a value type.
11318
11319         * cs-parser.jay: Add more simple parsing error catches.
11320
11321         * statement.cs (Switch): Add support for string switches.
11322         Handle null specially.
11323
11324         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
11325
11326 2001-11-28  Ravi Pratap  <ravi@ximian.com>
11327
11328         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
11329
11330         (declare_local_constant): New helper function.
11331
11332         * statement.cs (AddConstant): Keep a separate record of constants
11333
11334         (IsConstant): Implement to determine if a variable is a constant.
11335
11336         (GetConstantExpression): Implement.
11337
11338         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
11339
11340         * statement.cs (IsVariableDefined): Re-write.
11341
11342 2001-11-27  Ravi Pratap  <ravi@ximian.com>
11343
11344         * class.cs (TypeContainer::FindMembers): Look for constants
11345         in the case when we are looking for MemberTypes.Field
11346
11347         * expression.cs (MemberAccess::DoResolve): Check that in the
11348         case we are a FieldExpr and a Literal, we are not being accessed
11349         by an instance reference.
11350
11351         * cs-parser.jay (local_constant_declaration): Implement.
11352
11353         (declaration_statement): Implement for constant declarations.
11354
11355 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
11356
11357         * statement.cs (Switch): Catch double defaults.
11358
11359         (Switch): More work on the switch() statement
11360         implementation.  It works for integral values now, need to finish
11361         string support.
11362
11363
11364 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
11365
11366         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
11367         integer literals into other integer literals.  To be used by
11368         switch. 
11369
11370 2001-11-24  Ravi Pratap  <ravi@ximian.com>
11371
11372         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
11373         some memory.
11374
11375         (EmitDynamicInitializers): Cope with the above since we extract data
11376         directly from ArrayData now.
11377
11378         (ExpectInitializers): Keep track of whether initializers are mandatory
11379         or not.
11380
11381         (Bounds): Make it a hashtable to prevent the same dimension being 
11382         recorded for every element in that dimension.
11383
11384         (EmitDynamicInitializers): Fix bug which prevented the Set array method
11385         from being found.
11386
11387         Also fix bug which was causing the indices to be emitted in the reverse
11388         order.
11389
11390 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
11391
11392         * expression.cs (ArrayCreation): Implement the bits that Ravi left
11393         unfinished.  They do not work, because the underlying code is
11394         sloppy.
11395
11396 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11397
11398         * cs-parser.jay: Remove bogus fixme.
11399
11400         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
11401         on Switch statement.
11402         
11403 2001-11-23  Ravi Pratap  <ravi@ximian.com>
11404
11405         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
11406         the same. 
11407         
11408         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
11409         parameter. Apparently, any expression is allowed. 
11410
11411         (ValidateInitializers): Update accordingly.
11412
11413         (CheckIndices): Fix some tricky bugs thanks to recursion.
11414
11415         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
11416         I was being completely brain-dead.
11417
11418         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
11419         and re-write acordingly.
11420
11421         (DelegateInvocation): Re-write accordingly.
11422
11423         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
11424
11425         (MakeByteBlob): Handle types more correctly.
11426
11427         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
11428         initialization from expressions but it is incomplete because I am a complete
11429         Dodo :-|
11430
11431 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11432
11433         * statement.cs (If.Emit): Fix a bug that generated incorrect code
11434         on If.  Basically, we have to return `true' (ie, we do return to
11435         our caller) only if both branches of the if return.
11436
11437         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
11438         short-circuit operators, handle them as short circuit operators. 
11439
11440         (Cast.DoResolve): Resolve type.
11441         (Cast.Cast): Take an expression as the target type.
11442
11443         * cs-parser.jay (cast_expression): Remove old hack that only
11444         allowed a limited set of types to be handled.  Now we take a
11445         unary_expression and we resolve to a type during semantic
11446         analysis.
11447
11448         Use the grammar productions from Rhys to handle casts (this is
11449         not complete like Rhys syntax yet, we fail to handle that corner
11450         case that C# has regarding (-x), but we will get there.
11451         
11452 2001-11-22  Ravi Pratap  <ravi@ximian.com>
11453
11454         * class.cs (EmitFieldInitializer): Take care of the case when we have a
11455         field which is an array type.
11456
11457         * cs-parser.jay (declare_local_variables): Support array initialization too.
11458
11459         * typemanager.cs (MakeKey): Implement.
11460
11461         (everywhere): Use the above appropriately.
11462
11463         * cs-parser.jay (for_statement): Update for array initialization while
11464         declaring variables.
11465
11466         * ecore.cs : The error message was correct, it's the variable's names that
11467         were misleading ;-) Make the code more readable.
11468
11469         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
11470         the correct type etc.
11471
11472         (ConvertExplicit): Handle Enum types by examining the underlying type.
11473
11474 2001-11-21  Ravi Pratap  <ravi@ximian.com>
11475
11476         * parameter.cs (GetCallingConvention): Always return
11477         CallingConventions.Standard for now.
11478
11479 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
11480
11481         * expression.cs (Binary.ResolveOperator): Update the values of `l'
11482         and `r' after calling DoNumericPromotions.
11483
11484         * ecore.cs: Fix error message (the types were in the wrong order).
11485
11486         * statement.cs (Foreach.ProbeCollectionType): Need to pass
11487         BindingFlags.Instance as well 
11488
11489         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
11490         implicit int literal conversion in an empty cast so that we
11491         propagate the right type upstream.
11492
11493         (UnboxCast): new class used to unbox value types.
11494         (Expression.ConvertExplicit): Add explicit type conversions done
11495         by unboxing.
11496
11497         (Expression.ImplicitNumericConversion): Oops, forgot to test for
11498         the target type before applying the implicit LongLiterals to ULong
11499         literal cast.
11500
11501 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
11502
11503         * cs-parser.jay (for_statement): Reworked the way For works: now
11504         we declare manually any variables that are introduced in
11505         for_initializer to solve the problem of having out-of-band code
11506         emition (that is what got for broken).
11507
11508         (declaration_statement): Perform the actual variable declaration
11509         that used to be done in local_variable_declaration here.
11510
11511         (local_variable_declaration): Do not declare anything, just pass
11512         the information on a DictionaryEntry
11513
11514 2001-11-20  Ravi Pratap  <ravi@ximian.com>
11515
11516         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
11517         re-write of the logic to now make it recursive.
11518
11519         (UpdateIndices): Re-write accordingly.
11520
11521         Store element data in a separate ArrayData list in the above methods.
11522
11523         (MakeByteBlob): Implement to dump the array data into a byte array.
11524
11525 2001-11-19  Ravi Pratap  <ravi@ximian.com>
11526
11527         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
11528         into CheckIndices.
11529
11530         * constant.cs (Define): Implement.
11531
11532         (EmitConstant): Re-write fully.
11533
11534         Pass in location info.
11535
11536         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
11537         respectively.
11538
11539         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
11540         DictionaryEntry since we need location info too.
11541
11542         (constant_declaration): Update accordingly.
11543
11544         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
11545         code into another method : UpdateIndices.
11546
11547 2001-11-18  Ravi Pratap  <ravi@ximian.com>
11548
11549         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
11550         some type checking etc.
11551
11552 2001-11-17  Ravi Pratap  <ravi@ximian.com>
11553
11554         * expression.cs (ArrayCreation::ValidateInitializers): Implement
11555         bits to provide dimension info if the user skips doing that.
11556
11557         Update second constructor to store the rank correctly.
11558
11559 2001-11-16  Ravi Pratap  <ravi@ximian.com>
11560
11561         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
11562         and try to implement.
11563
11564         * ../errors/cs0150.cs : Add.
11565
11566         * ../errors/cs0178.cs : Add.
11567
11568 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
11569
11570         * statement.cs: Implement foreach on multi-dimensional arrays. 
11571
11572         * parameter.cs (Parameters.GetParameterByName): Also lookup the
11573         name of the params argument.
11574
11575         * expression.cs: Use EmitStoreOpcode to get the right opcode while
11576         initializing the array.
11577
11578         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
11579         we can use this elsewhere.
11580
11581         * statement.cs: Finish implementation of foreach for single
11582         dimension arrays.
11583
11584         * cs-parser.jay: Use an out-of-band stack to pass information
11585         around, I wonder why I need this.
11586
11587         foreach_block: Make the new foreach_block the current_block.
11588
11589         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
11590         function used to return a static Parameters structure.  Used for
11591         empty parameters, as those are created very frequently.
11592
11593         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
11594
11595 2001-11-15  Ravi Pratap  <ravi@ximian.com>
11596
11597         * interface.cs : Default modifier is private, not public. The
11598         make verify test passes again.
11599
11600 2001-11-15  Ravi Pratap  <ravi@ximian.com>
11601
11602         * support.cs (ReflectionParameters): Fix logic to determine
11603         whether the last parameter is a params one. Test 9 passes again.
11604
11605         * delegate.cs (Populate): Register the builders we define with
11606         RegisterParameterForBuilder. Test 19 passes again.
11607
11608         * cs-parser.jay (property_declaration): Reference $6 instead
11609         of $$ to get at the location.
11610
11611         (indexer_declaration): Similar stuff.
11612
11613         (attribute): Ditto.
11614
11615         * class.cs (Property): Register parameters for the Get and Set methods
11616         if they exist. Test 23 passes again.
11617
11618         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
11619         call to EmitArguments as we are sure there aren't any params arguments. 
11620         Test 32 passes again.
11621
11622         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
11623         IndexOutOfRangeException. 
11624
11625         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
11626         Test 33 now passes again.
11627         
11628 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
11629
11630         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
11631         broke a bunch of things.  Will have to come up with a better way
11632         of tracking locations.
11633
11634         * statement.cs: Implemented foreach for single dimension arrays.
11635
11636 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
11637
11638         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
11639         an error.  This removes the lookup from the critical path.
11640
11641         * cs-parser.jay: Removed use of temporary_loc, which is completely
11642         broken. 
11643
11644 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
11645
11646         * support.cs (ReflectionParameters.ParameterModifier): Report
11647         whether the argument is a PARAMS argument or not.
11648
11649         * class.cs: Set the attribute `ParamArrayAttribute' on the
11650         parameter argument.
11651
11652         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
11653         and cons_param_array_attribute (ConstructorInfo for
11654         ParamArrayAttribute)., 
11655
11656         * codegen.cs: Emit the return using the `Return' statement, that
11657         way we can report the error correctly for missing return values. 
11658
11659         * class.cs (Method.Emit): Clean up.
11660
11661         * expression.cs (Argument.Resolve): Take another argument: the
11662         location where this argument is used.  Notice that this is not
11663         part of the "Argument" class as to reduce the size of the
11664         structure (we know the approximate location anyways).
11665
11666         Test if the argument is a variable-reference, if not, then
11667         complain with a 206.
11668
11669         (Argument.Emit): Emit addresses of variables.
11670
11671         (Argument.FullDesc): Simplify.
11672
11673         (Invocation.DoResolve): Update for Argument.Resolve.
11674
11675         (ElementAccess.DoResolve): ditto.
11676
11677         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
11678         method should be virtual, as this method is always virtual.
11679
11680         (NewDelegate.DoResolve): Update for Argument.Resolve.
11681
11682         * class.cs (ConstructorInitializer.DoResolve): ditto.
11683         
11684         * attribute.cs (Attribute.Resolve): ditto.
11685
11686 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
11687
11688         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
11689
11690         * expression.cs (ParameterReference): Drop IStackStorage and implement
11691         IAssignMethod instead. 
11692
11693         (LocalVariableReference): ditto.
11694         
11695         * ecore.cs (FieldExpr): Drop IStackStorage and implement
11696         IAssignMethod instead. 
11697
11698 2001-11-13  Miguel de Icaza <miguel@ximian.com>
11699
11700         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
11701         enumerations that are used in heavily used structures derive from
11702         byte in a laughable and pathetic attempt to reduce memory usage.
11703         This is the kind of pre-optimzations that you should not do at
11704         home without adult supervision.
11705
11706         * expression.cs (UnaryMutator): New class, used to handle ++ and
11707         -- separatedly from the other unary operators.  Cleans up the
11708         code, and kills the ExpressionStatement dependency in Unary.
11709
11710         (Unary): Removed `method' and `Arguments' from this class, making
11711         it smaller, and moving it all to SimpleCall, so I can reuse this
11712         code in other locations and avoid creating a lot of transient data
11713         strucutres when not required.
11714
11715         * cs-parser.jay: Adjust for new changes.
11716
11717 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
11718
11719         * enum.cs (Enum.Populate): If there is a failure during
11720         definition, return
11721
11722         * cs-parser.jay (opt_enum_base): we used to catch type errors
11723         here, but this is really incorrect.  The type error should be
11724         catched during semantic analysis.
11725
11726 2001-12-11  Ravi Pratap  <ravi@ximian.com>
11727
11728         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
11729         current_local_parameters as expected since I, in my stupidity, had forgotten
11730         to do this :-)
11731
11732         * attribute.cs (GetValidPlaces): Fix stupid bug.
11733
11734         * class.cs (Method::Emit): Perform check on applicability of attributes.
11735
11736         (Constructor::Emit): Ditto.
11737
11738         (Field::Emit): Ditto.
11739
11740         (Field.Location): Store location information.
11741
11742         (Property, Event, Indexer, Operator): Ditto.
11743
11744         * cs-parser.jay (field_declaration): Pass in location for each field.
11745
11746         * ../errors/cs0592.cs : Add.
11747
11748 2001-11-12  Ravi Pratap  <ravi@ximian.com>
11749
11750         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
11751
11752         (InitCoreTypes): Update accordingly.
11753
11754         (RegisterAttrType, LookupAttr): Implement.
11755
11756         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
11757         info about the same.
11758
11759         (Resolve): Update to populate the above as necessary.
11760
11761         (Error592): Helper.
11762
11763         (GetValidPlaces): Helper to the above.
11764
11765         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
11766
11767         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
11768
11769 2001-11-12  Ravi Pratap  <ravi@ximian.com>
11770
11771         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
11772
11773         * ../errors/cs0617.cs : Add.
11774
11775 2001-11-11  Ravi Pratap  <ravi@ximian.com>
11776
11777         * enum.cs (Emit): Rename to Populate to be more consistent with what
11778         we expect it to do and when exactly it is called.
11779
11780         * class.cs, rootcontext.cs : Update accordingly.
11781
11782         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
11783         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
11784
11785         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
11786
11787         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
11788         of a fieldinfo using the above, when dealing with a FieldBuilder.
11789
11790 2001-11-10  Ravi Pratap  <ravi@ximian.com>
11791
11792         * ../errors/cs0031.cs : Add.
11793
11794         * ../errors/cs1008.cs : Add.
11795
11796         * ../errrors/cs0543.cs : Add.
11797
11798         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
11799         enum type.
11800
11801         (FindMembers): Implement.
11802
11803         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
11804         enums and delegates too.
11805
11806         (enum_types): Rename to builder_to_enum.
11807
11808         (delegate_types): Rename to builder_to_delegate.
11809
11810         * delegate.cs (FindMembers): Implement.
11811
11812 2001-11-09  Ravi Pratap  <ravi@ximian.com>
11813
11814         * typemanager.cs (IsEnumType): Implement.
11815
11816         * enum.cs (Emit): Re-write parts to account for the underlying type
11817         better and perform checking etc.
11818
11819         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
11820         of the underlying type.
11821
11822         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
11823         value
11824
11825         * enum.cs (error31): Helper to report error #31.
11826
11827         * cs-parser.jay (enum_declaration): Store location of each member too.
11828
11829         * enum.cs (member_to_location): New hashtable. 
11830
11831         (AddEnumMember): Update location hashtable.
11832
11833         (Emit): Use the location of each member while reporting errors.
11834
11835 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
11836
11837         * cs-parser.jay: A for_initializer if is a
11838         local_variable_declaration really ammount to have an implicit
11839         block with the variable declaration and no initializer for for.
11840
11841         * statement.cs (For.Emit): Cope with null initializers.
11842
11843         This fixes the infinite loop on for initializers.
11844
11845 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
11846
11847         * enum.cs: More cleanup.
11848
11849         * ecore.cs: Remove dead code.
11850
11851         * class.cs (Property.Emit): More simplification.
11852         (Event.Emit): ditto.
11853
11854         Reworked to have less levels of indentation.
11855         
11856 2001-11-08  Ravi Pratap  <ravi@ximian.com>
11857
11858         * class.cs (Property): Emit attributes.
11859
11860         (Field): Ditto.
11861         
11862         (Event): Ditto.
11863
11864         (Indexer): Ditto.
11865
11866         (Operator): Ditto.
11867
11868         * enum.cs (Emit): Ditto.
11869
11870         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
11871         Enums too.
11872
11873         * class.cs (Field, Event, etc.): Move attribute generation into the
11874         Emit method everywhere.
11875
11876         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
11877         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
11878         as we had no way of defining nested enums !
11879
11880         * rootcontext.cs : Adjust code accordingly.
11881
11882         * typemanager.cs (AddEnumType): To keep track of enum types separately.
11883
11884 2001-11-07  Ravi Pratap  <ravi@ximian.com>
11885
11886         * expression.cs (EvalConstantExpression): Move into ecore.cs
11887         
11888         * enum.cs (Enum): Rename some members and make them public and readonly
11889         according to our convention.
11890
11891         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
11892         nothing else.
11893
11894         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
11895
11896         (Enum::Emit): Write a simple version for now which doesn't try to compute
11897         expressions. I shall modify this to be more robust in just a while.
11898
11899         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
11900
11901         (TypeContainer::CloseType): Create the Enum types too.
11902
11903         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
11904
11905         * expression.cs (EvalConstantExpression): Get rid of completely.
11906
11907         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
11908         user-defined values and other cases.
11909
11910         (IsValidEnumLiteral): Helper function.
11911
11912         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
11913         out there in the case we had a literal FieldExpr.
11914
11915         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
11916
11917         (Literalize): Revamp a bit to take two arguments.
11918         
11919         (EnumLiteral): New class which derives from Literal to wrap enum literals.
11920         
11921 2001-11-06  Ravi Pratap  <ravi@ximian.com>
11922
11923         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
11924
11925         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
11926
11927         (Resolve): Use the above to ensure we have proper initializers.
11928
11929 2001-11-05  Ravi Pratap  <ravi@ximian.com>
11930
11931         * expression.cs (Expression::EvalConstantExpression): New method to 
11932         evaluate constant expressions.
11933
11934         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
11935
11936 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
11937
11938         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
11939         in an array.
11940
11941         (Binary.ResolveOperator): Handle operator != (object a, object b)
11942         and operator == (object a, object b);
11943
11944         (Binary.DoNumericPromotions): Indicate whether the numeric
11945         promotion was possible.
11946
11947         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
11948         Implement.  
11949
11950         Made the ArrayAccess implement interface IAssignMethod instead of
11951         IStackStore as the order in which arguments are passed reflects
11952         this.
11953
11954         * assign.cs: Instead of using expr.ExprClass to select the way of
11955         assinging, probe for the IStackStore/IAssignMethod interfaces.
11956
11957         * typemanager.cs: Load InitializeArray definition.
11958
11959         * rootcontext.cs (RootContext.MakeStaticData): Used to define
11960         static data that can be used to initialize arrays. 
11961
11962 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
11963
11964         * expression.cs: Handle operator== and operator!= for booleans.
11965
11966         (Conditioal.Reduce): Implement reducer for the ?: operator.
11967
11968         (Conditional.Resolve): Implement dead code elimination.
11969
11970         (Binary.Resolve): Catch string literals and return a new
11971         concatenated string.
11972
11973         (Unary.Reduce): Implement reduction of unary expressions.
11974
11975         * ecore.cs: Split out the expression core handling here.
11976
11977         (Expression.Reduce): New method used to perform constant folding
11978         and CSE.  This is needed to support constant-expressions. 
11979         
11980         * statement.cs (Statement.EmitBoolExpression): Pass true and false
11981         targets, and optimize for !x.
11982
11983 2001-11-04  Ravi Pratap  <ravi@ximian.com>
11984
11985         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
11986         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
11987         set custom atttributes.
11988
11989         * literal.cs (Literal::GetValue): New abstract method to return the actual
11990         value of the literal, cast as an object.
11991
11992         (*Literal): Implement GetValue method.
11993
11994         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
11995         expressions to the arraylist but objects of type Argument.
11996
11997         * class.cs (TypeContainer::Emit): Emit our attributes too.
11998
11999         (Method::Emit, Constructor::Emit): Ditto.
12000
12001         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
12002         to be ignoring earlier.
12003
12004 2001-11-03  Ravi Pratap  <ravi@ximian.com>
12005
12006         * attribute.cs (AttributeSection::Define): Implement to do the business
12007         of constructing a CustomAttributeBuilder.
12008
12009         (Attribute): New trivial class. Increases readability of code.  
12010
12011         * cs-parser.jay : Update accordingly.
12012
12013         (positional_argument_list, named_argument_list, named_argument): New rules
12014
12015         (attribute_arguments): Use the above so that we are more correct.
12016         
12017 2001-11-02  Ravi Pratap  <ravi@ximian.com>
12018         
12019         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
12020         to perform all checks for a method with a params parameter.
12021
12022         (Invocation::OverloadResolve): Update to use the above method and therefore
12023         cope correctly with params method invocations.
12024
12025         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
12026         params too.
12027
12028         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
12029         constructors in our parent too because we can't afford to miss out on 
12030         protected ones ;-)
12031
12032         * attribute.cs (AttributeSection): New name for the class Attribute
12033
12034         Other trivial changes to improve readability.
12035
12036         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
12037         use the new class names.
12038         
12039 2001-11-01  Ravi Pratap  <ravi@ximian.com>
12040
12041         * class.cs (Method::Define): Complete definition for params types too
12042
12043         (Indexer::Define): Ditto.
12044
12045         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
12046         Cope everywhere with a request for info about the array parameter.
12047
12048 2001-11-01  Ravi Pratap  <ravi@ximian.com>
12049
12050         * tree.cs (RecordNamespace): Fix up to check for the correct key.
12051
12052         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
12053         local_variable_type to extract the string corresponding to the type.
12054
12055         (local_variable_type): Fixup the action to use the new helper method.
12056
12057         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
12058         go.
12059
12060         * expression.cs : Clean out code which uses the above.
12061
12062 2001-10-31  Ravi Pratap  <ravi@ximian.com>
12063         
12064         * typemanager.cs (RegisterMethod): Check if we already have an existing key
12065         and bale out if necessary by returning a false.
12066
12067         (RegisterProperty): Ditto.
12068
12069         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
12070         and print out appropriate error messages.
12071
12072         * interface.cs (everywhere): Ditto.
12073
12074         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
12075         location to constructor.
12076
12077         * class.cs (Property, Event, Indexer): Update accordingly.
12078
12079         * ../errors/cs111.cs : Added.
12080
12081         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
12082         of a method, as laid down by the spec.
12083
12084         (Invocation::OverloadResolve): Use the above method.
12085
12086 2001-10-31  Ravi Pratap  <ravi@ximian.com>
12087
12088         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
12089         now take a TypeContainer and a Parameters object.
12090
12091         (ParameterData): Modify return type of ParameterModifier method to be 
12092         Parameter.Modifier and not a string.
12093
12094         (ReflectionParameters, InternalParameters): Update accordingly.
12095
12096         * expression.cs (Argument::GetParameterModifier): Same here.
12097
12098         * support.cs (InternalParameters::ParameterType): Find a better way of determining
12099         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
12100         symbol in it at all so maybe this is only for now.
12101
12102 2001-10-30  Ravi Pratap  <ravi@ximian.com>
12103
12104         * support.cs (InternalParameters): Constructor now takes an extra argument 
12105         which is the actual Parameters class.
12106
12107         (ParameterDesc): Update to provide info on ref/out modifiers.
12108
12109         * class.cs (everywhere): Update call to InternalParameters to pass in
12110         the second argument too.
12111
12112         * support.cs (ParameterData): Add ParameterModifier, which is a method 
12113         to return the modifier info [ref/out etc]
12114
12115         (InternalParameters, ReflectionParameters): Implement the above.
12116
12117         * expression.cs (Argument::ParameterModifier): Similar function to return
12118         info about the argument's modifiers.
12119
12120         (Invocation::OverloadResolve): Update to take into account matching modifiers 
12121         too.
12122
12123         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
12124         a new SetFormalParameters object which we pass to InternalParameters.
12125
12126 2001-10-30  Ravi Pratap  <ravi@ximian.com>
12127
12128         * expression.cs (NewArray): Merge into the ArrayCreation class.
12129
12130 2001-10-29  Ravi Pratap  <ravi@ximian.com>
12131
12132         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
12133         NewUserdefinedArray into one as there wasn't much of a use in having
12134         two separate ones.
12135
12136         * expression.cs (Argument): Change field's name to ArgType from Type.
12137
12138         (Type): New readonly property which returns the proper type, taking into 
12139         account ref/out modifiers.
12140
12141         (everywhere): Adjust code accordingly for the above.
12142
12143         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
12144         whether we are emitting for a ref or out parameter.
12145
12146         * expression.cs (Argument::Emit): Use the above field to set the state.
12147
12148         (LocalVariableReference::Emit): Update to honour the flag and emit the
12149         right stuff.
12150
12151         * parameter.cs (Attributes): Set the correct flags for ref parameters.
12152
12153         * expression.cs (Argument::FullDesc): New function to provide a full desc.
12154
12155         * support.cs (ParameterData): Add method ParameterDesc to the interface.
12156
12157         (ReflectionParameters, InternalParameters): Implement the above method.
12158
12159         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
12160         reporting errors.
12161
12162         (Invocation::FullMethodDesc): Ditto. 
12163
12164 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
12165
12166         * cs-parser.jay: Add extra production for the second form of array
12167         creation. 
12168
12169         * expression.cs (ArrayCreation): Update to reflect the above
12170         change. 
12171
12172         * Small changes to prepare for Array initialization.
12173
12174 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
12175
12176         * typemanager.cs (ImplementsInterface): interface might be null;
12177         Deal with this problem;
12178
12179         Also, we do store negative hits on the cache (null values), so use
12180         this instead of calling t.GetInterfaces on the type everytime.
12181
12182 2001-10-28  Ravi Pratap  <ravi@ximian.com>
12183
12184         * typemanager.cs (IsBuiltinType): New method to help determine the same.
12185
12186         * expression.cs (New::DoResolve): Get rid of array creation code and instead
12187         split functionality out into different classes.
12188
12189         (New::FormArrayType): Move into NewBuiltinArray.
12190
12191         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
12192         quite useless.
12193
12194         (NewBuiltinArray): New class to handle creation of built-in arrays.
12195
12196         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
12197         account creation of one-dimensional arrays.
12198
12199         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
12200
12201         (NewUserdefinedArray::DoResolve): Implement.
12202
12203         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
12204
12205         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
12206         we maintain inside the TypeManager. This is necessary to perform lookups on the
12207         module builder.
12208
12209         (LookupType): Update to perform GetType on the module builders too.     
12210
12211         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
12212
12213         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
12214
12215 2001-10-23  Ravi Pratap  <ravi@ximian.com>
12216
12217         * expression.cs (New::DoResolve): Implement guts of array creation.
12218
12219         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
12220         
12221 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
12222
12223         * expression.cs: Fix bug I introduced lsat night that broke
12224         Delegates. 
12225
12226         (Expression.Resolve): Report a 246 error (can not resolve name)
12227         if we find a SimpleName in the stream.
12228         
12229         (Expression.ResolveLValue): Ditto.
12230         
12231         (Expression.ResolveWithSimpleName): This function is a variant of
12232         ResolveName, this one allows SimpleNames to be returned without a
12233         warning.  The only consumer of SimpleNames is MemberAccess
12234
12235 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
12236
12237         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
12238         might arrive here.  I have my doubts that this is correct.
12239
12240         * statement.cs (Lock): Implement lock statement.
12241
12242         * cs-parser.jay: Small fixes to support `lock' and `using'
12243
12244         * cs-tokenizer.cs: Remove extra space
12245
12246         * driver.cs: New flag --checked, allows to turn on integer math
12247         checking. 
12248
12249         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
12250         Threading.Monitor.Exit 
12251         
12252 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
12253
12254         * expression.cs (IndexerAccess::DoResolveLValue): Set the
12255         Expression Class to be IndexerAccess.
12256
12257         Notice that Indexer::DoResolve sets the eclass to Value.
12258
12259 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
12260
12261         * class.cs (TypeContainer::Emit): Emit code for indexers.
12262
12263         * assign.cs (IAssignMethod): New interface implemented by Indexers
12264         and Properties for handling assignment.
12265
12266         (Assign::Emit): Simplify and reuse code. 
12267         
12268         * expression.cs (IndexerAccess, PropertyExpr): Implement
12269         IAssignMethod, clean up old code. 
12270
12271 2001-10-22  Ravi Pratap  <ravi@ximian.com>
12272
12273         * typemanager.cs (ImplementsInterface): New method to determine if a type
12274         implements a given interface. Provides a nice cache too.
12275
12276         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
12277         method.
12278
12279         (ConvertReferenceExplicit): Ditto.
12280
12281         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
12282         various methods, with correct names etc.
12283
12284         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
12285         Operator.UnaryNegation.
12286
12287         * cs-parser.jay (operator_declarator): Be a little clever in the case where
12288         we have a unary plus or minus operator.
12289
12290         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
12291         UnaryMinus.
12292
12293         * everywhere : update accordingly.
12294
12295         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
12296         respectively.
12297
12298         * class.cs (Method::Define): For the case where we are implementing a method
12299         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
12300         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
12301         
12302 2001-10-21  Ravi Pratap  <ravi@ximian.com>
12303
12304         * interface.cs (FindMembers): Implement to work around S.R.E
12305         lameness.
12306
12307         * typemanager.cs (IsInterfaceType): Implement.
12308
12309         (FindMembers): Update to handle interface types too.
12310
12311         * expression.cs (ImplicitReferenceConversion): Re-write bits which
12312         use IsAssignableFrom as that is not correct - it doesn't work.
12313
12314         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
12315         and accordingly override EmitStatement.
12316
12317         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
12318         using the correct logic :-)
12319
12320 2001-10-19  Ravi Pratap  <ravi@ximian.com>
12321
12322         * ../errors/cs-11.cs : Add to demonstrate error -11 
12323
12324 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
12325
12326         * assign.cs (Assign::Resolve): Resolve right hand side first, and
12327         then pass this as a hint to ResolveLValue.
12328         
12329         * expression.cs (FieldExpr): Add Location information
12330
12331         (FieldExpr::LValueResolve): Report assignment to readonly
12332         variable. 
12333         
12334         (Expression::ExprClassFromMemberInfo): Pass location information.
12335
12336         (Expression::ResolveLValue): Add new method that resolves an
12337         LValue. 
12338
12339         (Expression::DoResolveLValue): Default invocation calls
12340         DoResolve. 
12341
12342         (Indexers): New class used to keep track of indexers in a given
12343         Type. 
12344
12345         (IStackStore): Renamed from LValue, as it did not really describe
12346         what this did.  Also ResolveLValue is gone from this interface and
12347         now is part of Expression.
12348
12349         (ElementAccess): Depending on the element access type
12350         
12351         * typemanager.cs: Add `indexer_name_type' as a Core type
12352         (System.Runtime.CompilerServices.IndexerNameAttribute)
12353
12354         * statement.cs (Goto): Take a location.
12355         
12356 2001-10-18  Ravi Pratap  <ravi@ximian.com>
12357
12358         * delegate.cs (Delegate::VerifyDelegate): New method to verify
12359         if two delegates are compatible.
12360
12361         (NewDelegate::DoResolve): Update to take care of the case when
12362         we instantiate a delegate from another delegate.
12363
12364         * typemanager.cs (FindMembers): Don't even try to look up members
12365         of Delegate types for now.
12366
12367 2001-10-18  Ravi Pratap  <ravi@ximian.com>
12368
12369         * delegate.cs (NewDelegate): New class to take care of delegate
12370         instantiation.
12371
12372         * expression.cs (New): Split the delegate related code out into 
12373         the NewDelegate class.
12374
12375         * delegate.cs (DelegateInvocation): New class to handle delegate 
12376         invocation.
12377
12378         * expression.cs (Invocation): Split out delegate related code into
12379         the DelegateInvocation class.
12380
12381 2001-10-17  Ravi Pratap  <ravi@ximian.com>
12382
12383         * expression.cs (New::DoResolve): Implement delegate creation fully
12384         and according to the spec.
12385
12386         (New::DoEmit): Update to handle delegates differently.
12387
12388         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
12389         because of which we were printing out arguments in reverse order !
12390
12391         * delegate.cs (VerifyMethod): Implement to check if the given method
12392         matches the delegate.
12393
12394         (FullDelegateDesc): Implement.
12395
12396         (VerifyApplicability): Implement.
12397
12398         * expression.cs (Invocation::DoResolve): Update to accordingly handle
12399         delegate invocations too.
12400
12401         (Invocation::Emit): Ditto.
12402
12403         * ../errors/cs1593.cs : Added.
12404
12405         * ../errors/cs1594.cs : Added.
12406
12407         * delegate.cs (InstanceExpression, TargetMethod): New properties.
12408
12409 2001-10-16  Ravi Pratap  <ravi@ximian.com>
12410
12411         * typemanager.cs (intptr_type): Core type for System.IntPtr
12412
12413         (InitCoreTypes): Update for the same.
12414
12415         (iasyncresult_type, asynccallback_type): Ditto.
12416
12417         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
12418         correct.
12419
12420         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
12421         too.
12422
12423         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
12424         the builders for the 4 members of a delegate type :-)
12425
12426         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
12427         type.
12428
12429         * expression.cs (New::DoResolve): Implement guts for delegate creation.
12430
12431         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
12432
12433 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
12434
12435         * statement.cs (Break::Emit): Implement.   
12436         (Continue::Emit): Implement.
12437
12438         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12439         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12440         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
12441         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
12442         end loop
12443         
12444         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
12445         properties that track the label for the current loop (begin of the
12446         loop and end of the loop).
12447
12448 2001-10-15  Ravi Pratap  <ravi@ximian.com>
12449
12450         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
12451         use of emitting anything at all.
12452
12453         * class.cs, rootcontext.cs : Get rid of calls to the same.
12454
12455         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
12456
12457         (Populate): Define the constructor correctly and set the implementation
12458         attributes.
12459
12460         * typemanager.cs (delegate_types): New hashtable to hold delegates that
12461         have been defined.
12462
12463         (AddDelegateType): Implement.
12464
12465         (IsDelegateType): Implement helper method.
12466
12467         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
12468
12469         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
12470         and accordingly handle it.
12471
12472         * delegate.cs (Populate): Take TypeContainer argument.
12473         Implement bits to define the Invoke method. However, I still haven't figured out
12474         how to take care of the native int bit :-(
12475
12476         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
12477         Qualify the name of the delegate, not its return type !
12478
12479         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
12480         conversion.
12481
12482         (StandardConversionExists): Checking for array types turns out to be recursive.
12483
12484         (ConvertReferenceExplicit): Implement array conversion.
12485
12486         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
12487         
12488 2001-10-12  Ravi Pratap  <ravi@ximian.com>
12489
12490         * cs-parser.jay (delegate_declaration): Store the fully qualified
12491         name as it is a type declaration.
12492
12493         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
12494         readonly.
12495
12496         (DefineDelegate): Renamed from Define. Does the same thing essentially,
12497         as TypeContainer::DefineType.
12498
12499         (Populate): Method in which all the definition of the various methods (Invoke)
12500         etc is done.
12501
12502         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
12503         see.
12504         
12505         (CloseDelegate): Finally creates the delegate.
12506
12507         * class.cs (TypeContainer::DefineType): Update to define delegates.
12508         (Populate, Emit and CloseType): Do the same thing here too.
12509
12510         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
12511         delegates in all these operations.
12512
12513 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
12514
12515         * expression.cs: LocalTemporary: a new expression used to
12516         reference a temporary that has been created.
12517
12518         * assign.cs: Handle PropertyAccess back here, so that we can
12519         provide the proper semantic access to properties.
12520
12521         * expression.cs (Expression::ConvertReferenceExplicit): Implement
12522         a few more explicit conversions. 
12523
12524         * modifiers.cs: `NEW' modifier maps to HideBySig.
12525
12526         * expression.cs (PropertyExpr): Make this into an
12527         ExpressionStatement, and support the EmitStatement code path. 
12528
12529         Perform get/set error checking, clean up the interface.
12530
12531         * assign.cs: recognize PropertyExprs as targets, and if so, turn
12532         them into toplevel access objects.
12533
12534 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
12535
12536         * expression.cs: PropertyExpr::PropertyExpr: use work around the
12537         SRE.
12538
12539         * typemanager.cs: Keep track here of our PropertyBuilders again to
12540         work around lameness in SRE.
12541
12542 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
12543
12544         * expression.cs (LValue::LValueResolve): New method in the
12545         interface, used to perform a second resolution pass for LValues. 
12546         
12547         (This::DoResolve): Catch the use of this in static methods.
12548
12549         (This::LValueResolve): Implement.
12550
12551         (This::Store): Remove warning, assigning to `this' in structures
12552         is 
12553
12554         (Invocation::Emit): Deal with invocation of
12555         methods on value types.  We need to pass the address to structure
12556         methods rather than the object itself.  (The equivalent code to
12557         emit "this" for structures leaves the entire structure on the
12558         stack instead of a pointer to it). 
12559
12560         (ParameterReference::DoResolve): Compute the real index for the
12561         argument based on whether the method takes or not a `this' pointer
12562         (ie, the method is static).
12563
12564         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
12565         value types returned from functions when we need to invoke a
12566         method on the sturcture.
12567         
12568
12569 2001-10-11  Ravi Pratap  <ravi@ximian.com>
12570
12571         * class.cs (TypeContainer::DefineType): Method to actually do the business of
12572         defining the type in the Modulebuilder or Typebuilder. This is to take
12573         care of nested types which need to be defined on the TypeBuilder using
12574         DefineNestedMethod.
12575
12576         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
12577         methods in RootContext, only ported to be part of TypeContainer.
12578
12579         (TypeContainer::GetInterfaceOrClass): Ditto.
12580
12581         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
12582
12583         * interface.cs (Interface::DefineInterface): New method. Does exactly
12584         what RootContext.CreateInterface did earlier, only it takes care of nested types 
12585         too.
12586
12587         (Interface::GetInterfaces): Move from RootContext here and port.
12588
12589         (Interface::GetInterfaceByName): Same here.
12590
12591         * rootcontext.cs (ResolveTree): Re-write.
12592
12593         (PopulateTypes): Re-write.
12594
12595         * class.cs (TypeContainer::Populate): Populate nested types too.
12596         (TypeContainer::Emit): Emit nested members too.
12597
12598         * typemanager.cs (AddUserType): Do not make use of the FullName property,
12599         instead just use the name argument passed in as it is already fully
12600         qualified.
12601
12602         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
12603         to TypeContainer mapping to see if a type is user-defined.
12604
12605         * class.cs (TypeContainer::CloseType): Implement. 
12606
12607         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
12608         the default constructor.
12609         
12610         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
12611         twice.
12612
12613         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
12614
12615         * interface.cs (CloseType): Create the type here.
12616         
12617         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
12618         the hierarchy.
12619
12620         Remove all the methods which are now in TypeContainer.
12621
12622 2001-10-10  Ravi Pratap  <ravi@ximian.com>
12623
12624         * delegate.cs (Define): Re-write bits to define the delegate
12625         correctly.
12626
12627 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
12628
12629         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
12630
12631         * expression.cs (ImplicitReferenceConversion): handle null as well
12632         as a source to convert to any reference type.
12633
12634         * statement.cs (Return): Perform any implicit conversions to
12635         expected return type.  
12636
12637         Validate use of return statement.  
12638
12639         * codegen.cs (EmitContext): Pass the expected return type here.
12640
12641         * class.cs (Method, Constructor, Property): Pass expected return
12642         type to EmitContext.
12643
12644 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
12645
12646         * expression.cs: Make DoResolve take an EmitContext instead of a
12647         TypeContainer.
12648
12649         Replaced `l' and `location' for `loc', for consistency.
12650         
12651         (Error, Warning): Remove unneeded Tc argument.
12652
12653         * assign.cs, literal.cs, constant.cs: Update to new calling
12654         convention. 
12655         
12656         * codegen.cs: EmitContext now contains a flag indicating whether
12657         code is being generated in a static method or not.
12658
12659         * cs-parser.jay: DecomposeQI, new function that replaces the old
12660         QualifiedIdentifier.  Now we always decompose the assembled
12661         strings from qualified_identifier productions into a group of
12662         memberaccesses.
12663
12664 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
12665
12666         * rootcontext.cs: Deal with field-less struct types correctly now
12667         by passing the size option to Define Type.
12668
12669         * class.cs: Removed hack that created one static field. 
12670
12671 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
12672
12673         * statement.cs: Moved most of the code generation here. 
12674
12675 2001-10-09  Ravi Pratap  <ravi@ximian.com>
12676
12677         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
12678         seem very right.
12679
12680         (ElementAccess): Remove useless bits for now - keep checks as the spec
12681         says.
12682
12683 2001-10-08  Ravi Pratap  <ravi@ximian.com>
12684
12685         * expression.cs (ElementAccess::DoResolve): Remove my crap code
12686         and start performing checks according to the spec.
12687
12688 2001-10-07  Ravi Pratap  <ravi@ximian.com>
12689
12690         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
12691         rank_specifiers instead.
12692
12693         (rank_specifiers): Change the order in which the rank specifiers are stored
12694
12695         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
12696
12697         * expression.cs (ElementAccess): Implement the LValue interface too.
12698         
12699 2001-10-06  Ravi Pratap  <ravi@ximian.com>
12700         
12701         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
12702         except that user defined conversions are not included.
12703
12704         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
12705         perform the conversion of the return type, if necessary.
12706
12707         (New::DoResolve): Check whether we are creating an array or an object
12708         and accordingly do the needful.
12709
12710         (New::Emit): Same here.
12711
12712         (New::DoResolve): Implement guts of array creation.
12713
12714         (New::FormLookupType): Helper function.
12715
12716 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
12717
12718         * codegen.cs: Removed most of the code generation here, and move the
12719         corresponding code generation bits to the statement classes. 
12720
12721         Added support for try/catch/finalize and throw.
12722         
12723         * cs-parser.jay: Added support for try/catch/finalize.
12724
12725         * class.cs: Catch static methods having the flags override,
12726         virtual or abstract.
12727
12728         * expression.cs (UserCast): This user cast was not really doing
12729         what it was supposed to do.  Which is to be born in fully resolved
12730         state.  Parts of the resolution were being performed at Emit time! 
12731
12732         Fixed this code.
12733
12734 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
12735
12736         * expression.cs: Implicity convert the result from UserCast.
12737
12738 2001-10-05  Ravi Pratap  <ravi@ximian.com>
12739
12740         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
12741         prevented it from working correctly. 
12742
12743         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
12744         merely ConvertImplicit.
12745
12746 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
12747
12748         * typemanager.cs: Make the LookupTypeContainer function static,
12749         and not per-instance.  
12750
12751         * class.cs: Make static FindMembers (the one that takes a Type
12752         argument). 
12753
12754         * codegen.cs: Add EmitForeach here.
12755
12756         * cs-parser.jay: Make foreach a toplevel object instead of the
12757         inline expansion, as we need to perform semantic analysis on it. 
12758
12759 2001-10-05  Ravi Pratap  <ravi@ximian.com>
12760
12761         * expression.cs (Expression::ImplicitUserConversion): Rename to
12762         UserDefinedConversion.
12763
12764         (Expression::UserDefinedConversion): Take an extra argument specifying 
12765         whether we look for explicit user conversions too.
12766
12767         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
12768
12769         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
12770
12771         (ExplicitUserConversion): Make it a call to UserDefinedConversion
12772         with the appropriate arguments.
12773
12774         * cs-parser.jay (cast_expression): Record location too.
12775
12776         * expression.cs (Cast): Record location info.
12777
12778         (Expression::ConvertExplicit): Take location argument.
12779
12780         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
12781         to determine if we are doing explicit conversions.
12782
12783         (UserCast::Emit): Update accordingly.
12784
12785         (Expression::ConvertExplicit): Report an error if everything fails.
12786
12787         * ../errors/cs0030.cs : Add.
12788
12789 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
12790
12791         * modifiers.cs: If the ABSTRACT keyword is present, also set the
12792         virtual and newslot bits. 
12793
12794         * class.cs (TypeContainer::RegisterRequiredImplementations):
12795         Record methods we need.
12796
12797         (TypeContainer::MakeKey): Helper function to make keys for
12798         MethodBases, since the Methodbase key is useless.
12799
12800         (TypeContainer::Populate): Call RegisterRequiredImplementations
12801         before defining the methods.   
12802
12803         Create a mapping for method_builders_to_methods ahead of time
12804         instead of inside a tight loop.
12805
12806         (::RequireMethods):  Accept an object as the data to set into the
12807         hashtable so we can report interface vs abstract method mismatch.
12808
12809 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
12810
12811         * report.cs: Make all of it static.
12812
12813         * rootcontext.cs: Drop object_type and value_type computations, as
12814         we have those in the TypeManager anyways.
12815
12816         Drop report instance variable too, now it is a global.
12817
12818         * driver.cs: Use try/catch on command line handling.
12819
12820         Add --probe option to debug the error reporting system with a test
12821         suite. 
12822
12823         * report.cs: Add support for exiting program when a probe
12824         condition is reached.
12825
12826 2001-10-03  Ravi Pratap  <ravi@ximian.com>
12827
12828         * expression.cs (Binary::DoNumericPromotions): Fix the case when
12829         we do a forcible conversion regardless of type, to check if 
12830         ForceConversion returns a null.
12831
12832         (Binary::error19): Use location to report error.
12833
12834         (Unary::error23): Use location here too.
12835
12836         * ../errors/cs0019.cs : Check in.
12837
12838         * ../errors/cs0023.cs : Check in.
12839
12840         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
12841         case of a non-null MethodInfo object with a length of 0 !
12842
12843         (Binary::ResolveOperator): Flag error if overload resolution fails to find
12844         an applicable member - according to the spec :-)
12845         Also fix logic to find members in base types.
12846
12847         (Unary::ResolveOperator): Same here.
12848
12849         (Unary::report23): Change name to error23 and make first argument a TypeContainer
12850         as I was getting thoroughly confused between this and error19 :-)
12851         
12852         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
12853         (::FindMostEncompassedType): Implement.
12854         (::FindMostEncompassingType): Implement.
12855         (::StandardConversionExists): Implement.
12856
12857         (UserImplicitCast): Re-vamp. We now need info about most specific
12858         source and target types so that we can do the necessary conversions.
12859
12860         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
12861         mathematical union with no duplicates.
12862
12863 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
12864
12865         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
12866         in order from base classes to child classes, so that we can in
12867         child classes look up in our parent for method names and
12868         attributes (required for handling abstract, virtual, new, override
12869         constructs: we need to instrospect our base class, and if we dont
12870         populate the classes in order, the introspection might be
12871         incorrect.  For example, a method could query its parent before
12872         the parent has any methods and would determine that the parent has
12873         no abstract methods (while it could have had them)).
12874
12875         (RootContext::CreateType): Record the order in which we define the
12876         classes.
12877
12878 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
12879
12880         * class.cs (TypeContainer::Populate): Also method definitions can
12881         fail now, keep track of this.
12882
12883         (TypeContainer::FindMembers): Implement support for
12884         DeclaredOnly/noDeclaredOnly flag.
12885
12886         (Constructor::Emit) Return the ConstructorBuilder.
12887
12888         (Method::Emit) Return the MethodBuilder. 
12889         Check for abstract or virtual methods to be public.
12890
12891         * rootcontext.cs (RootContext::CreateType): Register all the
12892         abstract methods required for the class to be complete and the
12893         interface methods that must be implemented. 
12894
12895         * cs-parser.jay: Report error 501 (method requires body if it is
12896         not marked abstract or extern).
12897
12898         * expression.cs (TypeOf::Emit): Implement.
12899
12900         * typemanager.cs: runtime_handle_type, new global type.
12901
12902         * class.cs (Property::Emit): Generate code for properties.
12903
12904 2001-10-02  Ravi Pratap  <ravi@ximian.com>
12905
12906         * expression.cs (Unary::ResolveOperator): Find operators on base type
12907         too - we now conform exactly to the spec.
12908
12909         (Binary::ResolveOperator): Same here.
12910
12911         * class.cs (Operator::Define): Fix minor quirk in the tests.
12912
12913         * ../errors/cs0215.cs : Added.
12914
12915         * ../errors/cs0556.cs : Added.
12916
12917         * ../errors/cs0555.cs : Added.
12918
12919 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
12920
12921         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
12922         single integer which is really efficient
12923
12924 2001-10-01  Ravi Pratap  <ravi@ximian.com>
12925
12926         *  expression.cs (Expression::ImplicitUserConversion): Use location
12927         even in the case when we are examining True operators.
12928  
12929         * class.cs (Operator::Define): Perform extensive checks to conform
12930         with the rules for operator overloading in the spec.
12931
12932         * expression.cs (Expression::ImplicitReferenceConversion): Implement
12933         some of the other conversions mentioned in the spec.
12934
12935         * typemanager.cs (array_type): New static member for the System.Array built-in
12936         type.
12937
12938         (cloneable_interface): For System.ICloneable interface.
12939
12940         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
12941         we start resolving the tree and populating types.
12942
12943         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
12944  
12945 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
12946
12947         * expression.cs (Expression::ExprClassFromMemberInfo,
12948         Expression::Literalize): Create literal expressions from
12949         FieldInfos which are literals.
12950
12951         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
12952         type casts, because they were wrong.  The test suite in tests
12953         caught these ones.
12954
12955         (ImplicitNumericConversion): ushort to ulong requires a widening
12956         cast. 
12957
12958         Int32 constant to long requires widening cast as well.
12959
12960         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
12961         for integers because the type on the stack is not i4.
12962
12963 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
12964
12965         * expression.cs (report118): require location argument. 
12966
12967         * parameter.cs: Do not dereference potential null value.
12968
12969         * class.cs: Catch methods that lack the `new' keyword when
12970         overriding a name.  Report warnings when `new' is used without
12971         anything being there to override.
12972
12973         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
12974
12975         * class.cs: Only add constructor to hashtable if it is non-null
12976         (as now constructors can fail on define).
12977
12978         (TypeManager, Class, Struct): Take location arguments.
12979
12980         Catch field instance initialization in structs as errors.
12981
12982         accepting_filter: a new filter for FindMembers that is static so
12983         that we dont create an instance per invocation.
12984
12985         (Constructor::Define): Catch errors where a struct constructor is
12986         parameterless 
12987
12988         * cs-parser.jay: Pass location information for various new
12989         constructs. 
12990         
12991         * delegate.cs (Delegate): take a location argument.
12992
12993         * driver.cs: Do not call EmitCode if there were problesm in the
12994         Definition of the types, as many Builders wont be there. 
12995
12996         * decl.cs (Decl::Decl): Require a location argument.
12997
12998         * cs-tokenizer.cs: Handle properly hex constants that can not fit
12999         into integers, and find the most appropiate integer for it.
13000
13001         * literal.cs: Implement ULongLiteral.
13002
13003         * rootcontext.cs: Provide better information about the location of
13004         failure when CreateType fails.
13005         
13006 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
13007
13008         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
13009         as well.
13010
13011         * expression.cs (Binary::CheckShiftArguments): Add missing type
13012         computation.
13013         (Binary::ResolveOperator): Add type to the logical and and logical
13014         or, Bitwise And/Or and Exclusive Or code paths, it was missing
13015         before.
13016
13017         (Binary::DoNumericPromotions): In the case where either argument
13018         is ulong (and most signed types combined with ulong cause an
13019         error) perform implicit integer constant conversions as well.
13020
13021 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
13022
13023         * expression.cs (UserImplicitCast): Method should always be
13024         non-null. 
13025         (Invocation::BetterConversion): Simplified test for IntLiteral.
13026
13027         (Expression::ImplicitNumericConversion): Split this routine out.
13028         Put the code that performs implicit constant integer conversions
13029         here. 
13030
13031         (Expression::Resolve): Become a wrapper around DoResolve so we can
13032         check eclass and type being set after resolve.
13033
13034         (Invocation::Badness): Remove this dead function
13035
13036         (Binary::ResolveOperator): Do not compute the expensive argumnets
13037         unless we have a union for it.
13038
13039         (Probe::Emit): Is needs to do an isinst and then
13040         compare against null.
13041
13042         (::CanConvert): Added Location argument.  If the Location argument
13043         is null (Location.Null), then we do not report errors.  This is
13044         used by the `probe' mechanism of the Explicit conversion.  We do
13045         not want to generate an error for something that the user
13046         explicitly requested to be casted.  But the pipeline for an
13047         explicit cast first tests for potential implicit casts.
13048
13049         So for now, if the Location is null, it means `Probe only' to
13050         avoid adding another argument.   Might have to revise this
13051         strategy later.
13052
13053         (ClassCast): New class used to type cast objects into arbitrary
13054         classes (used in Explicit Reference Conversions).
13055
13056         Implement `as' as well.
13057
13058         Reverted all the patches from Ravi below: they were broken:
13059
13060                 * The use of `level' as a mechanism to stop recursive
13061                   invocations is wrong.  That was there just to catch the
13062                   bug with a strack trace but not as a way of addressing
13063                   the problem.
13064
13065                   To fix the problem we have to *understand* what is going
13066                   on and the interactions and come up with a plan, not
13067                   just get things going.
13068
13069                 * The use of the type conversion cache that I proposed
13070                   last night had an open topic: How does this work across
13071                   protection domains.  A user defined conversion might not
13072                   be public in the location where we are applying the
13073                   conversion, a different conversion might be selected
13074                   (ie, private A->B (better) but public B->A (worse),
13075                   inside A, A->B applies, but outside it, B->A will
13076                   apply).
13077
13078                 * On top of that (ie, even if the above is solved),
13079                   conversions in a cache need to be abstract.  Ie, `To
13080                   convert from an Int to a Short use an OpcodeCast', not
13081                   `To convert from an Int to a Short use the OpcodeCast on
13082                   the variable 5' (which is what this patch was doing).
13083         
13084 2001-09-28  Ravi Pratap  <ravi@ximian.com>
13085
13086         * expression.cs (Invocation::ConversionExists): Re-write to use
13087         the conversion cache
13088         
13089         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
13090         cache all conversions done, not just user-defined ones.
13091
13092         (Invocation::BetterConversion): The real culprit. Use ConversionExists
13093         to determine if a conversion exists instead of acutually trying to 
13094         perform the conversion. It's faster too.
13095
13096         (Expression::ConvertExplicit): Modify to use ConversionExists to check
13097         and only then attempt the implicit conversion.
13098
13099 2001-09-28  Ravi Pratap  <ravi@ximian.com>
13100
13101         * expression.cs (ConvertImplicit): Use a cache for conversions
13102         already found. Check level of recursion and bail out if necessary.
13103         
13104 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
13105
13106         * typemanager.cs (string_concat_string_string, string_concat_object_object):
13107         Export standard methods that we expect for string operations.
13108         
13109         * statement.cs (Block::UsageWarning): Track usage of variables and
13110         report the errors for not used variables.
13111
13112         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
13113         operator. 
13114
13115 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
13116
13117         * codegen.cs: remove unnneded code 
13118
13119         * expression.cs: Removed BuiltinTypeAccess class
13120
13121         Fix the order in which implicit conversions are
13122         done.  
13123
13124         The previous fixed dropped support for boxed conversions (adding a
13125         test to the test suite now)
13126
13127         (UserImplicitCast::CanConvert): Remove test for source being null,
13128         that code is broken.  We should not feed a null to begin with, if
13129         we do, then we should track the bug where the problem originates
13130         and not try to cover it up here.
13131
13132         Return a resolved expression of type UserImplicitCast on success
13133         rather than true/false.  Ravi: this is what I was talking about,
13134         the pattern is to use a static method as a "constructor" for
13135         objects. 
13136
13137         Also, do not create arguments until the very last minute,
13138         otherwise we always create the arguments even for lookups that
13139         will never be performed. 
13140
13141         (UserImplicitCast::Resolve): Eliminate, objects of type
13142         UserImplicitCast are born in a fully resolved state. 
13143         
13144         * typemanager.cs (InitCoreTypes): Init also value_type
13145         (System.ValueType). 
13146
13147         * expression.cs (Cast::Resolve): First resolve the child expression.
13148
13149         (LValue): Add new method AddressOf to be used by
13150         the `&' operator.  
13151
13152         Change the argument of Store to take an EmitContext instead of an
13153         ILGenerator, because things like FieldExpr need to be able to call
13154         their children expression to generate the instance code. 
13155
13156         (Expression::Error, Expression::Warning): Sugar functions for
13157         reporting errors.
13158
13159         (Expression::MemberLookup): Accept a TypeContainer instead of a
13160         Report as the first argument.
13161
13162         (Expression::ResolvePrimary): Killed.  I still want to improve
13163         this as currently the code is just not right.
13164
13165         (Expression::ResolveMemberAccess): Simplify, but it is still
13166         wrong. 
13167
13168         (Unary::Resolve): Catch errors in AddressOf operators.
13169
13170         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
13171         index to a byte for the short-version, or the compiler will choose
13172         the wrong Emit call, which generates the wrong data.
13173
13174         (ParameterReference::Emit, ::Store): same.
13175
13176         (FieldExpr::AddressOf): Implement.
13177         
13178         * typemanager.cs: TypeManager: made public variable instead of
13179         property.
13180         
13181         * driver.cs: document --fatal.
13182
13183         * report.cs (ErrorMessage, WarningMessage): new names for the old
13184         Error and Warning classes.
13185
13186         * cs-parser.jay (member_access): Turn built-in access to types
13187         into a normal simplename
13188
13189 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13190
13191         * expression.cs (Invocation::BetterConversion): Fix to cope
13192         with q being null, since this was introducing a bug.
13193
13194         * expression.cs (ConvertImplicit): Do built-in conversions first.
13195
13196 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13197
13198         * expression.cs (UserImplicitCast::Resolve): Fix bug.
13199
13200 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13201
13202         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
13203         I had introduced long ago (what's new ?).
13204
13205         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
13206         the work of all the checking. 
13207         (ConvertImplicit): Call CanConvert and only then create object if necessary.
13208         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
13209
13210         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
13211         that is the right way. 
13212
13213         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
13214         overloading resolution. Use everywhere instead of cutting and pasting code.
13215
13216         (Binary::ResolveOperator): Use MakeUnionSet.
13217
13218         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
13219         we have to convert to bool types. Not complete yet.
13220         
13221 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
13222
13223         * typemanager.cs (TypeManager::CSharpName): support ushort.
13224
13225         * expression.cs (Expression::TryImplicitIntConversion): Attempts
13226         to provide an expression that performsn an implicit constant int
13227         conversion (section 6.1.6).
13228         (Expression::ConvertImplicitRequired): Reworked to include
13229         implicit constant expression conversions.
13230
13231         (Expression::ConvertNumericExplicit): Finished.
13232
13233         (Invocation::Emit): If InstanceExpression is null, then it means
13234         that we perform a call on this.
13235         
13236 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
13237
13238         * expression.cs (Unary::Emit): Remove some dead code.
13239         (Probe): Implement Resolve and Emit for `is'.
13240         (Expression::ConvertImplicitRequired): Attempt to do constant
13241         expression conversions here.  Maybe should be moved to
13242         ConvertImplicit, but I am not sure.
13243         (Expression::ImplicitLongConstantConversionPossible,
13244         Expression::ImplicitIntConstantConversionPossible): New functions
13245         that tell whether is it possible to apply an implicit constant
13246         expression conversion.
13247
13248         (ConvertNumericExplicit): Started work on explicit numeric
13249         conversions.
13250
13251         * cs-parser.jay: Update operator constants.
13252
13253         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
13254         (Parameters::GetSignature): Hook up VerifyArgs here.
13255         (Parameters::VerifyArgs): Verifies that no two arguments have the
13256         same name. 
13257
13258         * class.cs (Operator): Update the operator names to reflect the
13259         ones that the spec expects (as we are just stringizing the
13260         operator names).
13261         
13262         * expression.cs (Unary::ResolveOperator): Fix bug: Use
13263         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
13264         previous usage did only work for our methods.
13265         (Expression::ConvertImplicit): Handle decimal implicit numeric
13266         conversions as well.
13267         (Expression::InternalTypeConstructor): Used to invoke constructors
13268         on internal types for default promotions.
13269
13270         (Unary::Emit): Implement special handling for the pre/post
13271         increment/decrement for overloaded operators, as they need to have
13272         the same semantics as the other operators.
13273
13274         (Binary::ResolveOperator): ditto.
13275         (Invocation::ConversionExists): ditto.
13276         (UserImplicitCast::Resolve): ditto.
13277         
13278 2001-09-26  Ravi Pratap  <ravi@ximian.com>
13279
13280         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
13281         operator, return after emitting body. Regression tests pass again !
13282
13283         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
13284         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
13285         (Invocation::OverloadResolve): Ditto.
13286         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
13287
13288         * everywhere : update calls to the above methods accordingly.
13289
13290 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
13291
13292         * assign.cs (Assign): Make it inherit from ExpressionStatement.
13293
13294         * expression.cs (ExpressionStatement): New base class used for
13295         expressions that can appear in statements, so that we can provide
13296         an alternate path to generate expression that do not leave a value
13297         on the stack.
13298
13299         (Expression::Emit, and all the derivatives): We no longer return
13300         whether a value is left on the stack or not.  Every expression
13301         after being emitted leaves a single value on the stack.
13302
13303         * codegen.cs (EmitContext::EmitStatementExpression): Use the
13304         facilties of ExpressionStatement if possible.
13305
13306         * cs-parser.jay: Update statement_expression.
13307
13308 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
13309
13310         * driver.cs: Change the wording of message
13311
13312 2001-09-25  Ravi Pratap  <ravi@ximian.com>
13313
13314         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
13315         the type of the expression to the return type of the method if
13316         we have an overloaded operator match ! The regression tests pass again !
13317         (Unary::ResolveOperator): Ditto.
13318
13319         * expression.cs (Invocation::ConversionExists): Correct the member lookup
13320         to find "op_Implicit", not "implicit" ;-)
13321         (UserImplicitCast): New class to take care of user-defined implicit conversions.
13322         (ConvertImplicit, ForceConversion): Take TypeContainer argument
13323
13324         * everywhere : Correct calls to the above accordingly.
13325
13326         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
13327         (ConvertImplicit): Do user-defined conversion if it exists.
13328
13329 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
13330
13331         * assign.cs: track location.
13332         (Resolve): Use implicit conversions on assignment.
13333
13334         * literal.cs: Oops.  Not good, Emit of short access values should
13335         pass (Bytes) or the wrong argument will be selected.
13336
13337         * expression.cs (Unary::Emit): Emit code for -expr.
13338         
13339         (Unary::ResolveOperator): Handle `Substract' for non-constants
13340         (substract from zero from the non-constants).
13341         Deal with Doubles as well. 
13342         
13343         (Expression::ConvertImplicitRequired): New routine that reports an
13344         error if no implicit conversion exists. 
13345
13346         (Invocation::OverloadResolve): Store the converted implicit
13347         expressions if we make them
13348         
13349 2001-09-24  Ravi Pratap  <ravi@ximian.com>
13350
13351         * class.cs (ConstructorInitializer): Take a Location argument.
13352         (ConstructorBaseInitializer): Same here.
13353         (ConstructorThisInitializer): Same here.
13354
13355         * cs-parser.jay : Update all calls accordingly.
13356
13357         * expression.cs (Unary, Binary, New): Take location argument.
13358         Update accordingly everywhere.
13359
13360         * cs-parser.jay : Update all calls to the above to take a location
13361         argument.
13362
13363         * class.cs : Ditto.
13364
13365 2001-09-24  Ravi Pratap  <ravi@ximian.com>
13366
13367         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
13368         (Invocation::BetterConversion): Same here
13369         (Invocation::ConversionExists): Ditto.
13370
13371         (Invocation::ConversionExists): Implement.
13372
13373 2001-09-22  Ravi Pratap  <ravi@ximian.com>
13374
13375         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
13376         Also take an additional TypeContainer argument.
13377
13378         * All over : Pass in TypeContainer as argument to OverloadResolve.
13379
13380         * typemanager.cs (CSharpName): Update to check for the string type and return
13381         that too.
13382
13383         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
13384         a given method.
13385         
13386 2001-09-21  Ravi Pratap  <ravi@ximian.com>
13387
13388         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
13389         (Invocation::BetterFunction): Implement.
13390         (Invocation::BetterConversion): Implement.
13391         (Invocation::ConversionExists): Skeleton, no implementation yet.
13392
13393         Okay, things work fine !
13394
13395 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
13396
13397         * typemanager.cs: declare and load enum_type, delegate_type and
13398         void_type. 
13399
13400         * expression.cs (Expression::Emit): Now emit returns a value that
13401         tells whether a value is left on the stack or not.  This strategy
13402         might be reveted tomorrow with a mechanism that would address
13403         multiple assignments.
13404         (Expression::report118): Utility routine to report mismatches on
13405         the ExprClass.
13406
13407         (Unary::Report23): Report impossible type/operator combination
13408         utility function.
13409
13410         (Unary::IsIncrementableNumber): Whether the type can be
13411         incremented or decremented with add.
13412         (Unary::ResolveOperator): Also allow enumerations to be bitwise
13413         complemented. 
13414         (Unary::ResolveOperator): Implement ++, !, ~,
13415
13416         (Invocation::Emit): Deal with new Emit convetion.
13417         
13418         * All Expression derivatives: Updated their Emit method to return
13419         whether they leave values on the stack or not.
13420         
13421         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
13422         stack for expressions that are statements. 
13423
13424 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
13425
13426         * expression.cs (LValue): New interface.  Must be implemented by
13427         LValue objects.
13428         (LocalVariableReference, ParameterReference, FieldExpr): Implement
13429         LValue interface.
13430         
13431         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
13432         interface for generating code, simplifies the code.
13433
13434 2001-09-20  Ravi Pratap  <ravi@ximian.com>
13435
13436         * expression.cs (everywhere): Comment out return statements in ::Resolve
13437         methods to avoid the warnings.
13438
13439 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
13440
13441         * driver.cs (parse): Report error 2001 if we can not open the
13442         source file.
13443
13444         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
13445         not resolve it.
13446
13447         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
13448         object. 
13449
13450         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
13451         otherwise nested blocks end up with the same index.
13452
13453         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
13454
13455         * expression.cs:  Instead of having FIXMEs in the Resolve
13456         functions, throw exceptions so it is obvious that we are facing a
13457         bug. 
13458
13459         * cs-parser.jay (invocation_expression): Pass Location information.
13460
13461         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
13462         Use a basename for those routines because .NET does not like paths
13463         on them. 
13464
13465         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
13466         already defined.
13467
13468 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
13469
13470         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
13471         are loading the correct data types (throws an exception if not).
13472         (TypeManager::InitCoreTypes): Use CoreLookupType
13473
13474         * expression.cs (Unary::ResolveOperator): return the child
13475         expression for expressions which are just +expr.
13476         (Unary::ResolveOperator): Return negative literals for -LITERAL
13477         expressions (otherwise they are Unary {Literal}).
13478         (Invocation::Badness): Take into account `Implicit constant
13479         expression conversions'.
13480
13481         * literal.cs (LongLiteral): Implement long literal class.
13482         (IntLiteral): export the `Value' of the intliteral. 
13483
13484 2001-09-19  Ravi Pratap  <ravi@ximian.com>
13485
13486         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
13487
13488         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
13489         instead of 'Operator'
13490
13491         * expression.cs (Binary::ResolveOperator): Update accordingly.
13492         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
13493         and 'Minus'
13494
13495         * cs-parser.jay (unary_expression): Update to use the new names.
13496
13497         * gen-treedump.cs (GetUnary): Same here.
13498
13499         * expression.cs (Unary::Resolve): Implement.
13500         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
13501         operators are found instead of making noise ;-)
13502         (Unary::ResolveOperator): New method to do precisely the same thing which
13503         Binary::ResolveOperator does for Binary expressions.
13504         (Unary.method, .Arguments): Add.
13505         (Unary::OperName): Implement.   
13506         (Unary::ForceConversion): Copy and Paste !
13507
13508         * class.cs (Operator::Define): Fix a small bug for the case when we have 
13509         a unary operator.
13510
13511         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
13512         for the inbuilt operators. Only overloading works for now ;-)
13513
13514 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
13515
13516         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
13517         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
13518
13519         * expression.cs (This::Emit): Implement. 
13520         (This::Resolve): Implement.
13521         (TypeOf:Resolve): Implement.
13522         (Expression::ResolveSimpleName): Add an implicit this to instance
13523         field references. 
13524         (MemberAccess::Resolve): Deal with Parameters and Fields. 
13525         Bind instance variable to Field expressions.
13526         (FieldExpr::Instance): New field used to track the expression that
13527         represents the object instance.
13528         (FieldExpr::Resolve): Track potential errors from MemberLookup not
13529         binding 
13530         (FieldExpr::Emit): Implement.
13531
13532         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
13533         the last instruction contains a return opcode to avoid generating
13534         the last `ret' instruction (this generates correct code, and it is
13535         nice to pass the peverify output).
13536
13537         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
13538         initializer for static and instance variables.
13539         (Constructor::Emit): Allow initializer to be null in the case of
13540         static constructors.  Only emit initializer for instance
13541         constructors. 
13542
13543         (TypeContainer::FindMembers): Return a null array if there are no
13544         matches.
13545
13546         Also fix the code for the MemberTypes.Method branch, as it was not
13547         scanning that for operators (or tried to access null variables before).
13548
13549         * assign.cs (Assign::Emit): Handle instance and static fields. 
13550
13551         * TODO: Updated.
13552
13553         * driver.cs: Stop compilation if there are parse errors.
13554
13555         * cs-parser.jay (constructor_declaration): Provide default base
13556         initializer for non-static constructors.
13557         (constructor_declarator): Do not provide a default base
13558         initializers if none was specified.
13559         Catch the fact that constructors should not have parameters.
13560
13561         * class.cs: Do not emit parent class initializers for static
13562         constructors, that should be flagged as an error.
13563
13564 2001-09-18  Ravi Pratap  <ravi@ximian.com>
13565
13566         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
13567         Move back code into TypeContainer::Populate.
13568
13569 2001-09-18  Ravi Pratap  <ravi@ximian.com>
13570
13571         * class.cs (TypeContainer::AddConstructor): Fix the check to
13572         compare against Name, not Basename. 
13573         (Operator::OpType): Change Plus and Minus to Add and Subtract.
13574
13575         * cs-parser.jay : Update accordingly.
13576
13577         * class.cs (TypeContainer::FindMembers): For the case where we are searching
13578         for methods, don't forget to look into the operators too.
13579         (RegisterMethodBuilder): Helper method to take care of this for
13580         methods, constructors and operators.
13581         (Operator::Define): Completely revamp.
13582         (Operator.OperatorMethod, MethodName): New fields.
13583         (TypeContainer::Populate): Move the registering of builders into
13584         RegisterMethodBuilder.
13585         (Operator::Emit): Re-write.
13586
13587         * expression.cs (Binary::Emit): Comment out code path to emit method
13588         invocation stuff for the case when we have a user defined operator. I am
13589         just not able to get it right !
13590         
13591 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
13592
13593         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
13594         argument. 
13595
13596         (Expression::MemberLookup): Provide a version that allows to
13597         specify the MemberTypes and BindingFlags. 
13598
13599         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
13600         so it was not fetching variable information from outer blocks.
13601
13602         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
13603         Beforefieldinit as it was buggy.
13604
13605         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
13606         that Ravi put here.  
13607
13608         * class.cs (Constructor::Emit): Only emit if block is not null.
13609         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
13610         deal with this by semantically definining it as if the user had
13611         done it.
13612
13613         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
13614         constructors as we now "emit" them at a higher level.
13615
13616         (TypeContainer::DefineDefaultConstructor): Used to define the
13617         default constructors if none was provided.
13618
13619         (ConstructorInitializer): Add methods Resolve and Emit. 
13620         
13621         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
13622
13623 2001-09-17  Ravi Pratap  <ravi@ximian.com>
13624
13625         * class.cs (TypeContainer::EmitDefaultConstructor): Register
13626         the default constructor builder with our hashtable for methodbuilders
13627         to methodcores.
13628
13629         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
13630         and argument_count is 0 in which case we have a match.
13631         (Binary::ResolveOperator): More null checking and miscellaneous coding
13632         style cleanup.
13633
13634 2001-09-17  Ravi Pratap  <ravi@ximian.com>
13635
13636         * rootcontext.cs (IsNameSpace): Compare against null.
13637
13638         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
13639
13640         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
13641         and Unary::Operator.
13642
13643         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
13644         accordingly.
13645
13646         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
13647         we have overloaded operators.
13648         (Binary::ResolveOperator): Implement the part which does the operator overload
13649         resolution.
13650
13651         * class.cs (Operator::Emit): Implement.
13652         (TypeContainer::Emit): Emit the operators we have too.
13653
13654         * expression.cs (Binary::Emit): Update to emit the appropriate code for
13655         the case when we have a user-defined operator.
13656         
13657 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
13658
13659         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
13660
13661 2001-09-16  Ravi Pratap  <ravi@ximian.com>
13662
13663         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
13664         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
13665         (Constructor::Emit): Implement.
13666         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
13667         if we have no work to do. 
13668         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
13669         Emit method.
13670
13671         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
13672         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
13673
13674         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
13675         of parent.parent.
13676
13677 2001-09-15  Ravi Pratap  <ravi@ximian.com>
13678
13679         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
13680         in the source.
13681         (Tree::RecordNamespace): Method to do what the name says ;-)
13682         (Tree::Namespaces): Property to get at the namespaces hashtable.
13683
13684         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
13685         keep track.
13686
13687         * rootcontext.cs (IsNamespace): Fixed it :-)
13688
13689 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
13690
13691         * class.cs (TypeContainer::FindMembers): Add support for
13692         constructors. 
13693         (MethodCore): New class that encapsulates both the shared aspects
13694         of a Constructor and a Method.  
13695         (Method, Constructor): Factored pieces into MethodCore.
13696
13697         * driver.cs: Added --fatal which makes errors throw exceptions.
13698         Load System assembly as well as part of the standard library.
13699
13700         * report.cs: Allow throwing exceptions on errors for debugging.
13701
13702         * modifiers.cs: Do not use `parent', instead use the real type
13703         container to evaluate permission settings.
13704
13705         * class.cs: Put Ravi's patch back in.  He is right, and we will
13706         have to cope with the
13707
13708 2001-09-14  Ravi Pratap  <ravi@ximian.com>
13709
13710         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
13711         FamORAssem, not FamANDAssem.
13712         
13713 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
13714
13715         * driver.cs: Added --parse option that only parses its input files
13716         and terminates.
13717
13718         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
13719         incorrect.  IsTopLevel is not used to tell whether an object is
13720         root_types or not (that can be achieved by testing this ==
13721         root_types).  But to see if this is a top-level *class* (not
13722         necessarly our "toplevel" container). 
13723
13724 2001-09-14  Ravi Pratap  <ravi@ximian.com>
13725
13726         * enum.cs (Enum::Define): Modify to call the Lookup method on the
13727         parent instead of a direct call to GetType.
13728
13729 2001-09-14  Ravi Pratap  <ravi@ximian.com>
13730
13731         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
13732         Modifiers.TypeAttr. This should just be a call to that method.
13733
13734         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
13735         object so that we can determine if we are top-level or not.
13736
13737         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
13738         TypeContainer too.
13739
13740         * enum.cs (Enum::Define): Ditto.
13741
13742         * modifiers.cs (FieldAttr): Re-write.
13743
13744         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
13745         (TypeContainer::HaveStaticConstructor): New property to provide access
13746         to precisely that info.
13747
13748         * modifiers.cs (MethodAttr): Re-write.
13749         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
13750
13751         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
13752         of top-level types as claimed.
13753         
13754 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
13755
13756         * expression.cs (MemberLookup): Fruitless attempt to lookup
13757         constructors.  Maybe I need to emit default constructors?  That
13758         might be it (currently .NET emits this for me automatically).
13759         (Invocation::OverloadResolve): Cope with Arguments == null.
13760         (Invocation::EmitArguments): new function, shared by the new
13761         constructor and us.
13762         (Invocation::Emit): Handle static and instance methods.  Emit
13763         proper call instruction for virtual or non-virtual invocations.
13764         (New::Emit): Implement.
13765         (New::Resolve): Implement.
13766         (MemberAccess:Resolve): Implement.
13767         (MethodGroupExpr::InstanceExpression): used conforming to the spec
13768         to track instances.
13769         (FieldExpr::Resolve): Set type.
13770
13771         * support.cs: Handle empty arguments.
13772                 
13773         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
13774         SimpleLookup): Auxiliary routines to help parse a qualifier
13775         identifier.  
13776
13777         Update qualifier_identifier rule.
13778
13779         * codegen.cs: Removed debugging messages.
13780
13781         * class.cs: Make this a global thing, this acts just as a "key" to
13782         objects that we might have around.
13783
13784         (Populate): Only initialize method_builders_to_methods once.
13785
13786         * expression.cs (PropertyExpr): Initialize type from the
13787         PropertyType. 
13788
13789         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
13790         Resolve pattern.  Attempt to implicitly convert value to boolean.
13791         Emit code.
13792
13793         * expression.cs: Set the type for the int32/int32 argument case.
13794         (Binary::ResolveOperator): Set the return type to boolean for
13795         comparission operators
13796
13797         * typemanager.cs: Remove debugging print code.
13798
13799         (Invocation::Resolve): resolve type.
13800
13801         * class.cs: Allocate a MemberInfo of the correct size, as the code
13802         elsewhere depends on the test to reflect the correct contents.
13803
13804         (Method::) Keep track of parameters, due to System.Reflection holes
13805
13806         (TypeContainer::Populate): Keep track of MethodBuilders to Method
13807         mapping here.
13808
13809         (TypeContainer::FindMembers): Use ArrayList and then copy an array
13810         of the exact size and return that.
13811
13812         (Class::LookupMethodByBuilder): New function that maps
13813         MethodBuilders to its methods.  Required to locate the information
13814         on methods because System.Reflection bit us again.
13815
13816         * support.cs: New file, contains an interface ParameterData and
13817         two implementations: ReflectionParameters and InternalParameters
13818         used to access Parameter information.  We will need to grow this
13819         as required.
13820
13821         * expression.cs (Invocation::GetParameterData): implement a cache
13822         and a wrapper around the ParameterData creation for methods. 
13823         (Invocation::OverloadResolve): Use new code.
13824
13825 2001-09-13  Ravi Pratap  <ravi@ximian.com>
13826
13827         * class.cs (TypeContainer::EmitField): Remove and move into 
13828         (Field::Define): here and modify accordingly.
13829         (Field.FieldBuilder): New member.
13830         (TypeContainer::Populate): Update accordingly.
13831         (TypeContainer::FindMembers): Implement.
13832
13833 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
13834
13835         * statement.cs: (VariableInfo::VariableType): New field to be
13836         initialized with the full type once it is resolved. 
13837
13838 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
13839
13840         * parameter.cs (GetParameterInfo): Use a type cache to compute
13841         things only once, and to reuse this information
13842
13843         * expression.cs (LocalVariableReference::Emit): Implement.
13844         (OpcodeCast::Emit): fix.
13845
13846         (ParameterReference::Resolve): Implement.
13847         (ParameterReference::Emit): Implement.
13848
13849         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
13850         that are expressions need to stay as Expressions.
13851
13852         * typemanager.cs (CSharpName): Returns the C# name of a type if
13853         possible. 
13854
13855         * expression.cs (Expression::ConvertImplicit): New function that
13856         implements implicit type conversions.
13857
13858         (Expression::ImplicitReferenceConversion): Implements implicit
13859         reference conversions.
13860
13861         (EmptyCast): New type for transparent casts.
13862
13863         (OpcodeCast): New type for casts of types that are performed with
13864         a sequence of bytecodes.
13865         
13866         (BoxedCast): New type used for casting value types into reference
13867         types.  Emits a box opcode.
13868
13869         (Binary::DoNumericPromotions): Implements numeric promotions of
13870         and computation of the Binary::Type.
13871
13872         (Binary::EmitBranchable): Optimization.
13873
13874         (Binary::Emit): Implement code emission for expressions.
13875         
13876         * typemanager.cs (TypeManager): Added two new core types: sbyte
13877         and byte.
13878
13879 2001-09-12  Ravi Pratap  <ravi@ximian.com>
13880
13881         * class.cs (TypeContainer::FindMembers): Method which does exactly
13882         what Type.FindMembers does, only we don't have to use reflection. No
13883         implementation yet.
13884
13885         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
13886         typecontainer objects as we need to get at them.
13887         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
13888
13889         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
13890         typecontainer object.
13891
13892         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
13893         of just a Report object.
13894
13895 2001-09-11  Ravi Pratap  <ravi@ximian.com>
13896
13897         * class.cs (Event::Define): Go back to using the prefixes "add_" and
13898         "remove_"
13899         (TypeContainer::Populate): Now define the delegates of the type too.
13900         (TypeContainer.Delegates): Property to access the list of delegates defined
13901         in the type.
13902
13903         * delegates.cs (Delegate::Define): Implement partially.
13904
13905         * modifiers.cs (TypeAttr): Handle more flags.
13906
13907 2001-09-11  Ravi Pratap  <ravi@ximian.com>
13908
13909         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
13910         and not <=
13911         (Operator::Define): Re-write logic to get types by using the LookupType method
13912         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
13913         (Indexer::Define): Ditto.
13914         (Event::Define): Ditto.
13915         (Property::Define): Ditto.
13916         
13917 2001-09-10  Ravi Pratap  <ravi@ximian.com>
13918
13919         * class.cs (TypeContainer::Populate): Now define operators too. 
13920         (TypeContainer.Operators): New property to access the list of operators
13921         in a type.
13922         (Operator.OperatorMethodBuilder): New member to hold the method builder
13923         for the operator we are defining.
13924         (Operator::Define): Implement.
13925
13926 2001-09-10  Ravi Pratap  <ravi@ximian.com>
13927
13928         * class.cs (Event::Define): Make the prefixes of the accessor methods
13929         addOn_ and removeOn_ 
13930
13931         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
13932         of the location being passed in too. Ideally, this should go later since all
13933         error reporting should be done through the Report object.
13934
13935         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
13936         (Populate): Iterate thru the indexers we have and define them too.
13937         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
13938         for the get and set accessors.
13939         (Indexer::Define): Implement.
13940         
13941 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
13942
13943         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
13944         my previous implementation, did not work.
13945
13946         * typemanager.cs: Add a couple of missing types (the longs).
13947
13948         * literal.cs: Use TypeManager.bool_type instead of getting it.
13949
13950         * expression.cs (EventExpr): New kind of expressions.
13951         (Expressio::ExprClassFromMemberInfo): finish
13952
13953 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
13954
13955         * assign.cs: Emit stores to static fields differently.
13956
13957 2001-09-08  Ravi Pratap  <ravi@ximian.com>
13958
13959         * Merge in changes and adjust code to tackle conflicts. Backed out my
13960         code in Assign::Resolve ;-) 
13961
13962 2001-09-08  Ravi Pratap  <ravi@ximian.com>
13963
13964         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
13965         instead Report.Error and also pass in the location.
13966         (CSharpParser::Lexer): New readonly property to return the reference
13967         to the Tokenizer object.
13968         (declare_local_variables): Use Report.Error with location instead of plain 
13969         old error.
13970         (CheckDef): Ditto.
13971
13972         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
13973         (Operator.CheckBinaryOperator): Ditto.
13974
13975         * cs-parser.jay (operator_declarator): Update accordingly.
13976
13977         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
13978         (CheckBinaryOperator): Same here.
13979
13980         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
13981         on the name without any prefixes of namespace names etc. This is because we
13982         already might have something already fully qualified like 
13983         'System.Console.WriteLine'
13984
13985         * assign.cs (Resolve): Begin implementation. Stuck ;-)
13986
13987 2001-09-07  Ravi Pratap  <ravi@ximian.com>
13988
13989         * cs-tokenizer.cs (location): Return a string which also contains
13990         the file name.
13991
13992         * expression.cs (ElementAccess): New class for expressions of the
13993         type 'element access.'
13994         (BaseAccess): New class for expressions of the type 'base access.'
13995         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
13996         respectively.
13997         
13998         * cs-parser.jay (element_access): Implement action.
13999         (base_access): Implement actions.
14000         (checked_expression, unchecked_expression): Implement.
14001
14002         * cs-parser.jay (local_variable_type): Correct and implement.
14003         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
14004
14005         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
14006
14007         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
14008         name and the specifiers.
14009
14010         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
14011         
14012         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
14013         making them all public ;-)
14014
14015         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
14016         class anyways.
14017         
14018 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
14019
14020         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
14021         PropertyExprs.
14022         (FieldExpr, PropertyExprs): New resolved expressions.
14023         (SimpleName::MemberStaticCheck): Perform static checks for access
14024         to non-static fields on static methods. Maybe this should be
14025         generalized for MemberAccesses. 
14026         (SimpleName::ResolveSimpleName): More work on simple name
14027         resolution. 
14028
14029         * cs-parser.jay (primary_expression/qualified_identifier): track
14030         the parameter index.
14031
14032         * codegen.cs (CodeGen::Save): Catch save exception, report error.
14033         (EmitContext::EmitBoolExpression): Chain to expression generation
14034         instead of temporary hack.
14035         (::EmitStatementExpression): Put generic expression code generation.
14036
14037         * assign.cs (Assign::Emit): Implement variable assignments to
14038         local variables, parameters and fields.
14039
14040 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
14041
14042         * statement.cs (Block::GetVariableInfo): New method, returns the
14043         VariableInfo for a variable name in a block.
14044         (Block::GetVariableType): Implement in terms of GetVariableInfo
14045
14046         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
14047         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
14048
14049 2001-09-06  Ravi Pratap  <ravi@ximian.com>
14050
14051         * cs-parser.jay (operator_declaration): Continue on my quest : update
14052         to take attributes argument.
14053         (event_declaration): Ditto.
14054         (enum_declaration): Ditto.
14055         (indexer_declaration): Ditto.
14056         
14057         * class.cs (Operator::Operator): Update constructor accordingly.
14058         (Event::Event): Ditto.
14059
14060         * delegate.cs (Delegate::Delegate): Same here.
14061
14062         * enum.cs (Enum::Enum): Same here.
14063         
14064 2001-09-05  Ravi Pratap  <ravi@ximian.com>
14065
14066         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
14067
14068         * ../tests/cs0658.cs : New file to demonstrate error 0658.
14069
14070         * attribute.cs (Attributes): New class to encapsulate all attributes which were
14071         being passed around as an arraylist.
14072         (Attributes::AddAttribute): Method to add attribute sections.
14073
14074         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
14075         (struct_declaration): Update accordingly.
14076         (constant_declaration): Update.
14077         (field_declaration): Update.
14078         (method_header): Update.
14079         (fixed_parameter): Update.
14080         (parameter_array): Ditto.
14081         (property_declaration): Ditto.
14082         (destructor_declaration): Ditto.
14083         
14084         * class.cs (Struct::Struct): Update constructors accordingly.
14085         (Class::Class): Ditto.
14086         (Field::Field): Ditto.
14087         (Method::Method): Ditto.
14088         (Property::Property): Ditto.
14089         (TypeContainer::OptAttribute): update property's return type.
14090         
14091         * interface.cs (Interface.opt_attributes): New member.
14092         (Interface::Interface): Update to take the extra Attributes argument.
14093
14094         * parameter.cs (Parameter::Parameter): Ditto.
14095
14096         * constant.cs (Constant::Constant): Ditto.
14097
14098         * interface.cs (InterfaceMemberBase): New OptAttributes field.
14099         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
14100         the attributes as a parameter.
14101         (InterfaceProperty): Update constructor call.
14102         (InterfaceEvent): Ditto.
14103         (InterfaceMethod): Ditto.
14104         (InterfaceIndexer): Ditto.
14105
14106         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
14107         pass the attributes too.
14108         (interface_event_declaration): Ditto.
14109         (interface_property_declaration): Ditto.
14110         (interface_method_declaration): Ditto.
14111         (interface_declaration): Ditto.
14112
14113 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
14114
14115         * class.cs (Method::Define): Track the "static Main" definition to
14116         create an entry point. 
14117
14118         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
14119         EntryPoint if we find it. 
14120
14121         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
14122         (EmitContext::ig): Make this variable public.
14123
14124         * driver.cs: Make the default output file be the first file name
14125         with the .exe extension.  
14126
14127         Detect empty compilations
14128
14129         Handle various kinds of output targets.  Handle --target and
14130         rename -t to --dumper.
14131
14132         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
14133         methods inherited from Expression return now an Expression.  This
14134         will is used during the tree rewriting as we resolve them during
14135         semantic analysis.
14136
14137         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
14138         the spec.  Missing entirely is the information about
14139         accessability of elements of it.
14140
14141         (Expression::ExprClassFromMemberInfo): New constructor for
14142         Expressions that creates a fully initialized Expression based on
14143         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
14144         a Type.
14145
14146         (Invocation::Resolve): Begin implementing resolution of invocations.
14147         
14148         * literal.cs (StringLiteral):  Implement Emit.
14149
14150 2001-09-05  Ravi Pratap  <ravi@ximian.com>
14151
14152         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
14153         member.
14154         
14155 2001-09-04  Ravi Pratap  <ravi@ximian.com>
14156
14157         * cs-parser.jay (attribute_arguments): Implement actions.
14158         (attribute): Fix bug in production. Implement action.
14159         (attribute_list): Implement.
14160         (attribute_target): Implement.
14161         (attribute_target_specifier, opt_target_specifier): Implement
14162         (CheckAttributeTarget): New method to check if the attribute target
14163         is valid.
14164         (attribute_section): Implement.
14165         (opt_attributes): Implement.
14166
14167         * attribute.cs : New file to handle attributes.
14168         (Attribute): Class to hold attribute info.
14169
14170         * cs-parser.jay (opt_attribute_target_specifier): Remove production
14171         (attribute_section): Modify production to use 2 different rules to 
14172         achieve the same thing. 1 s/r conflict down !
14173         Clean out commented, useless, non-reducing dimension_separator rules.
14174         
14175         * class.cs (TypeContainer.attributes): New member to hold list
14176         of attributes for a type.
14177         (Struct::Struct): Modify to take one more argument, the attribute list.
14178         (Class::Class): Ditto.
14179         (Field::Field): Ditto.
14180         (Method::Method): Ditto.
14181         (Property::Property): Ditto.
14182         
14183         * cs-parser.jay (struct_declaration): Update constructor call to
14184         pass in the attributes too.
14185         (class_declaration): Ditto.
14186         (constant_declaration): Ditto.
14187         (field_declaration): Ditto.
14188         (method_header): Ditto.
14189         (fixed_parameter): Ditto.
14190         (parameter_array): Ditto.
14191         (property_declaration): Ditto.
14192
14193         * constant.cs (Constant::Constant): Update constructor similarly.
14194         Use System.Collections.
14195
14196         * parameter.cs (Parameter::Parameter): Update as above.
14197
14198 2001-09-02  Ravi Pratap  <ravi@ximian.com>
14199
14200         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
14201         (TypeContainer.delegates): New member to hold list of delegates.
14202
14203         * cs-parser.jay (delegate_declaration): Implement the action correctly 
14204         this time as I seem to be on crack ;-)
14205
14206 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
14207
14208         * rootcontext.cs (RootContext::IsNamespace): new function, used to
14209         tell whether an identifier represents a namespace.
14210
14211         * expression.cs (NamespaceExpr): A namespace expression, used only
14212         temporarly during expression resolution.
14213         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
14214         utility functions to resolve names on expressions.
14215
14216 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
14217
14218         * codegen.cs: Add hook for StatementExpressions. 
14219
14220         * class.cs: Fix inverted test for static flag in methods.
14221
14222 2001-09-02  Ravi Pratap  <ravi@ximian.com>
14223
14224         * class.cs (Operator::CheckUnaryOperator): Correct error number used
14225         to make it coincide with MS' number.
14226         (Operator::CheckBinaryOperator): Ditto.
14227
14228         * ../errors/errors.txt : Remove error numbers added earlier.
14229
14230         * ../errors/cs1019.cs : Test case for error # 1019
14231
14232         * ../errros/cs1020.cs : Test case for error # 1020
14233
14234         * cs-parser.jay : Clean out commented cruft.
14235         (dimension_separators, dimension_separator): Comment out. Ostensibly not
14236         used anywhere - non-reducing rule.
14237         (namespace_declarations): Non-reducing rule - comment out.
14238
14239         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
14240         with TypeContainer::AddEnum.
14241
14242         * delegate.cs : New file for delegate handling classes.
14243         (Delegate): Class for declaring delegates.
14244
14245         * makefile : Update.
14246
14247         * cs-parser.jay (delegate_declaration): Implement.
14248
14249 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
14250
14251         * class.cs (Event::Define): Implement.
14252         (Event.EventBuilder): New member.
14253
14254         * class.cs (TypeContainer::Populate): Update to define all enums and events
14255         we have.
14256         (Events): New property for the events arraylist we hold. Shouldn't we move to using
14257         readonly fields for all these cases ?
14258
14259 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
14260
14261         * class.cs (Property): Revamp to use the convention of making fields readonly.
14262         Accordingly modify code elsewhere.
14263
14264         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
14265         the Define method of the Property class.
14266
14267         * class.cs : Clean up applied patch and update references to variables etc. Fix 
14268         trivial bug.
14269         (TypeContainer::Populate): Update to define all the properties we have. Also
14270         define all enumerations.
14271
14272         * enum.cs (Define): Implement.
14273         
14274 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
14275
14276         * cs-parser.jay (overloadable_operator): The semantic value is an
14277         enum of the Operator class.
14278         (operator_declarator): Implement actions.
14279         (operator_declaration): Implement.
14280
14281         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
14282         validity of definitions.
14283         (Operator::CheckBinaryOperator): Static method to check for binary operators
14284         (TypeContainer::AddOperator): New method to add an operator to a type.
14285
14286         * cs-parser.jay (indexer_declaration): Added line to actually call the
14287         AddIndexer method so it gets added ;-)
14288
14289         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
14290         already taken care of by the MS compiler ?  
14291
14292 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
14293
14294         * class.cs (Operator): New class for operator declarations.
14295         (Operator::OpType): Enum for the various operators.
14296
14297 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
14298
14299         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
14300         ostensibly handle this in semantic analysis.
14301
14302         * cs-parser.jay (general_catch_clause): Comment out
14303         (specific_catch_clauses, specific_catch_clause): Ditto.
14304         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
14305         (catch_args, opt_catch_args): New productions.
14306         (catch_clause): Rewrite to use the new productions above
14307         (catch_clauses): Modify accordingly.
14308         (opt_catch_clauses): New production to use in try_statement
14309         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
14310         and re-write the code in the actions to extract the specific and
14311         general catch clauses by being a little smart ;-)
14312
14313         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
14314         Hooray, try and catch statements parse fine !
14315         
14316 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14317
14318         * statement.cs (Block::GetVariableType): Fix logic to extract the type
14319         string from the hashtable of variables.
14320
14321         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
14322         I end up making that mistake ;-)
14323         (catch_clauses): Fixed gross error which made Key and Value of the 
14324         DictionaryEntry the same : $1 !!
14325
14326 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14327
14328         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
14329
14330         * cs-parser.jay (event_declaration): Correct to remove the semicolon
14331         when the add and remove accessors are specified. 
14332
14333 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
14334
14335         * cs-parser.jay (IndexerDeclaration): New helper class to hold
14336         information about indexer_declarator.
14337         (indexer_declarator): Implement actions.
14338         (parsing_indexer): New local boolean used to keep track of whether
14339         we are parsing indexers or properties. This is necessary because 
14340         implicit_parameters come into picture even for the get accessor in the 
14341         case of an indexer.
14342         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
14343
14344         * class.cs (Indexer): New class for indexer declarations.
14345         (TypeContainer::AddIndexer): New method to add an indexer to a type.
14346         (TypeContainer::indexers): New member to hold list of indexers for the
14347         type.
14348
14349 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
14350
14351         * cs-parser.jay (add_accessor_declaration): Implement action.
14352         (remove_accessor_declaration): Implement action.
14353         (event_accessors_declaration): Implement
14354         (variable_declarators): swap statements for first rule - trivial.
14355
14356         * class.cs (Event): New class to hold information about event
14357         declarations.
14358         (TypeContainer::AddEvent): New method to add an event to a type
14359         (TypeContainer::events): New member to hold list of events.
14360
14361         * cs-parser.jay (event_declaration): Implement actions.
14362
14363 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
14364
14365         * cs-parser.jay (dim_separators): Implement. Make it a string
14366         concatenating all the commas together, just as they appear.
14367         (opt_dim_separators): Modify accordingly
14368         (rank_specifiers): Update accordingly. Basically do the same
14369         thing - instead, collect the brackets here.
14370         (opt_rank_sepcifiers): Modify accordingly.
14371         (array_type): Modify to actually return the complete type string
14372         instead of ignoring the rank_specifiers.
14373         (expression_list): Implement to collect the expressions
14374         (variable_initializer): Implement. We make it a list of expressions
14375         essentially so that we can handle the array_initializer case neatly too.
14376         (variable_initializer_list): Implement.
14377         (array_initializer): Make it a list of variable_initializers
14378         (opt_array_initializer): Modify accordingly.
14379
14380         * expression.cs (New::NType): Add enumeration to help us
14381         keep track of whether we have an object/delegate creation
14382         or an array creation.
14383         (New:NewType, New::Rank, New::Indices, New::Initializers): New
14384         members to hold data about array creation.
14385         (New:New): Modify to update NewType
14386         (New:New): New Overloaded contructor for the array creation
14387         case.
14388
14389         * cs-parser.jay (array_creation_expression): Implement to call
14390         the overloaded New constructor.
14391         
14392 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
14393
14394         * class.cs (TypeContainer::Constructors): Return member
14395         constructors instead of returning null.
14396
14397 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
14398
14399         * typemanager.cs (InitCoreTypes): Initialize the various core
14400         types after we have populated the type manager with the user
14401         defined types (this distinction will be important later while
14402         compiling corlib.dll)
14403
14404         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
14405         on Expression Classification.  Now all expressions have a method
14406         `Resolve' and a method `Emit'.
14407
14408         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
14409         generation from working.     Also add some temporary debugging
14410         code. 
14411         
14412 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
14413
14414         * codegen.cs: Lots of code generation pieces.  This is only the
14415         beginning, will continue tomorrow with more touches of polish.  We
14416         handle the fundamentals of if, while, do, for, return.  Others are
14417         trickier and I need to start working on invocations soon.
14418         
14419         * gen-treedump.cs: Bug fix, use s.Increment here instead of
14420         s.InitStatement. 
14421
14422         * codegen.cs (EmitContext): New struct, used during code
14423         emission to keep a context.   Most of the code generation will be
14424         here. 
14425
14426         * cs-parser.jay: Add embedded blocks to the list of statements of
14427         this block.  So code generation proceeds in a top down fashion.
14428
14429 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
14430
14431         * statement.cs: Add support for multiple child blocks.
14432
14433 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
14434
14435         * codegen.cs (EmitCode): New function, will emit the code for a
14436         Block of code given a TypeContainer and its ILGenerator. 
14437
14438         * statement.cs (Block): Standard public readonly optimization.
14439         (Block::Block constructors): Link children. 
14440         (Block::Child): Child Linker.
14441         (Block::EmitVariables): Emits IL variable declarations.
14442
14443         * class.cs: Drop support for MethodGroups here, delay until
14444         Semantic Analysis.
14445         (Method::): Applied the same simplification that I did before, and
14446         move from Properties to public readonly fields.
14447         (Method::ParameterTypes): Returns the parameter types for the
14448         function, and implements a cache that will be useful later when I
14449         do error checking and the semantic analysis on the methods is
14450         performed.
14451         (Constructor::GetCallingConvention): Renamed from CallingConvetion
14452         and made a method, optional argument tells whether this is a class
14453         or a structure to apply the `has-this' bit.
14454         (Method::GetCallingConvention): Implement, returns the calling
14455         convention. 
14456         (Method::Define): Defines the type, a second pass is performed
14457         later to populate the methods.
14458
14459         (Constructor::ParameterTypes): implement a cache similar to the
14460         one on Method::ParameterTypes, useful later when we do semantic
14461         analysis. 
14462
14463         (TypeContainer::EmitMethod):  New method.  Emits methods.
14464
14465         * expression.cs: Removed MethodGroup class from here.
14466         
14467         * parameter.cs (Parameters::GetCallingConvention): new method.
14468
14469 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
14470
14471         * class.cs (TypeContainer::Populate): Drop RootContext from the
14472         argument. 
14473
14474         (Constructor::CallingConvention): Returns the calling convention.
14475         (Constructor::ParameterTypes): Returns the constructor parameter
14476         types. 
14477         
14478         (TypeContainer::AddConstructor): Keep track of default constructor
14479         and the default static constructor.
14480
14481         (Constructor::) Another class that starts using `public readonly'
14482         instead of properties. 
14483
14484         (Constructor::IsDefault): Whether this is a default constructor. 
14485
14486         (Field::) use readonly public fields instead of properties also.
14487
14488         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
14489         track of static constructors;  If none is used, turn on
14490         BeforeFieldInit in the TypeAttributes. 
14491
14492         * cs-parser.jay (opt_argument_list): now the return can be null
14493         for the cases where there are no arguments. 
14494
14495         (constructor_declarator): If there is no implicit `base' or
14496         `this', then invoke the default parent constructor. 
14497         
14498         * modifiers.cs (MethodAttr): New static function maps a set of
14499         modifiers flags into a MethodAttributes enum
14500         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
14501         MethodAttr, TypeAttr to represent the various mappings where the
14502         modifiers are used.
14503         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
14504
14505 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
14506
14507         * parameter.cs (GetParameterInfo): Fix bug where there would be no
14508         method arguments.
14509
14510         * interface.cs (PopulateIndexer): Implemented the code generator
14511         for interface indexers.
14512
14513 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
14514
14515         * interface.cs (InterfaceMemberBase): Now we track the new status
14516         here.  
14517
14518         (PopulateProperty): Implement property population.  Woohoo!  Got
14519         Methods and Properties going today. 
14520
14521         Removed all the properties for interfaces, and replaced them with
14522         `public readonly' fields. 
14523
14524 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
14525
14526         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
14527         initialize their hashtables/arraylists only when they are needed
14528         instead of doing this always.
14529
14530         * parameter.cs: Handle refs and out parameters.
14531
14532         * cs-parser.jay: Use an ArrayList to construct the arguments
14533         instead of the ParameterCollection, and then cast that to a
14534         Parameter[] array.
14535
14536         * parameter.cs: Drop the use of ParameterCollection and use
14537         instead arrays of Parameters.
14538
14539         (GetParameterInfo): Use the Type, not the Name when resolving
14540         types. 
14541
14542 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
14543
14544         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
14545         and instead use public readonly fields.
14546
14547         * class.cs: Put back walking code for type containers.
14548
14549 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
14550
14551         * class.cs (MakeConstant): Code to define constants.
14552
14553         * rootcontext.cs (LookupType): New function.  Used to locate types 
14554
14555         
14556 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
14557
14558         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
14559         this System.Reflection code is.  Kudos to Microsoft
14560         
14561         * typemanager.cs: Implement a type cache and avoid loading all
14562         types at boot time.  Wrap in LookupType the internals.  This made
14563         the compiler so much faster.  Wow.  I rule!
14564         
14565         * driver.cs: Make sure we always load mscorlib first (for
14566         debugging purposes, nothing really important).
14567
14568         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
14569         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
14570
14571         * rootcontext.cs: Lookup types on their namespace;  Lookup types
14572         on namespaces that have been imported using the `using' keyword.
14573
14574         * class.cs (TypeContainer::TypeAttr): Virtualize.
14575         (Class::TypeAttr): Return attributes suitable for this bad boy.
14576         (Struct::TypeAttr): ditto.
14577         Handle nested classes.
14578         (TypeContainer::) Remove all the type visiting code, it is now
14579         replaced with the rootcontext.cs code
14580
14581         * rootcontext.cs (GetClassBases): Added support for structs. 
14582
14583 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
14584
14585         * interface.cs, statement.cs, class.cs, parameter.cs,
14586         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
14587         Drop use of TypeRefs, and use strings instead.
14588
14589 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
14590
14591         * rootcontext.cs: 
14592
14593         * class.cs (Struct::Struct): set the SEALED flags after
14594         checking the modifiers.
14595         (TypeContainer::TypeAttr): new property, returns the
14596         TypeAttributes for a class.  
14597
14598         * cs-parser.jay (type_list): Oops, list production was creating a
14599         new list of base types.
14600
14601         * rootcontext.cs (StdLib): New property.
14602         (GetInterfaceTypeByName): returns an interface by type name, and
14603         encapsulates error handling here.
14604         (GetInterfaces): simplified.
14605         (ResolveTree): Encapsulated all the tree resolution here.
14606         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
14607         types. 
14608         
14609         * driver.cs: Add support for --nostdlib, to avoid loading the
14610         default assemblies.
14611         (Main): Do not put tree resolution here. 
14612
14613         * rootcontext.cs: Beginning of the class resolution.
14614
14615 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
14616
14617         * rootcontext.cs: Provide better error reporting. 
14618
14619         * cs-parser.jay (interface_base): set our $$ to be interfaces.
14620
14621         * rootcontext.cs (CreateInterface): Handle the case where there
14622         are no parent interfaces.
14623         
14624         (CloseTypes): Routine to flush types at the end.
14625         (CreateInterface): Track types.
14626         (GetInterfaces): Returns an array of Types from the list of
14627         defined interfaces.
14628
14629         * typemanager.c (AddUserType): Mechanism to track user types (puts
14630         the type on the global type hash, and allows us to close it at the
14631         end). 
14632         
14633 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
14634
14635         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
14636         RecordInterface instead.
14637
14638         * cs-parser.jay: Updated to reflect changes above.
14639
14640         * decl.cs (Definition): Keep track of the TypeBuilder type that
14641         represents this type here.  Not sure we will use it in the long
14642         run, but wont hurt for now.
14643
14644         * driver.cs: Smaller changes to accomodate the new code.
14645
14646         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
14647         when done. 
14648
14649         * rootcontext.cs (CreateInterface):  New method, used to create
14650         the System.TypeBuilder type for interfaces.
14651         (ResolveInterfaces): new entry point to resolve the interface
14652         hierarchy. 
14653         (CodeGen): Property, used to keep track of the code generator.
14654
14655 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
14656
14657         * cs-parser.jay: Add a second production for delegate_declaration
14658         with `VOID'.
14659
14660         (enum_body): Put an opt_comma here instead of putting it on
14661         enum_body or enum_member_declarations so we can handle trailing
14662         commas on enumeration members.  Gets rid of a shift/reduce.
14663         
14664         (type_list): Need a COMMA in the middle.
14665
14666         (indexer_declaration): Tell tokenizer to recognize get/set
14667
14668         * Remove old targets.
14669
14670         * Re-add the parser target.
14671
14672 2001-07-13  Simon Cozens <simon@simon-cozens.org>
14673
14674         * cs-parser.jay: Add precendence rules for a number of operators
14675         ot reduce the number of shift/reduce conflicts in the grammar.
14676         
14677 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
14678
14679         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
14680         and put it here.
14681
14682         Get rid of old crufty code.
14683
14684         * rootcontext.cs: Use this to keep track of the parsed
14685         representation and the defined types available to the program. 
14686
14687         * gen-treedump.cs: adjust for new convention.
14688
14689         * type.cs: Split out the type manager, and the assembly builder
14690         from here. 
14691
14692         * typemanager.cs: the type manager will live here now.
14693
14694         * cil-codegen.cs: And the code generator here. 
14695
14696 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
14697
14698         * makefile: Fixed up for easy making.
14699
14700 2001-07-13  Simon Cozens <simon@simon-cozens.org>
14701
14702         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
14703         the 
14704
14705         (unary_expression): Expand pre_increment_expression and
14706         post_decrement_expression to reduce a shift/reduce.
14707
14708 2001-07-11  Simon Cozens
14709
14710         * cs-tokenizer.cs: Hex numbers should begin with a 0.
14711
14712         Improve allow_keyword_as_indent name.
14713
14714 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
14715
14716         * Adjustments for Beta2. 
14717
14718 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
14719
14720         * decl.cs: Added `Define' abstract method.
14721         (InTransit): new property, used to catch recursive definitions. 
14722
14723         * interface.cs: Implement `Define'. 
14724
14725         * modifiers.cs: Map Modifiers.constants to
14726         System.Reflection.TypeAttribute flags.
14727
14728         * class.cs: Keep track of types and user-defined types.
14729         (BuilderInit): New method for creating an assembly
14730         (ResolveType): New function to launch the resolution process, only
14731         used by interfaces for now.
14732
14733         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
14734         that are inserted into the name space. 
14735
14736 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
14737
14738         * ARGH.  I have screwed up my tree so many times due to the use of
14739         rsync rather than using CVS.  Going to fix this at once. 
14740
14741         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
14742         load types.
14743
14744 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
14745
14746         * Experiment successful: Use System.Type rather that our own
14747         version of Type.  
14748
14749 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
14750
14751         * cs-parser.jay: Removed nsAliases from here.
14752
14753         Use new namespaces, handle `using XXX;' 
14754
14755         * namespace.cs: Reimplemented namespace handling, use a recursive
14756         definition of the class.  Now we can keep track of using clauses
14757         and catch invalid using clauses.
14758
14759 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
14760
14761         * gen-treedump.cs: Adapted for all the renaming.
14762
14763         * expression.cs (Expression): this class now has a Type property
14764         which returns an expression Type.
14765
14766         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
14767         `Type', as this has a different meaning now in the base
14768
14769 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
14770
14771         * interface.cs, class.cs: Removed from all the sources the
14772         references to signature computation, as we can not do method
14773         signature computation during the parsing time, as we are not
14774         trying to solve at that point distinguishing:
14775
14776         class X {
14777                 void a (Blah x) {}
14778                 void a (NS.Blah x) {}
14779         }
14780
14781         Which depending on the context might be valid or not, as we do not
14782         know if Blah is the same thing as NS.Blah at that point.
14783
14784         * Redid everything so the code uses TypeRefs now instead of
14785         Types.  TypeRefs are just temporary type placeholders, that need
14786         to be resolved.  They initially have a pointer to a string and the
14787         current scope in which they are used.  This is used later by the
14788         compiler to resolve the reference to an actual Type. 
14789
14790         * DeclSpace is no longer a CIR.Type, and neither are
14791         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
14792         are all DeclSpaces, but no Types. 
14793
14794         * type.cs (TypeRefManager): This implements the TypeRef manager,
14795         which keeps track of all the types that need to be resolved after
14796         the parsing has finished. 
14797
14798 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
14799
14800         * ARGH.  We are going to have to store `foreach' as a class rather
14801         than resolving it, as we need to verify error 1579 after name
14802         resolution.   *OR* we could keep a flag that says `This request to
14803         IEnumerator comes from a foreach statement' which we can then use
14804         to generate the error.
14805
14806 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
14807
14808         * class.cs (TypeContainer.AddMethod): we now add methods to the
14809         MethodGroup instead of the method hashtable.  
14810
14811         * expression.cs: Add MethodGroup abstraction, which gets us one
14812         step closer to the specification in the way we handle method
14813         declarations.  
14814
14815         * cs-parser.jay (primary_expression): qualified_identifier now
14816         tried to match up an identifier to a local variable reference or
14817         to a parameter reference.
14818
14819         current_local_parameters is now a parser global variable that
14820         points to the current parameters for the block, used during name
14821         lookup.
14822
14823         (property_declaration): Now creates an implicit `value' argument to
14824         the set accessor.
14825
14826 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
14827
14828         * parameter.cs: Do not use `param' arguments as part of the
14829         signature, per the spec.
14830
14831 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
14832
14833         * decl.cs: Base class for classes, structs and interfaces.  This
14834         is the "Declaration Space" 
14835
14836         * cs-parser.jay: Use CheckDef for checking declaration errors
14837         instead of having one on each function.
14838
14839         * class.cs: Factor out some code for handling error handling in
14840         accordance to the "Declarations" section in the "Basic Concepts"
14841         chapter in the ECMA C# spec.
14842
14843         * interface.cs: Make all interface member classes derive from
14844         InterfaceMemberBase.
14845
14846 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
14847
14848         * Many things: all interfaces are parsed and generated in
14849         gen-treedump.  Support for member variables, constructors,
14850         destructors, properties, constants is there.
14851
14852         Beginning of the IL backend, but very little done, just there for
14853         testing purposes. 
14854
14855 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
14856
14857         * cs-parser.jay: Fix labeled statement.
14858
14859         * cs-tokenizer.cs (escape): Escape " and ' always.
14860         ref_line, ref_name: keep track of the line/filename as instructed
14861         by #line by the compiler.
14862         Parse #line.
14863
14864 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
14865
14866         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
14867         to match the values in System.CodeDOM.
14868
14869         Divid renamed to Divide.
14870
14871         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
14872         statements. 
14873         (Statements.set): remove.
14874
14875         * System.CodeDOM/CodeCatchClause.cs: always have a valid
14876         statements. 
14877
14878         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
14879         falseStatements always have valid values. 
14880
14881         * cs-parser.jay: Use System.CodeDOM now.
14882