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