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