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