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