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