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