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