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