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