2002-08-28 Martin Baulig <martin@gnome.org>
[mono.git] / mcs / mcs / ChangeLog
1 2002-08-28  Martin Baulig  <martin@gnome.org>
2
3         * expression.cs (Binary.ResolveOperator): Don't silently return
4         but return an error if an operator cannot be applied between two
5         enum types.
6
7 2002-08-28  Martin Baulig  <martin@gnome.org>
8
9         * class.cs (Constructor.Define): Set the permission attributes
10         correctly instead of making all constructors public.
11
12 2002-08-28  Martin Baulig  <martin@gnome.org>
13
14         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
15         for private members before reporting a CS0103; if we find anything,
16         it's a CS0122.
17
18 2002-08-28  Martin Baulig  <martin@gnome.org>
19
20         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
21         to check whether `closure_start_type == closure_invocation_type',
22         we also need to check whether `m.DeclaringType == closure_invocation_type'
23         before bypassing the permission checks.  We might be accessing
24         protected/private members from the base class.
25         (TypeManager.RealMemberLookup): Only set private_ok if private
26         members were requested via BindingFlags.NonPublic.
27
28         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
29
30         * expression.cs (MemberAccess.ResolveMemberAccess): Set
31         MethodGroupExpr.IsExplicitImpl if appropriate.
32         (Invocation.DoResolve): Don't report the CS0120 for explicit
33         interface implementations.
34
35 2002-08-27  Martin Baulig  <martin@gnome.org>
36
37         * expression.cs (Invocation.DoResolve): If this is a static
38         method and we don't have an InstanceExpression, we must report
39         a CS0120.
40
41 2002-08-25  Martin Baulig  <martin@gnome.org>
42
43         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
44         `==' between a valuetype and an object.
45
46 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
47
48         * ecore.cs (TypeExpr): Provide a ToString method.
49
50 2002-08-24  Martin Baulig  <martin@gnome.org>
51
52         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
53         now called proggie.dbg and it's a binary file.
54
55 2002-08-23  Martin Baulig  <martin@gnome.org>
56
57         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
58
59 2002-08-23  Martin Baulig  <martin@gnome.org>
60
61         * struct.cs (MyStructInfo.ctor): Make this work with empty
62         structs; it's not allowed to use foreach() on null.
63
64 2002-08-23  Martin Baulig  <martin@gnome.org>
65
66         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
67         writer the full pathname of the generated assembly.
68
69 2002-08-23  Martin Baulig  <martin@gnome.org>
70
71         * statements.cs (FlowBranching.UsageVector.MergeChildren):
72         A `finally' block never returns or breaks; improved handling of
73         unreachable code.
74
75 2002-08-23  Martin Baulig  <martin@gnome.org>
76
77         * statement.cs (Throw.Resolve): Allow `throw null'.
78
79 2002-08-23  Martin Baulig  <martin@gnome.org>
80
81         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
82         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
83         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
84         MemberLookup would return a wrong event if this is an explicit
85         interface implementation and the class has an event with the same
86         name.
87
88 2002-08-23  Martin Baulig  <martin@gnome.org>
89
90         * statement.cs (Block.AddChildVariableNames): New public method.
91         (Block.AddChildVariableName): Likewise.
92         (Block.IsVariableNameUsedInChildBlock): Likewise.
93         (Block.AddVariable): Check whether a variable name has already
94         been used in a child block.
95
96         * cs-parser.jay (declare_local_variables): Mark all variable names
97         from the current block as being used in a child block in the
98         implicit block.
99
100 2002-08-23  Martin Baulig  <martin@gnome.org>
101
102         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
103         find the symbol writer.
104
105         * driver.cs: csc also allows the arguments to /define being
106         separated by commas, not only by semicolons.
107
108 2002-08-23  Martin Baulig  <martin@gnome.org>
109
110         * interface.cs (Interface.GetMembers): Added static check for events.
111
112 2002-08-15  Martin Baulig  <martin@gnome.org>
113
114         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
115         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
116
117         * ecore.cs (Expression.MemberLookup): Added documentation and explained
118         why the MethodData.EmitDestructor() change was necessary.
119
120 2002-08-20  Martin Baulig  <martin@gnome.org>
121
122         * class.cs (TypeContainer.FindMembers): Added static check for events.
123
124         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
125
126         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
127         use Type.GetEvents(), not Type.FindMembers().
128
129 2002-08-20  Martin Baulig  <martin@gnome.org>
130
131         * decl.cs (MemberCache): Added a special method cache which will
132         be used for method-only searched.  This ensures that a method
133         search will return a MethodInfo with the correct ReflectedType for
134         inherited methods.      
135
136 2002-08-20  Martin Baulig  <martin@gnome.org>
137
138         * decl.cs (DeclSpace.FindMembers): Made this public.
139
140 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
141
142         * delegate.cs: fixed build on windows.
143         [FIXME:  Filed as bug #29150: MCS must report these errors.]
144
145 2002-08-19  Ravi Pratap  <ravi@ximian.com>
146
147         * ecore.cs (StandardConversionExists): Return a false
148         if we are trying to convert the void type to anything else
149         since that is not allowed.
150
151         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
152         we flag error 70 in the event an event is trying to be accessed
153         directly from outside the declaring type.
154
155 2002-08-20  Martin Baulig  <martin@gnome.org>
156
157         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
158         MemberCache from typemanager.cs to decl.cs.
159
160 2002-08-19  Martin Baulig  <martin@gnome.org>
161
162         * class.cs (TypeContainer): Implement IMemberContainer.
163         (TypeContainer.DefineMembers): Create the MemberCache.
164         (TypeContainer.FindMembers): Do better BindingFlags checking; only
165         return public members if BindingFlags.Public was given, check
166         whether members are static.
167
168 2002-08-16  Martin Baulig  <martin@gnome.org>
169
170         * decl.cs (DeclSpace.Define): Splitted this in Define and
171         DefineMembers.  DefineMembers is called first and initializes the
172         MemberCache.
173
174         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
175         DefineMembers() on all our DeclSpaces.
176
177         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
178         but call DefineMembers() on all nested interfaces.  We call their
179         Define() in our new Define() function.
180
181         * interface.cs (Interface): Implement IMemberContainer.
182         (Interface.Define): Moved all code except the attribute stuf to
183         DefineMembers().
184         (Interface.DefineMembers): Initialize the member cache.
185
186         * typemanager.cs (IMemberFinder): Removed this interface, we don't
187         need this anymore since we can use MemberCache.FindMembers directly.
188
189 2002-08-19  Martin Baulig  <martin@gnome.org>
190
191         * typemanager.cs (MemberCache): When creating the cache for an
192         interface type, add all inherited members.
193         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
194         to `out bool used_cache' and documented it.
195         (TypeManager.MemberLookup): If we already used the cache in the first
196         iteration, we don't need to do the interfaces check.
197
198 2002-08-19  Martin Baulig  <martin@gnome.org>
199
200         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
201         here from IMemberFinder and don't implement this interface anymore.
202         (DeclSpace.MemberCache): Moved here from IMemberFinder.
203
204         * typemanager.cs (IMemberFinder): This interface is now only used by
205         classes which actually support the member cache.
206         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
207         since we only put DeclSpaces into this Hashtable.
208         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
209         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
210
211 2002-08-16  Martin Baulig  <martin@gnome.org>
212
213         * typemanager.cs (ICachingMemberFinder): Removed.
214         (IMemberFinder.MemberCache): New property.
215         (TypeManager.FindMembers): Merged this with RealFindMembers().
216         This function will never be called from TypeManager.MemberLookup()
217         so we can't use the cache here, just the IMemberFinder.
218         (TypeManager.MemberLookup_FindMembers): Check whether the
219         IMemberFinder has a MemberCache and call the cache's FindMembers
220         function.
221         (MemberCache): Rewrote larger parts of this yet another time and
222         cleaned it up a bit.
223
224 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
225
226         * driver.cs (LoadArgs): Support quoting.
227
228         (Usage): Show the CSC-like command line arguments.
229
230         Improved a few error messages.
231
232 2002-08-15  Martin Baulig  <martin@gnome.org>
233
234         * typemanager.cs (IMemberContainer.Type): New property.
235         (IMemberContainer.IsInterface): New property.
236
237         The following changes are conditional to BROKEN_RUNTIME, which is
238         defined at the top of the file.
239
240         * typemanager.cs (MemberCache.MemberCache): Don't add the base
241         class'es members, but add all members from TypeHandle.ObjectType
242         if we're an interface.
243         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
244         is the current type.
245         (MemberCache.CacheEntry.Container): Removed this field.
246         (TypeHandle.GetMembers): Include inherited members.
247
248 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
249
250         * typemanager.cs: fixed compilation and added a comment on a field that
251         is never used.
252
253 2002-08-15  Martin Baulig  <martin@gnome.org>
254
255         * class.cs (ConstructorInitializer.Resolve): In the
256         Expression.MemberLookup call, use the queried_type as
257         invocation_type.
258
259         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
260         declared' attribute, it's always true.
261         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
262         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
263         temporary wrapper for FindMembers which tells MemberLookup whether
264         members from the base classes are included in the return value.
265         This will go away soon.
266         (TypeManager.MemberLookup): Use this temporary hack here; once the
267         new MemberCache is completed, we don't need to do the DeclaredOnly
268         looping here anymore since the MemberCache will take care of this.
269         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
270         (MemberCache): When creating the MemberCache for a class, get
271         members from the current class and all its base classes.
272         (MemberCache.CacheEntry.Container): New field.  This is a
273         temporary hack until the Mono runtime is fixed to distinguish
274         between ReflectedType and DeclaringType.  It allows us to use MCS
275         with both the MS runtime and the unfixed Mono runtime without
276         problems and without accecting performance.
277         (MemberCache.SearchMembers): The DeclaredOnly looping from
278         TypeManager.MemberLookup is now done here.      
279
280 2002-08-14  Martin Baulig  <martin@gnome.org>
281
282         * statement.cs (MyStructInfo.MyStructInfo): Don't call
283         Type.GetFields on dynamic types but get the fields from the
284         corresponding TypeContainer.
285         (MyStructInfo.GetStructInfo): Added check for enum types.
286
287         * typemanager.cs (MemberList.IsSynchronized): Implemented.
288         (MemberList.SyncRoot): Implemented.
289         (TypeManager.FilterWithClosure): No need to check permissions if
290         closure_start_type == closure_invocation_type, don't crash if
291         closure_invocation_type is null.
292
293 2002-08-13  Martin Baulig  <martin@gnome.org>
294
295         Rewrote TypeContainer.FindMembers to use a member cache.  This
296         gives us a speed increase of about 35% for the self-hosting MCS
297         build and of about 15-20% for the class libs (both on GNU/Linux).
298
299         * report.cs (Timer): New class to get enhanced profiling.  This
300         whole class is "TIMER" conditional since it remarkably slows down
301         compilation speed.
302
303         * class.cs (MemberList): New class.  This is an IList wrapper
304         which we're now using instead of passing MemberInfo[]'s around to
305         avoid copying this array unnecessarily.
306         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
307         (ICachingMemberFinder, IMemberContainer): New interface.
308         (TypeManager.FilterWithClosure): If `criteria' is null, the name
309         has already been checked, otherwise use it for the name comparision.
310         (TypeManager.FindMembers): Renamed to RealMemberFinder and
311         provided wrapper which tries to use ICachingMemberFinder.FindMembers
312         if possible.  Returns a MemberList, not a MemberInfo [].
313         (TypeHandle): New class, implements IMemberContainer.  We create
314         one instance of this class per type, it contains a MemberCache
315         which is used to do the member lookups.
316         (MemberCache): New class.  Each instance of this class contains
317         all members of a type and a name-based hash table.
318         (MemberCache.FindMembers): This is our new member lookup
319         function.  First, it looks up all members of the requested name in
320         the hash table.  Then, it walks this list and sorts out all
321         applicable members and returns them.
322
323 2002-08-13  Martin Baulig  <martin@gnome.org>
324
325         In addition to a nice code cleanup, this gives us a performance
326         increase of about 1.4% on GNU/Linux - not much, but it's already
327         half a second for the self-hosting MCS compilation.
328
329         * typemanager.cs (IMemberFinder): New interface.  It is used by
330         TypeManager.FindMembers to call FindMembers on a TypeContainer,
331         Enum, Delegate or Interface.
332         (TypeManager.finder_to_member_finder): New PtrHashtable.
333         (TypeManager.finder_to_container): Removed.
334         (TypeManager.finder_to_delegate): Removed.
335         (TypeManager.finder_to_interface): Removed.
336         (TypeManager.finder_to_enum): Removed.
337
338         * interface.cs (Interface): Implement IMemberFinder.
339
340         * delegate.cs (Delegate): Implement IMemberFinder.
341
342         * enum.cs (Enum): Implement IMemberFinder.
343
344         * class.cs (TypeContainer): Implement IMemberFinder.
345
346 2002-08-12  Martin Baulig  <martin@gnome.org>
347
348         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
349
350 2002-08-12  Martin Baulig  <martin@gnome.org>
351
352         * ecore.cs (ITypeExpression): New interface for expressions which
353         resolve to a type.
354         (TypeExpression): Renamed to TypeLookupExpression.
355         (Expression.DoResolve): If we're doing a types-only lookup, the
356         expression must implement the ITypeExpression interface and we
357         call DoResolveType() on it.
358         (SimpleName): Implement the new ITypeExpression interface.
359         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
360         hack, the situation that we're only looking up types can't happen
361         anymore when this method is called.  Moved the type lookup code to
362         DoResolveType() and call it.
363         (SimpleName.DoResolveType): This ITypeExpression interface method
364         is now doing the types-only lookup.
365         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
366         (ResolveFlags): Added MaskExprClass.
367
368         * expression.cs (MemberAccess): Implement the ITypeExpression
369         interface.
370         (MemberAccess.DoResolve): Added support for a types-only lookup
371         when we're called via ITypeExpression.DoResolveType().
372         (ComposedCast): Implement the ITypeExpression interface.
373
374         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
375         Expression.Resolve() with ResolveFlags.Type instead.
376
377 2002-08-12  Martin Baulig  <martin@gnome.org>
378
379         * interface.cs (Interface.Define): Apply attributes.
380
381         * attribute.cs (Attribute.ApplyAttributes): Added support for
382         interface attributes.
383
384 2002-08-11  Martin Baulig  <martin@gnome.org>
385
386         * statement.cs (Block.Emit): Only check the "this" variable if we
387         do not always throw an exception.
388
389         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
390         whether the property has a set accessor.
391
392 2002-08-11  Martin Baulig  <martin@gnome.org>
393
394         Added control flow analysis support for structs.
395
396         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
397         with control flow analysis turned off.
398         (IVariable): New interface.
399         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
400         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
401         (FieldExpr.DoResolve): Resolve the instance expression with flow
402         analysis turned off and do the definite assignment check after the
403         resolving when we know what the expression will resolve to.
404
405         * expression.cs (LocalVariableReference, ParameterReference):
406         Implement the new IVariable interface, only call the flow analysis
407         code if ec.DoFlowAnalysis is true.
408         (This): Added constructor which takes a Block argument.  Implement
409         the new IVariable interface.
410         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
411         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
412         This does the definite assignment checks for struct members.
413
414         * class.cs (Constructor.Emit): If this is a non-static `struct'
415         constructor which doesn't have any initializer, call
416         Block.AddThisVariable() to tell the flow analysis code that all
417         struct elements must be initialized before control returns from
418         the constructor.
419
420         * statement.cs (MyStructInfo): New public class.
421         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
422         argument to this indexer.  If non-zero, check an individual struct
423         member, not the whole struct.
424         (FlowBranching.CheckOutParameters): Check struct members.
425         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
426         overloaded versions of these methods which take an additional
427         `int field_idx' argument to check struct members.
428         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
429         overloaded versions of these methods which take an additional
430         `string field_name' argument to check struct member.s
431         (VariableInfo): Implement the IVariable interface.
432         (VariableInfo.StructInfo): New public property.  Returns the
433         MyStructInfo instance of the variable if it's a struct or null.
434         (Block.AddThisVariable): New public method.  This is called from
435         Constructor.Emit() for non-static `struct' constructor which do
436         not have any initializer.  It creates a special variable for the
437         "this" instance variable which will be checked by the flow
438         analysis code to ensure that all of the struct's fields are
439         initialized before control returns from the constructor.
440         (UsageVector): Added support for struct members.  If a
441         variable/parameter is a struct with N members, we reserve a slot
442         in the usage vector for each member.  A struct is considered fully
443         initialized if either the struct itself (slot 0) or all its
444         members are initialized.
445
446 2002-08-08  Martin Baulig  <martin@gnome.org>
447
448         * driver.cs (Driver.MainDriver): Only report an error CS5001
449         if there were no compilation errors.
450
451         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
452         `UnsafeContext' property to determine whether the parent is in
453         unsafe context rather than checking the parent's ModFlags:
454         classes nested in an unsafe class are unsafe as well.
455
456 2002-08-08  Martin Baulig  <martin@gnome.org>
457
458         * statement.cs (UsageVector.MergeChildren): Distinguish between
459         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
460         we return.  Added test17() and test18() to test-154.cs.
461
462 2002-08-08  Martin Baulig  <martin@gnome.org>
463
464         * typemanager.cs (TypeManager.FilterWithClosure): If we have
465         Family access, make sure the invoking type isn't a subclass of the
466         queried type (that'd be a CS1540).
467
468         * ecore.cs (Expression.MemberLookup): Added overloaded version of
469         this method which takes an additional `Type invocation_type'.
470
471         * expression.cs (BaseAccess.DoResolve): Use the base type as
472         invocation and query type.
473         (MemberAccess.DoResolve): If the lookup failed and we're about to
474         report a CS0122, try a lookup with the ec.ContainerType - if this
475         succeeds, we must report a CS1540.
476
477 2002-08-08  Martin Baulig  <martin@gnome.org>
478
479         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
480         (MethodGroupExpr): Implement the IMemberExpr interface.
481
482         * expression (MemberAccess.ResolveMemberAccess): No need to have
483         any special code for MethodGroupExprs anymore, they're now
484         IMemberExprs.   
485
486 2002-08-08  Martin Baulig  <martin@gnome.org>
487
488         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
489         Family, FamANDAssem and FamORAssem permissions.
490         (TypeManager.IsSubclassOrNestedChildOf): New public method.
491
492 2002-08-08  Martin Baulig  <martin@gnome.org>
493
494         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
495         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
496         or loop block.
497
498 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
499
500         * driver.cs: implemented /resource option to embed managed resources.
501
502 2002-08-07  Martin Baulig  <martin@gnome.org>
503
504         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
505         (FieldBase.HasFieldInitializer): New public property.
506         (FieldBase.GetInitializerExpression): New public method.  Resolves and
507         returns the field initializer and makes sure it is only resolved once.
508         (TypeContainer.EmitFieldInitializers): Call
509         FieldBase.GetInitializerExpression to get the initializer, this ensures
510         that it isn't resolved multiple times.
511
512         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
513         the resolving process (SimpleName/MemberLookup) that we're currently
514         emitting a field initializer (which must not access any instance members,
515         this is an error CS0236).
516
517         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
518         argument, if the `IsFieldInitializer' flag is set, we must report and
519         error CS0236 and not an error CS0120.   
520
521 2002-08-07  Martin Baulig  <martin@gnome.org>
522
523         * ecore.cs (IMemberExpr): New public interface.
524         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
525         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
526         if the expression is an IMemberExpr.
527
528         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
529         to be null, implicitly default to `this' if we're non-static in
530         this case.  Simplified the code a lot by using the new IMemberExpr
531         interface.  Also fixed bug #28176 here.
532
533 2002-08-06  Martin Baulig  <martin@gnome.org>
534
535         * cs-parser.jay (SimpleLookup): Removed.  We need to create
536         ParameterReferences during semantic analysis so that we can do a
537         type-only search when resolving Cast, TypeOf and SizeOf.
538         (block): Pass the `current_local_parameters' to the Block's
539         constructor.
540
541         * class.cs (ConstructorInitializer): Added `Parameters parameters'
542         argument to the constructor.
543         (ConstructorInitializer.Resolve): Create a temporary implicit
544         block with the parameters.
545
546         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
547         references here if we aren't doing a type-only search.
548
549         * statement.cs (Block): Added constructor which takes a
550         `Parameters parameters' argument.
551         (Block.Parameters): New public property.
552
553         * support.cs (InternalParameters.Parameters): Renamed `parameters'
554         to `Parameters' and made it public readonly.
555
556 2002-08-06  Martin Baulig  <martin@gnome.org>
557
558         * ecore.cs (Expression.Warning): Made this public as well.
559
560         * report.cs (Report.Debug): Print the contents of collections.
561
562 2002-08-06  Martin Baulig  <martin@gnome.org>
563
564         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
565         used to tell Resolve() which kinds of expressions it may return.
566         (Expression.Resolve): Added overloaded version of this method which
567         takes a `ResolveFlags flags' argument.  This can be used to tell
568         Resolve() which kinds of expressions it may return.  Reports a
569         CS0118 on error.
570         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
571         ResolveFlags.SimpleName.
572         (Expression.Error118): Added overloaded version of this method which
573         takes a `ResolveFlags flags' argument.  It uses the flags to determine
574         which kinds of expressions are allowed.
575
576         * expression.cs (Argument.ResolveMethodGroup): New public method.
577         Resolves an argument, but allows a MethodGroup to be returned.
578         This is used when invoking a delegate.
579
580         * TODO: Updated a bit.
581
582 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
583
584         Fixed compilation with csc.
585
586         * ecore.cs: Expression.Error made public. Is this correct? Should
587         Warning be made public too?
588
589         * expression.cs: use ea.Location instead of ea.loc.
590         [FIXME:  Filed as bug #28607: MCS must report these errors.]
591
592 2002-08-06  Martin Baulig  <martin@gnome.org>
593
594         * ecore.cs (Expression.loc): Moved the location here instead of
595         duplicating it in all derived classes.
596         (Expression.Location): New public property.
597         (Expression.Error, Expression.Warning): Made them non-static and
598         removed the location argument.
599         (Expression.Warning): Added overloaded version which takes an
600         `int level' argument.
601         (Expression.Error118): Make this non-static and removed the
602         expression and location arguments.
603         (TypeExpr): Added location argument to the constructor.
604
605         * expression.cs (StaticCallExpr): Added location argument to
606         the constructor.
607         (Indirection, PointerArithmetic): Likewise.
608         (CheckedExpr, UnCheckedExpr): Likewise.
609         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
610         (StringPtr): Likewise.
611
612
613 2002-08-05  Martin Baulig  <martin@gnome.org>
614
615         * expression.cs (BaseAccess.DoResolve): Actually report errors.
616
617         * assign.cs (Assign.DoResolve): Check whether the source
618         expression is a value or variable.
619
620         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
621         while resolving the corresponding blocks.
622
623         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
624         an error, don't silently return null.
625
626         * statement.cs (Block.AddVariable): Do the error reporting here
627         and distinguish between CS0128 and CS0136.
628         (Block.DoResolve): Report all unused labels (warning CS0164).
629         (LabeledStatement): Pass the location to the constructor.
630         (LabeledStatement.HasBeenReferenced): New property.
631         (LabeledStatement.Resolve): Set it to true here.
632
633         * statement.cs (Return.Emit): Return success even after reporting
634         a type mismatch error (CS0126 or CS0127), this is what csc does and
635         it avoids confusing the users with any consecutive errors.
636
637 2002-08-05  Martin Baulig  <martin@gnome.org>
638
639         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
640
641         * const.cs (Const.LookupConstantValue): Catch circular definitions.
642
643         * expression.cs (MemberAccess.DoResolve): Silently return if an
644         error has already been reported.
645
646         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
647         error has already been reported.
648
649 2002-08-05  Martin Baulig  <martin@gnome.org>
650
651         * statement.cs (UsageVector): Only initialize the `parameters'
652         vector if we actually have any "out" parameters.
653
654 2002-08-05  Martin Baulig  <martin@gnome.org>
655
656         * expression.cs (Binary.ResolveOperator): When combining delegates,
657         they must have the same type.
658
659 2002-08-05  Martin Baulig  <martin@gnome.org>
660
661         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
662         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
663         work with the ms runtime and we also don't need it: if we're a
664         PropertyBuilder and not in the `indexer_arguments' hash, then we
665         are a property and not an indexer.
666
667         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
668         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
669         since the latter one doesn't work with the ms runtime.
670
671 2002-08-03  Martin Baulig  <martin@gnome.org>
672
673         Fixed bugs #27998 and #22735.
674
675         * class.cs (Method.IsOperator): New public field.
676         (Method.CheckBase): Report CS0111 if there's already a method
677         with the same parameters in the current class.  Report CS0508 when
678         attempting to change the return type of an inherited method.
679         (MethodData.Emit): Report CS0179 if a method doesn't have a body
680         and it's not marked abstract or extern.
681         (PropertyBase): New abstract base class for Property and Indexer.
682         (PropertyBase.CheckBase): Moved here from Property and made it work
683         for indexers.
684         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
685         the same so we can reuse it there.
686         (Property, Indexer): Derive from PropertyBase.
687         (MethodSignature.inheritable_property_signature_filter): New delegate
688         to find properties and indexers.
689
690         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
691         argument and improved error reporting.
692
693         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
694         EmptyReadOnlyParameters and made it a property.
695
696         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
697         version of this method which takes a `PropertyInfo indexer'.
698         (TypeManager.RegisterIndexer): New method.
699
700         * class.cs: Added myself as author of this file :-)
701
702 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
703
704         * class.cs: fixed compilation on windoze.
705
706 2002-08-03  Martin Baulig  <martin@gnome.org>
707
708         * interface.cs (Interface.GetInterfaceBases): Check whether all
709         base interfaces are at least as accessible than the current one.
710
711         * class.cs (TypeContainer.GetClassBases): Check whether base types
712         are at least as accessible than the current type.
713         (TypeContainer.AsAccessible): Implemented and made non-static.
714         (MemberBase.CheckParameters): Report errors if the accessibility
715         checks fail.
716
717         * delegate.cs (Delegate.Delegate): The default visibility is
718         internal for top-level types and private for nested types.
719         (Delegate.Define): Report errors if the accessibility checks fail.
720
721         * enum.cs (Enum.Enum): The default visibility is internal for
722         top-level types and private for nested types.
723         (Enum.DefineType): Compute the correct visibility.
724
725         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
726         function which takes a `bool is_toplevel' instead of a TypeContainer.
727
728         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
729         builtin type.
730
731 2002-08-02  Martin Baulig  <martin@gnome.org>
732
733         * expression.cs (LocalVariableReferenc): Added constructor which
734         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
735         (LocalVariableReference.IsReadOnly): New property.
736         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
737         variable is readonly, use our own readonly flag to do this; you can
738         use the new constructor to get a writable reference to a read-only
739         variable.
740
741         * cs-parser.jay (foreach_statement, using_statement): Get a writable
742         reference to the local variable.
743
744 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
745
746         * rootcontext.cs (ResolveCore): Also include System.Exception
747
748         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
749         we reach an EmptyStatement.
750
751         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
752         is also fine.
753
754         * expression.cs (Binary.ResolveOperator): Check error result in
755         two places.
756
757         use brtrue/brfalse directly and avoid compares to null.
758
759 2002-08-02  Martin Baulig  <martin@gnome.org>
760
761         * class.cs (TypeContainer.Define): Define all nested interfaces here.
762         Fixes bug #28407, added test-155.cs.
763
764 2002-08-01  Martin Baulig  <martin@gnome.org>
765
766         * class.cs (Event.EmitDefaultMethod): Make this work with static
767         events.  Fixes #28311, added verify-3.cs.
768
769 2002-08-01  Martin Baulig  <martin@gnome.org>
770
771         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
772         `is_disposable' fields.
773         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
774         `hm.is_disposable' if we're using the collection pattern.
775         (Foreach.EmitCollectionForeach): Use the correct type for the
776         enumerator's local variable, only emit the try/finally block if
777         necessary (fixes #27713).
778
779 2002-08-01  Martin Baulig  <martin@gnome.org>
780
781         * ecore.cs (Expression.report118): Renamed to Error118 and made
782         it public static.
783
784         * statement.cs (Throw.Resolve): Check whether the expression is of
785         the correct type (CS0118) and whether the type derives from
786         System.Exception (CS0155).
787         (Catch.Resolve): New method.  Do the type lookup here and check
788         whether it derives from System.Exception (CS0155).
789         (Catch.CatchType, Catch.IsGeneral): New public properties.
790
791         * typemanager.cs (TypeManager.exception_type): Added.
792
793 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
794
795         * driver.cs: Updated About function.
796
797 2002-07-31  Martin Baulig  <martin@gnome.org>
798
799         Implemented Control Flow Analysis.
800
801         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
802         (EmitContext.CurrentBranching): Added.
803         (EmitContext.StartFlowBranching): Added.
804         (EmitContext.EndFlowBranching): Added.
805         (EmitContext.KillFlowBranching): Added.
806         (EmitContext.IsVariableAssigned): Added.
807         (EmitContext.SetVariableAssigned): Added.
808         (EmitContext.IsParameterAssigned): Added.
809         (EmitContext.SetParameterAssigned): Added.
810         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
811         Added control flow analysis stuff here.
812
813         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
814         resolve the expression as lvalue.
815         (LocalVariableReference.DoResolve): Check whether the variable has
816         already been assigned.
817         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
818         the parameter as assigned here.
819         (ParameterReference.DoResolve): Check whether the parameter has already
820         been assigned.
821         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
822         expression as lvalue.
823
824         * statement.cs (FlowBranching): New class for the flow analysis code.
825         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
826         (LabeledStatement.IsDefined): New public property.
827         (LabeledStatement.AddUsageVector): New public method to tell flow
828         analyis that the label may be reached via a forward jump.
829         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
830         flow analysis.
831         (VariableInfo.Number): New public field.  This is used by flow analysis
832         to number all locals of a block.
833         (Block.CountVariables): New public property.  This is the number of
834         local variables in this block (including the locals from all parent
835         blocks).
836         (Block.EmitMeta): Number all the variables.
837
838         * statement.cs: Added flow analysis support to all classes.
839
840 2002-07-31  Martin Baulig  <martin@gnome.org>
841
842         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
843         To get debugging messages, compile mcs with /define:MCS_DEBUG and
844         then use this argument.
845
846         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
847
848         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
849         use this to specify /define options.
850
851 2002-07-29  Martin Baulig  <martin@gnome.org>
852
853         * statement.cs (Fixed): Moved all code that does variable lookups
854         and resolvings from Emit to Resolve.
855
856         * statement.cs (For): Moved all code that does variable lookups
857         and resolvings from Emit to Resolve.
858
859         * statement.cs (Using): Moved all code that does variable lookups
860         and resolvings from Emit to Resolve.
861
862 2002-07-29  Martin Baulig  <martin@gnome.org>
863
864         * attribute.cs (Attribute.Resolve): Explicitly catch a
865         System.NullReferenceException when creating the
866         CustromAttributeBuilder and report a different warning message.
867
868 2002-07-29  Martin Baulig  <martin@gnome.org>
869
870         * support.cs (ParameterData.ParameterName): Added method to
871         get the name of a parameter.
872
873         * typemanager.cs (TypeManager.IsValueType): New public method.
874
875 2002-07-29  Martin Baulig  <martin@gnome.org>
876
877         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
878         is a flag which specifies that it's either ref or out.
879         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
880         the out parameter to `out Parameter.Modifier mod', also set the
881         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
882
883         * support.cs (InternalParameters.ParameterModifier): Distinguish
884         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
885         Parameter.Modifier.ISBYREF flag if it's either ref or out.
886
887         * expression.cs (Argument.GetParameterModifier): Distinguish
888         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
889         Parameter.Modifier.ISBYREF flag if it's either ref or out.
890
891 2002-07-29  Martin Baulig  <martin@gnome.org>
892
893         * expression.cs (ParameterReference.ParameterReference): Added
894         `Location loc' argument to the constructor.
895
896         * cs-parser.jay: Pass location to ParameterReference.
897
898 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
899
900         * statement.cs (Try): Initialize the location.
901
902         * cs-parser.jay: pass location to Try.
903
904         * expression.cs (Unary.Reduce): Change the prototype to return
905         whether a constant fold could be performed or not.  The result is
906         returned in an out parameters.  In the case of Indirection and
907         AddressOf, we want to perform the full tests.
908
909 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
910
911         * statement.cs (Statement.Emit): Flag dead code.
912
913 2002-07-27  Andrew Birkett  <andy@nobugs.org>
914
915         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
916
917 2002-07-27  Martin Baulig  <martin@gnome.org>
918
919         * class.cs (MethodData.Define): Put back call to
920         TypeManager.AddMethod(), accidentally commented this out.
921
922         * report.cs (Debug): New public method to print debugging information,
923         this is `[Conditional ("DEBUG")]'.
924
925 2002-07-26  Martin Baulig  <martin@gnome.org>
926
927         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
928         (switch_statement): Push the current_block to the switch_stack and
929         pop it again when we're done with the switch.
930         (switch_section): The new block is a child of the current_block.
931         Fixes bug #24007, added test-152.cs.
932
933 2002-07-27  Martin Baulig  <martin@gnome.org>
934
935         * expression.cs (Invocation.EmitArguments): When calling a varargs
936         function with only its fixed arguments, we need to pass an empty
937         array.
938
939 2002-07-27  Martin Baulig  <martin@gnome.org>
940
941         Mono 0.13 has been released.
942
943 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
944
945         * driver.cs: Rename --resource to --linkres, because that is what
946         we do currently, we dont support --resource yet.
947
948         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
949
950 2002-07-25  Martin Baulig  <martin@gnome.org>
951
952         * class.cs (MethodData): New public class.  This is a `method builder'
953         class for a method or one accessor of a Property/Indexer/Event.
954         (MethodData.GetMethodFlags): Moved here from MemberBase.
955         (MethodData.ApplyAttributes): Likewise.
956         (MethodData.ApplyObsoleteAttribute): Likewise.
957         (MethodData.ApplyConditionalAttribute): Likewise.
958         (MethodData.ApplyDllImportAttribute): Likewise.
959         (MethodData.CheckAbstractAndExternal): Likewise.
960         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
961         (MethodData.Emit): Formerly known as Method.Emit().
962         (MemberBase): Moved everything which was specific to a single
963         accessor/method to MethodData.
964         (Method): Create a new MethodData and call Define() and Emit() on it.
965         (Property, Indexer, Event): Create a new MethodData objects for each
966         accessor and call Define() and Emit() on them.
967
968 2002-07-25  Martin Baulig  <martin@gnome.org>
969
970         Made MethodCore derive from MemberBase to reuse the code from there.
971         MemberBase now also checks for attributes.
972
973         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
974         (MemberBase.GetMethodFlags): Moved here from class Method and marked
975         as virtual.
976         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
977         `CallingConventions cc' and `Attributes opt_attrs' arguments.
978         (MemberBase.ApplyAttributes): New virtual method; applies the
979         attributes to a method or accessor.
980         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
981         (MemberBase.ApplyConditionalAttribute): Likewise.
982         (MemberBase.ApplyDllImportAttribute): Likewise.
983         (MemberBase.CheckAbstractAndExternal): Likewise.
984         (MethodCore.ParameterTypes): This is now a property instead of a
985         method, it's initialized from DoDefineParameters().
986         (MethodCore.ParameterInfo): Removed the set accessor.
987         (MethodCore.DoDefineParameters): New protected virtual method to
988         initialize ParameterTypes and ParameterInfo.
989         (Method.GetReturnType): We can now simply return the MemberType.
990         (Method.GetMethodFlags): Override the MemberBase version and add
991         the conditional flags.
992         (Method.CheckBase): Moved some code from Define() here, call
993         DoDefineParameters() here.
994         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
995         here to avoid some larger code duplication.
996         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
997         ensure that abstract and external accessors don't declare a body.
998
999         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
1000         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
1001         lookup in the attribute's parent classes, so we need to abort as soon
1002         as we found the first match.
1003         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
1004         the attribute has no arguments.
1005
1006         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
1007         of a Method.
1008
1009 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1010
1011         * cs-parser.jay: reverted previous patch.
1012
1013 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1014
1015         * cs-parser.jay: fixed bug #22119.
1016
1017 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1018
1019         * attribute.cs: fixed compilation. The error was:
1020         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
1021         be assigned to before control leaves the current method."
1022         [FIXME:  Filed as bug #28186: MCS must report this error.]
1023
1024 2002-07-25  Martin Baulig  <martin@gnome.org>
1025
1026         * attribute.cs (Attribute.Conditional_GetConditionName): New static
1027         method to pull the condition name ouf of a Conditional attribute.
1028         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
1029         the obsolete message and error flag out of an Obsolete attribute.
1030
1031         * class.cs (Method.GetMethodFlags): New public method to get the
1032         TypeManager.MethodFlags for this method.
1033         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
1034         private methods.
1035         (Method.Define): Get and apply the Obsolete and Conditional attributes;
1036         if we're overriding a virtual function, set the new private variable
1037         `parent_method'; call the new TypeManager.AddMethod().
1038
1039         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
1040         the MethodBuilder and the Method in a PtrHashtable.
1041         (TypeManager.builder_to_method): Added for this purpose.
1042         (TypeManager.MethodFlags): Added IsObsoleteError.
1043         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
1044         Obsolete and Conditional arguments in MethodBuilders.  If we discover
1045         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
1046         the message from the attribute.
1047
1048 2002-07-24  Martin Baulig  <martin@gnome.org>
1049
1050         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
1051         preprocessor directives, ensure that the argument to #define/#undef is
1052         exactly one identifier and that it's actually an identifier.
1053
1054         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
1055         did not work ....
1056
1057 2002-07-24  Martin Baulig  <martin@gnome.org>
1058
1059         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
1060         initialize it to TypeManager.object_type in the constructor.
1061         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
1062         of the `hm.get_current' method if we're using the collection pattern.
1063         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
1064         for the explicit conversion to make it work when we're using the collection
1065         pattern and the `Current' property has a different return type than `object'.
1066         Fixes #27713.
1067
1068 2002-07-24  Martin Baulig  <martin@gnome.org>
1069
1070         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
1071         does not match, but don't report any errors.  This method is called in
1072         order for all methods in a MethodGroupExpr until a matching method is
1073         found, so we don't want to bail out if the first method doesn't match.
1074         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
1075         matches, report the 123.  Fixes #28070.
1076
1077 2002-07-24  Martin Baulig  <martin@gnome.org>
1078
1079         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
1080         TypeManager.TypeToCoreType() to the top of the method so the
1081         following equality checks will work.  Fixes #28107.
1082
1083 2002-07-24  Martin Baulig  <martin@gnome.org>
1084
1085         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
1086         operand is of type uint, and the other operand is of type sbyte,
1087         short or int, the operands are converted to type long." -
1088         Actually do what this comment already told us.  Fixes bug #28106,
1089         added test-150.cs.
1090
1091 2002-07-24  Martin Baulig  <martin@gnome.org>
1092
1093         * class.cs (MethodBase): New abstract class.  This is now a base
1094         class for Property, Indexer and Event to avoid some code duplication
1095         in their Define() and DefineMethods() methods.
1096         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
1097         generic methods for Define() and DefineMethods().
1098         (FieldBase): Derive from MemberBase, not MemberCore.
1099         (Property): Derive from MemberBase, not MemberCore.
1100         (Property.DefineMethod): Moved all the code from this method to the
1101         new MethodBase.DefineAccessor(), just call it with appropriate
1102         argumetnts.
1103         (Property.Define): Call the new Property.DoDefine(), this does some
1104         sanity checks and we don't need to duplicate the code everywhere.
1105         (Event): Derive from MemberBase, not MemberCore.
1106         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
1107         accessors, this will also make them work with interface events.
1108         (Indexer): Derive from MemberBase, not MemberCore.
1109         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
1110         (Indexer.Define): Use the new MethodBase functions.
1111
1112         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
1113         argument to the constructor.
1114         (Interface.FindMembers): Added support for interface events.
1115         (Interface.PopluateEvent): Implemented.
1116
1117         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
1118
1119 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
1120
1121         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
1122         but this is required to check for a method name being the same as
1123         the containing class.  
1124
1125         Handle this now.
1126
1127 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1128
1129         * interface.cs: initialize variable.
1130
1131 2002-07-23  Martin Baulig  <martin@gnome.org>
1132
1133         Implemented the IndexerName attribute in interfaces.
1134
1135         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
1136         name if this is an explicit interface implementation.
1137         (Indexer.InterfaceIndexerName): New public variable.  If we're
1138         implementing an interface indexer, this is the IndexerName in that
1139         interface.  Otherwise, it's the IndexerName.
1140         (Indexer.DefineMethod): If we're implementing interface indexer,
1141         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
1142         and Pending.ImplementIndexer methods.
1143         (Indexer.Define): Also define the PropertyBuilder if we're
1144         implementing an interface indexer and this is neither an explicit
1145         interface implementation nor do the IndexerName match the one in
1146         the interface.
1147
1148         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
1149         If a method is defined here, then we always need to create a proxy
1150         for it.  This is used when implementing interface indexers.
1151         (Pending.IsInterfaceIndexer): New public method.
1152         (Pending.ImplementIndexer): New public method.
1153         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
1154         This is used when implementing interface indexers to define a proxy
1155         if necessary.
1156         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
1157         define a proxy if necessary.
1158
1159         * interface.cs (Interface.IndexerName): New public variable.
1160         (Interface.PopulateIndexer): Set the IndexerName.
1161         (Interface.DefineIndexers): New private method.  Populate all the
1162         indexers and make sure their IndexerNames match.
1163
1164         * typemanager.cs (IndexerPropertyName): Added support for interface
1165         indexers.
1166
1167 2002-07-22  Martin Baulig  <martin@gnome.org>
1168
1169         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
1170         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
1171         ret if HasReturnLabel.
1172         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
1173         variables.
1174
1175         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
1176         and set the ec.LoopBeginTryCatchLevel.
1177         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
1178         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
1179         the current ec.TryCatchLevel, the branch goes out of an exception
1180         block.  In this case, we need to use Leave and not Br.
1181
1182 2002-07-22  Martin Baulig  <martin@gnome.org>
1183
1184         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
1185         block unless the block does not always return or it is contained in
1186         another try { ... } catch { ... } block.  Fixes bug #26506.
1187         Added verify-1.cs to the test suite.
1188
1189 2002-07-22  Martin Baulig  <martin@gnome.org>
1190
1191         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
1192         then we do not always return.  Fixes bug #24985.
1193
1194 2002-07-22  Martin Baulig  <martin@gnome.org>
1195
1196         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
1197         lookup on a per-class level; ie. walk up the class hierarchy until we
1198         found at least one applicable method, then choose the best among them.
1199         Fixes bug #24463 and test-29.cs.
1200
1201 2002-07-22  Martin Baulig  <martin@gnome.org>
1202
1203         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
1204         return types of the methods.  The return type is not part of the
1205         signature and we must not check it to make the `new' modifier work.
1206         Fixes bug #27999, also added test-147.cs.
1207         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
1208
1209         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
1210         on the method's return type.
1211
1212 2002-07-21  Martin Baulig  <martin@gnome.org>
1213
1214         * assign.cs: Make this work if the rightmost source is a constant and
1215         we need to do an implicit type conversion.  Also adding a few more tests
1216         to test-38.cs which should have caught this.
1217
1218         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
1219         target in the makefile for this.  The makefile.gnu is primarily intended
1220         for end-users who don't want to debug the compiler.
1221
1222 2002-07-21  Martin Baulig  <martin@gnome.org>
1223
1224         * assign.cs: Improved the Assign class so it can now handle embedded
1225         assignments (X = Y = Z = something).  As a side-effect this'll now also
1226         consume less local variables.  test-38.cs now passes with MCS, added
1227         a few new test cases to that test.
1228
1229 2002-07-20  Martin Baulig  <martin@gnome.org>
1230
1231         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
1232         instructions.  Fixes bug #27977, also added test-146.cs.
1233
1234 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1235
1236         * cs-tokenizer.cs: fixed getHex ().
1237
1238 2002-07-19  Martin Baulig  <martin@gnome.org>
1239
1240         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
1241         not Type.GetType() to lookup the array type.  This is needed when
1242         we're constructing an array of a user-defined type.
1243         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
1244         single-dimensional arrays, but also for single-dimensial arrays of
1245         type decimal.
1246
1247 2002-07-19  Martin Baulig  <martin@gnome.org>
1248
1249         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
1250         this function is called, it's not allowed to share LocalBuilders
1251         among ILGenerators.
1252
1253 2002-07-19  Martin Baulig  <martin@gnome.org>
1254
1255         * expression.cs (Argument.Resolve): Report an error 118 when trying
1256         to pass a type as argument.
1257
1258 2002-07-18  Martin Baulig  <martin@gnome.org>
1259
1260         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
1261         Conv_R_Un for the signed `long' type.
1262
1263 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
1264
1265         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
1266         `expr' for the temporary result, as that will fail if we do
1267         multiple resolves on the same expression.
1268
1269 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
1270
1271         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
1272         ec.TypeContainer for looking up aliases. 
1273
1274         * class.cs (TypeContainer): Remove LookupAlias from here.
1275
1276         * decl.cs (DeclSpace); Move here.
1277
1278 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
1279
1280         * class.cs (FindMembers): Only call filter if the constructor
1281         bulider is not null.
1282
1283         Also handle delegates in `NestedTypes' now.  Now we will perform
1284         type lookups using the standard resolution process.  This also
1285         fixes a bug.
1286
1287         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
1288         This uses Expressions (the limited kind that can be parsed by the
1289         tree) instead of strings.
1290
1291         * expression.cs (ComposedCast.ToString): Implement, used to flag
1292         errors since now we have to render expressions.
1293
1294         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
1295         FormArrayType. 
1296
1297         * ecore.cs (SimpleName.ToString): ditto.
1298
1299         * cs-parser.jay: Instead of using strings to assemble types, use
1300         Expressions to assemble the type (using SimpleName, ComposedCast,
1301         MemberAccess).  This should fix the type lookups in declarations,
1302         because we were using a different code path for this.
1303
1304         * statement.cs (Block.Resolve): Continue processing statements
1305         even when there is an error.
1306
1307 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
1308
1309         * class.cs (Event.Define): Also remove the `remove' method from
1310         the list of pending items.
1311
1312         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
1313         generate more compact code. 
1314
1315 2002-07-17  Martin Baulig  <martin@gnome.org>
1316
1317         * const.cs (Const.LookupConstantValue): Add support for constant
1318         `unchecked' and `checked' expressions.
1319         Also adding test case test-140.cs for this.
1320
1321 2002-07-17  Martin Baulig  <martin@gnome.org>
1322
1323         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
1324         check whether mi.ReturnType implements the IEnumerator interface; the
1325         `==' and the IsAssignableFrom() will fail in this situation.
1326
1327 2002-07-16  Ravi Pratap  <ravi@ximian.com>
1328
1329         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
1330         here too.
1331
1332 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1333
1334         * expression.cs: fixed bug #27811.
1335
1336 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
1337
1338         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
1339         Molaro: when we are a ref, the value already contains a pointer
1340         value, do not take the address of it.
1341
1342 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
1343         * removed mb-parser.jay and mb-tokenizer.cs
1344
1345 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
1346
1347         * expression.cs: check against the building corlib void type.
1348
1349 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
1350
1351         * ecore.cs: fix for valuetype static readonly fields: when 
1352         initializing them, we need their address, not the address of a copy.
1353
1354 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
1355
1356         * typemanager.cs: register also enum_type in corlib.
1357
1358 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
1359
1360         * class.cs: allow calling this (but not base) initializers in structs.
1361
1362 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
1363
1364         * ecore.cs: make sure we compare against the building base types
1365         in GetTypeSize ().
1366
1367 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
1368
1369         * typemanager.cs: fix TypeToCoreType() to handle void and object
1370         (corlib gets no more typerefs after this change).
1371
1372 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
1373
1374         * expression.cs (ArrayCreation.EmitArrayArguments): use
1375         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
1376
1377         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
1378         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
1379         array indexes, the runtime actually forbids them.
1380
1381         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
1382         for array arguments here.
1383
1384         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
1385         instead of the default for ValueTypes.
1386
1387         (New.DoEmit): Use IsValueType instead of
1388         IsSubclassOf (value_type)
1389         (New.DoResolve): ditto.
1390         (Invocation.EmitCall): ditto.
1391
1392         * assign.cs (Assign): ditto.
1393
1394         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
1395         Statements *are* currently doing part of their resolution during
1396         Emit.  
1397
1398         Expressions do always resolve during resolve, but statements are
1399         only required to propagate resolution to their children.
1400
1401 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
1402
1403         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
1404
1405         (LoadAssembly): Do not add the dll if it is already specified
1406         
1407         (MainDriver): Add the System directory to the link path at the end,
1408         after all the other -L arguments. 
1409
1410         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
1411         wrong opcode for loading bytes and bools (ldelem.i1 instead of
1412         ldelem.u1) and using the opposite for sbytes.
1413
1414         This fixes Digger, and we can finally run it.
1415
1416         * driver.cs (UnixParseOption): Move the option parsing here.  
1417         (CSCParseOption): Implement CSC-like parsing of options.
1418
1419         We now support both modes of operation, the old Unix way, and the
1420         new CSC-like way.  This should help those who wanted to make cross
1421         platform makefiles.
1422
1423         The only thing broken is that /r:, /reference: and /lib: are not
1424         implemented, because I want to make those have the same semantics
1425         as the CSC compiler has, and kill once and for all the confussion
1426         around this.   Will be doing this tomorrow.
1427
1428         * statement.cs (Unsafe.Resolve): The state is checked during
1429         resolve, not emit, so we have to set the flags for IsUnsfe here.
1430
1431 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
1432
1433         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
1434         not catch the Error_ObjectRefRequired in SimpleName (as it is
1435         possible to have a class/instance variable name that later gets
1436         deambiguated), we have to check this here.      
1437
1438 2002-07-10  Ravi Pratap  <ravi@ximian.com>
1439
1440         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
1441         make static and put into Expression.
1442
1443         (Event.Define): Register the private field of the event with the 
1444         TypeManager so that GetFieldFromEvent can get at it.
1445
1446         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
1447         keep track of the private field associated with an event which
1448         has no accessors.
1449
1450         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
1451         private field.
1452
1453         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
1454         
1455 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
1456
1457         * expression.cs (Binary.EmitBranchable): this routine emits the
1458         Binary expression in a branchable context.  This basically means:
1459         we need to branch somewhere, not just get the value on the stack.
1460
1461         This works together with Statement.EmitBoolExpression.
1462
1463         * statement.cs (Statement.EmitBoolExpression): Use
1464         EmitBranchable. 
1465
1466 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
1467
1468         * statement.cs (For): Reduce the number of jumps in loops.
1469
1470         (For): Implement loop inversion for the For statement.
1471
1472         (Break): We can be breaking out of a Try/Catch controlled section
1473         (foreach might have an implicit try/catch clause), so we need to
1474         use Leave instead of Br.
1475
1476         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
1477         now).  If the instace expression supports IMemoryLocation, we use
1478         the AddressOf method from the IMemoryLocation to extract the
1479         address instead of emitting the instance.
1480
1481         This showed up with `This', as we were emitting the instance
1482         always (Emit) instead of the Address of This.  Particularly
1483         interesting when This is a value type, as we dont want the Emit
1484         effect (which was to load the object).
1485         
1486 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
1487
1488         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
1489
1490         * statement.cs (Checked): Set the CheckedState during the resolve
1491         process too, as the ConvCast operations track the checked state on
1492         the resolve process, and not emit.
1493
1494         * cs-parser.jay (namespace_member_declaration): Flag that we have
1495         found a declaration when we do.  This is used to flag error 1529
1496
1497         * driver.cs: Report ok when we display the help only.
1498
1499 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
1500
1501         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
1502
1503 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
1504
1505         * cs-tokenizer.cs (define): We also have to track locally the
1506         defines.  AllDefines is just used for the Conditional Attribute,
1507         but we also need the local defines for the current source code. 
1508
1509 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
1510
1511         * statement.cs (While, For, Do): These loops can exit through a
1512         Break statement, use this information to tell whether the
1513         statement is the last piece of code.
1514
1515         (Break): Flag that we break.
1516
1517         * codegen.cs (EmitContexts): New `Breaks' state variable.
1518
1519 2002-07-03  Martin Baulig  <martin@gnome.org>
1520
1521         * class.cs (TypeContainer.MethodModifiersValid): Allow override
1522         modifiers in method declarations in structs.  Otherwise, you won't
1523         be able to override things like Object.Equals().
1524
1525 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
1526
1527         * class.cs (Method, Property, Indexer): Do not allow the public
1528         modifier to be used in explicit interface implementations.
1529
1530         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
1531         override modifiers in method declarations in structs
1532
1533 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
1534
1535         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
1536         integer or real overflow, report an error
1537
1538 2002-07-02  Martin Baulig  <martin@gnome.org>
1539
1540         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
1541         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
1542         to tell the runtime about our newly created System.Object and
1543         System.ValueType types.
1544
1545 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
1546
1547         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
1548         struct instead of Ldarg/Starg.
1549
1550 2002-07-02  Martin Baulig  <martin@gnome.org>
1551
1552         * expression.cs (Indirection.Indirection): Call
1553         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
1554
1555 2002-07-02  Martin Baulig  <martin@gnome.org>
1556
1557         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
1558         ValueType, call TypeManager.TypeToCoreType() on it.
1559         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
1560         the OpCodes.Newarr argument.
1561
1562 2002-07-02  Martin Baulig  <martin@gnome.org>
1563
1564         * expression.cs (Invocation.EmitCall): When compiling corlib,
1565         replace all calls to the system's System.Array type to calls to
1566         the newly created one.
1567
1568         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
1569         System.Array methods.
1570         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
1571         from the system's System.Array type which must be replaced.
1572
1573 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
1574
1575         * typemanager.cs: load unverifiable_code_ctor so we can build
1576         corlib using the correct type. Avoid using GetTypeCode() with
1577         TypeBuilders.
1578         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
1579         TypeManager.object_type to allow building corlib.
1580
1581 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
1582
1583         * ecore.cs: handle System.Enum separately in LoadFromPtr().
1584
1585 2002-07-01  Martin Baulig  <martin@gnome.org>
1586
1587         * class.cs: Make the last change actually work, we need to check
1588         whether `ifaces != null' to avoid a crash.
1589
1590 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
1591
1592         * class.cs: when we build structs without fields that implement
1593         interfaces, we need to add the interfaces separately, since there is
1594         no API to both set the size and add the interfaces at type creation
1595         time.
1596
1597 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
1598
1599         * expression.cs: the dimension arguments to the array constructors
1600         need to be converted if they are a long.
1601
1602 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
1603
1604         * class.cs: don't emit ldarg.0 if there is no parent constructor
1605         (fixes showstopper for corlib).
1606
1607 2002-06-29  Martin Baulig  <martin@gnome.org>
1608
1609         MCS now compiles corlib on GNU/Linux :-)
1610
1611         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
1612         ie. check for MethodImplOptions.InternalCall.
1613
1614         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
1615         and TypeManager.attribute_type are null, so we must explicitly check
1616         whether parent is not null to find out whether it's an attribute type.
1617         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
1618         and SetBuilder, not only if the property is neither abstract nor external.
1619         This is necessary to set the MethodImplOptions on the accessor methods.
1620         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
1621         SetBuilder, see Property.Emit().
1622
1623         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
1624         populate "System.Object", "System.ValueType" and "System.Attribute" since
1625         they've already been populated from BootCorlib_PopulateCoreTypes().
1626
1627 2002-06-29  Martin Baulig  <martin@gnome.org>
1628
1629         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
1630         is the NullLiteral, we also need to make sure that target_type is not
1631         an enum type.   
1632
1633 2002-06-29  Martin Baulig  <martin@gnome.org>
1634
1635         * rootcontext.cs (RootContext.ResolveCore): We must initialize
1636         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
1637         before calling BootstrapCorlib_ResolveDelegate ().
1638
1639 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1640
1641         * statement.cs: fixed build-breaker. All tests passed ok.
1642
1643 2002-06-27  Martin Baulig  <martin@gnome.org>
1644
1645         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
1646         for System.Decimal when compiling corlib.
1647
1648 2002-06-27  Martin Baulig  <martin@gnome.org>
1649
1650         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
1651         switch blocks which contain nothing but a default clause.
1652
1653 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
1654
1655        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
1656
1657 2002-06-27  Martin Baulig  <martin@gnome.org>
1658
1659         * ecore.cs (PropertyExpr.PropertyExpr): Call
1660         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
1661
1662         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
1663         is already a TypeBuilder.
1664
1665 2002-06-27  Martin Baulig  <martin@gnome.org>
1666
1667         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
1668         `target_type == TypeManager.array_type', not IsAssignableFrom() in
1669         the "from an array-type to System.Array" case.  This makes it work
1670         when compiling corlib.
1671
1672 2002-06-27  Martin Baulig  <martin@gnome.org>
1673
1674         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
1675         non-static PropertyExpr, set its InstanceExpression.  This makes
1676         the `ICollection.Count' property work in System/Array.cs.
1677
1678 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
1679
1680         * driver.cs: Made error handling more consistent.  Errors now
1681         tracked by Report class, so many methods which used to return int
1682         now return void.  Main() now prints success/failure and 
1683         errors/warnings message.
1684
1685         Renamed '--probe' compiler argument to '--expect-error'.  Removed
1686         the magic number return values (123 and 124).  Now, if the
1687         expected error occurs, the compiler exits with success (exit value
1688         0).  If the compilation completes without seeing that particular
1689         error, the compiler exits with failure (exit value 1).  The
1690         makefile in mcs/errors has been changed to handle the new behaviour.
1691
1692         * report.cs: Made 'expected error' number a property and renamed
1693         it from 'Probe' to 'ExpectedError'.
1694
1695         * genericparser.cs: Removed error handling support, since it is
1696         now all done by Report class.
1697
1698         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
1699         class, so parse() no longer returns an int.
1700
1701         * namespace.cs: Use Report.Error instead of GenericParser.error
1702
1703 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
1704
1705         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
1706         TypeContainer.AddOperator): At the front of the list put the
1707         explicit implementations, so they get resolved/defined first. 
1708
1709 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
1710
1711         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
1712         interface type is implemented by this TypeContainer.  Used during
1713         explicit interface implementation.
1714
1715         (Property.Define, Indexer.Define, Method.Define): Validate that
1716         the given interface in the explicit implementation is one of the
1717         base classes for the containing type.
1718
1719         Also if we are explicitly implementing an interface, but there is
1720         no match in the pending implementation table, report an error.
1721
1722         (Property.Define): Only define the property if we are
1723         not explicitly implementing a property from an interface.  Use the
1724         correct name also for those properties (the same CSC uses,
1725         although that is really not needed).
1726         
1727         (Property.Emit): Do not emit attributes for explicitly implemented
1728         properties, as there is no TypeBuilder.
1729
1730         (Indexer.Emit): ditto.
1731
1732         Hiding then means that we do not really *implement* a pending
1733         implementation, which makes code fail.
1734
1735 2002-06-22  Martin Baulig  <martin@gnome.org>
1736
1737         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
1738         the return value of Object.GetType().  [FIXME: we need to do this whenever
1739         we get a type back from the reflection library].
1740
1741 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
1742
1743         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
1744
1745 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
1746
1747         * attribute.cs: Return null if we can not look up the type.
1748
1749         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
1750         the interface types found.
1751
1752         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
1753         interface types found.
1754
1755         * typemanager.cs (GetInterfaces): Make this routine returns alll
1756         the interfaces and work around the lame differences between
1757         System.Type and System.Reflection.Emit.TypeBuilder in the results
1758         result for GetInterfaces.
1759         
1760         (ExpandInterfaces): Given an array of interface types, expand and
1761         eliminate repeated ocurrences of an interface.  This expands in
1762         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
1763         be IA, IB, IC.
1764         
1765 2002-06-21  Martin Baulig  <martin@gnome.org>
1766
1767         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
1768         on System.Enum.
1769
1770 2002-06-21  Martin Baulig  <martin@gnome.org>
1771
1772         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
1773         and called with one of the core types, return the corresponding typebuilder for
1774         that type.
1775
1776         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
1777         element type.
1778
1779 2002-06-21  Martin Baulig  <martin@gnome.org>
1780
1781         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
1782         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
1783         (Expression.ConvertReferenceExplicit): Likewise.
1784
1785         * expression.cs (ElementAccess.DoResolve): Likewise.
1786         (ElementAccess.DoResolveLValue): Likewise.
1787
1788 2002-06-10  Martin Baulig  <martin@gnome.org>
1789
1790         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
1791         add the "value" parameter to the parameter list.
1792
1793         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
1794         to our caller.
1795
1796 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
1797
1798         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
1799         the argument to an int, uint, long or ulong, per the spec.  Also
1800         catch negative constants in array creation.
1801
1802 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
1803
1804         * class.cs: do not allow the same interface to appear twice in
1805         the definition list.
1806
1807 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
1808
1809         * ecore.cs: don't use ldlen with System.Array.
1810
1811 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
1812
1813         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
1814
1815 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
1816
1817         * modifiers.cs: produce correct field attributes for protected
1818         internal. Easy fix so miguel can work on ther harder stuff:-)
1819
1820 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
1821
1822         * pending.cs: New file.  Move the code from class.cs here.
1823         Support clearning the pending flag for all methods (when not doing
1824         explicit interface implementation).
1825
1826 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
1827
1828         * rootcontext.cs: added a couple more types needed to bootstrap.
1829
1830 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
1831
1832         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
1833         constructor in the type, instead of any constructor in the type
1834         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
1835         a bug in the Mono runtime when applying the params attribute). 
1836
1837 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
1838         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
1839
1840 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
1841
1842         * expression.cs (Unary.ResolveOperator): Use TypeManager
1843         to resolve the type.
1844         
1845 2002-06-13  Ravi Pratap  <ravi@ximian.com>
1846
1847         * cs-parser.jay (enum_member_declaration): Pass in the attributes
1848         attached.
1849
1850         * enum.cs (AddEnumMember): Add support to store the attributes associated 
1851         with each member too.
1852
1853         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
1854         field builders too - this takes care of the enum member case.
1855
1856 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
1857
1858         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
1859         address-of operator on both value types and pointers.
1860         
1861 2002-06-10  Martin Baulig  <martin@gnome.org>
1862
1863         * interface.cs (Interface.PopulateIndexer): Add the indexer's
1864         PropertyBuilder to the `property_builders' list.
1865
1866         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
1867         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
1868         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
1869         find any indexers which are inherited from an interface.
1870
1871 2002-06-09  Martin Baulig  <martin@gnome.org>
1872
1873         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
1874         the same type as the constant if necessary.  There's also a test-130.cs
1875         for this.
1876
1877         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
1878
1879         * typemanager.cs (TypeManager.ChangeType): Previously known as
1880         Enum.ChangeEnumType().
1881
1882 2002-06-09  Martin Baulig  <martin@gnome.org>
1883
1884         * expression.cs (Cast.TryReduce): Added support for consts.
1885
1886 2002-06-08  Ravi Pratap  <ravi@ximian.com>
1887
1888         * class.cs (Accessor): Hold attributes information so we can pass
1889         it along.
1890
1891         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
1892         Modify to pass in attributes attached to the methods.
1893
1894         (add_accessor_declaration, remove_accessor_declaration): Ditto.
1895
1896         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
1897         to handle the Accessor kind :-)
1898
1899         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
1900         
1901 2002-06-08  Martin Baulig  <martin@gnome.org>
1902
1903         * expression.cs (Unary.TryReduceNegative): Added support for
1904         ULongConstants.
1905
1906 2002-06-08  Martin Baulig  <martin@gnome.org>
1907
1908         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
1909         name can't be found in the `defined_names' - the caller will do a
1910         MemberLookup in this case and thus find methods in System.Enum
1911         such as Enum.IsDefined().
1912
1913 2002-06-08  Martin Baulig  <martin@gnome.org>
1914
1915         * enum.cs (Enum.ChangeEnumType): This is a custom version of
1916         Convert.ChangeType() which works with TypeBuilder created types.
1917         (Enum.LookupEnumValue, Enum.Define): Use it here.
1918
1919         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
1920         `TypeBuilder.BaseType != null' check.
1921         (TypeContainer.FindMembers): Only lookup parent members if we
1922         actually have a parent.
1923         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
1924         (ConstructorInitializer.Resolve): Likewise.
1925
1926         * interface.cs (Interface.FindMembers): Added
1927         `TypeBuilder.BaseType != null' check.
1928
1929         * rootcontext.cs (RootContext.ResolveCore): Added
1930         "System.Runtime.CompilerServices.IndexerNameAttribute" to
1931         classes_second_stage.
1932
1933         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
1934         debug_type and trace_type when compiling with --nostdlib.       
1935
1936 2002-06-07  Martin Baulig  <martin@gnome.org>
1937
1938         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
1939         (AddField): Set it to true when adding a non-static field.
1940         (DefineType): Use `have_nonstatic_fields' to find out whether we
1941         have non-static fields, not `Fields != null'.
1942
1943 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
1944
1945         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
1946         dereferencing a null on the static-field code path)
1947
1948 2002-05-30  Martin Baulig  <martin@gnome.org>
1949
1950         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
1951         to take command line arguments.  Use reflection to call the new
1952         custom `Initialize' function on the symbol writer and pass it the
1953         command line arguments.
1954
1955         * driver.cs (--debug-args): New command line argument to pass command
1956         line arguments to the symbol writer.
1957
1958 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
1959
1960         * assign.cs (DoResolve): Forgot to do the implicit conversion to
1961         the target type for indexers and properties.  Thanks to Joe for
1962         catching this.
1963
1964 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
1965
1966         * typemanager.cs (MethodFlags): returns the method flags
1967         (Obsolete/ShouldIgnore) that control warning emission and whether
1968         the invocation should be made, or ignored. 
1969
1970         * expression.cs (Invocation.Emit): Remove previous hack, we should
1971         not do this on matching a base type, we should do this based on an attribute
1972
1973         Only emit calls to System.Diagnostics.Debug and
1974         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
1975         on the command line.
1976
1977         * rootcontext.cs: Global settings for tracing and debugging.
1978
1979         * cs-tokenizer.cs (define): New utility function to track
1980         defines.   Set the global settings for TRACE and DEBUG if found.
1981
1982 2002-05-25  Ravi Pratap  <ravi@ximian.com>
1983
1984         * interface.cs (Populate*): Pass in the TypeContainer as well as
1985         the DeclSpace as parameters so that we can create EmitContexts and
1986         then use that to apply attributes etc.
1987
1988         (PopulateMethod, PopulateEvent, PopulateProperty)
1989         (PopulateIndexer): Apply attributes everywhere.
1990
1991         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
1992         etc.
1993
1994         (ApplyAttributes): Update accordingly.
1995
1996         We now apply interface attributes for all members too.
1997
1998 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
1999
2000         * class.cs (Indexer.Define); Correctly check if we are explicit
2001         implementation (instead of checking the Name for a ".", we
2002         directly look up if the InterfaceType was specified).
2003
2004         Delay the creation of the PropertyBuilder.
2005
2006         Only create the PropertyBuilder if we are not an explicit
2007         interface implementation.   This means that explicit interface
2008         implementation members do not participate in regular function
2009         lookups, and hence fixes another major ambiguity problem in
2010         overload resolution (that was the visible effect).
2011
2012         (DefineMethod): Return whether we are doing an interface
2013         implementation. 
2014         
2015         * typemanager.cs: Temporary hack until we get attributes in
2016         interfaces (Ravi is working on that) and we get IndexerName
2017         support in interfaces.
2018
2019         * interface.cs: Register the indexers as properties.
2020
2021         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
2022         warning, I have verified that this is a bug in the .NET runtime
2023         (JavaScript suffers of the same problem).
2024
2025         * typemanager.cs (MemberLookup): When looking up members for
2026         interfaces, the parent of an interface is the implicit
2027         System.Object (so we succeed in searches of Object methods in an
2028         interface method invocation.  Example:  IEnumerable x;  x.ToString
2029         ()) 
2030
2031 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
2032
2033         * class.cs (Event): Events should also register if they do
2034         implement the methods that an interface requires.
2035
2036         * typemanager.cs (MemberLookup); use the new GetInterfaces
2037         method. 
2038
2039         (GetInterfaces): The code used to lookup interfaces for a type is
2040         used in more than one place, factor it here. 
2041
2042         * driver.cs: Track the errors at the bottom of the file, we kept
2043         on going.
2044
2045         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
2046         instance if the method we are calling is static!
2047
2048 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
2049
2050         * attribute.cs (ApplyAttributes): Make this function filter out
2051         the IndexerName attribute (as that attribute in reality is never
2052         applied) and return the string constant for the IndexerName
2053         attribute. 
2054
2055         * class.cs (TypeContainer.Emit): Validate that all the indexers
2056         have the same IndexerName attribute, and if so, set the
2057         DefaultName attribute on the class. 
2058
2059         * typemanager.cs: The return value might contain other stuff (not
2060         only methods).  For instance, consider a method with an "Item"
2061         property and an Item method.
2062
2063         * class.cs: If there is a problem with the parameter types,
2064         return. 
2065
2066 2002-05-24  Ravi Pratap  <ravi@ximian.com>
2067
2068         * ecore.cs (ImplicitConversionExists): Wrapper function which also
2069         looks at user defined conversion after making a call to 
2070         StandardConversionExists - we need this for overload resolution.
2071
2072         * expression.cs : Update accordingly the various method calls.
2073
2074         This fixes 2 bugs filed against implicit user defined conversions 
2075
2076 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
2077
2078         * statement.cs: Track the result of the assignment.
2079
2080 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
2081
2082         * expression.cs (MemberAccess): Improved error reporting for
2083         inaccessible members.
2084
2085 2002-05-22  Martin Baulig  <martin@gnome.org>
2086
2087         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
2088         itself with debugging support.
2089
2090 2002-05-22  Martin Baulig  <martin@gnome.org>
2091
2092         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
2093         Removed, this isn't needed anymore.
2094
2095 2002-05-20  Martin Baulig  <martin@gnome.org>
2096
2097         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
2098         be underlying type for an enum.
2099
2100 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
2101
2102         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
2103         that splits out the loading of just the core types.
2104
2105         * rootcontext.cs (ResolveCore): Split the struct resolution in
2106         two, so we can load the enumeration underlying types before any
2107         enums are used.
2108
2109         * expression.cs (Is): Bandaid until we fix properly Switch (see
2110         bug #24985 for details).
2111
2112         * typemanager.cs (ImplementsInterface): The hashtable will contain
2113         a null if there are no interfaces implemented.
2114
2115 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
2116
2117         * cs-parser.jay (indexer_declarator): It is fine to have array
2118         parameters
2119
2120 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
2121
2122         * typemanager.cs: (RegisterBuilder): New function used to register
2123         TypeBuilders that implement interfaces.  Since
2124         TypeBuilder.GetInterfaces (as usual) does not work with lame
2125         Reflection.Emit. 
2126         (AddUserType): register interfaces.
2127
2128         (ImplementsInterface): Use the builder_to_ifaces hash if we are
2129         dealing with TypeBuilder.  Also, arrays are showing up as
2130         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
2131         methods can not be invoked on them!
2132
2133         * ecore.cs (ExplicitReferenceConversionExists): Made public.
2134         (ImplicitReferenceConversionExists): Split out from
2135         StandardConversionExists. 
2136
2137         * expression.cs (As): We were only implementing one of the three
2138         cases for the as operator.  We now implement them all.
2139         (Is): Implement the various other cases for Is as well.
2140
2141         * typemanager.cs (CACHE): New define used to control if we want or
2142         not the FindMembers cache.  Seems to have a negative impact on
2143         performance currently
2144
2145         (MemberLookup): Nested types have full acess to
2146         enclosing type members
2147
2148         Remove code that coped with instance/static returns for events, we
2149         now catch this in RealFindMembers.
2150
2151         (RealFindMembers): only perform static lookup if the instance
2152         lookup did not return a type or an event.  
2153
2154 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
2155
2156         * assign.cs (CompoundAssign): We pass more semantic information
2157         now to Compound Assignments than we did before: now we have all
2158         the information at hand, and now we resolve the target *before* we
2159         do the expression expansion, which allows the "CacheValue" method
2160         to have the effect we intended (before, a [x] += 1 would generate
2161         two differen ArrayAccess expressions from the ElementAccess,
2162         during the resolution process).
2163
2164         (CompoundAssign.DoResolve): Resolve target and original_source here.
2165
2166 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
2167
2168         * expression.cs (ArrayAccess): dropped debugging information. 
2169
2170         * typemanager.cs: Small bug fix: I was always returning i_members,
2171         instead of one of i_members or s_members (depending on which had
2172         the content).
2173
2174         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
2175         method is invoked before any code generation takes place, and it
2176         is a mechanism to inform that the expression will be invoked more
2177         than once, and that the method should use temporary values to
2178         avoid having side effects
2179
2180         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
2181         
2182         * ecore.cs (Expression.CacheTemporaries): Provide empty default
2183         implementation.
2184
2185         * expression.cs (Indirection, ArrayAccess): Add support for
2186         CacheTemporaries in these two bad boys. 
2187
2188         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
2189         ldobj or ldind_ref.  
2190         (StoreFromPtr): Handle stobj as well.
2191
2192         * expression.cs (UnaryMutator): Share more code.
2193         
2194         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
2195         down: I was not tracking the Filter function as well, which
2196         was affecting the results of the cache.
2197
2198 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
2199
2200         * attribute.cs: Remove the hack to handle the CharSet property on
2201         StructLayouts. 
2202
2203 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
2204
2205         * attribute.cs (DoResolve): More uglyness, we now only try to
2206         resolve the attribute partially, to extract the CharSet
2207         information (only if we are a StructLayout attribute).  Otherwise 
2208
2209         (GetExtraTypeInfo): Add some code to conditionally kill in the
2210         future this.   I am more and more convinced that the .NET
2211         framework has special code to handle the attribute setting on
2212         certain elements.
2213
2214         * expression.cs (IsParamsMethodApplicable): Revert my previous
2215         foreach change here, it was wrong.
2216
2217 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
2218
2219         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
2220         (pp_expr): do not abort on unknown input, just return.
2221         (eval): abort if there are pending chars.
2222
2223         * attribute.cs (Attribute.Resolve): Positional parameters are
2224         optional.  Deal with that case.
2225
2226         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
2227         the Ansi/Unicode/Auto information for the type.
2228
2229         (TypeContainer.DefineType): instantiate the EmitContext here, as
2230         we will be using it during the type definition (to resolve
2231         attributes) and during the emit phase.
2232
2233         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
2234         to pull type information out of the attributes
2235
2236         (Attribute.Resolve): track the constructor builder, and allow for
2237         multiple invocations (structs and classes will use this).
2238
2239         * ecore.cs (MemberLookupFinal): new version with all the
2240         parameters customizable.
2241
2242         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
2243         constructors.  Return if the result value is null (as the error
2244         would have been flagged already by MemberLookupFinal)
2245
2246         Do not allow instances of abstract classes or interfaces to be
2247         created.
2248         
2249         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
2250         We have to compare the assembly property here when dealing with
2251         FamANDAssem and Assembly access modifiers, because we might be
2252         creating an assembly from *modules* (that means that we are not
2253         getting TypeBuilders for types defined in other modules that are
2254         part of this assembly).
2255
2256         (Method.Emit): If the method is marked abstract and has a body,
2257         emit an error. 
2258
2259         (TypeContainer.DefineMembers): If both the defined member and the
2260         parent name match are methods, then do not emit any warnings: let
2261         the Method.Define routine take care of flagging warnings.  But if
2262         there is a mismatch (method overrides something else, or method is
2263         overriwritten by something, then emit warning).
2264
2265         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
2266         set to null, this means `do not check for the return type on the
2267         signature'. 
2268
2269         (Method.Define): set the return type for the method signature to
2270         null, so that we get methods with the same name and parameters and
2271         different return types.  This is used to flag warning 114 (you are
2272         hiding a method, and you probably want to use the new/override
2273         keywords instead).
2274
2275         * typemanager.cs (MemberLookup): Implemented proper access
2276         control, closing a long standing set of bug reports.  The problem
2277         was that the Framework only has two bits: Public and NonPublic,
2278         and NonPublic includes private and protected methods, but we need
2279         to enforce the FamANDAssem, FamOrAssem and Family. 
2280
2281 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
2282
2283         * statement.cs (GotoCase): Return true: Ammounts to giving up
2284         knowledge on whether we return or not, and letting the other case
2285         be responsible for it.
2286
2287 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
2288
2289         * driver.cs: Do not load directories for each file processed, only
2290         do it if there is a pattern.
2291
2292         * ecore.cs: Report readonly assigns here as well, as we might have
2293         been resolved only by MemberAccess.
2294
2295         (SimpleName.SimpleNameResolve): Also be useful for LValue
2296         resolution.   We need this to propagate assign to local readonly variables
2297
2298         * typemanager.cs: Use a ptrhashtable for the criteria, because we
2299         do not want to reuse potential criteria memory.
2300
2301         * class.cs (MyEventBuilder): Set reflected_type;
2302
2303         * ecore.cs (Constantify): Added support for constifying bools.
2304
2305         (RootContext.LookupType): Added a cache for values looked up in
2306         the declaration space.
2307
2308         * typemanager.cs (FindMembers): Now is a front-end to
2309         RealFindMembers, and provides a two-level hashtable-based cache to
2310         the request.  
2311
2312         15% performance improvement: from 22.5 to 19.2 seconds.
2313
2314         * expression.cs (IsParamsMethodApplicable): use foreach.
2315         (Invocation.DoResolve): ditto.
2316         (New.DoResolve): ditto.
2317         (ArrayCreation.DoResolve): ditto.
2318
2319         * ecore.cs (FindMostEncompassingType): use foreach.
2320
2321         * delegate.cs (NewDelegate.DoResolve): Use foreach
2322
2323         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
2324         (RemoveMethods): use foreach.
2325
2326         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
2327         nested foreach statements instead of for, and also break out of
2328         the inner loop once a match is found.
2329         
2330         (Invocation.OverloadResolve): Use foreach, simplify the code. 
2331
2332 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
2333
2334         * cfold.cs (BinaryFold): During an enumeration evaluation context,
2335         we actually unwrap the expression to allow for extra information
2336         to be extracted. 
2337
2338         * expression.cs: Use Shr_Un on unsigned operations. 
2339
2340 2002-05-08  Ravi Pratap  <ravi@ximian.com>
2341
2342         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
2343         applicable operators was not being considered correctly. This closes
2344         the bug Miguel reported.
2345
2346 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
2347
2348         * attribute.cs: check that the type derives from System.Attribute
2349         and report the correct error in that case (moved the duplicate code to
2350         its own method, too).
2351
2352 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
2353
2354         * attribute.cs: lookup attribute type name as the spec says: first the
2355         bare attribute name and then name + "Attribute" (nant compiles with
2356         mcs after this fix).
2357
2358 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
2359
2360         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
2361         Because of the way we parse things, we should try to see if a
2362         UIntConstant can fit in an integer.
2363
2364 2002-05-07  Ravi Pratap  <ravi@ximian.com>
2365
2366         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
2367         when we are in an explicit context.
2368
2369         (ConvertReferenceExplicit): When converting from Iface type S to Class
2370         T make sure the rules are implemented as an OR.
2371
2372         * parameter.cs (ParameterType): Make it a property for now although the
2373         purpose really isn't anything immediate.
2374         
2375         * expression.cs (Is*Applicable): Do better checking on the parameter type
2376         of a ref/out parameter. The ones from the system assemblies are already 
2377         marked with the correct type so we don't need to do any correction.
2378
2379         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
2380         the object type is standard too so include that.
2381
2382 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
2383
2384         * ecore.cs (StandardConversionExists): Augment with missing code:
2385         deal with IntConstant, LongConstants and Enumerations.
2386
2387         * assign.cs: Report the error, instead of failing silently
2388
2389         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
2390         typecontainer that they are declared, because the
2391         typecontainer/namespace will have the list of using clauses that
2392         need to be applied.
2393
2394         Assembly Attributes were escaping the normal registration
2395         mechanism. 
2396
2397         (EmitCode): Apply attributes within an EmitContext that represents
2398         the container they were declared on.
2399         
2400         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
2401
2402 2002-05-06  Ravi Pratap  <ravi@ximian.com>
2403
2404         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
2405         Revamp completely - make much cleaner as we now operate only
2406         on a set of Types.
2407
2408         (FindMostSpecificSource, FindMostSpecificTarget): New methods
2409         to implement the logic detailed in the spec more correctly.
2410
2411         (UserDefinedConversion): Update accordingly.
2412
2413 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
2414
2415         * statement.cs: Return flow analysis information up.
2416
2417         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
2418         and the default.
2419
2420         (token): Do not consume an extra character before calling
2421         decimal_digits.
2422
2423 2002-05-06  Piers Haken <piersh@friskit.com>
2424
2425         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
2426
2427 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
2428
2429         * class.cs (Constructor.Emit): Set the IsStatic flag in the
2430         EmitContext during the instance constructor initializer
2431         resolution, to stop access to instance variables.
2432
2433         This is mandated by the spec, last paragraph of the `constructor
2434         initializers' section. 
2435
2436 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
2437
2438         * cs-parser.jay, class.cs (Accessor): new class used to represent
2439         an accessor (get or set).  In the past we used `null' to represent
2440         a missing accessor.  But this is ambiguous because there was no
2441         way to tell in abstract indexers/properties if one of them was
2442         specified.
2443
2444         Now there is a way of addressing that.
2445
2446         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
2447         instead of FindMembers.
2448
2449         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
2450         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
2451
2452         * attribute.cs: Treat indexers and properties as the same in terms
2453         of applying attributes
2454
2455         * ecore.cs (FindMostEncompassedType): Use statically initialized
2456         EmptyExpressions()s like we do elsewhere to avoid creating useless
2457         objects (and we take this out of the tight loop).
2458
2459         (GetConversionOperators): Move the code to extract the actual
2460         operators to a separate routine to clean things up.
2461
2462 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
2463
2464         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
2465         events are always registered FieldBuilders.
2466         
2467         * class.cs (FieldBase): New class shared by Fields 
2468
2469         * delegate.cs: If we are a toplevel delegate, use our full name.
2470         If we are a nested delegate, then only use our tail name.
2471
2472 2002-05-02  Ravi Pratap  <ravi@ximian.com>
2473
2474         * expression.cs (IsApplicable): Ensure that we add the "&" to
2475         ref/out types before comparing it with the type of the argument.
2476
2477         (IsParamsMethodApplicable): Ditto.
2478
2479         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
2480         silly me ;-)
2481
2482         * delegate.cs : Handle the case when we have more than one applicable
2483         method. Flag an error only when we finish checking all.
2484
2485 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
2486
2487         * expression.cs: Add support for boolean static initializers.
2488
2489 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
2490
2491         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
2492
2493         * parameter.cs (ComputeParameterTypes,
2494         ComputeAndDefineParameterTypes): Better error handling: now we
2495         clear the `types' cache if we fail during any of the type lookups.
2496         We also return the status code correctly to our caller
2497
2498         * delegate.cs: If we fail to define a delegate, abort the extra
2499         steps. 
2500
2501         * expression.cs (Binary.ResolveOperator): for
2502         operator==(object,object) and operator !=(object, object) we also
2503         have to verify that there is an implicit conversion from one to
2504         the other.
2505
2506         (ArrayAccess.DoResolve): Array Access can operate on
2507         non-variables. 
2508
2509 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
2510
2511         * assign.cs (CompoundAssign): A new class used as a "flag" that
2512         the assignment actually is happening as part of a compound
2513         assignment operator.
2514
2515         During compound assignment, a few new rules exist to enable things
2516         like:
2517
2518         byte b |= 1 + 2
2519
2520         From the spec:
2521         
2522         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
2523         to the type of x) if y is implicitly convertible to the type of x,
2524         and the operator is a builtin operator and the return type of the
2525         operator is explicitly convertible to the type of x. 
2526
2527         * rootcontext.cs: Reset warning level to 2.  4 catches various
2528         "interesting" features in mcs, we must clean this up at some
2529         point, but currently am trying to kill other bugs ;-)
2530
2531         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
2532         in container classes as well.  
2533
2534         * expression.cs (Binary.ResolveOperator): Handle string case
2535         before anything else (as operator overloading does emit an error
2536         before doing anything else).
2537
2538         This code could go away when we move to a table driven model, but
2539         i could not come up with a good plan last night.
2540         
2541 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
2542
2543         * typemanager.cs (CSharpName): reimplementation using regex.
2544         * class.cs: added null check for fields in Emit
2545         * rootcontext.cs: set warninglevel to 4
2546
2547 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
2548
2549         * typemanager.cs (CSharpName): reimplemented with Lupus
2550         suggestion.
2551
2552 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
2553
2554         * statement.cs (If): correclty implement Resolve, because we were
2555         not catching sem errors in there.  The same process is needed
2556         everywhere else. 
2557         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
2558         
2559
2560         (Statement.Warning_DeadCodeFound): Factorize code.
2561         (While): Report dead code here too.
2562
2563         (Statement): Added Resolve virtual method to allow
2564         for resolution split from the emit code.
2565
2566 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
2567
2568         * statement.cs (EmitBoolExpression): No longer try to resolve the
2569         expression here.    
2570         (MakeBoolean): New utility function that resolve, implicitly
2571         converts to boolean and tags the expression. 
2572         
2573
2574         (If, Do): Implement dead code elimination.
2575         (While): Implement loop inversion
2576
2577         (Do, While, For, If): Resolve the expression prior to calling our
2578         code generation.
2579
2580 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
2581
2582         * class.cs:
2583           - added method Report28 (warning: program has more than one entry point)
2584           - added method IsEntryPoint, implements paragraph 10.1 of the spec
2585           - modified method Method.Define, the part at the end of the method
2586
2587         * rootcontext.cs: added static public Location EntryPointLocation;
2588           
2589         * ../errors/cs0028.cs : Add test case for the above warning.              
2590
2591         * typemanager.cs:
2592           - modified method CSharpName to allow arrays of primitive type to
2593             be printed nicely (e.g. instead of System.Int32[][] it now prints
2594             int[][])
2595           - added method CSharpSignature: returns the signature of a method
2596             in string format to be used in reporting errors, warnings, etc.
2597
2598         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
2599         with String.Empty.
2600         
2601 2002-04-26  Ravi Pratap  <ravi@ximian.com>
2602
2603         * delegate.cs (Define): Fix extremely silly bug where I was
2604         setting the type of the 'object' parameter of the BeginInvoke
2605         method to System.IAsyncResult instead of System.Object ;-)
2606
2607 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
2608
2609         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
2610         here. 
2611
2612         (Constructor.Emit): return if we fail to initialize the
2613         constructor.  Another door closed!  
2614
2615         * expression.cs (New.DoResolve): Improve error message (from -6 to
2616         1501).  Use DeclaredOnly lookup to find the exact constructor.
2617
2618         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
2619         loop.  This is useful.
2620
2621         * cs-parser.jay: Adjust the default parameters so that destructors
2622         have the proper signature.
2623
2624 2002-04-26  Martin Baulig  <martin@gnome.org>
2625
2626         * driver.cs (LoadAssembly): If `assembly' contains any characters
2627         which are only valid in path names and not in assembly names
2628         (currently slash, backslash and point), use Assembly.LoadFrom ()
2629         instead of Assembly.Load () on the `assembly' (before iteration
2630         over the link_paths).
2631
2632 2002-04-26  Martin Baulig  <martin@gnome.org>
2633
2634         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
2635
2636 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
2637
2638         * class.cs (Property): use the new typemanager.MemberLookup
2639
2640         (TypeContainer.MemberLookup): Implement using the
2641         TypeManager.MemberLookup now. 
2642         
2643         * typemanager.cs: Make MemberLookup a function of the TypeManager,
2644         and return MemberInfos, so that these can be used without an
2645         EmitContext (what we had before).
2646
2647 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
2648
2649         * expression.cs: Fix the case where the argument to params if the
2650         type of the params.  I omitted handling this before.   Fixed
2651
2652 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
2653
2654         * driver.cs: Call BootCorlib_PopulateCoreType
2655
2656         * class.cs (Property.CheckBase): Check for properties only, not
2657         for all members. 
2658
2659         * interface.cs: Temporary hack: try/catch around the
2660         CustomAttributeBuilder, because I am getting an exception that I
2661         do not understand.
2662
2663         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
2664         types whose definitions are required to be there (attributes are
2665         defined before standard types).
2666
2667         Compute definitions as we boot the various types, as they are used
2668         immediately (value_type class will need object_type, but if we do
2669         not initialize object_type, we will pass a null, which will let
2670         the runtime pick the System.Object from the existing corlib, which
2671         is not what we want).
2672
2673 2002-04-22  Patrik Torstensson <totte@labs2.com>
2674
2675         * cs-tokenizer.cs: fixed a number of trim() issues.
2676
2677 2002-04-22  Ravi Pratap  <ravi@ximian.com>
2678
2679         * expression.cs (Argument.Type): Ensure that we return the correct
2680         type when we have out or ref parameters [in which case we 
2681         append a "&"].
2682         
2683 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
2684
2685         * class.cs (Property, Indexer): Allow extern modifier in there. 
2686
2687         * typemanager.cs (InitBaseTypes): Initializes object_type and
2688         value_type, since those will be used early on during the bootstrap
2689         process to compile corlib.
2690
2691         (InitCoreTypes): Move code from here to InitBaseTypes.
2692
2693 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
2694
2695         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
2696         single-dimension arrays as using the ldlen opcode.  
2697
2698         Daniel Lewis discovered this optimization.  
2699
2700         * typemanager.cs: Add signature for System.Array::get_Length
2701
2702 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2703
2704         * statement.cs: report the error when the foreach does not apply to an
2705         array nor a collection.
2706
2707 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
2708
2709         * expression.cs: Add implicit conversions to the operator ~.
2710
2711         * constant.cs (DecimalConstant.Emit): Emit decimal value.
2712
2713         * typemanager.cs: Locate the decimal constructor.
2714
2715 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2716
2717         * attribute.cs: use the new property of TypeOf.
2718         * expression.cs: added 'get' property around typearg.
2719
2720         These changes fix a build breaker reported by NickD. Is this the
2721         correct way to fix?  If not, please, revert my changes and make it
2722         work :-).
2723
2724 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
2725
2726         * attribute.cs: Add support for typeof in attribute invocations.
2727         I am not sure that this is right though.
2728
2729 2002-04-14  Duncan Mak  <duncan@ximian.com>
2730
2731         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
2732         Binary.Operator.Division case.
2733
2734 2002-04-13  Ravi Pratap  <ravi@ximian.com>
2735
2736         * class.cs (DefineType): Ensure that we do a proper check on
2737         attribute types and also register it with the TypeManager.
2738
2739         (TypeContainer.Targets): The default for attribute types is
2740         AttributeTargets.All.
2741         
2742         * attribute.cs (ApplyAttributes): Registering the attribute type
2743         is done elsewhere, not when we discover we have a Usage attribute.
2744
2745 2002-04-12  Ravi Pratap  <ravi@ximian.com>
2746
2747         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
2748         and get rid of is_delegate parameter.
2749
2750         * everywhere : update.
2751         
2752 2002-04-12  Ravi Pratap  <ravi@ximian.com>
2753
2754         * cs-parser.jay (compilation_unit): Revamp completely to use
2755         some new ideas that I got from Rhys' grammar to solve the problems
2756         with assembly level attributes.
2757
2758         (outer_declaration): New grammar production.
2759
2760         (attribute_sections): Add.
2761
2762         (opt_attributes): Base on attribute_sections
2763
2764         (namespace_declaration): Allow opt_attributes to tackle the case
2765         when we have assembly level attributes - we are clever in this
2766         regard now ;-)
2767
2768         * attribute.cs (ApplyAttributes): Do not worry about assembly 
2769         attributes in the non-global context.
2770
2771         * rootcontext.cs (AddGlobalAttributes): Go back to using this
2772         instead of SetGlobalAttributes.
2773
2774         * class.cs, rootcontext.cs : Ensure we define and generate 
2775         attribute types before anything else.
2776
2777         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
2778         and flag the new error -20 for the case when the attribute type
2779         does not have valid targets specified. csc does not catch this.
2780
2781         * ../errors/errors.txt : update for error # -20
2782
2783 2002-04-11  Ravi Pratap  <ravi@ximian.com>
2784
2785         * support.cs (InternalParameters.ParameterModifier): Do some null
2786         checking and return sane values.
2787
2788         * class.cs (Method.Define): If we are a PInvoke method, ensure
2789         that we are static and extern. Report error # 601
2790
2791         * ../errors/cs0601.cs : Add test case for the above error.
2792
2793 2002-04-07  Ravi Pratap  <ravi@ximian.com>
2794
2795         * rootcontext.cs (attribute_types): We need to keep type of
2796         all attribute types separately and emit code for them first.
2797
2798         (RegisterAttribute) : Implement.
2799
2800         * class.cs (DefineType): Check if the current Type is a custom
2801         attribute type and register it accordingly.
2802
2803         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
2804         adding the first attribute twice and rename to
2805
2806         (SetGlobalAttributes): this.
2807
2808         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
2809         lookups.
2810
2811         * attribute.cs (ApplyAttributes): Take an additional argument telling us
2812         if we are processing global arguments. Hmm, I am unsure of this.
2813
2814 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2815
2816         * expression.cs: added static array of strings to avoid calling
2817         Enum.ToString () for Operator in Binary. Significant recover of
2818         performance.
2819
2820 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
2821
2822         * class.cs (FindMembers): Allow the Builders of the various
2823         members to be null.  If they are skip them.  This only happens
2824         during the PInvoke declaration.
2825
2826 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
2827
2828         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
2829         failure, so we do not keep going afterwards.
2830
2831         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
2832         wanted to pass `false' as the `is_delegate' argument.  If this is
2833         the case, why not use delegate_type == null to mean `is_delegate =
2834         false' and anything else as is_delegate = true.
2835
2836 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
2837
2838         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
2839         code for the section, not the beginning of the tests.
2840
2841 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
2842
2843         * cfold.cs: Handle operator + (Enum x, Underlying x) 
2844
2845         * expression.cs (Binary): same.  Warn about errors where we have
2846         Enum/Enum in operator + as well.
2847
2848 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
2849
2850         * statement.cs:
2851                 - added support for switch(bool)
2852                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
2853                 - add TableSwitchEmit() to handle table-based switch statements
2854
2855 2002-04-05  Ravi Pratap  <ravi@ximian.com>
2856
2857         * expression.cs (Invocation.OverloadResolve): Factor out code which
2858         does parameter compatibility checking with arguments so that we can 
2859         re-use the code even from Delegate.VerifyApplicability
2860
2861         (VerifyArgumentsCompat): Move above code here.
2862
2863         * delegate.cs (VerifyApplicability): Get rid of duplicate code
2864         and instead make a call to the above method.
2865
2866 2002-03-31  Ravi Pratap  <ravi@ximian.com>
2867
2868         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
2869         We use it to keep track of classes which are attribute types.
2870
2871 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
2872
2873         * delegate.cs (Delegate.Define): Correctly define the types in the
2874         presence of fixed and array parameters.
2875
2876         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
2877         doing FindMembers.
2878
2879         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
2880         include NonPublic after the first iteration.
2881
2882         * class.cs (Indexer.CheckBase): Only check if both parents are
2883         non-null. 
2884         
2885         * cs-parser.jay (accessor_body): If empty, set to null.
2886
2887         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
2888         same code path here to resolve constants names that we did have in
2889         MemberAccess.DoResolve.  There is too much code duplicated here.
2890
2891 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
2892
2893         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
2894
2895         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
2896         to MakeUnionSet.
2897
2898         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
2899         tokens, numbers and strings.
2900
2901         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
2902         parenthesis.
2903
2904         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
2905         asyncronous parameters and the regular parameters.  
2906
2907         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
2908         specify the target directory.
2909
2910         * expression.cs: (This.DoResolve): Simplify
2911         (As.Emit): Optimize, do not generate IsInst if the expression is
2912         always of the given type.
2913
2914         (Is.DoResolve): Bug fix, we were reporting both always/never for
2915         the is expression.
2916
2917         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
2918         creating too many unnecessary arrays.
2919
2920 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
2921
2922         * class.cs (EmitFieldInitializer): Use Assign expression to assign
2923         fields instead of rolling our own initializer.   Takes care of all
2924         implicit conversions, and drops unnecessary static checks/argument.
2925
2926 2002-03-31  Dick Porter  <dick@ximian.com>
2927
2928         * driver.cs: use the GetDirectories() return values properly, and
2929         use "/" as path separator.
2930
2931 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
2932
2933         * expression.cs (Unary): Optimize - - expr into expr.
2934         (Binary): Optimize a + (-b) into a -b.
2935
2936         * codegen.cs (CodeGen): Made all methods static.
2937
2938 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
2939
2940         * rootcontext.cs: 
2941
2942         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
2943         TypeBuilder property.
2944
2945         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
2946         instead. 
2947
2948         * tree.cs: Removed the various RecordXXXX, and replaced with a
2949         single RecordDecl.  Removed all the accessor methods, and just
2950         left a single access point Type 
2951
2952         * enum.cs: Rename DefineEnum to DefineType.
2953
2954         * decl.cs: New abstract method `DefineType' used to unify the
2955         Defines for Enumerations, Interfaces, TypeContainers and
2956         Delegates.
2957
2958         (FindType): Moved LookupInterfaceOrClass here.  Moved the
2959         LookupBaseClasses method that used to live in class.cs and
2960         interface.cs here, and renamed to FindType.
2961         
2962         * delegate.cs: Implement DefineType.  Take advantage of the
2963         refactored pattern for locating the parent builder without taking
2964         the parent_builder argument (which we know does not work if we are
2965         nested, and triggering a toplevel definition).
2966
2967 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
2968
2969         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
2970         accessibility of a member has changed during override and report
2971         an error if so.
2972
2973         * class.cs (Method.Define, Property.Define): Only complain on
2974         overrides if the method is private, any other accessibility is
2975         fine (and since we just checked the permission is the same, we are
2976         good to go).
2977
2978         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
2979         and elif are processed always.  The other pre-processing
2980         directives are only processed if we are "taking" the path
2981
2982 2002-03-29  Martin Baulig  <martin@gnome.org>
2983
2984         * class.cs (Method.Emit): Only emit symbolic debugging info if the
2985         current location is not Null.
2986
2987         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
2988         a separate method so we can profile it.
2989
2990         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
2991         `span.Seconds' are just seconds, but no minutes or hours.
2992         (MainDriver): Profile the CodeGen.SaveSymbols calls.
2993
2994 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
2995
2996         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
2997         Remove the gratuitous set of Final:
2998
2999                                 // If an interface implementation, then we can set Final.
3000                                 if (((flags & MethodAttributes.Abstract) == 0) &&
3001                                     implementing.DeclaringType.IsInterface)
3002                                         flags |= MethodAttributes.Final;
3003
3004         I do not know what I was smoking when I used that.
3005         
3006
3007         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
3008         step into fixing the name resolution issues for delegates and
3009         unifying the toplevel name resolution.
3010
3011 2002-03-28  Martin Baulig  <martin@gnome.org>
3012
3013         * class.cs (Method.Emit): If we have a symbol writer, call its
3014         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
3015         tell it about the current method.
3016
3017         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
3018         writer that we're going to emit the first byte of IL code for a new
3019         statement (a new source line).
3020         (EmitContext.EmitTopBlock): If we have a symbol writer, call
3021         EmitContext.Mark() before emitting any code.
3022
3023         * location.cs (SymbolDocument): Return null when we're Null.
3024
3025         * statement.cs (Statement): Moved the `Location loc' variable here.
3026         (Statement.EmitBoolExpression): If we have a symbol writer, call
3027         ec.Mark() before emitting any code to tell it that we're at the
3028         beginning of a new statement.
3029         (StatementExpression): Added `Location' argument to the constructor.
3030         (Block): Added public readonly variable `StartLocation' and public
3031         variable `EndLocation'.  The latter is to be set using SetEndLocation().
3032         (Block): Added constructor which takes a start and end location.
3033         (Block.SetEndLocation): New method. This sets the end location.
3034         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
3035         local variables we create.
3036         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
3037         each statement and do also mark the begin and end of the block.
3038
3039         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
3040         tell it the current lexer.Location, use Location.Null for the end of the
3041         block.
3042         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
3043         current block, set its end location using SetEndLocation().
3044         (statement_expression): StatementExpression constructor now takes the
3045         lexer.Location as additional argument.
3046         (for_statement, declare_local_variables): Likewise.
3047         (declare_local_variables): When creating a new implicit block, use the
3048         new Block constructor and pass it the lexer.Location.
3049
3050 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
3051
3052         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
3053         members also on the parent interfaces recursively.
3054
3055 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
3056
3057         * report.cs: Use new formats, since Gonzalo finished the missing
3058         bits. 
3059
3060         * expression.cs (Binary.ResolveOperator): added missing operator|
3061         operator& and operator^ for bool/bool.
3062
3063         * cs-parser.jay: CheckDef now takes a Location argument that is
3064         used to report errors more precisly (instead of reporting the end
3065         of a definition, we try to track something which is a lot closer
3066         to the source of the problem).
3067
3068         * cs-tokenizer.cs: Track global token use, so we can properly flag
3069         the use of #define/#undef after the first token has been seen.
3070
3071         Also, rename the reportXXXX to Error_DescriptiveName
3072
3073         * decl.cs (DeclSpace.IsTopLevel): Move property here from
3074         TypeContainer, so that Enum and Interface can use this too.
3075
3076         * class.cs (TypeContainer.LookupInterfaceOrClass,
3077         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
3078         `builder' argument.  Typically this was used to pass the parent
3079         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
3080         the definition).  
3081
3082         The problem is that a nested class could trigger the definition of
3083         a toplevel class, and the builder would be obviously wrong in that
3084         case. 
3085
3086         So we drop this argument, and we compute dynamically the
3087         TypeBuilder/ModuleBuilder (the correct information was available
3088         to us anyways from DeclSpace.Parent)
3089
3090         * interface.cs (Interface.DefineInterface): Drop builder
3091         parameter cleanup like class.cs
3092
3093         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
3094         like class.cs
3095
3096         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
3097         values. 
3098
3099         (Try.Emit): Propagate the returns value from the statement.
3100
3101         (Return.Emit): Even if we are leavning 
3102
3103         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
3104
3105         * modifiers.cs: Fix the computation of MethodAttributes flags.
3106
3107 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
3108
3109         * driver.cs: allow compilation of files that start with '/'.
3110         Add a default case when checking the argument of --target.
3111
3112 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
3113
3114         * interface.cs: Implement the same search algorithm for types in
3115         the interface code.
3116
3117         * delegate.cs: Do not allow multiple definition.
3118
3119         * Recovered ChangeLog that got accidentally amputated
3120
3121         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
3122
3123         * rootcontext.cs: Load manually enum to allow core classes to
3124         contain enumerations.
3125
3126         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
3127         Update to new static methods in TypeManager.
3128
3129         * typemanager.cs (GetMethod, GetConstructor): Use our
3130         implementation of FindMembers to find the members, since during
3131         corlib compilation, the types are TypeBuilders and GetMethod and
3132         GetConstructor do not work.
3133
3134         Make all methods in TypeManager static.
3135
3136         (InitCodeHelpers): Split the functionality from
3137         the InitCodeTypes function.
3138
3139         * driver.cs: Call InitCodeHelpers after we have populated the
3140         types. 
3141
3142         * cs-parser.jay (delegate_declaration): we did not used to compute
3143         the delegate name correctly for void delegates.
3144
3145 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
3146
3147         * rootcontext.cs (RootContext): Init the interface_resolve_order
3148         and type_container_resolve_order always.
3149
3150         (ResolveCore, BootstrapCorlib_ResolveClass,
3151         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
3152         compiler when compiling with --nostdlib
3153
3154         * class.cs (TypeContainer.DefineType): Check that our parent is
3155         not null.  This test is most important when we are bootstraping
3156         the core types.
3157
3158         * codegen.cs: Split out the symbol writing code.
3159
3160 2002-03-25  Martin Baulig  <martin@gnome.org>
3161
3162         * driver.cs (-g): Made -g an alias for --debug.
3163
3164 2002-03-24  Martin Baulig  <martin@gnome.org>
3165
3166         * codegen.cs (SymbolWriter): New public variable. Returns the
3167         current symbol writer.
3168         (CodeGen): Added `bool want_debugging_support' argument to the
3169          constructor. If true, tell the ModuleBuild that we want debugging
3170         support and ask it for the ISymbolWriter.
3171         (Save): If we have a symbol writer, call it's Close() method after
3172         saving the assembly.
3173
3174         * driver.c (--debug): New command line argument to create a
3175         debugger information file.
3176
3177         * location.cs (SymbolDocument): New public property. Returns an
3178         ISymbolDocumentWriter object for the current source file or null
3179         if we don't have a symbol writer.
3180
3181 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
3182
3183         * driver.cs (LoadAssembly): Correctly return when all the paths
3184         have been tried and not before.
3185
3186         * statement.cs (Switch.Emit): return the actual coverage for this
3187         statement (returns/not-returns)
3188
3189         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
3190         switch of the statement if we are the last switch section.  That
3191         kills two problems: try/catch problems (we used to emit an empty
3192         nop at the end) and switch statements where all branches would
3193         return. 
3194
3195 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
3196
3197         * driver.cs: Add default assemblies (the equivalent to the
3198         Microsoft CSC.RSP file)
3199
3200         * cs-tokenizer.cs: When updating `cols and setting it to zero,
3201         also update tokens_seen and set it to false.
3202
3203         * driver.cs: Implement --recurse for Mike.
3204
3205         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
3206         correctly splitting out the paths.
3207
3208 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
3209
3210         * interface.cs (Interface.PopulateProperty): Instead of using
3211         `parent' as the declaration space for the set parameters, use
3212         `this' 
3213
3214         * support.cs (InternalParameters): InternalParameters constructor
3215         takes a DeclSpace instead of a TypeContainer.
3216
3217         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
3218         types are being initialized, load the address of it before calling
3219         the function.  
3220
3221         (New): Provide a mechanism to disable the generation of local
3222         value type temporaries when the caller will be providing us with
3223         an address to store it.
3224
3225         (ArrayCreation.EmitDynamicInitializers): Use it.
3226
3227 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
3228
3229         * expression.cs (Invocation.EmitArguments): Only probe for array
3230         property if there is more than one argument.  Sorry about that.
3231
3232         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
3233         empty param arrays.
3234         
3235         * class.cs (Method.LabelParameters): Fix incorrect code path that
3236         prevented the `ParamArrayAttribute' from being applied to the
3237         params attribute.
3238
3239 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
3240
3241         * support.cs (ReflectionParameters): Correctly compute whether the
3242         last argument is a params array.  Fixes the problem with
3243         string.Split ('a')
3244
3245         * typemanager.cs: Make the assemblies array always be non-null
3246         (empty, but non-null)
3247
3248         * tree.cs (RecordDecl): New function that abstracts the recording
3249         of names.  This reports error 101, and provides a pointer to the
3250         previous declaration.  Fixes a crash in the compiler.
3251
3252         * cs-parser.jay (constructor_declaration): Update to new grammar,
3253         and provide a constructor_body that can be empty.
3254
3255 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
3256
3257         * driver.cs: Add support for --resources.
3258
3259         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
3260         Make all types for the various array helper methods be integer.
3261
3262         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
3263         CheckState to ConvCast.
3264
3265         (ConvCast): Now it takes a `checked' state argument, to avoid
3266         depending on the emit context for the conversion, and just using
3267         the resolve time setting.
3268
3269         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
3270         instead of Invocation.EmitArguments.  We do not emit the original
3271         arguments, instead we emit those which have been converted to
3272         unsigned int expressions.
3273
3274         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
3275
3276         * codegen.cs: ditto.
3277
3278         * expression.cs (LocalVariableReference): Drop the use of the
3279         Store function that depended on the variable index.
3280
3281         * statement.cs (VariableInfo): Drop the `Idx' property from this
3282         class, as this is not taking into account the indexes for
3283         temporaries tat we generate during the execution, getting the
3284         indexes wrong.
3285
3286         * class.cs: First emit class initializers, then call the parent
3287         constructor. 
3288
3289         * expression.cs (Binary): Fix opcode emision.
3290         (UnaryMutator.EmitCode): Support checked code generation
3291
3292         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
3293         matches for events for both the Static and Instance scans,
3294         pointing to the same element.   Fix that.
3295
3296 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
3297
3298         * rootcontext.cs (ResolveTree): Always set the
3299         interface_resolve_order, because nested interfaces will be calling
3300         into us.
3301
3302         * class.cs (GetInterfaceOrClass): Track the same resolution
3303         process used by TypeManager.LookupType.  This fixes the nested
3304         type lookups in class declarations (separate path from
3305         LookupType). 
3306
3307         (TypeContainer.DefineType): Also define nested interfaces.
3308         (TypeContainer.RegisterOrder): New public function used to
3309         register the order in which child interfaces need to be closed.
3310
3311         Nested interfaces need to be closed after their parents have been
3312         created. 
3313         
3314         * interface.cs (InterfaceAttr): Put all the logic for computing
3315         the interface attribute here. 
3316
3317         (DefineInterface): Register our interface order with the
3318         RootContext or with the TypeContainer depending on the case.
3319
3320 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
3321
3322         * cs-parser.jay: rework foreach statement to work with the new
3323         changes to the policy on SimpleNames.
3324         
3325         * report.cs: support Stacktrace on warnings as well.
3326
3327         * makefile: drop --unsafe and /unsafe from the compile.
3328
3329 2002-03-13  Ravi Pratap  <ravi@ximian.com>
3330
3331         * ecore.cs (StandardConversionExists): Modify to take an Expression
3332         as the first parameter. Ensure we do null -> reference type conversion
3333         checking.
3334
3335         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
3336         temporary Expression objects.
3337
3338 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
3339
3340         * interface.cs: workaround bug in method overloading resolution
3341         (there is already a bugzilla bug for it).
3342
3343 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
3344
3345         We could also solve this problem by having a separate path for
3346         performing type lookups, instead of DoResolve, we could have a
3347         ResolveType entry point, and only participating pieces of the
3348         production (simplename, deref, array) would implement this. 
3349         
3350         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
3351         signal SimpleName to only resolve type names and not attempt to
3352         resolve anything else.
3353
3354         * expression.cs (Cast): Set the flag.
3355
3356         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
3357
3358         * class.cs: Only report 108 if there is no `new' modifier.
3359
3360         * cs-parser.jay: rework foreach statement to work with the new
3361         changes to the policy on SimpleNames.
3362         
3363         * report.cs: support Stacktrace on warnings as well.
3364
3365         * makefile: drop --unsafe and /unsafe from the compile.
3366
3367 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
3368
3369         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
3370         lookups here, instead of doing that at parse time.  This means
3371         that our grammar will not introduce `LocalVariableReferences' as
3372         expressions at this point.  That solves the problem of code like
3373         this:
3374
3375         class X {
3376            static void Main ()
3377            { int X = 1;
3378             { X x = null }}}
3379
3380         This is only half the fix.  The full fix requires parameters to
3381         also be handled in this way.
3382
3383         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
3384         makes the use more obvious of the DeclSpace.  The
3385         ec.TypeContainer.TypeBuilder is now only used to pull the
3386         TypeBuilder for it.
3387
3388         My theory is that I can get rid of the TypeBuilder completely from
3389         the EmitContext, and have typecasts where it is used (from
3390         DeclSpace to where it matters).  
3391
3392         The only pending problem is that the code that implements Aliases
3393         is on TypeContainer, and probably should go in DeclSpace.
3394
3395         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
3396         lookups here, instead of doing that at parse time.  This means
3397         that our grammar will not introduce `LocalVariableReferences' as
3398         expressions at this point.  That solves the problem of code like
3399         this:
3400
3401         class X {
3402            static void Main ()
3403            { int X = 1;
3404             { X x = null }}}
3405
3406         This is only half the fix.  The full fix requires parameters to
3407         also be handled in this way.
3408
3409         * class.cs (Property.DefineMethod): When implementing an interface
3410         method, set newslot, when implementing an abstract method, do not
3411         set the flag (before we tried never setting it, or always setting
3412         it, which is the difference).
3413         (Indexer.DefineMethod): same.
3414         (Method.DefineMethod): same.
3415
3416         * ecore.cs: Only set the status used flag if we get back a Field.
3417
3418         * attribute.cs: Temporary hack, so Paolo can keep working.
3419
3420 2002-03-08  Ravi Pratap  <ravi@ximian.com>
3421
3422         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
3423         the unmanaged type in the case we have a MarshalAs attribute.
3424
3425         (Resolve): Handle the case when we are parsing the special MarshalAs
3426         attribute [we need to store the unmanaged type to use later]
3427         
3428         * typemanager.cs (marshal_as_attr_type): Built in type for the 
3429         MarshalAs Attribute.
3430
3431         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
3432         on parameters and accordingly set the marshalling info.
3433         
3434 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
3435
3436         * class.cs: Optimizing slightly by removing redundant code after
3437         we switched to the `NoTypes' return value.
3438         (Property.DefineMethod): use NoTypes here too.
3439
3440         This fixes the bug I introduced in my last batch of changes.
3441
3442 2002-03-05  Ravi Pratap  <ravi@ximian.com>
3443
3444         * tree.cs (RecordEnum): Add. We now keep track of enums too.
3445
3446         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
3447         Enums since those are types too. 
3448
3449         * cs-parser.jay (enum_declaration): Record enums as we parse them.
3450         
3451         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
3452         thanks to a call during the lookup process.
3453
3454 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
3455
3456         * statement.cs (Foreach): Lots of work to accomodate a particular
3457         kind of foreach statement that I had not kept in mind.  It is
3458         possible to have foreachs on classes that provide a GetEnumerator
3459         method that return objects that implement the "pattern" for using
3460         a foreach, there is no need to support GetEnumerator
3461         specifically. 
3462
3463         This is needed to compile nant.
3464
3465         * decl.cs: Only report 114 if the member is not `Finalize' and if
3466         the warning level is at least 2.
3467
3468         * class.cs: Moved the compare function from Method to
3469         MethodSignature. 
3470
3471         (MethodSignature.InheritableMemberSignatureCompare): Add new
3472         filter function that is used to extract inheritable methods from a
3473         class. 
3474
3475         (Method.Define): Use the new `inheritable_method_signature_filter'
3476         delegate
3477
3478         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
3479         command. 
3480
3481 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
3482
3483         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
3484
3485         * cs-parser.jay: Add opt_semicolon to the interface declaration.
3486
3487         * expression.cs: Pass location information to
3488         ConvertImplicitStandard. 
3489
3490         * class.cs: Added debugging code to track return values from
3491         interfaces. 
3492
3493 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
3494
3495         * expression.cs (Is.DoResolve): If either side of the `is' is an
3496         interface, do not flag the warning.
3497
3498         * ecore.cs (ImplicitReferenceConversion): We need a separate test
3499         for interfaces
3500
3501         * report.cs: Allow for --fatal to be used with --probe.
3502         
3503         * typemanager.cs (NoTypes): Move the definition for the empty Type
3504         array here. 
3505
3506         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
3507         properties. 
3508         (TypeContainer.DefineProxy): New function used to proxy to parent
3509         implementations when implementing interfaces.
3510         (TypeContainer.ParentImplements): used to lookup if our parent
3511         implements a public function that is required by an interface.
3512         (TypeContainer.VerifyPendingMethods): Hook this up.
3513
3514         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
3515         `modules' and `assemblies' arraylists into arrays.  We only grow
3516         these are the very early start up of the program, so this improves
3517         the speedof LookupType (nicely measured).
3518
3519         * expression.cs (MakeByteBlob): Replaced unsafe code with
3520         BitConverter, as suggested by Paolo.
3521
3522         * cfold.cs (ConstantFold.Binary): Special case: perform constant
3523         folding of string concatenation, but if either side is a string,
3524         and the other is not, then return null, and let the runtime use
3525         the concatenation on the string plus the object (using
3526         `Object.ToString'). 
3527
3528 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
3529
3530         Constant Folding has been implemented now.
3531         
3532         * expression.cs (Unary.Reduce): Do not throw an exception, catch
3533         the error instead on types that are not supported in one's
3534         complement. 
3535
3536         * constant.cs (Constant and all children): New set of functions to
3537         perform implict and explicit conversions.
3538         
3539         * ecore.cs (EnumConstant): Implement the new functions to perform
3540         conversion by proxying to the child expression.
3541
3542         * codegen.cs: (ConstantCheckState): Constant evaluation has its
3543         own separate setting that can not be turned off from the command
3544         line using --unchecked or --checked and is only controlled using
3545         the checked/unchecked statements and expressions.  This setting is
3546         used by the constant folder to flag errors.
3547
3548         * expression.cs (CheckedExpr, UncheckedExpr): Set the
3549         ConstantCheckState as well.   
3550
3551         During Resolve, they also have to flag the state, because the
3552         constant folder runs completely in the Resolve phase.
3553
3554         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
3555         well.
3556
3557 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
3558
3559         * cfold.cs: New file, this file contains the constant folder.
3560         
3561         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
3562         argument to track whether we are using the resulting address to
3563         load or store a value and provide better error messages. 
3564
3565         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
3566         new AddressOf arguments.
3567
3568         * statement.cs (Foreach.EmitCollectionForeach): Update
3569
3570         * expression.cs (Argument.Emit): Call AddressOf with proper
3571         arguments to track usage.
3572
3573         (New.DoEmit): Call AddressOf with new arguments.
3574
3575         (Unary.Emit): Adjust AddressOf call.
3576
3577 2002-03-01  Ravi Pratap  <ravi@ximian.com>
3578
3579         * cs-parser.jay (member_access): Change the case for pre-defined types
3580         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
3581         this suggestion.
3582
3583         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
3584         a method body.
3585
3586         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
3587         essentially like methods and apply attributes like MethodImplOptions to them too.
3588
3589         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
3590         not being null.
3591
3592         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
3593         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
3594         is the DeclSpace.
3595
3596         * Update code everywhere accordingly.
3597
3598         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
3599
3600         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
3601
3602 2002-02-28  Ravi Pratap  <ravi@ximian.com>
3603
3604         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
3605         try performing lookups against those instead of jumping straight into using
3606         the 'using' clauses.
3607
3608         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
3609
3610         (LookupType): Perform lookups in implicit parents too.
3611
3612         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
3613         sequence as RootContext.LookupType. 
3614
3615         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
3616         the various cases of namespace lookups into this method.
3617
3618 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
3619
3620         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
3621         in positional arguments)
3622
3623         * class.cs (Operator): Update the AllowedModifiers to contain
3624         extern. 
3625
3626         * cs-parser.jay: Update operator declaration to allow for the
3627         operator body to be empty.
3628
3629         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
3630         values. 
3631
3632 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
3633
3634         * class.cs (Method.Emit): Label parameters.
3635
3636         * driver.cs: Return 1 or 0 as the program exit code.
3637
3638 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
3639
3640         * expression.cs: Special case the `null' object when trying to
3641         auto-compute the type, as anything can be explicitly converted to
3642         that. 
3643
3644         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
3645         spotting this Paolo.
3646
3647         (Expression.ImplicitNumericConversion): Perform comparissions of
3648         the type using the underlying type in the case of an enumeration
3649         rather than using the enumeration type for the compare.
3650
3651         Cope with the underlying == type case, which is not possible to
3652         catch before. 
3653
3654         (Expression.ConvertNumericExplicit): Perform comparissions of
3655         the type using the underlying type in the case of an enumeration
3656         rather than using the enumeration type for the compare.
3657
3658         * driver.cs: If the user does not supply an extension, assume .exe
3659
3660         * cs-parser.jay (if_statement): Rewrote so that we can track the
3661         location for the if statement.
3662
3663         * expression.cs (Binary.ConstantFold): Only concat strings when
3664         the operation is "+", not everything ;-)
3665
3666         * statement.cs (Statement.EmitBoolExpression): Take a location
3667         argument. 
3668         (If, While, Do): Track location.
3669
3670         * expression.cs (Binary.ResolveOperator): In the object + string
3671         case, I was missing a call to ConvertImplicit
3672
3673 2002-02-25  Ravi Pratap  <ravi@ximian.com>
3674
3675         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
3676         Location arguments. Ensure we use RootContext.LookupType to do our work
3677         and not try to do a direct Type.GetType and ModuleBuilder.GetType
3678
3679         * interface.cs (PopulateMethod): Handle the type of the parameter being
3680         null gracefully.
3681
3682         * expression.cs (Invocation.BetterFunction): Handle the case when we 
3683         have a params method with no fixed arguments and a call is made with no
3684         arguments.
3685
3686 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
3687
3688         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
3689         the verbatim-string-literal
3690
3691         * support.cs (InternalParameters.ParameterModifier): handle null
3692         fixed parameters.
3693         (InternalParameters.ParameterType): ditto.
3694
3695         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
3696         duplicating the name of the variable parameter.
3697         (GetParameterByName): Fix bug where we were not looking up array
3698         paramters if they were the only present (thanks Paolo!).
3699         (GetParameterInfo): We only have an empty set of types if both
3700         fixed and array are set to null.
3701         (GetParameterInfo-idx): Handle FixedParameter == null
3702
3703         * cs-parser.jay: Handle the case where there is no catch
3704         statements (missing null test).
3705
3706 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
3707
3708         * driver.cs (MainDriver): Be conservative on our command line
3709         handling.
3710
3711         Catch DirectoryNotFoundException when calling GetFiles.
3712         
3713         (SplitPathAndPattern): Used to split the input specification into
3714         a path and a pattern that we can feed to Directory.GetFiles.
3715
3716 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
3717
3718         * statement.cs (Fixed): Implement the last case of the Fixed
3719         statement (string handling).
3720
3721         * expression.cs (StringPtr): New class used to return a char * to
3722         a string;  Used by the Fixed statement.
3723
3724         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
3725
3726         * expression.cs (Binary.ResolveOperator): Remove redundant
3727         MemberLookup pn parent type.
3728         Optimize union call, we do not need a union if the types are the same.
3729         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
3730         type.
3731
3732         Specialize the use of MemberLookup everywhere, instead of using
3733         the default settings. 
3734
3735         (StackAlloc): Implement stackalloc keyword.
3736
3737         * cs-parser.jay: Add rule to parse stackalloc.
3738         
3739         * driver.cs: Handle /h, /help, /?
3740
3741         * expression.cs (MakeByteBlob): Removed the hacks we had in place
3742         before we supported unsafe code.
3743         
3744         * makefile: add --unsafe to the self compilation of mcs.
3745
3746 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
3747
3748         * expression.cs (PointerArithmetic): New class that is used to
3749         perform pointer arithmetic.
3750         (Binary.Resolve): Handle pointer arithmetic
3751         Handle pointer comparission.
3752         (ArrayPtr): Utility expression class that is used to take the
3753         address of an array.
3754
3755         (ElementAccess): Implement array access for pointers
3756         
3757         * statement.cs (Fixed): Implement fixed statement for arrays, we
3758         are missing one more case before we are done.
3759
3760         * expression.cs (Indirection): Implement EmitAssign and set the
3761         ExprClass to Variable.  This allows pointer dereferences to be
3762         treated as variables, and to have values assigned to them.
3763         
3764         * ecore.cs (Expression.StoreFromPtr): New utility function to
3765         store values dereferencing.
3766
3767 2002-02-20  Ravi Pratap  <ravi@ximian.com>
3768
3769         * expression.cs (Binary.ResolveOperator): Ensure that we are
3770         not trying to operate on a void type - this fixes the reported
3771         bug.
3772
3773         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
3774         the parent implementation is sealed.
3775
3776         * ../errors/cs0239.cs : Add.
3777
3778         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
3779
3780         * typemanager.cs (unverifiable_code_type): Corresponds to 
3781         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
3782         which have unsafe code in them.
3783
3784         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
3785         unsafe context.
3786
3787 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
3788
3789         * cs-tokenizer.cs: Add support for @"litreal strings"
3790
3791         Make tokenizer accept pre-processor directives
3792         on any column (remove the old C-like limitation). 
3793
3794         * rootcontext.cs (EmitCode): Emit any global attributes.
3795         (AddGlobalAttributes): Used to keep track of assembly attributes. 
3796
3797         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
3798
3799         * cs-parser.jay: Add support for global attributes.  
3800
3801 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
3802
3803         * expression.cs (Indirection): New helper class.  Unary will
3804         create Indirection classes to be able to implement the
3805         IMemoryLocation interface on it.
3806
3807 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
3808
3809         * cs-parser.jay (fixed_statement): reference the right statement.
3810
3811         * statement.cs (Fixed.Emit): Finish implementing the fixed
3812         statement for the &x case.
3813
3814 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
3815
3816         * class.cs (Property.Define, Method.Define): Remove newslot when
3817         `implementing'.  
3818
3819         * modifiers.cs: My use of NewSlot when `Abstract' was set was
3820         wrong.  NewSlot should only be used if the `new' keyword is present.
3821
3822         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
3823         locating our system dir.  Sorry about this.
3824
3825 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
3826
3827         * driver.cs (GetSystemDir): Compute correctly the location of our
3828         system assemblies.  I was using the compiler directory instead of
3829         the library directory.
3830
3831 2002-02-13  Ravi Pratap  <ravi@ximian.com>
3832
3833         * expression.cs (BetterFunction): Put back in what Miguel commented out
3834         since it is the correct fix. The problem is elsewhere ;-)
3835
3836         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
3837         parameters of the parms method are themselves compatible or not !
3838
3839         (StandardConversionExists): Fix very dangerous bug where we were forgetting
3840         to check that a class implements an interface before saying that an implicit
3841         conversion was allowed. Use ImplementsInterface to do the checking.
3842
3843 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
3844
3845         * class.cs (Method.Define): Track whether we are an explicit
3846         implementation or not.  And only call DefineMethodOverride if we
3847         are an explicit implementation.
3848
3849         (Property.DefineMethod): Ditto.
3850
3851 2002-02-11  Ravi Pratap  <ravi@ximian.com>
3852
3853         * expression.cs (BetterFunction): Catch hideous bug which was
3854          preventing us from detecting ambiguous calls due to implicit casts i.e
3855         cs0121.
3856
3857 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
3858
3859         * support.cs (Pair): Remove un-needed method.  I figured why I was
3860         getting the error in cs-parser.jay, the variable in a foreach loop
3861         is readonly, and the compiler does not really treat this as a variable.
3862
3863         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
3864         instead of EQUALS in grammar.  
3865
3866         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
3867
3868         * expression.cs (Unary.DoResolve): Check whether the argument is
3869         managed or not.
3870
3871 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
3872
3873         * support.cs: Api for Pair to set a value.  Despite the fact that
3874         the variables are public the MS C# compiler refuses to compile
3875         code that accesses the field if the variable is part of a foreach
3876         statement. 
3877
3878         * statement.cs (Fixed): Begin implementation of the fixed
3879         statement.
3880
3881         (Block.AddVariable): Return the VariableInfo on success and null
3882         on failure instead of true/false. 
3883
3884         * cs-parser.jay (foreach): Catch errors on variables already
3885         defined (we were ignoring this value before) and properly unwind
3886         the block hierarchy
3887
3888         (fixed_statement): grammar for the fixed statement.
3889
3890 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
3891
3892         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
3893         pointer types to be incretemented.
3894
3895         (SizeOf): Implement.
3896
3897         * cs-parser.jay (pointer_member_access): Implement
3898         expr->IDENTIFIER production.
3899
3900         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
3901         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
3902         on safe contexts.
3903
3904         (Unary): Implement indirection.
3905
3906         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
3907         use in non-unsafe context).
3908
3909         (SimpleName.DoResolve): Check for pointers in field access on safe
3910         contexts. 
3911
3912         (Expression.LoadFromPtr): Factor the load-indirect code in this
3913         function.  This was duplicated in UnboxCast and ParameterReference
3914
3915 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
3916
3917         * expression.cs (ComposedCast): report an error if a pointer cast
3918         is used in a safe region.
3919
3920         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
3921         pointer type casts in unsafe context.
3922
3923         * codegen.cs (EmitContext): Set up IsUnsafe.
3924
3925         * cs-parser.jay (non_expression_type): Add productions for pointer
3926         casts. 
3927
3928         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
3929         code.  We should not use force into static mode if the method is
3930         not virtual.  Fixes bug in MIS
3931
3932         * statement.cs (Do.Emit, While.Emit, For.Emit,
3933         Statement.EmitBoolExpression): Add support to Do and While to
3934         propagate infinite loop as `I do return' semantics.
3935
3936         Improve the For case to also test for boolean constants.
3937
3938         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
3939         to the list of attributes we can add.
3940
3941         Remove `EmitContext' argument.
3942
3943         * class.cs (Method.Define): Apply parameter attributes.
3944         (Constructor.Define): Apply parameter attributes.
3945         (MethodCore.LabelParameters): Move here the core of labeling
3946         parameters. 
3947
3948         * support.cs (ReflectionParameters.ParameterModifier,
3949         InternalParameters.ParameterModifier): Use IsByRef on the type and
3950         only return the OUT bit for these parameters instead of in/out/ref
3951         flags.
3952
3953         This is because I miss-understood things.  The ParameterInfo.IsIn
3954         and IsOut represent whether the parameter has the [In] and [Out]
3955         attributes set.  
3956
3957 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
3958
3959         * ecore.cs (FieldExpr.Emit): Release temporaries.
3960
3961         * assign.cs (LocalTemporary.Release): new function.
3962
3963         * codegen.cs (EmitContext.GetTemporaryStorage,
3964         EmitContext.FreeTemporaryStorage): Rework the way we deal with
3965         temporary storage.  Now we can "put back" localbuilders when we
3966         are done with them
3967
3968 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
3969
3970         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
3971         need to make a copy of the variable to generate verifiable code.
3972
3973 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
3974
3975         * driver.cs: Compute dynamically the system directory.
3976
3977         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
3978         Slower, but more generally useful.  Used by the abstract
3979         registering implementation. 
3980
3981         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
3982         the rules for the special rule on Type/instances.  First check if
3983         we have the same name, and if so, try that special static path
3984         rather than the instance path.
3985         
3986 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
3987
3988         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
3989         for, while and if.
3990
3991         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
3992         Enum, ValueType, Delegate or Array for non-corlib compiles.
3993
3994         * cs-tokenizer.cs: Catch long identifiers (645)
3995
3996         * typemanager.cs (IndexerPropetyName): Ravi never tested this
3997         piece of code.
3998
3999         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
4000         fix, we were returning too early, so we were not registering
4001         pending methods from abstract classes.
4002
4003         Do not register pending methods if the class is abstract.
4004
4005         * expression.cs (Conditional.DoResolve): Report circular implicit
4006         conversions when we neecd to compute it for conditional
4007         expressions. 
4008
4009         (Is.DoResolve): If the expression is always of the provided type,
4010         flag warning 183.  If the expression can not ever be of the
4011         provided type flag warning 184.
4012
4013         * class.cs: Catch 169 as well.
4014
4015         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
4016         read. 
4017
4018 2002-01-18  Nick Drochak  <ndrochak@gol.com>
4019
4020         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
4021
4022 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
4023
4024         * interface.cs: (PopulateMethod): Check for pointers being defined
4025         only if the unsafe context is active.
4026         (PopulateProperty): ditto.
4027         (PopulateIndexer): ditto.
4028
4029         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
4030         specified.  If pointers are present, make sure that they are
4031         present in an unsafe context.
4032         (Constructor, Constructor.Define): ditto.
4033         (Field, Field.Define): ditto.
4034         (Property, Property.Define): ditto.
4035         (Event, Event.Define): ditto.
4036
4037         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
4038         hashtable if there are classes or structs defined.
4039
4040         * expression.cs (LocalVariableReference.DoResolve): Simplify this
4041         code, as the constant resolution moved.
4042
4043         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
4044         the metadata, so we can flag error 133. 
4045
4046         * decl.cs (MemberCore.UnsafeOK): New function to test that a
4047         pointer is being declared in an unsafe context.
4048
4049 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
4050
4051         * modifiers.cs (Modifiers.Check): Require a Location argument.
4052         Report error 227 for Unsafe use.
4053
4054         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
4055
4056         * statement.cs (For.Emit): If the test is null, then report that
4057         we do `return', as we wont reach anything afterwards.
4058
4059         (Switch.SwitchGoverningType): Track the expression that matched
4060         the conversion.
4061
4062         * driver.cs: Allow negative numbers as an error code to flag.
4063
4064         * cs-parser.jay: Handle 1551.
4065
4066         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
4067
4068 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
4069
4070         * cs-parser.jay: Report 1518 (type declaration can only contain
4071         class, struct, interface, enum or delegate)
4072
4073         (switch_label): Report 1523 (keywords `case' or `default' must
4074         preced code)
4075
4076         (opt_switch_sections): Report 1522 (empty switch)
4077
4078         * driver.cs: Report 1515 (response file specified multiple times)
4079         Report 1516 (Source file specified multiple times).
4080
4081         * expression.cs (Argument.Resolve): Signal 1510
4082
4083         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
4084         access not allowed in static code)
4085
4086 2002-01-11  Ravi Pratap  <ravi@ximian.com>
4087
4088         * typemanager.cs (IsPointerType): Utility method which we are going
4089         to need a lot.
4090
4091         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
4092         the object type, so we take care of that.
4093
4094         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
4095         
4096         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
4097         added to non-params parameters :-)
4098
4099         * typemanager.cs (CSharpName): Include 'void' type too. 
4100
4101         (void_ptr_type): Include in the set of core types.
4102
4103         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
4104         duplicating code.
4105
4106         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
4107         an unsafe context.
4108
4109         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
4110         completely forgotten about it.
4111
4112 2002-01-10  Ravi Pratap  <ravi@ximian.com>
4113
4114         * cs-parser.jay (pointer_type): Add. This begins our implementation
4115         of parsing rules for unsafe code.
4116
4117         (unsafe_statement): Implement.
4118
4119         (embedded_statement): Modify to include the above.
4120
4121         * statement.cs (Unsafe): Implement new class for unsafe blocks.
4122
4123         * codegen.cs (EmitContext.InUnsafe): Add. This determines
4124         if the current context is an unsafe one.
4125
4126         * cs-parser.jay (local_variable_pointer_type): Since local variable types
4127         are handled differently, we need separate rules for them.
4128
4129         (local_variable_declaration): Update to use local_variable_pointer_type
4130         to allow variable declarations of unmanaged pointer types.
4131
4132         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
4133         in unsafe contexts.
4134
4135         * ../errors/cs0214.cs : Add.
4136
4137 2002-01-16  Nick Drochak  <ndrochak@gol.com>
4138
4139         * makefile: remove 'response' file when cleaning.
4140
4141 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
4142
4143         * cs-parser.jay: Report 1524.
4144
4145 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
4146
4147         * typemanager.cs (RegisterMethod): drop checking if we have
4148         registered this from here
4149
4150 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
4151
4152         * class.cs (Method.EmitDestructor): Implement calling our base
4153         destructor. 
4154
4155         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
4156         value of InFinally.
4157
4158         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
4159         this routine and will wrap the call in a try/catch block.  Deal
4160         with the case.
4161
4162 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
4163
4164         * ecore.cs (Expression.MemberLookup): instead of taking a
4165         parameter `same_type' that was used to tell whether we could
4166         access private members we compute our containing type from the
4167         EmitContext.
4168
4169         (FieldExpr): Added partial support for volatile fields.  This does
4170         not work for volatile fields exposed from assemblies, as I can not
4171         figure out how to extract the modreq from it.
4172
4173         Updated all the source files to use this.
4174
4175         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
4176         because it is referenced by MemberLookup very often. 
4177
4178 2002-01-09  Ravi Pratap  <ravi@ximian.com>
4179
4180         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
4181         TypeBuilder.GetCustomAttributes to retrieve what we need.
4182
4183         Get rid of redundant default_member_attr_type as this is the same as
4184         default_member_type which already exists.
4185
4186         * interface.cs, attribute.cs : Update accordingly.
4187         
4188 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
4189
4190         * typemanager.cs: Enable IndexerPropertyName again.  It does not
4191         work for TYpeBuilders though.  Ravi, can you please fix this?
4192
4193         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
4194
4195         * expression.cs (Argument.Emit): Handle the case of ref objects
4196         being passed to ref functions;  
4197
4198         (ParameterReference.EmitLoad): Loads the content of the pointer
4199         without dereferencing.
4200
4201 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
4202
4203         * cs-tokenizer.cs: Implemented the pre-processing expressions.
4204
4205 2002-01-08  Ravi Pratap  <ravi@ximian.com>
4206
4207         * class.cs (Indexer.DefineMethod): Incorporate the interface
4208         type in the name of the method if we are doing explicit interface
4209         implementation.
4210
4211         * expression.cs (ConversionExists): Remove as it is completely obsolete.
4212
4213         (BetterConversion): Fix extremely trivial bug where we were referring to
4214         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
4215         again !
4216
4217         * ../errors/bug16.cs : Add although we have fixed it.
4218
4219 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
4220
4221         * expression.cs (BaseIndexer): Begin implementation.
4222
4223         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
4224
4225         * cs-parser.jay (indexer_declarator): Use qualified_identifier
4226         production directly to remove a shift/reduce, and implement
4227         explicit interface implementation.
4228
4229         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
4230         after a floating point suffix.
4231
4232         * expression.cs (DoNumericPromotions): Improved the conversion for
4233         uint/uint.  If we have a constant, we avoid doing a typecast to a
4234         larger type.
4235
4236         * class.cs (Indexer): Implement explicit interface implementation
4237         for indexers.
4238         
4239 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
4240
4241         * class.cs: make the default instance constructor public and hidebysig.
4242
4243 2001-01-03  Ravi Pratap  <ravi@ximian.com>
4244
4245         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
4246         so we can call it from elsewhere.
4247
4248         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
4249         we emit it internally if the class has a defined indexer; otherwise the user
4250         emits it by decorating the class definition with the DefaultMemberAttribute.
4251
4252         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
4253         attribute is not used on a type which defines an indexer.
4254
4255         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
4256         character when we skip whitespace.
4257
4258         * ../errors/cs0646.cs : Add.
4259
4260 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
4261
4262         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
4263         again. 
4264
4265         * makefile: Add practical target `mcs3.exe' which builds the third
4266         generation compiler. 
4267
4268         * expression.cs (New): Fix structures constructor calling.
4269
4270         * class.cs (Property, Method, Indexer): Emit Final flag on the
4271         method if we are an interface implementation and we are not
4272         abstract. 
4273
4274         * ecore.cs (PropertyExpr): New public field `IsBase', tells
4275         whether this property is referencing a `base' method.
4276
4277         * expression.cs (Invocation.EmitCall): take an extra argument:
4278         is_base, this is used to determine whether the `call' or
4279         `callvirt' opcode should be used.
4280
4281         
4282         * delegate.cs: update EmitCall.
4283
4284         * class.cs (Method.Define): Set NewSlot for the cases where we are
4285         not implementing an interface method.
4286
4287         (Property.Define): ditto.
4288
4289 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
4290
4291         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
4292         'r'.  Allows mcs to parse itself fully.
4293
4294 2002-01-02  Ravi Pratap  <ravi@ximian.com>
4295
4296         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
4297         of the number of initializers that require the InitializeArray method.
4298
4299         (CheckIndices): Store the Expression in all cases - not the plain value. Also
4300         update the above field where necessary.
4301
4302         (MakeByteBlob): Update accordingly.
4303
4304         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
4305         greater than 2.
4306
4307         (EmitDynamicInitializers): Update in accordance with the new optimization.
4308
4309         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
4310         same OpCode applies.
4311
4312         * cs-parser.jay : Fix some glaring errors I introduced.
4313
4314 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
4315
4316         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
4317         so that we can check for name clashes there too.
4318
4319         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
4320         for interface indexers.
4321
4322         * interfaces.cs (Define): Emit the default member attribute.
4323
4324         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
4325         variable was being referred to while setting the value ;-)
4326
4327 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
4328
4329         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
4330         byte-by-byte information when we know the data is zero.
4331
4332         Make the block always a multiple of 4, because
4333         DefineInitializedData has a bug.
4334
4335         * assign.cs: Fix, we should assign from the temporary, not from
4336         the source. 
4337
4338         * expression.cs (MakeByteBlob): Fix my incorrect code.
4339
4340 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
4341
4342         * typemanager.cs (EnumToUnderlying): This function is used to get
4343         the underlying type from an enumeration, because it does not
4344         always work. 
4345
4346         * constant.cs: Use the I4_S form for values between -128 and 127.
4347
4348         * statement.cs (Block.LookupLabel): Looks up a label.
4349         (Block): Drop support for labeled blocks.
4350
4351         (LabeledStatement): New kind of statement that represents a label
4352         only.
4353
4354         (Goto): Finally implement this bad boy.
4355         
4356         * cs-parser.jay: Update to reflect new mechanism to implement
4357         labels.
4358
4359 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
4360
4361         * codegen.cs (EmitContext.This): a codegen property that keeps the
4362         a single instance of this instead of creating many different this
4363         instances. 
4364
4365         * delegate.cs (Delegate.DoResolve): Update to use the property;
4366
4367         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
4368
4369         * expression.cs (BaseAccess.DoResolve): Ditto.
4370
4371 2001-12-29  Ravi Pratap  <ravi@ximian.com>
4372
4373         * typemanager.cs (methodimpl_attr_type): Add to hold the type
4374         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
4375
4376         (InitCoreTypes): Update accordingly.
4377
4378         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
4379         so we can quickly store the state.
4380
4381         (ApplyAttributes): Set the correct implementation flags
4382         for InternalCall methods.
4383
4384 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
4385
4386         * expression.cs (EmitCall): if a method is not virtual, then do
4387         not use callvirt on it.
4388
4389         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
4390         user defined stuff) requires the use of stobj, which takes an
4391         address on the stack instead of an array and an index.  So emit
4392         the Ldelema operation for it.
4393
4394         (EmitStoreOpcode): Use stobj for valuetypes.
4395
4396         (UnaryMutator.EmitCode): Use the right 1 value depending on
4397         whether we are dealing with int64/uint64, float or doubles.
4398
4399         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
4400         constructors that I implemented last night.
4401
4402         (Constructor.IsDefault): Fix to work properly for static
4403         constructors.
4404
4405         * cs-parser.jay (CheckDef): report method signature errors.
4406         Update error number 103 to be 132.
4407
4408         * decl.cs: New AdditionResult enumeration value: MethodExists.
4409         Although we do this check for methods later on in the semantic
4410         analysis, catching repeated default constructors is so easy that
4411         we catch these here. 
4412         
4413         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
4414         promotions code.
4415
4416         (ParameterReference.EmitAssign, Emit): handle
4417         bools as bytes.
4418
4419         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
4420         (ArrayAccess.EmitStoreOpcode): ditto.
4421
4422         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
4423
4424         * expression.cs (MakeByteBlob): Complete all the missing types
4425         (uint, short, ushort, byte, sbyte)
4426
4427         * class.cs: Only init instance field initializers on instance
4428         constructors. 
4429
4430         Rename `constructors' to instance_constructors. 
4431
4432         (TypeContainer.AddConstructor): Only add constructors to the list
4433         if it is not static.
4434
4435         Make sure that we handle default_static_constructor independently
4436         everywhere where we handle instance_constructors
4437
4438 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
4439
4440         * class.cs: Do not lookup or create a base initializer for a
4441         static constructor.
4442
4443         (ConstructorInitializer.Resolve): use the proper type to lookup
4444         for constructors.
4445
4446         * cs-parser.jay: Report error 1585 (modifiers between type and name).
4447
4448         * enum.cs, interface.cs: Remove CloseType, this is taken care by
4449         in DeclSpace. 
4450
4451         * decl.cs: CloseType is now an virtual method, the default
4452         implementation just closes this type.
4453         
4454 2001-12-28  Ravi Pratap  <ravi@ximian.com>
4455
4456         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
4457         to PreserveSig by default. Also emit HideBySig on such methods.
4458
4459         Basically, set the defaults to standard values.
4460
4461         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
4462         argument, if candidate is better, it can't be worse than the best !
4463
4464         (Invocation): Re-write bits to differentiate between methods being
4465         applicable in their expanded form and their normal form - for params
4466         methods of course.
4467
4468         Get rid of use_standard everywhere as only standard conversions are allowed
4469         in overload resolution. 
4470
4471         More spec conformance.
4472         
4473 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
4474
4475         * driver.cs: Add --timestamp, to see where the compiler spends
4476         most of its time.
4477
4478         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
4479         `this' in static code.
4480
4481         (SimpleName.DoResolve): Implement in terms of a helper function
4482         that allows static-references to be passed upstream to
4483         MemberAccess.
4484
4485         (Expression.ResolveWithSimpleName): Resolve specially simple
4486         names when called by MemberAccess to implement the special
4487         semantics. 
4488
4489         (Expression.ImplicitReferenceConversion): Handle conversions from
4490         Null to reference types before others, as Null's type is
4491         System.Object. 
4492
4493         * expression.cs (Invocation.EmitCall): Handle the special case of
4494         calling methods declared on a reference type from a ValueType
4495         (Base classes System.Object and System.Enum)
4496
4497         (MemberAccess.Resolve): Only perform lookups on Enumerations if
4498         the left hand side is a TypeExpr, not on every enumeration. 
4499
4500         (Binary.Resolve): If types are reference types, then do a cast to
4501         object on operators != and == of both arguments.
4502         
4503         * typemanager.cs (FindMembers): Extract instance and static
4504         members if requested.
4505
4506         * interface.cs (PopulateProperty): Use void_type instead of null
4507         as the return type for the setter method.
4508
4509         (PopulateIndexer): ditto.
4510
4511 2001-12-27  Ravi Pratap  <ravi@ximian.com>
4512
4513         * support.cs (ReflectionParameters): Fix minor bug where we
4514         were examining the wrong parameter for the ParamArray attribute.
4515
4516         Cope with requests for the type of the parameter at position
4517         greater than the params parameter's. We now return the element
4518         type of the params array as that makes more sense.
4519
4520         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
4521         accordingly as we no longer have to extract the element type
4522         ourselves.
4523
4524         (Invocation.OverloadResolve): Update.
4525
4526 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
4527
4528         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
4529         against IEnumerator, test whether the return value is a descendant
4530         of the IEnumerator interface.
4531
4532         * class.cs (Indexer.Define): Use an auxiliary method to implement
4533         the other bits of the method definition.  Begin support for
4534         explicit interface implementation.
4535
4536         (Property.DefineMethod): Use TypeManager.void_type instead of null
4537         for an empty return value.
4538
4539 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
4540
4541         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
4542         dealing with a FieldExpr which is composed of a FieldBuilder, in
4543         the code path we did extract the constant, but we should have
4544         obtained the underlying value to be able to cast it (otherwise we
4545         end up in an infinite loop, this is what Ravi was running into).
4546
4547         (ArrayCreation.UpdateIndices): Arrays might be empty.
4548
4549         (MemberAccess.ResolveMemberAccess): Add support for section
4550         14.5.4.1 that deals with the special case of E.I when E is a type
4551         and something else, that I can be a reference to a static member.
4552
4553         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
4554         handle a particular array type to create byte blobs, it is just
4555         something we dont generate byteblobs for.
4556
4557         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
4558         arguments. 
4559
4560         * location.cs (Push): remove the key from the hashtable that we
4561         are about to add.   This happens for empty files.
4562
4563         * driver.cs: Dispose files after we have parsed them.
4564
4565         (tokenize): new function that only runs the tokenizer on its
4566         input, for speed testing.
4567
4568 2001-12-26  Ravi Pratap  <ravi@ximian.com>
4569
4570         * class.cs (Event.Define): Define the private field only if there
4571         are no accessors defined.
4572
4573         * expression.cs (ResolveMemberAccess): If there is no associated
4574         field with the event, that means we have an event defined with its
4575         own accessors and we should flag error cs0070 since transforming
4576         ourselves into a field is not valid in that case.
4577
4578         * ecore.cs (SimpleName.DoResolve): Same as above.
4579
4580         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
4581         and charset to sane values.
4582
4583 2001-12-25  Ravi Pratap  <ravi@ximian.com>
4584
4585         * assign.cs (DoResolve): Perform check on events only if they 
4586         are being accessed outside the declaring type.
4587
4588         * cs-parser.jay (event_declarations): Update rules to correctly
4589         set the type of the implicit parameter etc.
4590
4591         (add_accessor, remove_accessor): Set current local parameters.
4592
4593         * expression.cs (Binary): For delegate addition and subtraction,
4594         cast the return value from the method into the appropriate delegate
4595         type.
4596
4597 2001-12-24  Ravi Pratap  <ravi@ximian.com>
4598
4599         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
4600         of these as the workaround is unnecessary.
4601
4602         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
4603         delegate data - none of that is needed at all.
4604
4605         Re-write bits to extract the instance expression and the delegate method
4606         correctly.
4607
4608         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
4609         on delegates too.
4610
4611         * attribute.cs (ApplyAttributes): New method to take care of common tasks
4612         of attaching attributes instead of duplicating code everywhere.
4613
4614         * everywhere : Update code to do attribute emission using the above method.
4615
4616 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
4617
4618         * expression.cs (IsParamsMethodApplicable): if there are not
4619         parameters, return immediately.
4620
4621         * ecore.cs: The 0 literal can be implicity converted to an enum
4622         type. 
4623
4624         (SimpleName.DoResolve): First lookup the type, then lookup the
4625         members. 
4626
4627         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
4628         want to get its address.  If the InstanceExpression is not
4629         addressable, store the result in a temporary variable, then get
4630         the address of it.
4631
4632         * codegen.cs: Only display 219 errors on warning level or above. 
4633
4634         * expression.cs (ArrayAccess): Make it implement the
4635         IMemoryLocation interface.
4636
4637         (Binary.DoResolve): handle the operator == (object a, object b)
4638         and operator != (object a, object b) without incurring into a
4639         BoxedCast (because 5 != o should never be performed).
4640
4641         Handle binary enumerator operators.
4642
4643         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
4644         value type, otherwise use Ldelem_ref.
4645
4646         Use precomputed names;
4647
4648         (AddressOf): Implement address of
4649
4650         * cs-parser.jay (labeled_statement): Fix recursive block
4651         addition by reworking the production.
4652
4653         * expression.cs (New.DoEmit): New has a special case:
4654                 
4655                  If we are dealing with a ValueType, we have a few
4656                  situations to deal with:
4657                 
4658                     * The target of New is a ValueType variable, that is
4659                       easy, we just pass this as the variable reference
4660                 
4661                     * The target of New is being passed as an argument,
4662                       to a boxing operation or a function that takes a
4663                       ValueType.
4664                 
4665                       In this case, we need to create a temporary variable
4666                       that is the argument of New.
4667
4668
4669 2001-12-23  Ravi Pratap  <ravi@ximian.com>
4670
4671         * rootcontext.cs (LookupType): Check that current_type is not null before
4672         going about looking at nested types.
4673
4674         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
4675         not implement the IAssignMethod interface any more.
4676
4677         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
4678         where we tranform them into FieldExprs if they are being resolved from within
4679         the declaring type.
4680
4681         * ecore.cs (SimpleName.DoResolve): Do the same here.
4682
4683         * assign.cs (DoResolve, Emit): Clean up code considerably. 
4684
4685         * ../errors/bug10.cs : Add.
4686
4687         * ../errors/cs0070.cs : Add.
4688
4689         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
4690
4691         * assign.cs : Get rid of EventIsLocal everywhere.
4692         
4693 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
4694
4695         * ecore.cs (ConvertIntLiteral): finished the implementation.
4696
4697         * statement.cs (SwitchLabel): Convert the value we are using as a
4698         key before looking up the table.
4699
4700 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
4701
4702         * codegen.cs (EmitTopBlock): Require a Location argument now.
4703
4704         * cs-parser.jay (constructor_declarator): We need to setup
4705         current_local_parameters before we parse the
4706         opt_constructor_initializer, to allow the variables to be bound
4707         to the constructor arguments.
4708
4709         * rootcontext.cs (LookupType): First lookup nested classes in our
4710         class and our parents before we go looking outside our class.
4711
4712         * expression.cs (ConstantFold): Extract/debox the values at the
4713         beginnning. 
4714
4715         * rootcontext.cs (EmitCode): Resolve the constants first before we
4716         resolve the types.  This is not really needed, but it helps debugging.
4717
4718         * statement.cs: report location.
4719         
4720         * cs-parser.jay: pass location to throw statement.
4721
4722         * driver.cs: Small bug fix.
4723
4724         * report.cs: Updated format to be 4-zero filled digits.
4725
4726 2001-12-22  Ravi Pratap  <ravi@ximian.com>
4727
4728         * expression.cs (CheckIndices): Fix minor bug where the wrong
4729         variable was being referred to ;-)
4730
4731         (DoEmit): Do not call EmitStaticInitializers when the 
4732         underlying type is System.Object.
4733
4734 2001-12-21  Ravi Pratap  <ravi@ximian.com>
4735
4736         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
4737         and do the usual workaround for SRE.
4738
4739         * class.cs (MyEventBuilder.EventType): New member to get at the type
4740         of the event, quickly.
4741
4742         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
4743
4744         * assign.cs (Assign.DoResolve): Handle the case when the target
4745         is an EventExpr and perform the necessary checks.
4746
4747         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
4748         interface.
4749
4750         (SimpleName.MemberStaticCheck): Include check for EventExpr.
4751
4752         (EventExpr): Set the type in the constructor itself since we 
4753         are meant to be born fully resolved.
4754
4755         (EventExpr.Define): Revert code I wrote earlier.
4756                 
4757         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
4758         instance expression is null. The instance expression is a This in that case
4759         or a null, depending on whether it is a static method or not.
4760
4761         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
4762         refers to more than one method.
4763
4764         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
4765         and accordingly flag errors.
4766
4767 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
4768
4769         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
4770
4771 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
4772
4773         * location.cs (ToString): Provide useful rutine.
4774
4775 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
4776
4777         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
4778         objects, return the actual integral boxed.
4779
4780         * statement.cs (SwitchLabel): define an ILLabel for each
4781         SwitchLabel. 
4782         
4783         (Switch.CheckSwitch): If the value is a Literal, extract
4784         the underlying literal.
4785         
4786         Also in the unused hashtable we had, add the SwitchLabel so we can
4787         quickly look this value up.
4788
4789         * constant.cs: Implement a bunch of new constants.  Rewrite
4790         Literal based on this.  Made changes everywhere to adapt to this.
4791         
4792         * expression.cs (Expression.MakeByteBlob): Optimize routine by
4793         dereferencing array only once, and also copes with enumrations.
4794
4795         bytes are two bytes wide, not one.
4796
4797         (Cast): Perform constant conversions.
4798         
4799         * ecore.cs (TryImplicitIntConversion): Return literals instead of
4800         wrappers to the literals here.
4801
4802         * expression.cs (DoNumericPromotions): long literals can converted
4803         to ulong implicity (this is taken care of elsewhere, but I was
4804         missing this spot).
4805
4806         * ecore.cs (Expression.Literalize): Make the return type Literal,
4807         to improve type checking.
4808
4809         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
4810
4811 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
4812
4813         * literal.cs: Revert code from ravi that checked the bounds.  The
4814         bounds are sane by the definition of the type itself. 
4815
4816         * typemanager.cs: Fix implementation of ImplementsInterface.  We
4817         need to actually look up in our parent hierarchy for interfaces
4818         implemented. 
4819
4820         * const.cs: Use the underlying type for enumerations
4821
4822         * delegate.cs: Compute the basename for the delegate creation,
4823         that should fix the delegate test case, and restore the correct
4824         Type Lookup semantics in rootcontext
4825
4826         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
4827         referencing a nested type with the Reflection API is using the "+"
4828         sign. 
4829
4830         * cs-parser.jay: Do not require EOF token at the end.
4831
4832 2001-12-20  Ravi Pratap  <ravi@ximian.com>
4833
4834         * rootcontext.cs (LookupType): Concatenate type names with
4835         a '.' instead of a '+' The test suite passes again.
4836
4837         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
4838         field of the enumeration.
4839
4840         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
4841         the case when the member is an EventExpr.
4842
4843         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
4844         static has an associated instance expression.
4845
4846         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
4847
4848         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
4849
4850         * class.cs (Event.Define): Register event and perform appropriate checks
4851         for error #111.
4852
4853         We define the Add and Remove methods even if the use provides none because
4854         in that case, we provide default implementations ourselves.
4855
4856         Define a private field of the type of the event. This is done by the CSC compiler
4857         and we should be doing it too ;-)
4858
4859         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
4860         More methods we use in code we generate.
4861
4862         (multicast_delegate_type, delegate_type): Two separate types since the distinction
4863         is important.
4864
4865         (InitCoreTypes): Update accordingly for the above.
4866
4867         * class.cs (Event.Emit): Generate code for default accessors that we provide
4868
4869         (EmitDefaultMethod): Do the job in the above.
4870
4871         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
4872         appropriate place.
4873
4874 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
4875
4876         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
4877         builders even if we were missing one.
4878
4879         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
4880         pass the Basename as our class name instead of the Name.  The
4881         basename will be correctly composed for us.
4882
4883         * parameter.cs (Paramters): Now takes a Location argument.
4884
4885         * decl.cs (DeclSpace.LookupType): Removed convenience function and
4886         make all the code call directly LookupType in RootContext and take
4887         this chance to pass the Location information everywhere.
4888
4889         * Everywhere: pass Location information.
4890
4891 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
4892
4893         * class.cs (Constructor.Define): Updated way of detecting the
4894         length of the parameters.
4895
4896         (TypeContainer.DefineType): Use basename as the type name for
4897         nested types.
4898
4899         (TypeContainer.Define): Do not recursively define types here, as
4900         definition is taken care in order by the RootContext.
4901
4902         * tree.cs: Keep track of namespaces in a per-file basis.
4903
4904         * parameter.cs (Parameter.ComputeSignature): Update to use
4905         DeclSpace. 
4906
4907         (Parameters.GetSignature): ditto.
4908
4909         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
4910         instead of a TypeContainer.
4911
4912         (Interface.SemanticAnalysis): Use `this' instead of our parent to
4913         resolve names.  Because we need to be resolve in our context, not
4914         our parents.
4915         
4916         * driver.cs: Implement response files.
4917
4918         * class.cs (TypeContainer.DefineType): If we are defined, do not
4919         redefine ourselves.
4920         
4921         (Event.Emit): Emit the code for add/remove handlers.
4922         (Event.Define): Save the MethodBuilders for add/remove.
4923
4924         * typemanager.cs: Use pair here too.
4925
4926         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
4927         DictionaryEntry requires the first argument to be non-null.  
4928         
4929         (enum_declaration): Compute full name for registering the
4930         enumeration.
4931         
4932         (delegate_declaration): Instead of using
4933         formal_parameter_list, use opt_formal_parameter_list as the list
4934         can be empty.
4935
4936         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
4937         (EventParsing): New property that controls whether `add' and
4938         `remove' are returned as tokens or identifiers (for events);
4939
4940 2001-12-19  Ravi Pratap  <ravi@ximian.com>
4941
4942         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
4943         use MyEventBuilder only and let it wrap the real builder for us.
4944
4945         (MyEventBuilder): Revamp constructor etc.
4946
4947         Implement all operations that we perform on EventBuilder in precisely the same
4948         way here too.
4949
4950         (FindMembers): Update to use the EventBuilder member.
4951
4952         (Event.Emit): Update accordingly.
4953
4954 2001-12-18  Ravi Pratap  <ravi@ximian.com>
4955
4956         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
4957         by calling the appropriate methods.
4958
4959         (GetCustomAttributes): Make stubs as they cannot possibly do anything
4960         useful.
4961
4962         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
4963
4964 2001-12-17  Ravi Pratap  <ravi@ximian.com>
4965
4966         * delegate.cs (Delegate.Populate): Check that the return type
4967         and various parameters types are indeed accessible.
4968
4969         * class.cs (Constructor.Define): Same here.
4970
4971         (Field.Define): Ditto.
4972
4973         (Event.Define): Ditto.
4974
4975         (Operator.Define): Check that the underlying Method defined itself
4976         correctly - so it's MethodBuilder should not be null.
4977
4978         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
4979         expression happens to be null.
4980
4981         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
4982         members but as of now we don't seem to be able to do anything really useful with it.
4983
4984         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
4985         not the EventBuilder.
4986
4987 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
4988
4989         * cs-tokenizer.cs: Add support for defines.
4990         Add support for #if, #elif, #else, #endif
4991         
4992         (eval_var): evaluates a variable.
4993         (eval): stubbed for evaluating functions.
4994
4995         * cs-parser.jay: Pass the defines information
4996
4997         * driver.cs: Add --define command line option.
4998
4999         * decl.cs: Move MemberCore here.
5000
5001         Make it the base class for DeclSpace.  This allows us to catch and
5002         report 108 and 109 for everything now.
5003
5004         * class.cs (TypeContainer.Define): Extract all the members
5005         before populating and emit the warning 108 (new keyword required
5006         to override) instead of having each member implement this.
5007
5008         (MemberCore.Define): New abstract method, we will be using this in
5009         the warning reporting engine in Populate.
5010         
5011         (Operator.Define): Adjust to new MemberCore protocol. 
5012
5013         * const.cs (Const): This does not derive from Expression, it is a
5014         temporary object we use to create fields, it is a MemberCore. 
5015
5016         * class.cs (Method.Define): Allow the entry point to be in a
5017         specific class.
5018
5019         * driver.cs: Rewrite the argument handler to clean it up a bit.
5020
5021         * rootcontext.cs: Made it just an auxiliary namespace feature by
5022         making everything static.
5023
5024         * driver.cs: Adapt code to use RootContext type name instead of
5025         instance variable.
5026
5027         * delegate.cs: Remove RootContext argument.
5028
5029         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
5030         argument. 
5031
5032         * class.cs (Event.Define): The lookup can fail.
5033         
5034         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
5035
5036         * expression.cs: Resolve the this instance before invoking the code.
5037
5038 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
5039
5040         * cs-parser.jay: Add a production in element_access that allows
5041         the thing to become a "type" reference.  This way we can parse
5042         things like "(string [])" as a type.
5043
5044         Note that this still does not handle the more complex rules of
5045         casts. 
5046         
5047
5048         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
5049
5050         * ecore.cs: (CopyNewMethods): new utility function used to
5051         assemble the list of methods from running FindMembers.
5052
5053         (MemberLookup): Rework FindMembers so that 
5054
5055 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
5056
5057         * class.cs (TypeContainer): Remove Delegates who fail to be
5058         defined.
5059
5060         * delegate.cs (Populate): Verify that we dont get null return
5061         values.   TODO: Check for AsAccessible.
5062
5063         * cs-parser.jay: Use basename to emit error 574 (destructor should
5064         have the same name as container class), not the full name.
5065
5066         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
5067         possible representation.  
5068
5069         Also implements integer type suffixes U and L.
5070
5071 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
5072
5073         * expression.cs (ArrayCreation.DoResolve): We need to do the
5074         argument resolution *always*.
5075
5076         * decl.cs: Make this hold the namespace.  Hold the root context as
5077         well.
5078         (LookupType): Move here.
5079
5080         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
5081
5082         * location.cs (Row, Name): Fixed the code, it was always returning
5083         references to the first file.
5084
5085         * interface.cs: Register properties defined through interfaces.
5086
5087         * driver.cs: Add support for globbing on the command line
5088
5089         * class.cs (Field): Make it derive from MemberCore as well.
5090         (Event): ditto.
5091
5092 2001-12-15  Ravi Pratap  <ravi@ximian.com>
5093
5094         * class.cs (Event::Define): Check that the type of the event is a delegate
5095         type else flag error #66.
5096
5097         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
5098         same.
5099
5100         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
5101         values of EntryPoint, CharSet etc etc.
5102
5103         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
5104
5105         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
5106         be null and we should ignore this. I am not sure if this is really clean. Apparently,
5107         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
5108         which needs this to do its work.
5109
5110         * ../errors/cs0066.cs : Add.
5111
5112 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
5113
5114         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
5115         helper functions.
5116
5117         * class.cs: (MethodSignature.MethodSignature): Removed hack that
5118         clears out the parameters field.
5119         (MemberSignatureCompare): Cleanup
5120
5121         (MemberCore): New base class used to share code between MethodCore
5122         and Property.
5123
5124         (RegisterRequiredImplementations) BindingFlags.Public requires
5125         either BindingFlags.Instace or Static.  Use instance here.
5126
5127         (Property): Refactored code to cope better with the full spec.
5128
5129         * parameter.cs (GetParameterInfo): Return an empty array instead
5130         of null on error.
5131
5132         * class.cs (Property): Abstract or extern properties have no bodies.
5133
5134         * parameter.cs (GetParameterInfo): return a zero-sized array.
5135
5136         * class.cs (TypeContainer.MethodModifiersValid): Move all the
5137         method modifier validation to the typecontainer so we can reuse
5138         this on properties.
5139
5140         (MethodCore.ParameterTypes): return an empty sized array of types.
5141
5142         (Property.Define): Test property modifier validity.
5143
5144         Add tests for sealed/override too.
5145
5146         (Method.Emit): abstract or extern methods have no bodies.
5147
5148 2001-12-14  Ravi Pratap  <ravi@ximian.com>
5149
5150         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
5151         thing.
5152
5153         (Method::Define, ::Emit): Modify accordingly.
5154
5155         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
5156
5157         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
5158
5159         * makefile: Pass in /unsafe.
5160
5161 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
5162
5163         * class.cs (MakeKey): Kill routine.
5164         
5165         * class.cs (TypeContainer.Define): Correctly define explicit
5166         method implementations (they require the full interface name plus
5167         the method name).
5168
5169         * typemanager.cs: Deply the PtrHashtable here and stop using the
5170         lame keys.  Things work so much better.
5171
5172         This of course broke everyone who depended on `RegisterMethod' to
5173         do the `test for existance' test.  This has to be done elsewhere.
5174
5175         * support.cs (PtrHashtable): A hashtable that avoid comparing with
5176         the object stupid Equals method (because, that like fails all over
5177         the place).  We still do not use it.
5178
5179         * class.cs (TypeContainer.SetRequiredInterface,
5180         TypeContainer.RequireMethods): Killed these two routines and moved
5181         all the functionality to RegisterRequiredImplementations.
5182
5183         (TypeContainer.RegisterRequiredImplementations): This routine now
5184         registers all the implementations required in an array for the
5185         interfaces and abstract methods.  We use an array of structures
5186         which can be computed ahead of time to reduce memory usage and we
5187         also assume that lookups are cheap as most classes will not
5188         implement too many interfaces.
5189
5190         We also avoid creating too many MethodSignatures.
5191
5192         (TypeContainer.IsInterfaceMethod): Update and optionally does not
5193         clear the "pending" bit if we find that there are problems with
5194         the declaration.
5195
5196         (TypeContainer.VerifyPendingMethods): Update to report errors of
5197         methods that look like implementations but are not.
5198
5199         (TypeContainer.Define): Add support for explicit interface method
5200         implementation. 
5201         
5202 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
5203
5204         * typemanager.cs: Keep track of the parameters here instead of
5205         being a feature of the TypeContainer.
5206
5207         * class.cs: Drop the registration of parameters here, as
5208         InterfaceMethods are also interface declarations.
5209
5210         * delegate.cs: Register methods with the TypeManager not only with
5211         the TypeContainer.  This code was buggy.
5212
5213         * interface.cs: Full registation here.
5214
5215 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
5216
5217         * expression.cs: Remove reducer for binary expressions, it can not
5218         be done this way.
5219
5220         * const.cs: Put here the code that used to go into constant.cs
5221
5222         * constant.cs: Put here the code for constants, this is a new base
5223         class for Literals.
5224
5225         * literal.cs: Make Literal derive from Constant.
5226
5227 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
5228
5229         * statement.cs (Return.Emit): Report error 157 if the user
5230         attempts to return from a finally block.
5231
5232         (Return.Emit): Instead of emitting a return, jump to the end of
5233         the function.
5234
5235         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
5236         LocalBuilder to store the result of the function.  ReturnLabel is
5237         the target where we jump.
5238         
5239
5240 2001-12-09  Radek Doulik  <rodo@ximian.com>
5241
5242         * cs-parser.jay: remember alias in current namespace
5243
5244         * ecore.cs (SimpleName::DoResolve): use aliases for types or
5245         namespaces
5246
5247         * class.cs (LookupAlias): lookup alias in my_namespace
5248
5249         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
5250         aliases hashtable
5251         (LookupAlias): lookup alias in this and if needed in parent
5252         namespaces
5253
5254 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
5255
5256         * support.cs: 
5257
5258         * rootcontext.cs: (ModuleBuilder) Made static, first step into
5259         making things static.  I need this to avoid passing the
5260         TypeContainer when calling ParameterType.
5261
5262         * support.cs (InternalParameters.ParameterType): Remove ugly hack
5263         that did string manipulation to compute the type and then call
5264         GetType.  Use Parameter.ParameterType instead.
5265
5266         * cs-tokenizer.cs: Consume the suffix for floating values.
5267
5268         * expression.cs (ParameterReference): figure out whether this is a
5269         reference parameter or not.  Kill an extra variable by computing
5270         the arg_idx during emission.
5271
5272         * parameter.cs (Parameters.GetParameterInfo): New overloaded
5273         function that returns whether a parameter is an out/ref value or not.
5274
5275         (Parameter.ParameterType): The type of the parameter (base,
5276         without ref/out applied).
5277         
5278         (Parameter.Resolve): Perform resolution here.
5279         (Parameter.ExternalType): The full type (with ref/out applied).
5280
5281         * statement.cs (Using.Emit, Using.EmitExpression): Implement
5282         support for expressions on the using statement.
5283
5284 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
5285
5286         * statement.cs (Using.EmitLocalVariableDecls): Split the
5287         localvariable handling of the using statement.
5288
5289         (Block.EmitMeta): Keep track of variable count across blocks.  We
5290         were reusing slots on separate branches of blocks.
5291
5292         (Try.Emit): Emit the general code block, we were not emitting it. 
5293
5294         Check the type of the declaration to be an IDisposable or
5295         something that can be implicity converted to it. 
5296
5297         Emit conversions if required.
5298
5299         * ecore.cs (EmptyExpression): New utility class.
5300         (Expression.ImplicitConversionExists): New utility function.
5301
5302 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
5303
5304         * statement.cs (Using): Implement.
5305
5306         * expression.cs (LocalVariableReference): Support read only variables.
5307
5308         * statement.cs: Remove the explicit emit for the Leave opcode.
5309         (VariableInfo): Add a readonly field.
5310
5311 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
5312
5313         * ecore.cs (ConvCast): new class used to encapsulate the various
5314         explicit integer conversions that works in both checked and
5315         unchecked contexts.
5316
5317         (Expression.ConvertNumericExplicit): Use new ConvCast class to
5318         properly generate the overflow opcodes.
5319
5320 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
5321
5322         * statement.cs: The correct type for the EmptyExpression is the
5323         element_type, not the variable type.  Ravi pointed this out.
5324
5325 2001-12-04  Ravi Pratap  <ravi@ximian.com>
5326
5327         * class.cs (Method::Define): Handle PInvoke methods specially
5328         by using DefinePInvokeMethod instead of the usual one.
5329
5330         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
5331         above to do the task of extracting information and defining the method.
5332         
5333 2001-12-04  Ravi Pratap  <ravi@ximian.com>
5334
5335         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
5336         of the condition for string type.
5337
5338         (Emit): Move that here. 
5339
5340         (ArrayCreation::CheckIndices): Keep string literals in their expression
5341         form.
5342
5343         (EmitDynamicInitializers): Handle strings appropriately.
5344
5345 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
5346
5347         * codegen.cs (EmitContext): Replace multiple variables with a
5348         single pointer to the current Switch statement.
5349
5350         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
5351         EmitContext.
5352
5353 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
5354
5355         * statement.cs 
5356
5357         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
5358         default'.
5359         
5360         (Foreach.Emit): Foreach on arrays was not setting
5361         up the loop variables (for break/continue).
5362
5363         (GotoCase): Semi-implented.
5364         
5365 2001-12-03  Ravi Pratap  <ravi@ximian.com>
5366
5367         * attribute.cs (CheckAttribute): Handle system attributes by using
5368         Attribute.GetAttributes to examine information we need.
5369
5370         (GetValidPlaces): Same here.
5371
5372         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
5373
5374         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
5375
5376         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
5377
5378         (Method::Define): Set appropriate flags if we have a DllImport attribute.
5379
5380         (Method::Emit): Handle the case when we are a PInvoke method.
5381
5382 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
5383
5384         * expression.cs: Use ResolveWithSimpleName on compound names.
5385
5386 2001-12-02  Ravi Pratap  <ravi@ximian.com>
5387
5388         * constant.cs (EmitConstant): Make sure we resolve the associated expression
5389         before trying to reduce it.
5390
5391         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
5392
5393         * constant.cs (LookupConstantValue): Implement.
5394
5395         (EmitConstant): Use the above in emitting the constant.
5396
5397         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
5398         that are user-defined by doing a LookupConstantValue on them.
5399
5400         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
5401         too, like above.
5402
5403 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
5404
5405         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
5406
5407         (BaseAccess.DoResolve): Implement.
5408
5409         (MemberAccess.DoResolve): Split this routine into a
5410         ResolveMemberAccess routine that can be used independently
5411
5412 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
5413
5414         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
5415         As that share bits of the implementation.  Is returns a boolean,
5416         while As returns the Type that is being probed.
5417
5418 2001-12-01  Ravi Pratap  <ravi@ximian.com>
5419
5420         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
5421         instead of a Literal - much easier.
5422
5423         (EnumInTransit): Remove - utterly useless :-)
5424
5425         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
5426
5427         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
5428
5429         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
5430         chain when we have no associated expression.
5431
5432 2001-11-30  Ravi Pratap  <ravi@ximian.com>
5433
5434         * constant.cs (Define): Use Location while reporting the errror.
5435
5436         Also emit a warning when 'new' is used and there is no inherited
5437         member to hide.
5438
5439         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
5440         populated.
5441
5442         (LookupEnumValue): Implement to lookup an enum member's value and define it
5443         if necessary.
5444
5445         (Populate): Re-write accordingly to use the above routine.
5446
5447 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
5448
5449         * expression.cs (This): Fix prototype for DoResolveLValue to
5450         override the base class DoResolveLValue.
5451
5452         * cs-parser.cs: Report errors cs574 and cs575 (destructor
5453         declarations) 
5454
5455         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
5456         (we need to load the address of the field here).  This fixes
5457         test-22. 
5458         
5459         (FieldExpr.DoResolveLValue): Call the DoResolve
5460         function to initialize the Instance expression.
5461         
5462         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
5463         correctly the GetEnumerator operation on a value type.
5464
5465         * cs-parser.jay: Add more simple parsing error catches.
5466
5467         * statement.cs (Switch): Add support for string switches.
5468         Handle null specially.
5469
5470         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
5471
5472 2001-11-28  Ravi Pratap  <ravi@ximian.com>
5473
5474         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
5475
5476         (declare_local_constant): New helper function.
5477
5478         * statement.cs (AddConstant): Keep a separate record of constants
5479
5480         (IsConstant): Implement to determine if a variable is a constant.
5481
5482         (GetConstantExpression): Implement.
5483
5484         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
5485
5486         * statement.cs (IsVariableDefined): Re-write.
5487
5488 2001-11-27  Ravi Pratap  <ravi@ximian.com>
5489
5490         * class.cs (TypeContainer::FindMembers): Look for constants
5491         in the case when we are looking for MemberTypes.Field
5492
5493         * expression.cs (MemberAccess::DoResolve): Check that in the
5494         case we are a FieldExpr and a Literal, we are not being accessed
5495         by an instance reference.
5496
5497         * cs-parser.jay (local_constant_declaration): Implement.
5498
5499         (declaration_statement): Implement for constant declarations.
5500
5501 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
5502
5503         * statement.cs (Switch): Catch double defaults.
5504
5505         (Switch): More work on the switch() statement
5506         implementation.  It works for integral values now, need to finish
5507         string support.
5508
5509
5510 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
5511
5512         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
5513         integer literals into other integer literals.  To be used by
5514         switch. 
5515
5516 2001-11-24  Ravi Pratap  <ravi@ximian.com>
5517
5518         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
5519         some memory.
5520
5521         (EmitDynamicInitializers): Cope with the above since we extract data
5522         directly from ArrayData now.
5523
5524         (ExpectInitializers): Keep track of whether initializers are mandatory
5525         or not.
5526
5527         (Bounds): Make it a hashtable to prevent the same dimension being 
5528         recorded for every element in that dimension.
5529
5530         (EmitDynamicInitializers): Fix bug which prevented the Set array method
5531         from being found.
5532
5533         Also fix bug which was causing the indices to be emitted in the reverse
5534         order.
5535
5536 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
5537
5538         * expression.cs (ArrayCreation): Implement the bits that Ravi left
5539         unfinished.  They do not work, because the underlying code is
5540         sloppy.
5541
5542 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
5543
5544         * cs-parser.jay: Remove bogus fixme.
5545
5546         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
5547         on Switch statement.
5548         
5549 2001-11-23  Ravi Pratap  <ravi@ximian.com>
5550
5551         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
5552         the same. 
5553         
5554         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
5555         parameter. Apparently, any expression is allowed. 
5556
5557         (ValidateInitializers): Update accordingly.
5558
5559         (CheckIndices): Fix some tricky bugs thanks to recursion.
5560
5561         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
5562         I was being completely brain-dead.
5563
5564         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
5565         and re-write acordingly.
5566
5567         (DelegateInvocation): Re-write accordingly.
5568
5569         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
5570
5571         (MakeByteBlob): Handle types more correctly.
5572
5573         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
5574         initialization from expressions but it is incomplete because I am a complete
5575         Dodo :-|
5576
5577 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
5578
5579         * statement.cs (If.Emit): Fix a bug that generated incorrect code
5580         on If.  Basically, we have to return `true' (ie, we do return to
5581         our caller) only if both branches of the if return.
5582
5583         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
5584         short-circuit operators, handle them as short circuit operators. 
5585
5586         (Cast.DoResolve): Resolve type.
5587         (Cast.Cast): Take an expression as the target type.
5588
5589         * cs-parser.jay (cast_expression): Remove old hack that only
5590         allowed a limited set of types to be handled.  Now we take a
5591         unary_expression and we resolve to a type during semantic
5592         analysis.
5593
5594         Use the grammar productions from Rhys to handle casts (this is
5595         not complete like Rhys syntax yet, we fail to handle that corner
5596         case that C# has regarding (-x), but we will get there.
5597         
5598 2001-11-22  Ravi Pratap  <ravi@ximian.com>
5599
5600         * class.cs (EmitFieldInitializer): Take care of the case when we have a
5601         field which is an array type.
5602
5603         * cs-parser.jay (declare_local_variables): Support array initialization too.
5604
5605         * typemanager.cs (MakeKey): Implement.
5606
5607         (everywhere): Use the above appropriately.
5608
5609         * cs-parser.jay (for_statement): Update for array initialization while
5610         declaring variables.
5611
5612         * ecore.cs : The error message was correct, it's the variable's names that
5613         were misleading ;-) Make the code more readable.
5614
5615         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
5616         the correct type etc.
5617
5618         (ConvertExplicit): Handle Enum types by examining the underlying type.
5619
5620 2001-11-21  Ravi Pratap  <ravi@ximian.com>
5621
5622         * parameter.cs (GetCallingConvention): Always return
5623         CallingConventions.Standard for now.
5624
5625 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
5626
5627         * expression.cs (Binary.ResolveOperator): Update the values of `l'
5628         and `r' after calling DoNumericPromotions.
5629
5630         * ecore.cs: Fix error message (the types were in the wrong order).
5631
5632         * statement.cs (Foreach.ProbeCollectionType): Need to pass
5633         BindingFlags.Instance as well 
5634
5635         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
5636         implicit int literal conversion in an empty cast so that we
5637         propagate the right type upstream.
5638
5639         (UnboxCast): new class used to unbox value types.
5640         (Expression.ConvertExplicit): Add explicit type conversions done
5641         by unboxing.
5642
5643         (Expression.ImplicitNumericConversion): Oops, forgot to test for
5644         the target type before applying the implicit LongLiterals to ULong
5645         literal cast.
5646
5647 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
5648
5649         * cs-parser.jay (for_statement): Reworked the way For works: now
5650         we declare manually any variables that are introduced in
5651         for_initializer to solve the problem of having out-of-band code
5652         emition (that is what got for broken).
5653
5654         (declaration_statement): Perform the actual variable declaration
5655         that used to be done in local_variable_declaration here.
5656
5657         (local_variable_declaration): Do not declare anything, just pass
5658         the information on a DictionaryEntry
5659
5660 2001-11-20  Ravi Pratap  <ravi@ximian.com>
5661
5662         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
5663         re-write of the logic to now make it recursive.
5664
5665         (UpdateIndices): Re-write accordingly.
5666
5667         Store element data in a separate ArrayData list in the above methods.
5668
5669         (MakeByteBlob): Implement to dump the array data into a byte array.
5670
5671 2001-11-19  Ravi Pratap  <ravi@ximian.com>
5672
5673         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
5674         into CheckIndices.
5675
5676         * constant.cs (Define): Implement.
5677
5678         (EmitConstant): Re-write fully.
5679
5680         Pass in location info.
5681
5682         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
5683         respectively.
5684
5685         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
5686         DictionaryEntry since we need location info too.
5687
5688         (constant_declaration): Update accordingly.
5689
5690         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
5691         code into another method : UpdateIndices.
5692
5693 2001-11-18  Ravi Pratap  <ravi@ximian.com>
5694
5695         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
5696         some type checking etc.
5697
5698 2001-11-17  Ravi Pratap  <ravi@ximian.com>
5699
5700         * expression.cs (ArrayCreation::ValidateInitializers): Implement
5701         bits to provide dimension info if the user skips doing that.
5702
5703         Update second constructor to store the rank correctly.
5704
5705 2001-11-16  Ravi Pratap  <ravi@ximian.com>
5706
5707         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
5708         and try to implement.
5709
5710         * ../errors/cs0150.cs : Add.
5711
5712         * ../errors/cs0178.cs : Add.
5713
5714 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
5715
5716         * statement.cs: Implement foreach on multi-dimensional arrays. 
5717
5718         * parameter.cs (Parameters.GetParameterByName): Also lookup the
5719         name of the params argument.
5720
5721         * expression.cs: Use EmitStoreOpcode to get the right opcode while
5722         initializing the array.
5723
5724         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
5725         we can use this elsewhere.
5726
5727         * statement.cs: Finish implementation of foreach for single
5728         dimension arrays.
5729
5730         * cs-parser.jay: Use an out-of-band stack to pass information
5731         around, I wonder why I need this.
5732
5733         foreach_block: Make the new foreach_block the current_block.
5734
5735         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
5736         function used to return a static Parameters structure.  Used for
5737         empty parameters, as those are created very frequently.
5738
5739         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
5740
5741 2001-11-15  Ravi Pratap  <ravi@ximian.com>
5742
5743         * interface.cs : Default modifier is private, not public. The
5744         make verify test passes again.
5745
5746 2001-11-15  Ravi Pratap  <ravi@ximian.com>
5747
5748         * support.cs (ReflectionParameters): Fix logic to determine
5749         whether the last parameter is a params one. Test 9 passes again.
5750
5751         * delegate.cs (Populate): Register the builders we define with
5752         RegisterParameterForBuilder. Test 19 passes again.
5753
5754         * cs-parser.jay (property_declaration): Reference $6 instead
5755         of $$ to get at the location.
5756
5757         (indexer_declaration): Similar stuff.
5758
5759         (attribute): Ditto.
5760
5761         * class.cs (Property): Register parameters for the Get and Set methods
5762         if they exist. Test 23 passes again.
5763
5764         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
5765         call to EmitArguments as we are sure there aren't any params arguments. 
5766         Test 32 passes again.
5767
5768         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
5769         IndexOutOfRangeException. 
5770
5771         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
5772         Test 33 now passes again.
5773         
5774 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
5775
5776         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
5777         broke a bunch of things.  Will have to come up with a better way
5778         of tracking locations.
5779
5780         * statement.cs: Implemented foreach for single dimension arrays.
5781
5782 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
5783
5784         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
5785         an error.  This removes the lookup from the critical path.
5786
5787         * cs-parser.jay: Removed use of temporary_loc, which is completely
5788         broken. 
5789
5790 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
5791
5792         * support.cs (ReflectionParameters.ParameterModifier): Report
5793         whether the argument is a PARAMS argument or not.
5794
5795         * class.cs: Set the attribute `ParamArrayAttribute' on the
5796         parameter argument.
5797
5798         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
5799         and cons_param_array_attribute (ConstructorInfo for
5800         ParamArrayAttribute)., 
5801
5802         * codegen.cs: Emit the return using the `Return' statement, that
5803         way we can report the error correctly for missing return values. 
5804
5805         * class.cs (Method.Emit): Clean up.
5806
5807         * expression.cs (Argument.Resolve): Take another argument: the
5808         location where this argument is used.  Notice that this is not
5809         part of the "Argument" class as to reduce the size of the
5810         structure (we know the approximate location anyways).
5811
5812         Test if the argument is a variable-reference, if not, then
5813         complain with a 206.
5814
5815         (Argument.Emit): Emit addresses of variables.
5816
5817         (Argument.FullDesc): Simplify.
5818
5819         (Invocation.DoResolve): Update for Argument.Resolve.
5820
5821         (ElementAccess.DoResolve): ditto.
5822
5823         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
5824         method should be virtual, as this method is always virtual.
5825
5826         (NewDelegate.DoResolve): Update for Argument.Resolve.
5827
5828         * class.cs (ConstructorInitializer.DoResolve): ditto.
5829         
5830         * attribute.cs (Attribute.Resolve): ditto.
5831
5832 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
5833
5834         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
5835
5836         * expression.cs (ParameterReference): Drop IStackStorage and implement
5837         IAssignMethod instead. 
5838
5839         (LocalVariableReference): ditto.
5840         
5841         * ecore.cs (FieldExpr): Drop IStackStorage and implement
5842         IAssignMethod instead. 
5843
5844 2001-11-13  Miguel de Icaza <miguel@ximian.com>
5845
5846         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
5847         enumerations that are used in heavily used structures derive from
5848         byte in a laughable and pathetic attempt to reduce memory usage.
5849         This is the kind of pre-optimzations that you should not do at
5850         home without adult supervision.
5851
5852         * expression.cs (UnaryMutator): New class, used to handle ++ and
5853         -- separatedly from the other unary operators.  Cleans up the
5854         code, and kills the ExpressionStatement dependency in Unary.
5855
5856         (Unary): Removed `method' and `Arguments' from this class, making
5857         it smaller, and moving it all to SimpleCall, so I can reuse this
5858         code in other locations and avoid creating a lot of transient data
5859         strucutres when not required.
5860
5861         * cs-parser.jay: Adjust for new changes.
5862
5863 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
5864
5865         * enum.cs (Enum.Populate): If there is a failure during
5866         definition, return
5867
5868         * cs-parser.jay (opt_enum_base): we used to catch type errors
5869         here, but this is really incorrect.  The type error should be
5870         catched during semantic analysis.
5871
5872 2001-12-11  Ravi Pratap  <ravi@ximian.com>
5873
5874         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
5875         current_local_parameters as expected since I, in my stupidity, had forgotten
5876         to do this :-)
5877
5878         * attribute.cs (GetValidPlaces): Fix stupid bug.
5879
5880         * class.cs (Method::Emit): Perform check on applicability of attributes.
5881
5882         (Constructor::Emit): Ditto.
5883
5884         (Field::Emit): Ditto.
5885
5886         (Field.Location): Store location information.
5887
5888         (Property, Event, Indexer, Operator): Ditto.
5889
5890         * cs-parser.jay (field_declaration): Pass in location for each field.
5891
5892         * ../errors/cs0592.cs : Add.
5893
5894 2001-11-12  Ravi Pratap  <ravi@ximian.com>
5895
5896         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
5897
5898         (InitCoreTypes): Update accordingly.
5899
5900         (RegisterAttrType, LookupAttr): Implement.
5901
5902         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
5903         info about the same.
5904
5905         (Resolve): Update to populate the above as necessary.
5906
5907         (Error592): Helper.
5908
5909         (GetValidPlaces): Helper to the above.
5910
5911         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
5912
5913         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
5914
5915 2001-11-12  Ravi Pratap  <ravi@ximian.com>
5916
5917         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
5918
5919         * ../errors/cs0617.cs : Add.
5920
5921 2001-11-11  Ravi Pratap  <ravi@ximian.com>
5922
5923         * enum.cs (Emit): Rename to Populate to be more consistent with what
5924         we expect it to do and when exactly it is called.
5925
5926         * class.cs, rootcontext.cs : Update accordingly.
5927
5928         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
5929         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
5930
5931         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
5932
5933         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
5934         of a fieldinfo using the above, when dealing with a FieldBuilder.
5935
5936 2001-11-10  Ravi Pratap  <ravi@ximian.com>
5937
5938         * ../errors/cs0031.cs : Add.
5939
5940         * ../errors/cs1008.cs : Add.
5941
5942         * ../errrors/cs0543.cs : Add.
5943
5944         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
5945         enum type.
5946
5947         (FindMembers): Implement.
5948
5949         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
5950         enums and delegates too.
5951
5952         (enum_types): Rename to builder_to_enum.
5953
5954         (delegate_types): Rename to builder_to_delegate.
5955
5956         * delegate.cs (FindMembers): Implement.
5957
5958 2001-11-09  Ravi Pratap  <ravi@ximian.com>
5959
5960         * typemanager.cs (IsEnumType): Implement.
5961
5962         * enum.cs (Emit): Re-write parts to account for the underlying type
5963         better and perform checking etc.
5964
5965         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
5966         of the underlying type.
5967
5968         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
5969         value
5970
5971         * enum.cs (error31): Helper to report error #31.
5972
5973         * cs-parser.jay (enum_declaration): Store location of each member too.
5974
5975         * enum.cs (member_to_location): New hashtable. 
5976
5977         (AddEnumMember): Update location hashtable.
5978
5979         (Emit): Use the location of each member while reporting errors.
5980
5981 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
5982
5983         * cs-parser.jay: A for_initializer if is a
5984         local_variable_declaration really ammount to have an implicit
5985         block with the variable declaration and no initializer for for.
5986
5987         * statement.cs (For.Emit): Cope with null initializers.
5988
5989         This fixes the infinite loop on for initializers.
5990
5991 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
5992
5993         * enum.cs: More cleanup.
5994
5995         * ecore.cs: Remove dead code.
5996
5997         * class.cs (Property.Emit): More simplification.
5998         (Event.Emit): ditto.
5999
6000         Reworked to have less levels of indentation.
6001         
6002 2001-11-08  Ravi Pratap  <ravi@ximian.com>
6003
6004         * class.cs (Property): Emit attributes.
6005
6006         (Field): Ditto.
6007         
6008         (Event): Ditto.
6009
6010         (Indexer): Ditto.
6011
6012         (Operator): Ditto.
6013
6014         * enum.cs (Emit): Ditto.
6015
6016         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
6017         Enums too.
6018
6019         * class.cs (Field, Event, etc.): Move attribute generation into the
6020         Emit method everywhere.
6021
6022         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
6023         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
6024         as we had no way of defining nested enums !
6025
6026         * rootcontext.cs : Adjust code accordingly.
6027
6028         * typemanager.cs (AddEnumType): To keep track of enum types separately.
6029
6030 2001-11-07  Ravi Pratap  <ravi@ximian.com>
6031
6032         * expression.cs (EvalConstantExpression): Move into ecore.cs
6033         
6034         * enum.cs (Enum): Rename some members and make them public and readonly
6035         according to our convention.
6036
6037         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
6038         nothing else.
6039
6040         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
6041
6042         (Enum::Emit): Write a simple version for now which doesn't try to compute
6043         expressions. I shall modify this to be more robust in just a while.
6044
6045         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
6046
6047         (TypeContainer::CloseType): Create the Enum types too.
6048
6049         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
6050
6051         * expression.cs (EvalConstantExpression): Get rid of completely.
6052
6053         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
6054         user-defined values and other cases.
6055
6056         (IsValidEnumLiteral): Helper function.
6057
6058         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
6059         out there in the case we had a literal FieldExpr.
6060
6061         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
6062
6063         (Literalize): Revamp a bit to take two arguments.
6064         
6065         (EnumLiteral): New class which derives from Literal to wrap enum literals.
6066         
6067 2001-11-06  Ravi Pratap  <ravi@ximian.com>
6068
6069         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
6070
6071         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
6072
6073         (Resolve): Use the above to ensure we have proper initializers.
6074
6075 2001-11-05  Ravi Pratap  <ravi@ximian.com>
6076
6077         * expression.cs (Expression::EvalConstantExpression): New method to 
6078         evaluate constant expressions.
6079
6080         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
6081
6082 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
6083
6084         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
6085         in an array.
6086
6087         (Binary.ResolveOperator): Handle operator != (object a, object b)
6088         and operator == (object a, object b);
6089
6090         (Binary.DoNumericPromotions): Indicate whether the numeric
6091         promotion was possible.
6092
6093         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
6094         Implement.  
6095
6096         Made the ArrayAccess implement interface IAssignMethod instead of
6097         IStackStore as the order in which arguments are passed reflects
6098         this.
6099
6100         * assign.cs: Instead of using expr.ExprClass to select the way of
6101         assinging, probe for the IStackStore/IAssignMethod interfaces.
6102
6103         * typemanager.cs: Load InitializeArray definition.
6104
6105         * rootcontext.cs (RootContext.MakeStaticData): Used to define
6106         static data that can be used to initialize arrays. 
6107
6108 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
6109
6110         * expression.cs: Handle operator== and operator!= for booleans.
6111
6112         (Conditioal.Reduce): Implement reducer for the ?: operator.
6113
6114         (Conditional.Resolve): Implement dead code elimination.
6115
6116         (Binary.Resolve): Catch string literals and return a new
6117         concatenated string.
6118
6119         (Unary.Reduce): Implement reduction of unary expressions.
6120
6121         * ecore.cs: Split out the expression core handling here.
6122
6123         (Expression.Reduce): New method used to perform constant folding
6124         and CSE.  This is needed to support constant-expressions. 
6125         
6126         * statement.cs (Statement.EmitBoolExpression): Pass true and false
6127         targets, and optimize for !x.
6128
6129 2001-11-04  Ravi Pratap  <ravi@ximian.com>
6130
6131         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
6132         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
6133         set custom atttributes.
6134
6135         * literal.cs (Literal::GetValue): New abstract method to return the actual
6136         value of the literal, cast as an object.
6137
6138         (*Literal): Implement GetValue method.
6139
6140         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
6141         expressions to the arraylist but objects of type Argument.
6142
6143         * class.cs (TypeContainer::Emit): Emit our attributes too.
6144
6145         (Method::Emit, Constructor::Emit): Ditto.
6146
6147         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
6148         to be ignoring earlier.
6149
6150 2001-11-03  Ravi Pratap  <ravi@ximian.com>
6151
6152         * attribute.cs (AttributeSection::Define): Implement to do the business
6153         of constructing a CustomAttributeBuilder.
6154
6155         (Attribute): New trivial class. Increases readability of code.  
6156
6157         * cs-parser.jay : Update accordingly.
6158
6159         (positional_argument_list, named_argument_list, named_argument): New rules
6160
6161         (attribute_arguments): Use the above so that we are more correct.
6162         
6163 2001-11-02  Ravi Pratap  <ravi@ximian.com>
6164         
6165         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
6166         to perform all checks for a method with a params parameter.
6167
6168         (Invocation::OverloadResolve): Update to use the above method and therefore
6169         cope correctly with params method invocations.
6170
6171         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
6172         params too.
6173
6174         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
6175         constructors in our parent too because we can't afford to miss out on 
6176         protected ones ;-)
6177
6178         * attribute.cs (AttributeSection): New name for the class Attribute
6179
6180         Other trivial changes to improve readability.
6181
6182         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
6183         use the new class names.
6184         
6185 2001-11-01  Ravi Pratap  <ravi@ximian.com>
6186
6187         * class.cs (Method::Define): Complete definition for params types too
6188
6189         (Indexer::Define): Ditto.
6190
6191         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
6192         Cope everywhere with a request for info about the array parameter.
6193
6194 2001-11-01  Ravi Pratap  <ravi@ximian.com>
6195
6196         * tree.cs (RecordNamespace): Fix up to check for the correct key.
6197
6198         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
6199         local_variable_type to extract the string corresponding to the type.
6200
6201         (local_variable_type): Fixup the action to use the new helper method.
6202
6203         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
6204         go.
6205
6206         * expression.cs : Clean out code which uses the above.
6207
6208 2001-10-31  Ravi Pratap  <ravi@ximian.com>
6209         
6210         * typemanager.cs (RegisterMethod): Check if we already have an existing key
6211         and bale out if necessary by returning a false.
6212
6213         (RegisterProperty): Ditto.
6214
6215         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
6216         and print out appropriate error messages.
6217
6218         * interface.cs (everywhere): Ditto.
6219
6220         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
6221         location to constructor.
6222
6223         * class.cs (Property, Event, Indexer): Update accordingly.
6224
6225         * ../errors/cs111.cs : Added.
6226
6227         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
6228         of a method, as laid down by the spec.
6229
6230         (Invocation::OverloadResolve): Use the above method.
6231
6232 2001-10-31  Ravi Pratap  <ravi@ximian.com>
6233
6234         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
6235         now take a TypeContainer and a Parameters object.
6236
6237         (ParameterData): Modify return type of ParameterModifier method to be 
6238         Parameter.Modifier and not a string.
6239
6240         (ReflectionParameters, InternalParameters): Update accordingly.
6241
6242         * expression.cs (Argument::GetParameterModifier): Same here.
6243
6244         * support.cs (InternalParameters::ParameterType): Find a better way of determining
6245         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
6246         symbol in it at all so maybe this is only for now.
6247
6248 2001-10-30  Ravi Pratap  <ravi@ximian.com>
6249
6250         * support.cs (InternalParameters): Constructor now takes an extra argument 
6251         which is the actual Parameters class.
6252
6253         (ParameterDesc): Update to provide info on ref/out modifiers.
6254
6255         * class.cs (everywhere): Update call to InternalParameters to pass in
6256         the second argument too.
6257
6258         * support.cs (ParameterData): Add ParameterModifier, which is a method 
6259         to return the modifier info [ref/out etc]
6260
6261         (InternalParameters, ReflectionParameters): Implement the above.
6262
6263         * expression.cs (Argument::ParameterModifier): Similar function to return
6264         info about the argument's modifiers.
6265
6266         (Invocation::OverloadResolve): Update to take into account matching modifiers 
6267         too.
6268
6269         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
6270         a new SetFormalParameters object which we pass to InternalParameters.
6271
6272 2001-10-30  Ravi Pratap  <ravi@ximian.com>
6273
6274         * expression.cs (NewArray): Merge into the ArrayCreation class.
6275
6276 2001-10-29  Ravi Pratap  <ravi@ximian.com>
6277
6278         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
6279         NewUserdefinedArray into one as there wasn't much of a use in having
6280         two separate ones.
6281
6282         * expression.cs (Argument): Change field's name to ArgType from Type.
6283
6284         (Type): New readonly property which returns the proper type, taking into 
6285         account ref/out modifiers.
6286
6287         (everywhere): Adjust code accordingly for the above.
6288
6289         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
6290         whether we are emitting for a ref or out parameter.
6291
6292         * expression.cs (Argument::Emit): Use the above field to set the state.
6293
6294         (LocalVariableReference::Emit): Update to honour the flag and emit the
6295         right stuff.
6296
6297         * parameter.cs (Attributes): Set the correct flags for ref parameters.
6298
6299         * expression.cs (Argument::FullDesc): New function to provide a full desc.
6300
6301         * support.cs (ParameterData): Add method ParameterDesc to the interface.
6302
6303         (ReflectionParameters, InternalParameters): Implement the above method.
6304
6305         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
6306         reporting errors.
6307
6308         (Invocation::FullMethodDesc): Ditto. 
6309
6310 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
6311
6312         * cs-parser.jay: Add extra production for the second form of array
6313         creation. 
6314
6315         * expression.cs (ArrayCreation): Update to reflect the above
6316         change. 
6317
6318         * Small changes to prepare for Array initialization.
6319
6320 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
6321
6322         * typemanager.cs (ImplementsInterface): interface might be null;
6323         Deal with this problem;
6324
6325         Also, we do store negative hits on the cache (null values), so use
6326         this instead of calling t.GetInterfaces on the type everytime.
6327
6328 2001-10-28  Ravi Pratap  <ravi@ximian.com>
6329
6330         * typemanager.cs (IsBuiltinType): New method to help determine the same.
6331
6332         * expression.cs (New::DoResolve): Get rid of array creation code and instead
6333         split functionality out into different classes.
6334
6335         (New::FormArrayType): Move into NewBuiltinArray.
6336
6337         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
6338         quite useless.
6339
6340         (NewBuiltinArray): New class to handle creation of built-in arrays.
6341
6342         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
6343         account creation of one-dimensional arrays.
6344
6345         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
6346
6347         (NewUserdefinedArray::DoResolve): Implement.
6348
6349         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
6350
6351         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
6352         we maintain inside the TypeManager. This is necessary to perform lookups on the
6353         module builder.
6354
6355         (LookupType): Update to perform GetType on the module builders too.     
6356
6357         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
6358
6359         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
6360
6361 2001-10-23  Ravi Pratap  <ravi@ximian.com>
6362
6363         * expression.cs (New::DoResolve): Implement guts of array creation.
6364
6365         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
6366         
6367 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
6368
6369         * expression.cs: Fix bug I introduced lsat night that broke
6370         Delegates. 
6371
6372         (Expression.Resolve): Report a 246 error (can not resolve name)
6373         if we find a SimpleName in the stream.
6374         
6375         (Expression.ResolveLValue): Ditto.
6376         
6377         (Expression.ResolveWithSimpleName): This function is a variant of
6378         ResolveName, this one allows SimpleNames to be returned without a
6379         warning.  The only consumer of SimpleNames is MemberAccess
6380
6381 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
6382
6383         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
6384         might arrive here.  I have my doubts that this is correct.
6385
6386         * statement.cs (Lock): Implement lock statement.
6387
6388         * cs-parser.jay: Small fixes to support `lock' and `using'
6389
6390         * cs-tokenizer.cs: Remove extra space
6391
6392         * driver.cs: New flag --checked, allows to turn on integer math
6393         checking. 
6394
6395         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
6396         Threading.Monitor.Exit 
6397         
6398 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
6399
6400         * expression.cs (IndexerAccess::DoResolveLValue): Set the
6401         Expression Class to be IndexerAccess.
6402
6403         Notice that Indexer::DoResolve sets the eclass to Value.
6404
6405 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
6406
6407         * class.cs (TypeContainer::Emit): Emit code for indexers.
6408
6409         * assign.cs (IAssignMethod): New interface implemented by Indexers
6410         and Properties for handling assignment.
6411
6412         (Assign::Emit): Simplify and reuse code. 
6413         
6414         * expression.cs (IndexerAccess, PropertyExpr): Implement
6415         IAssignMethod, clean up old code. 
6416
6417 2001-10-22  Ravi Pratap  <ravi@ximian.com>
6418
6419         * typemanager.cs (ImplementsInterface): New method to determine if a type
6420         implements a given interface. Provides a nice cache too.
6421
6422         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
6423         method.
6424
6425         (ConvertReferenceExplicit): Ditto.
6426
6427         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
6428         various methods, with correct names etc.
6429
6430         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
6431         Operator.UnaryNegation.
6432
6433         * cs-parser.jay (operator_declarator): Be a little clever in the case where
6434         we have a unary plus or minus operator.
6435
6436         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
6437         UnaryMinus.
6438
6439         * everywhere : update accordingly.
6440
6441         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
6442         respectively.
6443
6444         * class.cs (Method::Define): For the case where we are implementing a method
6445         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
6446         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
6447         
6448 2001-10-21  Ravi Pratap  <ravi@ximian.com>
6449
6450         * interface.cs (FindMembers): Implement to work around S.R.E
6451         lameness.
6452
6453         * typemanager.cs (IsInterfaceType): Implement.
6454
6455         (FindMembers): Update to handle interface types too.
6456
6457         * expression.cs (ImplicitReferenceConversion): Re-write bits which
6458         use IsAssignableFrom as that is not correct - it doesn't work.
6459
6460         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
6461         and accordingly override EmitStatement.
6462
6463         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
6464         using the correct logic :-)
6465
6466 2001-10-19  Ravi Pratap  <ravi@ximian.com>
6467
6468         * ../errors/cs-11.cs : Add to demonstrate error -11 
6469
6470 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
6471
6472         * assign.cs (Assign::Resolve): Resolve right hand side first, and
6473         then pass this as a hint to ResolveLValue.
6474         
6475         * expression.cs (FieldExpr): Add Location information
6476
6477         (FieldExpr::LValueResolve): Report assignment to readonly
6478         variable. 
6479         
6480         (Expression::ExprClassFromMemberInfo): Pass location information.
6481
6482         (Expression::ResolveLValue): Add new method that resolves an
6483         LValue. 
6484
6485         (Expression::DoResolveLValue): Default invocation calls
6486         DoResolve. 
6487
6488         (Indexers): New class used to keep track of indexers in a given
6489         Type. 
6490
6491         (IStackStore): Renamed from LValue, as it did not really describe
6492         what this did.  Also ResolveLValue is gone from this interface and
6493         now is part of Expression.
6494
6495         (ElementAccess): Depending on the element access type
6496         
6497         * typemanager.cs: Add `indexer_name_type' as a Core type
6498         (System.Runtime.CompilerServices.IndexerNameAttribute)
6499
6500         * statement.cs (Goto): Take a location.
6501         
6502 2001-10-18  Ravi Pratap  <ravi@ximian.com>
6503
6504         * delegate.cs (Delegate::VerifyDelegate): New method to verify
6505         if two delegates are compatible.
6506
6507         (NewDelegate::DoResolve): Update to take care of the case when
6508         we instantiate a delegate from another delegate.
6509
6510         * typemanager.cs (FindMembers): Don't even try to look up members
6511         of Delegate types for now.
6512
6513 2001-10-18  Ravi Pratap  <ravi@ximian.com>
6514
6515         * delegate.cs (NewDelegate): New class to take care of delegate
6516         instantiation.
6517
6518         * expression.cs (New): Split the delegate related code out into 
6519         the NewDelegate class.
6520
6521         * delegate.cs (DelegateInvocation): New class to handle delegate 
6522         invocation.
6523
6524         * expression.cs (Invocation): Split out delegate related code into
6525         the DelegateInvocation class.
6526
6527 2001-10-17  Ravi Pratap  <ravi@ximian.com>
6528
6529         * expression.cs (New::DoResolve): Implement delegate creation fully
6530         and according to the spec.
6531
6532         (New::DoEmit): Update to handle delegates differently.
6533
6534         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
6535         because of which we were printing out arguments in reverse order !
6536
6537         * delegate.cs (VerifyMethod): Implement to check if the given method
6538         matches the delegate.
6539
6540         (FullDelegateDesc): Implement.
6541
6542         (VerifyApplicability): Implement.
6543
6544         * expression.cs (Invocation::DoResolve): Update to accordingly handle
6545         delegate invocations too.
6546
6547         (Invocation::Emit): Ditto.
6548
6549         * ../errors/cs1593.cs : Added.
6550
6551         * ../errors/cs1594.cs : Added.
6552
6553         * delegate.cs (InstanceExpression, TargetMethod): New properties.
6554
6555 2001-10-16  Ravi Pratap  <ravi@ximian.com>
6556
6557         * typemanager.cs (intptr_type): Core type for System.IntPtr
6558
6559         (InitCoreTypes): Update for the same.
6560
6561         (iasyncresult_type, asynccallback_type): Ditto.
6562
6563         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
6564         correct.
6565
6566         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
6567         too.
6568
6569         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
6570         the builders for the 4 members of a delegate type :-)
6571
6572         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
6573         type.
6574
6575         * expression.cs (New::DoResolve): Implement guts for delegate creation.
6576
6577         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
6578
6579 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
6580
6581         * statement.cs (Break::Emit): Implement.   
6582         (Continue::Emit): Implement.
6583
6584         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
6585         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
6586         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
6587         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
6588         end loop
6589         
6590         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
6591         properties that track the label for the current loop (begin of the
6592         loop and end of the loop).
6593
6594 2001-10-15  Ravi Pratap  <ravi@ximian.com>
6595
6596         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
6597         use of emitting anything at all.
6598
6599         * class.cs, rootcontext.cs : Get rid of calls to the same.
6600
6601         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
6602
6603         (Populate): Define the constructor correctly and set the implementation
6604         attributes.
6605
6606         * typemanager.cs (delegate_types): New hashtable to hold delegates that
6607         have been defined.
6608
6609         (AddDelegateType): Implement.
6610
6611         (IsDelegateType): Implement helper method.
6612
6613         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
6614
6615         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
6616         and accordingly handle it.
6617
6618         * delegate.cs (Populate): Take TypeContainer argument.
6619         Implement bits to define the Invoke method. However, I still haven't figured out
6620         how to take care of the native int bit :-(
6621
6622         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
6623         Qualify the name of the delegate, not its return type !
6624
6625         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
6626         conversion.
6627
6628         (StandardConversionExists): Checking for array types turns out to be recursive.
6629
6630         (ConvertReferenceExplicit): Implement array conversion.
6631
6632         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
6633         
6634 2001-10-12  Ravi Pratap  <ravi@ximian.com>
6635
6636         * cs-parser.jay (delegate_declaration): Store the fully qualified
6637         name as it is a type declaration.
6638
6639         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
6640         readonly.
6641
6642         (DefineDelegate): Renamed from Define. Does the same thing essentially,
6643         as TypeContainer::DefineType.
6644
6645         (Populate): Method in which all the definition of the various methods (Invoke)
6646         etc is done.
6647
6648         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
6649         see.
6650         
6651         (CloseDelegate): Finally creates the delegate.
6652
6653         * class.cs (TypeContainer::DefineType): Update to define delegates.
6654         (Populate, Emit and CloseType): Do the same thing here too.
6655
6656         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
6657         delegates in all these operations.
6658
6659 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
6660
6661         * expression.cs: LocalTemporary: a new expression used to
6662         reference a temporary that has been created.
6663
6664         * assign.cs: Handle PropertyAccess back here, so that we can
6665         provide the proper semantic access to properties.
6666
6667         * expression.cs (Expression::ConvertReferenceExplicit): Implement
6668         a few more explicit conversions. 
6669
6670         * modifiers.cs: `NEW' modifier maps to HideBySig.
6671
6672         * expression.cs (PropertyExpr): Make this into an
6673         ExpressionStatement, and support the EmitStatement code path. 
6674
6675         Perform get/set error checking, clean up the interface.
6676
6677         * assign.cs: recognize PropertyExprs as targets, and if so, turn
6678         them into toplevel access objects.
6679
6680 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
6681
6682         * expression.cs: PropertyExpr::PropertyExpr: use work around the
6683         SRE.
6684
6685         * typemanager.cs: Keep track here of our PropertyBuilders again to
6686         work around lameness in SRE.
6687
6688 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
6689
6690         * expression.cs (LValue::LValueResolve): New method in the
6691         interface, used to perform a second resolution pass for LValues. 
6692         
6693         (This::DoResolve): Catch the use of this in static methods.
6694
6695         (This::LValueResolve): Implement.
6696
6697         (This::Store): Remove warning, assigning to `this' in structures
6698         is 
6699
6700         (Invocation::Emit): Deal with invocation of
6701         methods on value types.  We need to pass the address to structure
6702         methods rather than the object itself.  (The equivalent code to
6703         emit "this" for structures leaves the entire structure on the
6704         stack instead of a pointer to it). 
6705
6706         (ParameterReference::DoResolve): Compute the real index for the
6707         argument based on whether the method takes or not a `this' pointer
6708         (ie, the method is static).
6709
6710         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
6711         value types returned from functions when we need to invoke a
6712         method on the sturcture.
6713         
6714
6715 2001-10-11  Ravi Pratap  <ravi@ximian.com>
6716
6717         * class.cs (TypeContainer::DefineType): Method to actually do the business of
6718         defining the type in the Modulebuilder or Typebuilder. This is to take
6719         care of nested types which need to be defined on the TypeBuilder using
6720         DefineNestedMethod.
6721
6722         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
6723         methods in RootContext, only ported to be part of TypeContainer.
6724
6725         (TypeContainer::GetInterfaceOrClass): Ditto.
6726
6727         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
6728
6729         * interface.cs (Interface::DefineInterface): New method. Does exactly
6730         what RootContext.CreateInterface did earlier, only it takes care of nested types 
6731         too.
6732
6733         (Interface::GetInterfaces): Move from RootContext here and port.
6734
6735         (Interface::GetInterfaceByName): Same here.
6736
6737         * rootcontext.cs (ResolveTree): Re-write.
6738
6739         (PopulateTypes): Re-write.
6740
6741         * class.cs (TypeContainer::Populate): Populate nested types too.
6742         (TypeContainer::Emit): Emit nested members too.
6743
6744         * typemanager.cs (AddUserType): Do not make use of the FullName property,
6745         instead just use the name argument passed in as it is already fully
6746         qualified.
6747
6748         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
6749         to TypeContainer mapping to see if a type is user-defined.
6750
6751         * class.cs (TypeContainer::CloseType): Implement. 
6752
6753         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
6754         the default constructor.
6755         
6756         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
6757         twice.
6758
6759         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
6760
6761         * interface.cs (CloseType): Create the type here.
6762         
6763         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
6764         the hierarchy.
6765
6766         Remove all the methods which are now in TypeContainer.
6767
6768 2001-10-10  Ravi Pratap  <ravi@ximian.com>
6769
6770         * delegate.cs (Define): Re-write bits to define the delegate
6771         correctly.
6772
6773 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
6774
6775         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
6776
6777         * expression.cs (ImplicitReferenceConversion): handle null as well
6778         as a source to convert to any reference type.
6779
6780         * statement.cs (Return): Perform any implicit conversions to
6781         expected return type.  
6782
6783         Validate use of return statement.  
6784
6785         * codegen.cs (EmitContext): Pass the expected return type here.
6786
6787         * class.cs (Method, Constructor, Property): Pass expected return
6788         type to EmitContext.
6789
6790 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
6791
6792         * expression.cs: Make DoResolve take an EmitContext instead of a
6793         TypeContainer.
6794
6795         Replaced `l' and `location' for `loc', for consistency.
6796         
6797         (Error, Warning): Remove unneeded Tc argument.
6798
6799         * assign.cs, literal.cs, constant.cs: Update to new calling
6800         convention. 
6801         
6802         * codegen.cs: EmitContext now contains a flag indicating whether
6803         code is being generated in a static method or not.
6804
6805         * cs-parser.jay: DecomposeQI, new function that replaces the old
6806         QualifiedIdentifier.  Now we always decompose the assembled
6807         strings from qualified_identifier productions into a group of
6808         memberaccesses.
6809
6810 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
6811
6812         * rootcontext.cs: Deal with field-less struct types correctly now
6813         by passing the size option to Define Type.
6814
6815         * class.cs: Removed hack that created one static field. 
6816
6817 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
6818
6819         * statement.cs: Moved most of the code generation here. 
6820
6821 2001-10-09  Ravi Pratap  <ravi@ximian.com>
6822
6823         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
6824         seem very right.
6825
6826         (ElementAccess): Remove useless bits for now - keep checks as the spec
6827         says.
6828
6829 2001-10-08  Ravi Pratap  <ravi@ximian.com>
6830
6831         * expression.cs (ElementAccess::DoResolve): Remove my crap code
6832         and start performing checks according to the spec.
6833
6834 2001-10-07  Ravi Pratap  <ravi@ximian.com>
6835
6836         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
6837         rank_specifiers instead.
6838
6839         (rank_specifiers): Change the order in which the rank specifiers are stored
6840
6841         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
6842
6843         * expression.cs (ElementAccess): Implement the LValue interface too.
6844         
6845 2001-10-06  Ravi Pratap  <ravi@ximian.com>
6846         
6847         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
6848         except that user defined conversions are not included.
6849
6850         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
6851         perform the conversion of the return type, if necessary.
6852
6853         (New::DoResolve): Check whether we are creating an array or an object
6854         and accordingly do the needful.
6855
6856         (New::Emit): Same here.
6857
6858         (New::DoResolve): Implement guts of array creation.
6859
6860         (New::FormLookupType): Helper function.
6861
6862 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
6863
6864         * codegen.cs: Removed most of the code generation here, and move the
6865         corresponding code generation bits to the statement classes. 
6866
6867         Added support for try/catch/finalize and throw.
6868         
6869         * cs-parser.jay: Added support for try/catch/finalize.
6870
6871         * class.cs: Catch static methods having the flags override,
6872         virtual or abstract.
6873
6874         * expression.cs (UserCast): This user cast was not really doing
6875         what it was supposed to do.  Which is to be born in fully resolved
6876         state.  Parts of the resolution were being performed at Emit time! 
6877
6878         Fixed this code.
6879
6880 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
6881
6882         * expression.cs: Implicity convert the result from UserCast.
6883
6884 2001-10-05  Ravi Pratap  <ravi@ximian.com>
6885
6886         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
6887         prevented it from working correctly. 
6888
6889         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
6890         merely ConvertImplicit.
6891
6892 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
6893
6894         * typemanager.cs: Make the LookupTypeContainer function static,
6895         and not per-instance.  
6896
6897         * class.cs: Make static FindMembers (the one that takes a Type
6898         argument). 
6899
6900         * codegen.cs: Add EmitForeach here.
6901
6902         * cs-parser.jay: Make foreach a toplevel object instead of the
6903         inline expansion, as we need to perform semantic analysis on it. 
6904
6905 2001-10-05  Ravi Pratap  <ravi@ximian.com>
6906
6907         * expression.cs (Expression::ImplicitUserConversion): Rename to
6908         UserDefinedConversion.
6909
6910         (Expression::UserDefinedConversion): Take an extra argument specifying 
6911         whether we look for explicit user conversions too.
6912
6913         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
6914
6915         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
6916
6917         (ExplicitUserConversion): Make it a call to UserDefinedConversion
6918         with the appropriate arguments.
6919
6920         * cs-parser.jay (cast_expression): Record location too.
6921
6922         * expression.cs (Cast): Record location info.
6923
6924         (Expression::ConvertExplicit): Take location argument.
6925
6926         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
6927         to determine if we are doing explicit conversions.
6928
6929         (UserCast::Emit): Update accordingly.
6930
6931         (Expression::ConvertExplicit): Report an error if everything fails.
6932
6933         * ../errors/cs0030.cs : Add.
6934
6935 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
6936
6937         * modifiers.cs: If the ABSTRACT keyword is present, also set the
6938         virtual and newslot bits. 
6939
6940         * class.cs (TypeContainer::RegisterRequiredImplementations):
6941         Record methods we need.
6942
6943         (TypeContainer::MakeKey): Helper function to make keys for
6944         MethodBases, since the Methodbase key is useless.
6945
6946         (TypeContainer::Populate): Call RegisterRequiredImplementations
6947         before defining the methods.   
6948
6949         Create a mapping for method_builders_to_methods ahead of time
6950         instead of inside a tight loop.
6951
6952         (::RequireMethods):  Accept an object as the data to set into the
6953         hashtable so we can report interface vs abstract method mismatch.
6954
6955 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
6956
6957         * report.cs: Make all of it static.
6958
6959         * rootcontext.cs: Drop object_type and value_type computations, as
6960         we have those in the TypeManager anyways.
6961
6962         Drop report instance variable too, now it is a global.
6963
6964         * driver.cs: Use try/catch on command line handling.
6965
6966         Add --probe option to debug the error reporting system with a test
6967         suite. 
6968
6969         * report.cs: Add support for exiting program when a probe
6970         condition is reached.
6971
6972 2001-10-03  Ravi Pratap  <ravi@ximian.com>
6973
6974         * expression.cs (Binary::DoNumericPromotions): Fix the case when
6975         we do a forcible conversion regardless of type, to check if 
6976         ForceConversion returns a null.
6977
6978         (Binary::error19): Use location to report error.
6979
6980         (Unary::error23): Use location here too.
6981
6982         * ../errors/cs0019.cs : Check in.
6983
6984         * ../errors/cs0023.cs : Check in.
6985
6986         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
6987         case of a non-null MethodInfo object with a length of 0 !
6988
6989         (Binary::ResolveOperator): Flag error if overload resolution fails to find
6990         an applicable member - according to the spec :-)
6991         Also fix logic to find members in base types.
6992
6993         (Unary::ResolveOperator): Same here.
6994
6995         (Unary::report23): Change name to error23 and make first argument a TypeContainer
6996         as I was getting thoroughly confused between this and error19 :-)
6997         
6998         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
6999         (::FindMostEncompassedType): Implement.
7000         (::FindMostEncompassingType): Implement.
7001         (::StandardConversionExists): Implement.
7002
7003         (UserImplicitCast): Re-vamp. We now need info about most specific
7004         source and target types so that we can do the necessary conversions.
7005
7006         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
7007         mathematical union with no duplicates.
7008
7009 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
7010
7011         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
7012         in order from base classes to child classes, so that we can in
7013         child classes look up in our parent for method names and
7014         attributes (required for handling abstract, virtual, new, override
7015         constructs: we need to instrospect our base class, and if we dont
7016         populate the classes in order, the introspection might be
7017         incorrect.  For example, a method could query its parent before
7018         the parent has any methods and would determine that the parent has
7019         no abstract methods (while it could have had them)).
7020
7021         (RootContext::CreateType): Record the order in which we define the
7022         classes.
7023
7024 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
7025
7026         * class.cs (TypeContainer::Populate): Also method definitions can
7027         fail now, keep track of this.
7028
7029         (TypeContainer::FindMembers): Implement support for
7030         DeclaredOnly/noDeclaredOnly flag.
7031
7032         (Constructor::Emit) Return the ConstructorBuilder.
7033
7034         (Method::Emit) Return the MethodBuilder. 
7035         Check for abstract or virtual methods to be public.
7036
7037         * rootcontext.cs (RootContext::CreateType): Register all the
7038         abstract methods required for the class to be complete and the
7039         interface methods that must be implemented. 
7040
7041         * cs-parser.jay: Report error 501 (method requires body if it is
7042         not marked abstract or extern).
7043
7044         * expression.cs (TypeOf::Emit): Implement.
7045
7046         * typemanager.cs: runtime_handle_type, new global type.
7047
7048         * class.cs (Property::Emit): Generate code for properties.
7049
7050 2001-10-02  Ravi Pratap  <ravi@ximian.com>
7051
7052         * expression.cs (Unary::ResolveOperator): Find operators on base type
7053         too - we now conform exactly to the spec.
7054
7055         (Binary::ResolveOperator): Same here.
7056
7057         * class.cs (Operator::Define): Fix minor quirk in the tests.
7058
7059         * ../errors/cs0215.cs : Added.
7060
7061         * ../errors/cs0556.cs : Added.
7062
7063         * ../errors/cs0555.cs : Added.
7064
7065 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
7066
7067         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
7068         single integer which is really efficient
7069
7070 2001-10-01  Ravi Pratap  <ravi@ximian.com>
7071
7072         *  expression.cs (Expression::ImplicitUserConversion): Use location
7073         even in the case when we are examining True operators.
7074  
7075         * class.cs (Operator::Define): Perform extensive checks to conform
7076         with the rules for operator overloading in the spec.
7077
7078         * expression.cs (Expression::ImplicitReferenceConversion): Implement
7079         some of the other conversions mentioned in the spec.
7080
7081         * typemanager.cs (array_type): New static member for the System.Array built-in
7082         type.
7083
7084         (cloneable_interface): For System.ICloneable interface.
7085
7086         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
7087         we start resolving the tree and populating types.
7088
7089         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
7090  
7091 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
7092
7093         * expression.cs (Expression::ExprClassFromMemberInfo,
7094         Expression::Literalize): Create literal expressions from
7095         FieldInfos which are literals.
7096
7097         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
7098         type casts, because they were wrong.  The test suite in tests
7099         caught these ones.
7100
7101         (ImplicitNumericConversion): ushort to ulong requires a widening
7102         cast. 
7103
7104         Int32 constant to long requires widening cast as well.
7105
7106         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
7107         for integers because the type on the stack is not i4.
7108
7109 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
7110
7111         * expression.cs (report118): require location argument. 
7112
7113         * parameter.cs: Do not dereference potential null value.
7114
7115         * class.cs: Catch methods that lack the `new' keyword when
7116         overriding a name.  Report warnings when `new' is used without
7117         anything being there to override.
7118
7119         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
7120
7121         * class.cs: Only add constructor to hashtable if it is non-null
7122         (as now constructors can fail on define).
7123
7124         (TypeManager, Class, Struct): Take location arguments.
7125
7126         Catch field instance initialization in structs as errors.
7127
7128         accepting_filter: a new filter for FindMembers that is static so
7129         that we dont create an instance per invocation.
7130
7131         (Constructor::Define): Catch errors where a struct constructor is
7132         parameterless 
7133
7134         * cs-parser.jay: Pass location information for various new
7135         constructs. 
7136         
7137         * delegate.cs (Delegate): take a location argument.
7138
7139         * driver.cs: Do not call EmitCode if there were problesm in the
7140         Definition of the types, as many Builders wont be there. 
7141
7142         * decl.cs (Decl::Decl): Require a location argument.
7143
7144         * cs-tokenizer.cs: Handle properly hex constants that can not fit
7145         into integers, and find the most appropiate integer for it.
7146
7147         * literal.cs: Implement ULongLiteral.
7148
7149         * rootcontext.cs: Provide better information about the location of
7150         failure when CreateType fails.
7151         
7152 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
7153
7154         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
7155         as well.
7156
7157         * expression.cs (Binary::CheckShiftArguments): Add missing type
7158         computation.
7159         (Binary::ResolveOperator): Add type to the logical and and logical
7160         or, Bitwise And/Or and Exclusive Or code paths, it was missing
7161         before.
7162
7163         (Binary::DoNumericPromotions): In the case where either argument
7164         is ulong (and most signed types combined with ulong cause an
7165         error) perform implicit integer constant conversions as well.
7166
7167 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
7168
7169         * expression.cs (UserImplicitCast): Method should always be
7170         non-null. 
7171         (Invocation::BetterConversion): Simplified test for IntLiteral.
7172
7173         (Expression::ImplicitNumericConversion): Split this routine out.
7174         Put the code that performs implicit constant integer conversions
7175         here. 
7176
7177         (Expression::Resolve): Become a wrapper around DoResolve so we can
7178         check eclass and type being set after resolve.
7179
7180         (Invocation::Badness): Remove this dead function
7181
7182         (Binary::ResolveOperator): Do not compute the expensive argumnets
7183         unless we have a union for it.
7184
7185         (Probe::Emit): Is needs to do an isinst and then
7186         compare against null.
7187
7188         (::CanConvert): Added Location argument.  If the Location argument
7189         is null (Location.Null), then we do not report errors.  This is
7190         used by the `probe' mechanism of the Explicit conversion.  We do
7191         not want to generate an error for something that the user
7192         explicitly requested to be casted.  But the pipeline for an
7193         explicit cast first tests for potential implicit casts.
7194
7195         So for now, if the Location is null, it means `Probe only' to
7196         avoid adding another argument.   Might have to revise this
7197         strategy later.
7198
7199         (ClassCast): New class used to type cast objects into arbitrary
7200         classes (used in Explicit Reference Conversions).
7201
7202         Implement `as' as well.
7203
7204         Reverted all the patches from Ravi below: they were broken:
7205
7206                 * The use of `level' as a mechanism to stop recursive
7207                   invocations is wrong.  That was there just to catch the
7208                   bug with a strack trace but not as a way of addressing
7209                   the problem.
7210
7211                   To fix the problem we have to *understand* what is going
7212                   on and the interactions and come up with a plan, not
7213                   just get things going.
7214
7215                 * The use of the type conversion cache that I proposed
7216                   last night had an open topic: How does this work across
7217                   protection domains.  A user defined conversion might not
7218                   be public in the location where we are applying the
7219                   conversion, a different conversion might be selected
7220                   (ie, private A->B (better) but public B->A (worse),
7221                   inside A, A->B applies, but outside it, B->A will
7222                   apply).
7223
7224                 * On top of that (ie, even if the above is solved),
7225                   conversions in a cache need to be abstract.  Ie, `To
7226                   convert from an Int to a Short use an OpcodeCast', not
7227                   `To convert from an Int to a Short use the OpcodeCast on
7228                   the variable 5' (which is what this patch was doing).
7229         
7230 2001-09-28  Ravi Pratap  <ravi@ximian.com>
7231
7232         * expression.cs (Invocation::ConversionExists): Re-write to use
7233         the conversion cache
7234         
7235         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
7236         cache all conversions done, not just user-defined ones.
7237
7238         (Invocation::BetterConversion): The real culprit. Use ConversionExists
7239         to determine if a conversion exists instead of acutually trying to 
7240         perform the conversion. It's faster too.
7241
7242         (Expression::ConvertExplicit): Modify to use ConversionExists to check
7243         and only then attempt the implicit conversion.
7244
7245 2001-09-28  Ravi Pratap  <ravi@ximian.com>
7246
7247         * expression.cs (ConvertImplicit): Use a cache for conversions
7248         already found. Check level of recursion and bail out if necessary.
7249         
7250 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
7251
7252         * typemanager.cs (string_concat_string_string, string_concat_object_object):
7253         Export standard methods that we expect for string operations.
7254         
7255         * statement.cs (Block::UsageWarning): Track usage of variables and
7256         report the errors for not used variables.
7257
7258         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
7259         operator. 
7260
7261 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
7262
7263         * codegen.cs: remove unnneded code 
7264
7265         * expression.cs: Removed BuiltinTypeAccess class
7266
7267         Fix the order in which implicit conversions are
7268         done.  
7269
7270         The previous fixed dropped support for boxed conversions (adding a
7271         test to the test suite now)
7272
7273         (UserImplicitCast::CanConvert): Remove test for source being null,
7274         that code is broken.  We should not feed a null to begin with, if
7275         we do, then we should track the bug where the problem originates
7276         and not try to cover it up here.
7277
7278         Return a resolved expression of type UserImplicitCast on success
7279         rather than true/false.  Ravi: this is what I was talking about,
7280         the pattern is to use a static method as a "constructor" for
7281         objects. 
7282
7283         Also, do not create arguments until the very last minute,
7284         otherwise we always create the arguments even for lookups that
7285         will never be performed. 
7286
7287         (UserImplicitCast::Resolve): Eliminate, objects of type
7288         UserImplicitCast are born in a fully resolved state. 
7289         
7290         * typemanager.cs (InitCoreTypes): Init also value_type
7291         (System.ValueType). 
7292
7293         * expression.cs (Cast::Resolve): First resolve the child expression.
7294
7295         (LValue): Add new method AddressOf to be used by
7296         the `&' operator.  
7297
7298         Change the argument of Store to take an EmitContext instead of an
7299         ILGenerator, because things like FieldExpr need to be able to call
7300         their children expression to generate the instance code. 
7301
7302         (Expression::Error, Expression::Warning): Sugar functions for
7303         reporting errors.
7304
7305         (Expression::MemberLookup): Accept a TypeContainer instead of a
7306         Report as the first argument.
7307
7308         (Expression::ResolvePrimary): Killed.  I still want to improve
7309         this as currently the code is just not right.
7310
7311         (Expression::ResolveMemberAccess): Simplify, but it is still
7312         wrong. 
7313
7314         (Unary::Resolve): Catch errors in AddressOf operators.
7315
7316         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
7317         index to a byte for the short-version, or the compiler will choose
7318         the wrong Emit call, which generates the wrong data.
7319
7320         (ParameterReference::Emit, ::Store): same.
7321
7322         (FieldExpr::AddressOf): Implement.
7323         
7324         * typemanager.cs: TypeManager: made public variable instead of
7325         property.
7326         
7327         * driver.cs: document --fatal.
7328
7329         * report.cs (ErrorMessage, WarningMessage): new names for the old
7330         Error and Warning classes.
7331
7332         * cs-parser.jay (member_access): Turn built-in access to types
7333         into a normal simplename
7334
7335 2001-09-27  Ravi Pratap  <ravi@ximian.com>
7336
7337         * expression.cs (Invocation::BetterConversion): Fix to cope
7338         with q being null, since this was introducing a bug.
7339
7340         * expression.cs (ConvertImplicit): Do built-in conversions first.
7341
7342 2001-09-27  Ravi Pratap  <ravi@ximian.com>
7343
7344         * expression.cs (UserImplicitCast::Resolve): Fix bug.
7345
7346 2001-09-27  Ravi Pratap  <ravi@ximian.com>
7347
7348         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
7349         I had introduced long ago (what's new ?).
7350
7351         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
7352         the work of all the checking. 
7353         (ConvertImplicit): Call CanConvert and only then create object if necessary.
7354         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
7355
7356         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
7357         that is the right way. 
7358
7359         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
7360         overloading resolution. Use everywhere instead of cutting and pasting code.
7361
7362         (Binary::ResolveOperator): Use MakeUnionSet.
7363
7364         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
7365         we have to convert to bool types. Not complete yet.
7366         
7367 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
7368
7369         * typemanager.cs (TypeManager::CSharpName): support ushort.
7370
7371         * expression.cs (Expression::TryImplicitIntConversion): Attempts
7372         to provide an expression that performsn an implicit constant int
7373         conversion (section 6.1.6).
7374         (Expression::ConvertImplicitRequired): Reworked to include
7375         implicit constant expression conversions.
7376
7377         (Expression::ConvertNumericExplicit): Finished.
7378
7379         (Invocation::Emit): If InstanceExpression is null, then it means
7380         that we perform a call on this.
7381         
7382 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
7383
7384         * expression.cs (Unary::Emit): Remove some dead code.
7385         (Probe): Implement Resolve and Emit for `is'.
7386         (Expression::ConvertImplicitRequired): Attempt to do constant
7387         expression conversions here.  Maybe should be moved to
7388         ConvertImplicit, but I am not sure.
7389         (Expression::ImplicitLongConstantConversionPossible,
7390         Expression::ImplicitIntConstantConversionPossible): New functions
7391         that tell whether is it possible to apply an implicit constant
7392         expression conversion.
7393
7394         (ConvertNumericExplicit): Started work on explicit numeric
7395         conversions.
7396
7397         * cs-parser.jay: Update operator constants.
7398
7399         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
7400         (Parameters::GetSignature): Hook up VerifyArgs here.
7401         (Parameters::VerifyArgs): Verifies that no two arguments have the
7402         same name. 
7403
7404         * class.cs (Operator): Update the operator names to reflect the
7405         ones that the spec expects (as we are just stringizing the
7406         operator names).
7407         
7408         * expression.cs (Unary::ResolveOperator): Fix bug: Use
7409         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
7410         previous usage did only work for our methods.
7411         (Expression::ConvertImplicit): Handle decimal implicit numeric
7412         conversions as well.
7413         (Expression::InternalTypeConstructor): Used to invoke constructors
7414         on internal types for default promotions.
7415
7416         (Unary::Emit): Implement special handling for the pre/post
7417         increment/decrement for overloaded operators, as they need to have
7418         the same semantics as the other operators.
7419
7420         (Binary::ResolveOperator): ditto.
7421         (Invocation::ConversionExists): ditto.
7422         (UserImplicitCast::Resolve): ditto.
7423         
7424 2001-09-26  Ravi Pratap  <ravi@ximian.com>
7425
7426         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
7427         operator, return after emitting body. Regression tests pass again !
7428
7429         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
7430         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
7431         (Invocation::OverloadResolve): Ditto.
7432         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
7433
7434         * everywhere : update calls to the above methods accordingly.
7435
7436 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
7437
7438         * assign.cs (Assign): Make it inherit from ExpressionStatement.
7439
7440         * expression.cs (ExpressionStatement): New base class used for
7441         expressions that can appear in statements, so that we can provide
7442         an alternate path to generate expression that do not leave a value
7443         on the stack.
7444
7445         (Expression::Emit, and all the derivatives): We no longer return
7446         whether a value is left on the stack or not.  Every expression
7447         after being emitted leaves a single value on the stack.
7448
7449         * codegen.cs (EmitContext::EmitStatementExpression): Use the
7450         facilties of ExpressionStatement if possible.
7451
7452         * cs-parser.jay: Update statement_expression.
7453
7454 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
7455
7456         * driver.cs: Change the wording of message
7457
7458 2001-09-25  Ravi Pratap  <ravi@ximian.com>
7459
7460         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
7461         the type of the expression to the return type of the method if
7462         we have an overloaded operator match ! The regression tests pass again !
7463         (Unary::ResolveOperator): Ditto.
7464
7465         * expression.cs (Invocation::ConversionExists): Correct the member lookup
7466         to find "op_Implicit", not "implicit" ;-)
7467         (UserImplicitCast): New class to take care of user-defined implicit conversions.
7468         (ConvertImplicit, ForceConversion): Take TypeContainer argument
7469
7470         * everywhere : Correct calls to the above accordingly.
7471
7472         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
7473         (ConvertImplicit): Do user-defined conversion if it exists.
7474
7475 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
7476
7477         * assign.cs: track location.
7478         (Resolve): Use implicit conversions on assignment.
7479
7480         * literal.cs: Oops.  Not good, Emit of short access values should
7481         pass (Bytes) or the wrong argument will be selected.
7482
7483         * expression.cs (Unary::Emit): Emit code for -expr.
7484         
7485         (Unary::ResolveOperator): Handle `Substract' for non-constants
7486         (substract from zero from the non-constants).
7487         Deal with Doubles as well. 
7488         
7489         (Expression::ConvertImplicitRequired): New routine that reports an
7490         error if no implicit conversion exists. 
7491
7492         (Invocation::OverloadResolve): Store the converted implicit
7493         expressions if we make them
7494         
7495 2001-09-24  Ravi Pratap  <ravi@ximian.com>
7496
7497         * class.cs (ConstructorInitializer): Take a Location argument.
7498         (ConstructorBaseInitializer): Same here.
7499         (ConstructorThisInitializer): Same here.
7500
7501         * cs-parser.jay : Update all calls accordingly.
7502
7503         * expression.cs (Unary, Binary, New): Take location argument.
7504         Update accordingly everywhere.
7505
7506         * cs-parser.jay : Update all calls to the above to take a location
7507         argument.
7508
7509         * class.cs : Ditto.
7510
7511 2001-09-24  Ravi Pratap  <ravi@ximian.com>
7512
7513         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
7514         (Invocation::BetterConversion): Same here
7515         (Invocation::ConversionExists): Ditto.
7516
7517         (Invocation::ConversionExists): Implement.
7518
7519 2001-09-22  Ravi Pratap  <ravi@ximian.com>
7520
7521         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
7522         Also take an additional TypeContainer argument.
7523
7524         * All over : Pass in TypeContainer as argument to OverloadResolve.
7525
7526         * typemanager.cs (CSharpName): Update to check for the string type and return
7527         that too.
7528
7529         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
7530         a given method.
7531         
7532 2001-09-21  Ravi Pratap  <ravi@ximian.com>
7533
7534         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
7535         (Invocation::BetterFunction): Implement.
7536         (Invocation::BetterConversion): Implement.
7537         (Invocation::ConversionExists): Skeleton, no implementation yet.
7538
7539         Okay, things work fine !
7540
7541 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
7542
7543         * typemanager.cs: declare and load enum_type, delegate_type and
7544         void_type. 
7545
7546         * expression.cs (Expression::Emit): Now emit returns a value that
7547         tells whether a value is left on the stack or not.  This strategy
7548         might be reveted tomorrow with a mechanism that would address
7549         multiple assignments.
7550         (Expression::report118): Utility routine to report mismatches on
7551         the ExprClass.
7552
7553         (Unary::Report23): Report impossible type/operator combination
7554         utility function.
7555
7556         (Unary::IsIncrementableNumber): Whether the type can be
7557         incremented or decremented with add.
7558         (Unary::ResolveOperator): Also allow enumerations to be bitwise
7559         complemented. 
7560         (Unary::ResolveOperator): Implement ++, !, ~,
7561
7562         (Invocation::Emit): Deal with new Emit convetion.
7563         
7564         * All Expression derivatives: Updated their Emit method to return
7565         whether they leave values on the stack or not.
7566         
7567         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
7568         stack for expressions that are statements. 
7569
7570 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
7571
7572         * expression.cs (LValue): New interface.  Must be implemented by
7573         LValue objects.
7574         (LocalVariableReference, ParameterReference, FieldExpr): Implement
7575         LValue interface.
7576         
7577         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
7578         interface for generating code, simplifies the code.
7579
7580 2001-09-20  Ravi Pratap  <ravi@ximian.com>
7581
7582         * expression.cs (everywhere): Comment out return statements in ::Resolve
7583         methods to avoid the warnings.
7584
7585 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
7586
7587         * driver.cs (parse): Report error 2001 if we can not open the
7588         source file.
7589
7590         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
7591         not resolve it.
7592
7593         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
7594         object. 
7595
7596         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
7597         otherwise nested blocks end up with the same index.
7598
7599         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
7600
7601         * expression.cs:  Instead of having FIXMEs in the Resolve
7602         functions, throw exceptions so it is obvious that we are facing a
7603         bug. 
7604
7605         * cs-parser.jay (invocation_expression): Pass Location information.
7606
7607         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
7608         Use a basename for those routines because .NET does not like paths
7609         on them. 
7610
7611         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
7612         already defined.
7613
7614 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
7615
7616         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
7617         are loading the correct data types (throws an exception if not).
7618         (TypeManager::InitCoreTypes): Use CoreLookupType
7619
7620         * expression.cs (Unary::ResolveOperator): return the child
7621         expression for expressions which are just +expr.
7622         (Unary::ResolveOperator): Return negative literals for -LITERAL
7623         expressions (otherwise they are Unary {Literal}).
7624         (Invocation::Badness): Take into account `Implicit constant
7625         expression conversions'.
7626
7627         * literal.cs (LongLiteral): Implement long literal class.
7628         (IntLiteral): export the `Value' of the intliteral. 
7629
7630 2001-09-19  Ravi Pratap  <ravi@ximian.com>
7631
7632         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
7633
7634         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
7635         instead of 'Operator'
7636
7637         * expression.cs (Binary::ResolveOperator): Update accordingly.
7638         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
7639         and 'Minus'
7640
7641         * cs-parser.jay (unary_expression): Update to use the new names.
7642
7643         * gen-treedump.cs (GetUnary): Same here.
7644
7645         * expression.cs (Unary::Resolve): Implement.
7646         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
7647         operators are found instead of making noise ;-)
7648         (Unary::ResolveOperator): New method to do precisely the same thing which
7649         Binary::ResolveOperator does for Binary expressions.
7650         (Unary.method, .Arguments): Add.
7651         (Unary::OperName): Implement.   
7652         (Unary::ForceConversion): Copy and Paste !
7653
7654         * class.cs (Operator::Define): Fix a small bug for the case when we have 
7655         a unary operator.
7656
7657         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
7658         for the inbuilt operators. Only overloading works for now ;-)
7659
7660 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
7661
7662         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
7663         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
7664
7665         * expression.cs (This::Emit): Implement. 
7666         (This::Resolve): Implement.
7667         (TypeOf:Resolve): Implement.
7668         (Expression::ResolveSimpleName): Add an implicit this to instance
7669         field references. 
7670         (MemberAccess::Resolve): Deal with Parameters and Fields. 
7671         Bind instance variable to Field expressions.
7672         (FieldExpr::Instance): New field used to track the expression that
7673         represents the object instance.
7674         (FieldExpr::Resolve): Track potential errors from MemberLookup not
7675         binding 
7676         (FieldExpr::Emit): Implement.
7677
7678         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
7679         the last instruction contains a return opcode to avoid generating
7680         the last `ret' instruction (this generates correct code, and it is
7681         nice to pass the peverify output).
7682
7683         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
7684         initializer for static and instance variables.
7685         (Constructor::Emit): Allow initializer to be null in the case of
7686         static constructors.  Only emit initializer for instance
7687         constructors. 
7688
7689         (TypeContainer::FindMembers): Return a null array if there are no
7690         matches.
7691
7692         Also fix the code for the MemberTypes.Method branch, as it was not
7693         scanning that for operators (or tried to access null variables before).
7694
7695         * assign.cs (Assign::Emit): Handle instance and static fields. 
7696
7697         * TODO: Updated.
7698
7699         * driver.cs: Stop compilation if there are parse errors.
7700
7701         * cs-parser.jay (constructor_declaration): Provide default base
7702         initializer for non-static constructors.
7703         (constructor_declarator): Do not provide a default base
7704         initializers if none was specified.
7705         Catch the fact that constructors should not have parameters.
7706
7707         * class.cs: Do not emit parent class initializers for static
7708         constructors, that should be flagged as an error.
7709
7710 2001-09-18  Ravi Pratap  <ravi@ximian.com>
7711
7712         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
7713         Move back code into TypeContainer::Populate.
7714
7715 2001-09-18  Ravi Pratap  <ravi@ximian.com>
7716
7717         * class.cs (TypeContainer::AddConstructor): Fix the check to
7718         compare against Name, not Basename. 
7719         (Operator::OpType): Change Plus and Minus to Add and Subtract.
7720
7721         * cs-parser.jay : Update accordingly.
7722
7723         * class.cs (TypeContainer::FindMembers): For the case where we are searching
7724         for methods, don't forget to look into the operators too.
7725         (RegisterMethodBuilder): Helper method to take care of this for
7726         methods, constructors and operators.
7727         (Operator::Define): Completely revamp.
7728         (Operator.OperatorMethod, MethodName): New fields.
7729         (TypeContainer::Populate): Move the registering of builders into
7730         RegisterMethodBuilder.
7731         (Operator::Emit): Re-write.
7732
7733         * expression.cs (Binary::Emit): Comment out code path to emit method
7734         invocation stuff for the case when we have a user defined operator. I am
7735         just not able to get it right !
7736         
7737 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
7738
7739         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
7740         argument. 
7741
7742         (Expression::MemberLookup): Provide a version that allows to
7743         specify the MemberTypes and BindingFlags. 
7744
7745         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
7746         so it was not fetching variable information from outer blocks.
7747
7748         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
7749         Beforefieldinit as it was buggy.
7750
7751         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
7752         that Ravi put here.  
7753
7754         * class.cs (Constructor::Emit): Only emit if block is not null.
7755         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
7756         deal with this by semantically definining it as if the user had
7757         done it.
7758
7759         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
7760         constructors as we now "emit" them at a higher level.
7761
7762         (TypeContainer::DefineDefaultConstructor): Used to define the
7763         default constructors if none was provided.
7764
7765         (ConstructorInitializer): Add methods Resolve and Emit. 
7766         
7767         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
7768
7769 2001-09-17  Ravi Pratap  <ravi@ximian.com>
7770
7771         * class.cs (TypeContainer::EmitDefaultConstructor): Register
7772         the default constructor builder with our hashtable for methodbuilders
7773         to methodcores.
7774
7775         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
7776         and argument_count is 0 in which case we have a match.
7777         (Binary::ResolveOperator): More null checking and miscellaneous coding
7778         style cleanup.
7779
7780 2001-09-17  Ravi Pratap  <ravi@ximian.com>
7781
7782         * rootcontext.cs (IsNameSpace): Compare against null.
7783
7784         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
7785
7786         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
7787         and Unary::Operator.
7788
7789         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
7790         accordingly.
7791
7792         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
7793         we have overloaded operators.
7794         (Binary::ResolveOperator): Implement the part which does the operator overload
7795         resolution.
7796
7797         * class.cs (Operator::Emit): Implement.
7798         (TypeContainer::Emit): Emit the operators we have too.
7799
7800         * expression.cs (Binary::Emit): Update to emit the appropriate code for
7801         the case when we have a user-defined operator.
7802         
7803 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
7804
7805         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
7806
7807 2001-09-16  Ravi Pratap  <ravi@ximian.com>
7808
7809         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
7810         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
7811         (Constructor::Emit): Implement.
7812         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
7813         if we have no work to do. 
7814         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
7815         Emit method.
7816
7817         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
7818         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
7819
7820         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
7821         of parent.parent.
7822
7823 2001-09-15  Ravi Pratap  <ravi@ximian.com>
7824
7825         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
7826         in the source.
7827         (Tree::RecordNamespace): Method to do what the name says ;-)
7828         (Tree::Namespaces): Property to get at the namespaces hashtable.
7829
7830         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
7831         keep track.
7832
7833         * rootcontext.cs (IsNamespace): Fixed it :-)
7834
7835 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
7836
7837         * class.cs (TypeContainer::FindMembers): Add support for
7838         constructors. 
7839         (MethodCore): New class that encapsulates both the shared aspects
7840         of a Constructor and a Method.  
7841         (Method, Constructor): Factored pieces into MethodCore.
7842
7843         * driver.cs: Added --fatal which makes errors throw exceptions.
7844         Load System assembly as well as part of the standard library.
7845
7846         * report.cs: Allow throwing exceptions on errors for debugging.
7847
7848         * modifiers.cs: Do not use `parent', instead use the real type
7849         container to evaluate permission settings.
7850
7851         * class.cs: Put Ravi's patch back in.  He is right, and we will
7852         have to cope with the
7853
7854 2001-09-14  Ravi Pratap  <ravi@ximian.com>
7855
7856         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
7857         FamORAssem, not FamANDAssem.
7858         
7859 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
7860
7861         * driver.cs: Added --parse option that only parses its input files
7862         and terminates.
7863
7864         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
7865         incorrect.  IsTopLevel is not used to tell whether an object is
7866         root_types or not (that can be achieved by testing this ==
7867         root_types).  But to see if this is a top-level *class* (not
7868         necessarly our "toplevel" container). 
7869
7870 2001-09-14  Ravi Pratap  <ravi@ximian.com>
7871
7872         * enum.cs (Enum::Define): Modify to call the Lookup method on the
7873         parent instead of a direct call to GetType.
7874
7875 2001-09-14  Ravi Pratap  <ravi@ximian.com>
7876
7877         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
7878         Modifiers.TypeAttr. This should just be a call to that method.
7879
7880         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
7881         object so that we can determine if we are top-level or not.
7882
7883         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
7884         TypeContainer too.
7885
7886         * enum.cs (Enum::Define): Ditto.
7887
7888         * modifiers.cs (FieldAttr): Re-write.
7889
7890         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
7891         (TypeContainer::HaveStaticConstructor): New property to provide access
7892         to precisely that info.
7893
7894         * modifiers.cs (MethodAttr): Re-write.
7895         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
7896
7897         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
7898         of top-level types as claimed.
7899         
7900 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
7901
7902         * expression.cs (MemberLookup): Fruitless attempt to lookup
7903         constructors.  Maybe I need to emit default constructors?  That
7904         might be it (currently .NET emits this for me automatically).
7905         (Invocation::OverloadResolve): Cope with Arguments == null.
7906         (Invocation::EmitArguments): new function, shared by the new
7907         constructor and us.
7908         (Invocation::Emit): Handle static and instance methods.  Emit
7909         proper call instruction for virtual or non-virtual invocations.
7910         (New::Emit): Implement.
7911         (New::Resolve): Implement.
7912         (MemberAccess:Resolve): Implement.
7913         (MethodGroupExpr::InstanceExpression): used conforming to the spec
7914         to track instances.
7915         (FieldExpr::Resolve): Set type.
7916
7917         * support.cs: Handle empty arguments.
7918                 
7919         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
7920         SimpleLookup): Auxiliary routines to help parse a qualifier
7921         identifier.  
7922
7923         Update qualifier_identifier rule.
7924
7925         * codegen.cs: Removed debugging messages.
7926
7927         * class.cs: Make this a global thing, this acts just as a "key" to
7928         objects that we might have around.
7929
7930         (Populate): Only initialize method_builders_to_methods once.
7931
7932         * expression.cs (PropertyExpr): Initialize type from the
7933         PropertyType. 
7934
7935         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
7936         Resolve pattern.  Attempt to implicitly convert value to boolean.
7937         Emit code.
7938
7939         * expression.cs: Set the type for the int32/int32 argument case.
7940         (Binary::ResolveOperator): Set the return type to boolean for
7941         comparission operators
7942
7943         * typemanager.cs: Remove debugging print code.
7944
7945         (Invocation::Resolve): resolve type.
7946
7947         * class.cs: Allocate a MemberInfo of the correct size, as the code
7948         elsewhere depends on the test to reflect the correct contents.
7949
7950         (Method::) Keep track of parameters, due to System.Reflection holes
7951
7952         (TypeContainer::Populate): Keep track of MethodBuilders to Method
7953         mapping here.
7954
7955         (TypeContainer::FindMembers): Use ArrayList and then copy an array
7956         of the exact size and return that.
7957
7958         (Class::LookupMethodByBuilder): New function that maps
7959         MethodBuilders to its methods.  Required to locate the information
7960         on methods because System.Reflection bit us again.
7961
7962         * support.cs: New file, contains an interface ParameterData and
7963         two implementations: ReflectionParameters and InternalParameters
7964         used to access Parameter information.  We will need to grow this
7965         as required.
7966
7967         * expression.cs (Invocation::GetParameterData): implement a cache
7968         and a wrapper around the ParameterData creation for methods. 
7969         (Invocation::OverloadResolve): Use new code.
7970
7971 2001-09-13  Ravi Pratap  <ravi@ximian.com>
7972
7973         * class.cs (TypeContainer::EmitField): Remove and move into 
7974         (Field::Define): here and modify accordingly.
7975         (Field.FieldBuilder): New member.
7976         (TypeContainer::Populate): Update accordingly.
7977         (TypeContainer::FindMembers): Implement.
7978
7979 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
7980
7981         * statement.cs: (VariableInfo::VariableType): New field to be
7982         initialized with the full type once it is resolved. 
7983
7984 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
7985
7986         * parameter.cs (GetParameterInfo): Use a type cache to compute
7987         things only once, and to reuse this information
7988
7989         * expression.cs (LocalVariableReference::Emit): Implement.
7990         (OpcodeCast::Emit): fix.
7991
7992         (ParameterReference::Resolve): Implement.
7993         (ParameterReference::Emit): Implement.
7994
7995         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
7996         that are expressions need to stay as Expressions.
7997
7998         * typemanager.cs (CSharpName): Returns the C# name of a type if
7999         possible. 
8000
8001         * expression.cs (Expression::ConvertImplicit): New function that
8002         implements implicit type conversions.
8003
8004         (Expression::ImplicitReferenceConversion): Implements implicit
8005         reference conversions.
8006
8007         (EmptyCast): New type for transparent casts.
8008
8009         (OpcodeCast): New type for casts of types that are performed with
8010         a sequence of bytecodes.
8011         
8012         (BoxedCast): New type used for casting value types into reference
8013         types.  Emits a box opcode.
8014
8015         (Binary::DoNumericPromotions): Implements numeric promotions of
8016         and computation of the Binary::Type.
8017
8018         (Binary::EmitBranchable): Optimization.
8019
8020         (Binary::Emit): Implement code emission for expressions.
8021         
8022         * typemanager.cs (TypeManager): Added two new core types: sbyte
8023         and byte.
8024
8025 2001-09-12  Ravi Pratap  <ravi@ximian.com>
8026
8027         * class.cs (TypeContainer::FindMembers): Method which does exactly
8028         what Type.FindMembers does, only we don't have to use reflection. No
8029         implementation yet.
8030
8031         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
8032         typecontainer objects as we need to get at them.
8033         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
8034
8035         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
8036         typecontainer object.
8037
8038         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
8039         of just a Report object.
8040
8041 2001-09-11  Ravi Pratap  <ravi@ximian.com>
8042
8043         * class.cs (Event::Define): Go back to using the prefixes "add_" and
8044         "remove_"
8045         (TypeContainer::Populate): Now define the delegates of the type too.
8046         (TypeContainer.Delegates): Property to access the list of delegates defined
8047         in the type.
8048
8049         * delegates.cs (Delegate::Define): Implement partially.
8050
8051         * modifiers.cs (TypeAttr): Handle more flags.
8052
8053 2001-09-11  Ravi Pratap  <ravi@ximian.com>
8054
8055         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
8056         and not <=
8057         (Operator::Define): Re-write logic to get types by using the LookupType method
8058         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
8059         (Indexer::Define): Ditto.
8060         (Event::Define): Ditto.
8061         (Property::Define): Ditto.
8062         
8063 2001-09-10  Ravi Pratap  <ravi@ximian.com>
8064
8065         * class.cs (TypeContainer::Populate): Now define operators too. 
8066         (TypeContainer.Operators): New property to access the list of operators
8067         in a type.
8068         (Operator.OperatorMethodBuilder): New member to hold the method builder
8069         for the operator we are defining.
8070         (Operator::Define): Implement.
8071
8072 2001-09-10  Ravi Pratap  <ravi@ximian.com>
8073
8074         * class.cs (Event::Define): Make the prefixes of the accessor methods
8075         addOn_ and removeOn_ 
8076
8077         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
8078         of the location being passed in too. Ideally, this should go later since all
8079         error reporting should be done through the Report object.
8080
8081         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
8082         (Populate): Iterate thru the indexers we have and define them too.
8083         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
8084         for the get and set accessors.
8085         (Indexer::Define): Implement.
8086         
8087 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
8088
8089         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
8090         my previous implementation, did not work.
8091
8092         * typemanager.cs: Add a couple of missing types (the longs).
8093
8094         * literal.cs: Use TypeManager.bool_type instead of getting it.
8095
8096         * expression.cs (EventExpr): New kind of expressions.
8097         (Expressio::ExprClassFromMemberInfo): finish
8098
8099 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
8100
8101         * assign.cs: Emit stores to static fields differently.
8102
8103 2001-09-08  Ravi Pratap  <ravi@ximian.com>
8104
8105         * Merge in changes and adjust code to tackle conflicts. Backed out my
8106         code in Assign::Resolve ;-) 
8107
8108 2001-09-08  Ravi Pratap  <ravi@ximian.com>
8109
8110         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
8111         instead Report.Error and also pass in the location.
8112         (CSharpParser::Lexer): New readonly property to return the reference
8113         to the Tokenizer object.
8114         (declare_local_variables): Use Report.Error with location instead of plain 
8115         old error.
8116         (CheckDef): Ditto.
8117
8118         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
8119         (Operator.CheckBinaryOperator): Ditto.
8120
8121         * cs-parser.jay (operator_declarator): Update accordingly.
8122
8123         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
8124         (CheckBinaryOperator): Same here.
8125
8126         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
8127         on the name without any prefixes of namespace names etc. This is because we
8128         already might have something already fully qualified like 
8129         'System.Console.WriteLine'
8130
8131         * assign.cs (Resolve): Begin implementation. Stuck ;-)
8132
8133 2001-09-07  Ravi Pratap  <ravi@ximian.com>
8134
8135         * cs-tokenizer.cs (location): Return a string which also contains
8136         the file name.
8137
8138         * expression.cs (ElementAccess): New class for expressions of the
8139         type 'element access.'
8140         (BaseAccess): New class for expressions of the type 'base access.'
8141         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
8142         respectively.
8143         
8144         * cs-parser.jay (element_access): Implement action.
8145         (base_access): Implement actions.
8146         (checked_expression, unchecked_expression): Implement.
8147
8148         * cs-parser.jay (local_variable_type): Correct and implement.
8149         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
8150
8151         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
8152
8153         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
8154         name and the specifiers.
8155
8156         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
8157         
8158         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
8159         making them all public ;-)
8160
8161         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
8162         class anyways.
8163         
8164 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
8165
8166         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
8167         PropertyExprs.
8168         (FieldExpr, PropertyExprs): New resolved expressions.
8169         (SimpleName::MemberStaticCheck): Perform static checks for access
8170         to non-static fields on static methods. Maybe this should be
8171         generalized for MemberAccesses. 
8172         (SimpleName::ResolveSimpleName): More work on simple name
8173         resolution. 
8174
8175         * cs-parser.jay (primary_expression/qualified_identifier): track
8176         the parameter index.
8177
8178         * codegen.cs (CodeGen::Save): Catch save exception, report error.
8179         (EmitContext::EmitBoolExpression): Chain to expression generation
8180         instead of temporary hack.
8181         (::EmitStatementExpression): Put generic expression code generation.
8182
8183         * assign.cs (Assign::Emit): Implement variable assignments to
8184         local variables, parameters and fields.
8185
8186 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
8187
8188         * statement.cs (Block::GetVariableInfo): New method, returns the
8189         VariableInfo for a variable name in a block.
8190         (Block::GetVariableType): Implement in terms of GetVariableInfo
8191
8192         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
8193         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
8194
8195 2001-09-06  Ravi Pratap  <ravi@ximian.com>
8196
8197         * cs-parser.jay (operator_declaration): Continue on my quest : update
8198         to take attributes argument.
8199         (event_declaration): Ditto.
8200         (enum_declaration): Ditto.
8201         (indexer_declaration): Ditto.
8202         
8203         * class.cs (Operator::Operator): Update constructor accordingly.
8204         (Event::Event): Ditto.
8205
8206         * delegate.cs (Delegate::Delegate): Same here.
8207
8208         * enum.cs (Enum::Enum): Same here.
8209         
8210 2001-09-05  Ravi Pratap  <ravi@ximian.com>
8211
8212         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
8213
8214         * ../tests/cs0658.cs : New file to demonstrate error 0658.
8215
8216         * attribute.cs (Attributes): New class to encapsulate all attributes which were
8217         being passed around as an arraylist.
8218         (Attributes::AddAttribute): Method to add attribute sections.
8219
8220         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
8221         (struct_declaration): Update accordingly.
8222         (constant_declaration): Update.
8223         (field_declaration): Update.
8224         (method_header): Update.
8225         (fixed_parameter): Update.
8226         (parameter_array): Ditto.
8227         (property_declaration): Ditto.
8228         (destructor_declaration): Ditto.
8229         
8230         * class.cs (Struct::Struct): Update constructors accordingly.
8231         (Class::Class): Ditto.
8232         (Field::Field): Ditto.
8233         (Method::Method): Ditto.
8234         (Property::Property): Ditto.
8235         (TypeContainer::OptAttribute): update property's return type.
8236         
8237         * interface.cs (Interface.opt_attributes): New member.
8238         (Interface::Interface): Update to take the extra Attributes argument.
8239
8240         * parameter.cs (Parameter::Parameter): Ditto.
8241
8242         * constant.cs (Constant::Constant): Ditto.
8243
8244         * interface.cs (InterfaceMemberBase): New OptAttributes field.
8245         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
8246         the attributes as a parameter.
8247         (InterfaceProperty): Update constructor call.
8248         (InterfaceEvent): Ditto.
8249         (InterfaceMethod): Ditto.
8250         (InterfaceIndexer): Ditto.
8251
8252         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
8253         pass the attributes too.
8254         (interface_event_declaration): Ditto.
8255         (interface_property_declaration): Ditto.
8256         (interface_method_declaration): Ditto.
8257         (interface_declaration): Ditto.
8258
8259 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
8260
8261         * class.cs (Method::Define): Track the "static Main" definition to
8262         create an entry point. 
8263
8264         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
8265         EntryPoint if we find it. 
8266
8267         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
8268         (EmitContext::ig): Make this variable public.
8269
8270         * driver.cs: Make the default output file be the first file name
8271         with the .exe extension.  
8272
8273         Detect empty compilations
8274
8275         Handle various kinds of output targets.  Handle --target and
8276         rename -t to --dumper.
8277
8278         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
8279         methods inherited from Expression return now an Expression.  This
8280         will is used during the tree rewriting as we resolve them during
8281         semantic analysis.
8282
8283         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
8284         the spec.  Missing entirely is the information about
8285         accessability of elements of it.
8286
8287         (Expression::ExprClassFromMemberInfo): New constructor for
8288         Expressions that creates a fully initialized Expression based on
8289         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
8290         a Type.
8291
8292         (Invocation::Resolve): Begin implementing resolution of invocations.
8293         
8294         * literal.cs (StringLiteral):  Implement Emit.
8295
8296 2001-09-05  Ravi Pratap  <ravi@ximian.com>
8297
8298         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
8299         member.
8300         
8301 2001-09-04  Ravi Pratap  <ravi@ximian.com>
8302
8303         * cs-parser.jay (attribute_arguments): Implement actions.
8304         (attribute): Fix bug in production. Implement action.
8305         (attribute_list): Implement.
8306         (attribute_target): Implement.
8307         (attribute_target_specifier, opt_target_specifier): Implement
8308         (CheckAttributeTarget): New method to check if the attribute target
8309         is valid.
8310         (attribute_section): Implement.
8311         (opt_attributes): Implement.
8312
8313         * attribute.cs : New file to handle attributes.
8314         (Attribute): Class to hold attribute info.
8315
8316         * cs-parser.jay (opt_attribute_target_specifier): Remove production
8317         (attribute_section): Modify production to use 2 different rules to 
8318         achieve the same thing. 1 s/r conflict down !
8319         Clean out commented, useless, non-reducing dimension_separator rules.
8320         
8321         * class.cs (TypeContainer.attributes): New member to hold list
8322         of attributes for a type.
8323         (Struct::Struct): Modify to take one more argument, the attribute list.
8324         (Class::Class): Ditto.
8325         (Field::Field): Ditto.
8326         (Method::Method): Ditto.
8327         (Property::Property): Ditto.
8328         
8329         * cs-parser.jay (struct_declaration): Update constructor call to
8330         pass in the attributes too.
8331         (class_declaration): Ditto.
8332         (constant_declaration): Ditto.
8333         (field_declaration): Ditto.
8334         (method_header): Ditto.
8335         (fixed_parameter): Ditto.
8336         (parameter_array): Ditto.
8337         (property_declaration): Ditto.
8338
8339         * constant.cs (Constant::Constant): Update constructor similarly.
8340         Use System.Collections.
8341
8342         * parameter.cs (Parameter::Parameter): Update as above.
8343
8344 2001-09-02  Ravi Pratap  <ravi@ximian.com>
8345
8346         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
8347         (TypeContainer.delegates): New member to hold list of delegates.
8348
8349         * cs-parser.jay (delegate_declaration): Implement the action correctly 
8350         this time as I seem to be on crack ;-)
8351
8352 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
8353
8354         * rootcontext.cs (RootContext::IsNamespace): new function, used to
8355         tell whether an identifier represents a namespace.
8356
8357         * expression.cs (NamespaceExpr): A namespace expression, used only
8358         temporarly during expression resolution.
8359         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
8360         utility functions to resolve names on expressions.
8361
8362 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
8363
8364         * codegen.cs: Add hook for StatementExpressions. 
8365
8366         * class.cs: Fix inverted test for static flag in methods.
8367
8368 2001-09-02  Ravi Pratap  <ravi@ximian.com>
8369
8370         * class.cs (Operator::CheckUnaryOperator): Correct error number used
8371         to make it coincide with MS' number.
8372         (Operator::CheckBinaryOperator): Ditto.
8373
8374         * ../errors/errors.txt : Remove error numbers added earlier.
8375
8376         * ../errors/cs1019.cs : Test case for error # 1019
8377
8378         * ../errros/cs1020.cs : Test case for error # 1020
8379
8380         * cs-parser.jay : Clean out commented cruft.
8381         (dimension_separators, dimension_separator): Comment out. Ostensibly not
8382         used anywhere - non-reducing rule.
8383         (namespace_declarations): Non-reducing rule - comment out.
8384
8385         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
8386         with TypeContainer::AddEnum.
8387
8388         * delegate.cs : New file for delegate handling classes.
8389         (Delegate): Class for declaring delegates.
8390
8391         * makefile : Update.
8392
8393         * cs-parser.jay (delegate_declaration): Implement.
8394
8395 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
8396
8397         * class.cs (Event::Define): Implement.
8398         (Event.EventBuilder): New member.
8399
8400         * class.cs (TypeContainer::Populate): Update to define all enums and events
8401         we have.
8402         (Events): New property for the events arraylist we hold. Shouldn't we move to using
8403         readonly fields for all these cases ?
8404
8405 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
8406
8407         * class.cs (Property): Revamp to use the convention of making fields readonly.
8408         Accordingly modify code elsewhere.
8409
8410         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
8411         the Define method of the Property class.
8412
8413         * class.cs : Clean up applied patch and update references to variables etc. Fix 
8414         trivial bug.
8415         (TypeContainer::Populate): Update to define all the properties we have. Also
8416         define all enumerations.
8417
8418         * enum.cs (Define): Implement.
8419         
8420 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
8421
8422         * cs-parser.jay (overloadable_operator): The semantic value is an
8423         enum of the Operator class.
8424         (operator_declarator): Implement actions.
8425         (operator_declaration): Implement.
8426
8427         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
8428         validity of definitions.
8429         (Operator::CheckBinaryOperator): Static method to check for binary operators
8430         (TypeContainer::AddOperator): New method to add an operator to a type.
8431
8432         * cs-parser.jay (indexer_declaration): Added line to actually call the
8433         AddIndexer method so it gets added ;-)
8434
8435         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
8436         already taken care of by the MS compiler ?  
8437
8438 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
8439
8440         * class.cs (Operator): New class for operator declarations.
8441         (Operator::OpType): Enum for the various operators.
8442
8443 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
8444
8445         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
8446         ostensibly handle this in semantic analysis.
8447
8448         * cs-parser.jay (general_catch_clause): Comment out
8449         (specific_catch_clauses, specific_catch_clause): Ditto.
8450         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
8451         (catch_args, opt_catch_args): New productions.
8452         (catch_clause): Rewrite to use the new productions above
8453         (catch_clauses): Modify accordingly.
8454         (opt_catch_clauses): New production to use in try_statement
8455         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
8456         and re-write the code in the actions to extract the specific and
8457         general catch clauses by being a little smart ;-)
8458
8459         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
8460         Hooray, try and catch statements parse fine !
8461         
8462 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
8463
8464         * statement.cs (Block::GetVariableType): Fix logic to extract the type
8465         string from the hashtable of variables.
8466
8467         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
8468         I end up making that mistake ;-)
8469         (catch_clauses): Fixed gross error which made Key and Value of the 
8470         DictionaryEntry the same : $1 !!
8471
8472 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
8473
8474         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
8475
8476         * cs-parser.jay (event_declaration): Correct to remove the semicolon
8477         when the add and remove accessors are specified. 
8478
8479 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
8480
8481         * cs-parser.jay (IndexerDeclaration): New helper class to hold
8482         information about indexer_declarator.
8483         (indexer_declarator): Implement actions.
8484         (parsing_indexer): New local boolean used to keep track of whether
8485         we are parsing indexers or properties. This is necessary because 
8486         implicit_parameters come into picture even for the get accessor in the 
8487         case of an indexer.
8488         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
8489
8490         * class.cs (Indexer): New class for indexer declarations.
8491         (TypeContainer::AddIndexer): New method to add an indexer to a type.
8492         (TypeContainer::indexers): New member to hold list of indexers for the
8493         type.
8494
8495 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
8496
8497         * cs-parser.jay (add_accessor_declaration): Implement action.
8498         (remove_accessor_declaration): Implement action.
8499         (event_accessors_declaration): Implement
8500         (variable_declarators): swap statements for first rule - trivial.
8501
8502         * class.cs (Event): New class to hold information about event
8503         declarations.
8504         (TypeContainer::AddEvent): New method to add an event to a type
8505         (TypeContainer::events): New member to hold list of events.
8506
8507         * cs-parser.jay (event_declaration): Implement actions.
8508
8509 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
8510
8511         * cs-parser.jay (dim_separators): Implement. Make it a string
8512         concatenating all the commas together, just as they appear.
8513         (opt_dim_separators): Modify accordingly
8514         (rank_specifiers): Update accordingly. Basically do the same
8515         thing - instead, collect the brackets here.
8516         (opt_rank_sepcifiers): Modify accordingly.
8517         (array_type): Modify to actually return the complete type string
8518         instead of ignoring the rank_specifiers.
8519         (expression_list): Implement to collect the expressions
8520         (variable_initializer): Implement. We make it a list of expressions
8521         essentially so that we can handle the array_initializer case neatly too.
8522         (variable_initializer_list): Implement.
8523         (array_initializer): Make it a list of variable_initializers
8524         (opt_array_initializer): Modify accordingly.
8525
8526         * expression.cs (New::NType): Add enumeration to help us
8527         keep track of whether we have an object/delegate creation
8528         or an array creation.
8529         (New:NewType, New::Rank, New::Indices, New::Initializers): New
8530         members to hold data about array creation.
8531         (New:New): Modify to update NewType
8532         (New:New): New Overloaded contructor for the array creation
8533         case.
8534
8535         * cs-parser.jay (array_creation_expression): Implement to call
8536         the overloaded New constructor.
8537         
8538 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
8539
8540         * class.cs (TypeContainer::Constructors): Return member
8541         constructors instead of returning null.
8542
8543 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
8544
8545         * typemanager.cs (InitCoreTypes): Initialize the various core
8546         types after we have populated the type manager with the user
8547         defined types (this distinction will be important later while
8548         compiling corlib.dll)
8549
8550         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
8551         on Expression Classification.  Now all expressions have a method
8552         `Resolve' and a method `Emit'.
8553
8554         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
8555         generation from working.     Also add some temporary debugging
8556         code. 
8557         
8558 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
8559
8560         * codegen.cs: Lots of code generation pieces.  This is only the
8561         beginning, will continue tomorrow with more touches of polish.  We
8562         handle the fundamentals of if, while, do, for, return.  Others are
8563         trickier and I need to start working on invocations soon.
8564         
8565         * gen-treedump.cs: Bug fix, use s.Increment here instead of
8566         s.InitStatement. 
8567
8568         * codegen.cs (EmitContext): New struct, used during code
8569         emission to keep a context.   Most of the code generation will be
8570         here. 
8571
8572         * cs-parser.jay: Add embedded blocks to the list of statements of
8573         this block.  So code generation proceeds in a top down fashion.
8574
8575 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
8576
8577         * statement.cs: Add support for multiple child blocks.
8578
8579 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
8580
8581         * codegen.cs (EmitCode): New function, will emit the code for a
8582         Block of code given a TypeContainer and its ILGenerator. 
8583
8584         * statement.cs (Block): Standard public readonly optimization.
8585         (Block::Block constructors): Link children. 
8586         (Block::Child): Child Linker.
8587         (Block::EmitVariables): Emits IL variable declarations.
8588
8589         * class.cs: Drop support for MethodGroups here, delay until
8590         Semantic Analysis.
8591         (Method::): Applied the same simplification that I did before, and
8592         move from Properties to public readonly fields.
8593         (Method::ParameterTypes): Returns the parameter types for the
8594         function, and implements a cache that will be useful later when I
8595         do error checking and the semantic analysis on the methods is
8596         performed.
8597         (Constructor::GetCallingConvention): Renamed from CallingConvetion
8598         and made a method, optional argument tells whether this is a class
8599         or a structure to apply the `has-this' bit.
8600         (Method::GetCallingConvention): Implement, returns the calling
8601         convention. 
8602         (Method::Define): Defines the type, a second pass is performed
8603         later to populate the methods.
8604
8605         (Constructor::ParameterTypes): implement a cache similar to the
8606         one on Method::ParameterTypes, useful later when we do semantic
8607         analysis. 
8608
8609         (TypeContainer::EmitMethod):  New method.  Emits methods.
8610
8611         * expression.cs: Removed MethodGroup class from here.
8612         
8613         * parameter.cs (Parameters::GetCallingConvention): new method.
8614
8615 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
8616
8617         * class.cs (TypeContainer::Populate): Drop RootContext from the
8618         argument. 
8619
8620         (Constructor::CallingConvention): Returns the calling convention.
8621         (Constructor::ParameterTypes): Returns the constructor parameter
8622         types. 
8623         
8624         (TypeContainer::AddConstructor): Keep track of default constructor
8625         and the default static constructor.
8626
8627         (Constructor::) Another class that starts using `public readonly'
8628         instead of properties. 
8629
8630         (Constructor::IsDefault): Whether this is a default constructor. 
8631
8632         (Field::) use readonly public fields instead of properties also.
8633
8634         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
8635         track of static constructors;  If none is used, turn on
8636         BeforeFieldInit in the TypeAttributes. 
8637
8638         * cs-parser.jay (opt_argument_list): now the return can be null
8639         for the cases where there are no arguments. 
8640
8641         (constructor_declarator): If there is no implicit `base' or
8642         `this', then invoke the default parent constructor. 
8643         
8644         * modifiers.cs (MethodAttr): New static function maps a set of
8645         modifiers flags into a MethodAttributes enum
8646         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
8647         MethodAttr, TypeAttr to represent the various mappings where the
8648         modifiers are used.
8649         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
8650
8651 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
8652
8653         * parameter.cs (GetParameterInfo): Fix bug where there would be no
8654         method arguments.
8655
8656         * interface.cs (PopulateIndexer): Implemented the code generator
8657         for interface indexers.
8658
8659 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
8660
8661         * interface.cs (InterfaceMemberBase): Now we track the new status
8662         here.  
8663
8664         (PopulateProperty): Implement property population.  Woohoo!  Got
8665         Methods and Properties going today. 
8666
8667         Removed all the properties for interfaces, and replaced them with
8668         `public readonly' fields. 
8669
8670 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
8671
8672         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
8673         initialize their hashtables/arraylists only when they are needed
8674         instead of doing this always.
8675
8676         * parameter.cs: Handle refs and out parameters.
8677
8678         * cs-parser.jay: Use an ArrayList to construct the arguments
8679         instead of the ParameterCollection, and then cast that to a
8680         Parameter[] array.
8681
8682         * parameter.cs: Drop the use of ParameterCollection and use
8683         instead arrays of Parameters.
8684
8685         (GetParameterInfo): Use the Type, not the Name when resolving
8686         types. 
8687
8688 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
8689
8690         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
8691         and instead use public readonly fields.
8692
8693         * class.cs: Put back walking code for type containers.
8694
8695 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
8696
8697         * class.cs (MakeConstant): Code to define constants.
8698
8699         * rootcontext.cs (LookupType): New function.  Used to locate types 
8700
8701         
8702 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
8703
8704         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
8705         this System.Reflection code is.  Kudos to Microsoft
8706         
8707         * typemanager.cs: Implement a type cache and avoid loading all
8708         types at boot time.  Wrap in LookupType the internals.  This made
8709         the compiler so much faster.  Wow.  I rule!
8710         
8711         * driver.cs: Make sure we always load mscorlib first (for
8712         debugging purposes, nothing really important).
8713
8714         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
8715         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
8716
8717         * rootcontext.cs: Lookup types on their namespace;  Lookup types
8718         on namespaces that have been imported using the `using' keyword.
8719
8720         * class.cs (TypeContainer::TypeAttr): Virtualize.
8721         (Class::TypeAttr): Return attributes suitable for this bad boy.
8722         (Struct::TypeAttr): ditto.
8723         Handle nested classes.
8724         (TypeContainer::) Remove all the type visiting code, it is now
8725         replaced with the rootcontext.cs code
8726
8727         * rootcontext.cs (GetClassBases): Added support for structs. 
8728
8729 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
8730
8731         * interface.cs, statement.cs, class.cs, parameter.cs,
8732         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
8733         Drop use of TypeRefs, and use strings instead.
8734
8735 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
8736
8737         * rootcontext.cs: 
8738
8739         * class.cs (Struct::Struct): set the SEALED flags after
8740         checking the modifiers.
8741         (TypeContainer::TypeAttr): new property, returns the
8742         TypeAttributes for a class.  
8743
8744         * cs-parser.jay (type_list): Oops, list production was creating a
8745         new list of base types.
8746
8747         * rootcontext.cs (StdLib): New property.
8748         (GetInterfaceTypeByName): returns an interface by type name, and
8749         encapsulates error handling here.
8750         (GetInterfaces): simplified.
8751         (ResolveTree): Encapsulated all the tree resolution here.
8752         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
8753         types. 
8754         
8755         * driver.cs: Add support for --nostdlib, to avoid loading the
8756         default assemblies.
8757         (Main): Do not put tree resolution here. 
8758
8759         * rootcontext.cs: Beginning of the class resolution.
8760
8761 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
8762
8763         * rootcontext.cs: Provide better error reporting. 
8764
8765         * cs-parser.jay (interface_base): set our $$ to be interfaces.
8766
8767         * rootcontext.cs (CreateInterface): Handle the case where there
8768         are no parent interfaces.
8769         
8770         (CloseTypes): Routine to flush types at the end.
8771         (CreateInterface): Track types.
8772         (GetInterfaces): Returns an array of Types from the list of
8773         defined interfaces.
8774
8775         * typemanager.c (AddUserType): Mechanism to track user types (puts
8776         the type on the global type hash, and allows us to close it at the
8777         end). 
8778         
8779 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
8780
8781         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
8782         RecordInterface instead.
8783
8784         * cs-parser.jay: Updated to reflect changes above.
8785
8786         * decl.cs (Definition): Keep track of the TypeBuilder type that
8787         represents this type here.  Not sure we will use it in the long
8788         run, but wont hurt for now.
8789
8790         * driver.cs: Smaller changes to accomodate the new code.
8791
8792         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
8793         when done. 
8794
8795         * rootcontext.cs (CreateInterface):  New method, used to create
8796         the System.TypeBuilder type for interfaces.
8797         (ResolveInterfaces): new entry point to resolve the interface
8798         hierarchy. 
8799         (CodeGen): Property, used to keep track of the code generator.
8800
8801 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
8802
8803         * cs-parser.jay: Add a second production for delegate_declaration
8804         with `VOID'.
8805
8806         (enum_body): Put an opt_comma here instead of putting it on
8807         enum_body or enum_member_declarations so we can handle trailing
8808         commas on enumeration members.  Gets rid of a shift/reduce.
8809         
8810         (type_list): Need a COMMA in the middle.
8811
8812         (indexer_declaration): Tell tokenizer to recognize get/set
8813
8814         * Remove old targets.
8815
8816         * Re-add the parser target.
8817
8818 2001-07-13  Simon Cozens <simon@simon-cozens.org>
8819
8820         * cs-parser.jay: Add precendence rules for a number of operators
8821         ot reduce the number of shift/reduce conflicts in the grammar.
8822         
8823 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
8824
8825         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
8826         and put it here.
8827
8828         Get rid of old crufty code.
8829
8830         * rootcontext.cs: Use this to keep track of the parsed
8831         representation and the defined types available to the program. 
8832
8833         * gen-treedump.cs: adjust for new convention.
8834
8835         * type.cs: Split out the type manager, and the assembly builder
8836         from here. 
8837
8838         * typemanager.cs: the type manager will live here now.
8839
8840         * cil-codegen.cs: And the code generator here. 
8841
8842 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
8843
8844         * makefile: Fixed up for easy making.
8845
8846 2001-07-13  Simon Cozens <simon@simon-cozens.org>
8847
8848         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
8849         the 
8850
8851         (unary_expression): Expand pre_increment_expression and
8852         post_decrement_expression to reduce a shift/reduce.
8853
8854 2001-07-11  Simon Cozens
8855
8856         * cs-tokenizer.cs: Hex numbers should begin with a 0.
8857
8858         Improve allow_keyword_as_indent name.
8859
8860 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
8861
8862         * Adjustments for Beta2. 
8863
8864 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
8865
8866         * decl.cs: Added `Define' abstract method.
8867         (InTransit): new property, used to catch recursive definitions. 
8868
8869         * interface.cs: Implement `Define'. 
8870
8871         * modifiers.cs: Map Modifiers.constants to
8872         System.Reflection.TypeAttribute flags.
8873
8874         * class.cs: Keep track of types and user-defined types.
8875         (BuilderInit): New method for creating an assembly
8876         (ResolveType): New function to launch the resolution process, only
8877         used by interfaces for now.
8878
8879         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
8880         that are inserted into the name space. 
8881
8882 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
8883
8884         * ARGH.  I have screwed up my tree so many times due to the use of
8885         rsync rather than using CVS.  Going to fix this at once. 
8886
8887         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
8888         load types.
8889
8890 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
8891
8892         * Experiment successful: Use System.Type rather that our own
8893         version of Type.  
8894
8895 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
8896
8897         * cs-parser.jay: Removed nsAliases from here.
8898
8899         Use new namespaces, handle `using XXX;' 
8900
8901         * namespace.cs: Reimplemented namespace handling, use a recursive
8902         definition of the class.  Now we can keep track of using clauses
8903         and catch invalid using clauses.
8904
8905 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
8906
8907         * gen-treedump.cs: Adapted for all the renaming.
8908
8909         * expression.cs (Expression): this class now has a Type property
8910         which returns an expression Type.
8911
8912         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
8913         `Type', as this has a different meaning now in the base
8914
8915 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
8916
8917         * interface.cs, class.cs: Removed from all the sources the
8918         references to signature computation, as we can not do method
8919         signature computation during the parsing time, as we are not
8920         trying to solve at that point distinguishing:
8921
8922         class X {
8923                 void a (Blah x) {}
8924                 void a (NS.Blah x) {}
8925         }
8926
8927         Which depending on the context might be valid or not, as we do not
8928         know if Blah is the same thing as NS.Blah at that point.
8929
8930         * Redid everything so the code uses TypeRefs now instead of
8931         Types.  TypeRefs are just temporary type placeholders, that need
8932         to be resolved.  They initially have a pointer to a string and the
8933         current scope in which they are used.  This is used later by the
8934         compiler to resolve the reference to an actual Type. 
8935
8936         * DeclSpace is no longer a CIR.Type, and neither are
8937         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
8938         are all DeclSpaces, but no Types. 
8939
8940         * type.cs (TypeRefManager): This implements the TypeRef manager,
8941         which keeps track of all the types that need to be resolved after
8942         the parsing has finished. 
8943
8944 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
8945
8946         * ARGH.  We are going to have to store `foreach' as a class rather
8947         than resolving it, as we need to verify error 1579 after name
8948         resolution.   *OR* we could keep a flag that says `This request to
8949         IEnumerator comes from a foreach statement' which we can then use
8950         to generate the error.
8951
8952 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
8953
8954         * class.cs (TypeContainer.AddMethod): we now add methods to the
8955         MethodGroup instead of the method hashtable.  
8956
8957         * expression.cs: Add MethodGroup abstraction, which gets us one
8958         step closer to the specification in the way we handle method
8959         declarations.  
8960
8961         * cs-parser.jay (primary_expression): qualified_identifier now
8962         tried to match up an identifier to a local variable reference or
8963         to a parameter reference.
8964
8965         current_local_parameters is now a parser global variable that
8966         points to the current parameters for the block, used during name
8967         lookup.
8968
8969         (property_declaration): Now creates an implicit `value' argument to
8970         the set accessor.
8971
8972 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
8973
8974         * parameter.cs: Do not use `param' arguments as part of the
8975         signature, per the spec.
8976
8977 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
8978
8979         * decl.cs: Base class for classes, structs and interfaces.  This
8980         is the "Declaration Space" 
8981
8982         * cs-parser.jay: Use CheckDef for checking declaration errors
8983         instead of having one on each function.
8984
8985         * class.cs: Factor out some code for handling error handling in
8986         accordance to the "Declarations" section in the "Basic Concepts"
8987         chapter in the ECMA C# spec.
8988
8989         * interface.cs: Make all interface member classes derive from
8990         InterfaceMemberBase.
8991
8992 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
8993
8994         * Many things: all interfaces are parsed and generated in
8995         gen-treedump.  Support for member variables, constructors,
8996         destructors, properties, constants is there.
8997
8998         Beginning of the IL backend, but very little done, just there for
8999         testing purposes. 
9000
9001 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
9002
9003         * cs-parser.jay: Fix labeled statement.
9004
9005         * cs-tokenizer.cs (escape): Escape " and ' always.
9006         ref_line, ref_name: keep track of the line/filename as instructed
9007         by #line by the compiler.
9008         Parse #line.
9009
9010 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
9011
9012         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
9013         to match the values in System.CodeDOM.
9014
9015         Divid renamed to Divide.
9016
9017         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
9018         statements. 
9019         (Statements.set): remove.
9020
9021         * System.CodeDOM/CodeCatchClause.cs: always have a valid
9022         statements. 
9023
9024         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
9025         falseStatements always have valid values. 
9026
9027         * cs-parser.jay: Use System.CodeDOM now.
9028