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