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