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