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