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