2001-10-14 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
1 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
2
3         * expression.cs: LocalTemporary: a new expression used to
4         reference a temporary that has been created.
5
6         * assign.cs: Handle PropertyAccess back here, so that we can
7         provide the proper semantic access to properties.
8
9         * expression.cs (Expression::ConvertReferenceExplicit): Implement
10         a few more explicit conversions. 
11
12         * modifiers.cs: `NEW' modifier maps to HideBySig.
13
14         * expression.cs (PropertyExpr): Make this into an
15         ExpressionStatement, and support the EmitStatement code path. 
16
17         Perform get/set error checking, clean up the interface.
18
19         * assign.cs: recognize PropertyExprs as targets, and if so, turn
20         them into toplevel access objects.
21
22 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
23
24         * expression.cs: PropertyExpr::PropertyExpr: use work around the
25         SRE.
26
27         * typemanager.cs: Keep track here of our PropertyBuilders again to
28         work around lameness in SRE.
29
30 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
31
32         * expression.cs (LValue::LValueResolve): New method in the
33         interface, used to perform a second resolution pass for LValues. 
34         
35         (This::DoResolve): Catch the use of this in static methods.
36
37         (This::LValueResolve): Implement.
38
39         (This::Store): Remove warning, assigning to `this' in structures
40         is 
41
42         (Invocation::Emit): Deal with invocation of
43         methods on value types.  We need to pass the address to structure
44         methods rather than the object itself.  (The equivalent code to
45         emit "this" for structures leaves the entire structure on the
46         stack instead of a pointer to it). 
47
48         (ParameterReference::DoResolve): Compute the real index for the
49         argument based on whether the method takes or not a `this' pointer
50         (ie, the method is static).
51
52         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
53         value types returned from functions when we need to invoke a
54         method on the sturcture.
55         
56
57 2001-10-11  Ravi Pratap  <ravi@ximian.com>
58
59         * class.cs (TypeContainer::DefineType): Method to actually do the business of
60         defining the type in the Modulebuilder or Typebuilder. This is to take
61         care of nested types which need to be defined on the TypeBuilder using
62         DefineNestedMethod.
63
64         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
65         methods in RootContext, only ported to be part of TypeContainer.
66
67         (TypeContainer::GetInterfaceOrClass): Ditto.
68
69         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
70
71         * interface.cs (Interface::DefineInterface): New method. Does exactly
72         what RootContext.CreateInterface did earlier, only it takes care of nested types 
73         too.
74
75         (Interface::GetInterfaces): Move from RootContext here and port.
76
77         (Interface::GetInterfaceByName): Same here.
78
79         * rootcontext.cs (ResolveTree): Re-write.
80
81         (PopulateTypes): Re-write.
82
83         * class.cs (TypeContainer::Populate): Populate nested types too.
84         (TypeContainer::Emit): Emit nested members too.
85
86         * typemanager.cs (AddUserType): Do not make use of the FullName property,
87         instead just use the name argument passed in as it is already fully
88         qualified.
89
90         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
91         to TypeContainer mapping to see if a type is user-defined.
92
93         * class.cs (TypeContainer::CloseType): Implement. 
94
95         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
96         the default constructor.
97         
98         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
99         twice.
100
101         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
102
103         * interface.cs (CloseType): Create the type here.
104         
105         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
106         the hierarchy.
107
108         Remove all the methods which are now in TypeContainer.
109
110 2001-10-10  Ravi Pratap  <ravi@ximian.com>
111
112         * delegate.cs (Define): Re-write bits to define the delegate
113         correctly.
114
115 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
116
117         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
118
119         * expression.cs (ImplicitReferenceConversion): handle null as well
120         as a source to convert to any reference type.
121
122         * statement.cs (Return): Perform any implicit conversions to
123         expected return type.  
124
125         Validate use of return statement.  
126
127         * codegen.cs (EmitContext): Pass the expected return type here.
128
129         * class.cs (Method, Constructor, Property): Pass expected return
130         type to EmitContext.
131
132 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
133
134         * expression.cs: Make DoResolve take an EmitContext instead of a
135         TypeContainer.
136
137         Replaced `l' and `location' for `loc', for consistency.
138         
139         (Error, Warning): Remove unneeded Tc argument.
140
141         * assign.cs, literal.cs, constant.cs: Update to new calling
142         convention. 
143         
144         * codegen.cs: EmitContext now contains a flag indicating whether
145         code is being generated in a static method or not.
146
147         * cs-parser.jay: DecomposeQI, new function that replaces the old
148         QualifiedIdentifier.  Now we always decompose the assembled
149         strings from qualified_identifier productions into a group of
150         memberaccesses.
151
152 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
153
154         * rootcontext.cs: Deal with field-less struct types correctly now
155         by passing the size option to Define Type.
156
157         * class.cs: Removed hack that created one static field. 
158
159 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
160
161         * statement.cs: Moved most of the code generation here. 
162
163 2001-10-09  Ravi Pratap  <ravi@ximian.com>
164
165         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
166         seem very right.
167
168         (ElementAccess): Remove useless bits for now - keep checks as the spec
169         says.
170
171 2001-10-08  Ravi Pratap  <ravi@ximian.com>
172
173         * expression.cs (ElementAccess::DoResolve): Remove my crap code
174         and start performing checks according to the spec.
175
176 2001-10-07  Ravi Pratap  <ravi@ximian.com>
177
178         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
179         rank_specifiers instead.
180
181         (rank_specifiers): Change the order in which the rank specifiers are stored
182
183         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
184
185         * expression.cs (ElementAccess): Implement the LValue interface too.
186         
187 2001-10-06  Ravi Pratap  <ravi@ximian.com>
188         
189         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
190         except that user defined conversions are not included.
191
192         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
193         perform the conversion of the return type, if necessary.
194
195         (New::DoResolve): Check whether we are creating an array or an object
196         and accordingly do the needful.
197
198         (New::Emit): Same here.
199
200         (New::DoResolve): Implement guts of array creation.
201
202         (New::FormLookupType): Helper function.
203
204 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
205
206         * codegen.cs: Removed most of the code generation here, and move the
207         corresponding code generation bits to the statement classes. 
208
209         Added support for try/catch/finalize and throw.
210         
211         * cs-parser.jay: Added support for try/catch/finalize.
212
213         * class.cs: Catch static methods having the flags override,
214         virtual or abstract.
215
216         * expression.cs (UserCast): This user cast was not really doing
217         what it was supposed to do.  Which is to be born in fully resolved
218         state.  Parts of the resolution were being performed at Emit time! 
219
220         Fixed this code.
221
222 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
223
224         * expression.cs: Implicity convert the result from UserCast.
225
226 2001-10-05  Ravi Pratap  <ravi@ximian.com>
227
228         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
229         prevented it from working correctly. 
230
231         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
232         merely ConvertImplicit.
233
234 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
235
236         * typemanager.cs: Make the LookupTypeContainer function static,
237         and not per-instance.  
238
239         * class.cs: Make static FindMembers (the one that takes a Type
240         argument). 
241
242         * codegen.cs: Add EmitForeach here.
243
244         * cs-parser.jay: Make foreach a toplevel object instead of the
245         inline expansion, as we need to perform semantic analysis on it. 
246
247 2001-10-05  Ravi Pratap  <ravi@ximian.com>
248
249         * expression.cs (Expression::ImplicitUserConversion): Rename to
250         UserDefinedConversion.
251
252         (Expression::UserDefinedConversion): Take an extra argument specifying 
253         whether we look for explicit user conversions too.
254
255         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
256
257         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
258
259         (ExplicitUserConversion): Make it a call to UserDefinedConversion
260         with the appropriate arguments.
261
262         * cs-parser.jay (cast_expression): Record location too.
263
264         * expression.cs (Cast): Record location info.
265
266         (Expression::ConvertExplicit): Take location argument.
267
268         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
269         to determine if we are doing explicit conversions.
270
271         (UserCast::Emit): Update accordingly.
272
273         (Expression::ConvertExplicit): Report an error if everything fails.
274
275         * ../errors/cs0030.cs : Add.
276
277 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
278
279         * modifiers.cs: If the ABSTRACT keyword is present, also set the
280         virtual and newslot bits. 
281
282         * class.cs (TypeContainer::RegisterRequiredImplementations):
283         Record methods we need.
284
285         (TypeContainer::MakeKey): Helper function to make keys for
286         MethodBases, since the Methodbase key is useless.
287
288         (TypeContainer::Populate): Call RegisterRequiredImplementations
289         before defining the methods.   
290
291         Create a mapping for method_builders_to_methods ahead of time
292         instead of inside a tight loop.
293
294         (::RequireMethods):  Accept an object as the data to set into the
295         hashtable so we can report interface vs abstract method mismatch.
296
297 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
298
299         * report.cs: Make all of it static.
300
301         * rootcontext.cs: Drop object_type and value_type computations, as
302         we have those in the TypeManager anyways.
303
304         Drop report instance variable too, now it is a global.
305
306         * driver.cs: Use try/catch on command line handling.
307
308         Add --probe option to debug the error reporting system with a test
309         suite. 
310
311         * report.cs: Add support for exiting program when a probe
312         condition is reached.
313
314 2001-10-03  Ravi Pratap  <ravi@ximian.com>
315
316         * expression.cs (Binary::DoNumericPromotions): Fix the case when
317         we do a forcible conversion regardless of type, to check if 
318         ForceConversion returns a null.
319
320         (Binary::error19): Use location to report error.
321
322         (Unary::error23): Use location here too.
323
324         * ../errors/cs0019.cs : Check in.
325
326         * ../errors/cs0023.cs : Check in.
327
328         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
329         case of a non-null MethodInfo object with a length of 0 !
330
331         (Binary::ResolveOperator): Flag error if overload resolution fails to find
332         an applicable member - according to the spec :-)
333         Also fix logic to find members in base types.
334
335         (Unary::ResolveOperator): Same here.
336
337         (Unary::report23): Change name to error23 and make first argument a TypeContainer
338         as I was getting thoroughly confused between this and error19 :-)
339         
340         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
341         (::FindMostEncompassedType): Implement.
342         (::FindMostEncompassingType): Implement.
343         (::StandardConversionExists): Implement.
344
345         (UserImplicitCast): Re-vamp. We now need info about most specific
346         source and target types so that we can do the necessary conversions.
347
348         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
349         mathematical union with no duplicates.
350
351 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
352
353         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
354         in order from base classes to child classes, so that we can in
355         child classes look up in our parent for method names and
356         attributes (required for handling abstract, virtual, new, override
357         constructs: we need to instrospect our base class, and if we dont
358         populate the classes in order, the introspection might be
359         incorrect.  For example, a method could query its parent before
360         the parent has any methods and would determine that the parent has
361         no abstract methods (while it could have had them)).
362
363         (RootContext::CreateType): Record the order in which we define the
364         classes.
365
366 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
367
368         * class.cs (TypeContainer::Populate): Also method definitions can
369         fail now, keep track of this.
370
371         (TypeContainer::FindMembers): Implement support for
372         DeclaredOnly/noDeclaredOnly flag.
373
374         (Constructor::Emit) Return the ConstructorBuilder.
375
376         (Method::Emit) Return the MethodBuilder. 
377         Check for abstract or virtual methods to be public.
378
379         * rootcontext.cs (RootContext::CreateType): Register all the
380         abstract methods required for the class to be complete and the
381         interface methods that must be implemented. 
382
383         * cs-parser.jay: Report error 501 (method requires body if it is
384         not marked abstract or extern).
385
386         * expression.cs (TypeOf::Emit): Implement.
387
388         * typemanager.cs: runtime_handle_type, new global type.
389
390         * class.cs (Property::Emit): Generate code for properties.
391
392 2001-10-02  Ravi Pratap  <ravi@ximian.com>
393
394         * expression.cs (Unary::ResolveOperator): Find operators on base type
395         too - we now conform exactly to the spec.
396
397         (Binary::ResolveOperator): Same here.
398
399         * class.cs (Operator::Define): Fix minor quirk in the tests.
400
401         * ../errors/cs0215.cs : Added.
402
403         * ../errors/cs0556.cs : Added.
404
405         * ../errors/cs0555.cs : Added.
406
407 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
408
409         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
410         single integer which is really efficient
411
412 2001-10-01  Ravi Pratap  <ravi@ximian.com>
413
414         *  expression.cs (Expression::ImplicitUserConversion): Use location
415         even in the case when we are examining True operators.
416  
417         * class.cs (Operator::Define): Perform extensive checks to conform
418         with the rules for operator overloading in the spec.
419
420         * expression.cs (Expression::ImplicitReferenceConversion): Implement
421         some of the other conversions mentioned in the spec.
422
423         * typemanager.cs (array_type): New static member for the System.Array built-in
424         type.
425
426         (cloneable_interface): For System.ICloneable interface.
427
428         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
429         we start resolving the tree and populating types.
430
431         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
432  
433 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
434
435         * expression.cs (Expression::ExprClassFromMemberInfo,
436         Expression::Literalize): Create literal expressions from
437         FieldInfos which are literals.
438
439         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
440         type casts, because they were wrong.  The test suite in tests
441         caught these ones.
442
443         (ImplicitNumericConversion): ushort to ulong requires a widening
444         cast. 
445
446         Int32 constant to long requires widening cast as well.
447
448         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
449         for integers because the type on the stack is not i4.
450
451 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
452
453         * expression.cs (report118): require location argument. 
454
455         * parameter.cs: Do not dereference potential null value.
456
457         * class.cs: Catch methods that lack the `new' keyword when
458         overriding a name.  Report warnings when `new' is used without
459         anything being there to override.
460
461         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
462
463         * class.cs: Only add constructor to hashtable if it is non-null
464         (as now constructors can fail on define).
465
466         (TypeManager, Class, Struct): Take location arguments.
467
468         Catch field instance initialization in structs as errors.
469
470         accepting_filter: a new filter for FindMembers that is static so
471         that we dont create an instance per invocation.
472
473         (Constructor::Define): Catch errors where a struct constructor is
474         parameterless 
475
476         * cs-parser.jay: Pass location information for various new
477         constructs. 
478         
479         * delegate.cs (Delegate): take a location argument.
480
481         * driver.cs: Do not call EmitCode if there were problesm in the
482         Definition of the types, as many Builders wont be there. 
483
484         * decl.cs (Decl::Decl): Require a location argument.
485
486         * cs-tokenizer.cs: Handle properly hex constants that can not fit
487         into integers, and find the most appropiate integer for it.
488
489         * literal.cs: Implement ULongLiteral.
490
491         * rootcontext.cs: Provide better information about the location of
492         failure when CreateType fails.
493         
494 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
495
496         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
497         as well.
498
499         * expression.cs (Binary::CheckShiftArguments): Add missing type
500         computation.
501         (Binary::ResolveOperator): Add type to the logical and and logical
502         or, Bitwise And/Or and Exclusive Or code paths, it was missing
503         before.
504
505         (Binary::DoNumericPromotions): In the case where either argument
506         is ulong (and most signed types combined with ulong cause an
507         error) perform implicit integer constant conversions as well.
508
509 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
510
511         * expression.cs (UserImplicitCast): Method should always be
512         non-null. 
513         (Invocation::BetterConversion): Simplified test for IntLiteral.
514
515         (Expression::ImplicitNumericConversion): Split this routine out.
516         Put the code that performs implicit constant integer conversions
517         here. 
518
519         (Expression::Resolve): Become a wrapper around DoResolve so we can
520         check eclass and type being set after resolve.
521
522         (Invocation::Badness): Remove this dead function
523
524         (Binary::ResolveOperator): Do not compute the expensive argumnets
525         unless we have a union for it.
526
527         (Probe::Emit): Is needs to do an isinst and then
528         compare against null.
529
530         (::CanConvert): Added Location argument.  If the Location argument
531         is null (Location.Null), then we do not report errors.  This is
532         used by the `probe' mechanism of the Explicit conversion.  We do
533         not want to generate an error for something that the user
534         explicitly requested to be casted.  But the pipeline for an
535         explicit cast first tests for potential implicit casts.
536
537         So for now, if the Location is null, it means `Probe only' to
538         avoid adding another argument.   Might have to revise this
539         strategy later.
540
541         (ClassCast): New class used to type cast objects into arbitrary
542         classes (used in Explicit Reference Conversions).
543
544         Implement `as' as well.
545
546         Reverted all the patches from Ravi below: they were broken:
547
548                 * The use of `level' as a mechanism to stop recursive
549                   invocations is wrong.  That was there just to catch the
550                   bug with a strack trace but not as a way of addressing
551                   the problem.
552
553                   To fix the problem we have to *understand* what is going
554                   on and the interactions and come up with a plan, not
555                   just get things going.
556
557                 * The use of the type conversion cache that I proposed
558                   last night had an open topic: How does this work across
559                   protection domains.  A user defined conversion might not
560                   be public in the location where we are applying the
561                   conversion, a different conversion might be selected
562                   (ie, private A->B (better) but public B->A (worse),
563                   inside A, A->B applies, but outside it, B->A will
564                   apply).
565
566                 * On top of that (ie, even if the above is solved),
567                   conversions in a cache need to be abstract.  Ie, `To
568                   convert from an Int to a Short use an OpcodeCast', not
569                   `To convert from an Int to a Short use the OpcodeCast on
570                   the variable 5' (which is what this patch was doing).
571         
572 2001-09-28  Ravi Pratap  <ravi@ximian.com>
573
574         * expression.cs (Invocation::ConversionExists): Re-write to use
575         the conversion cache
576         
577         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
578         cache all conversions done, not just user-defined ones.
579
580         (Invocation::BetterConversion): The real culprit. Use ConversionExists
581         to determine if a conversion exists instead of acutually trying to 
582         perform the conversion. It's faster too.
583
584         (Expression::ConvertExplicit): Modify to use ConversionExists to check
585         and only then attempt the implicit conversion.
586
587 2001-09-28  Ravi Pratap  <ravi@ximian.com>
588
589         * expression.cs (ConvertImplicit): Use a cache for conversions
590         already found. Check level of recursion and bail out if necessary.
591         
592 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
593
594         * typemanager.cs (string_concat_string_string, string_concat_object_object):
595         Export standard methods that we expect for string operations.
596         
597         * statement.cs (Block::UsageWarning): Track usage of variables and
598         report the errors for not used variables.
599
600         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
601         operator. 
602
603 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
604
605         * codegen.cs: remove unnneded code 
606
607         * expression.cs: Removed BuiltinTypeAccess class
608
609         Fix the order in which implicit conversions are
610         done.  
611
612         The previous fixed dropped support for boxed conversions (adding a
613         test to the test suite now)
614
615         (UserImplicitCast::CanConvert): Remove test for source being null,
616         that code is broken.  We should not feed a null to begin with, if
617         we do, then we should track the bug where the problem originates
618         and not try to cover it up here.
619
620         Return a resolved expression of type UserImplicitCast on success
621         rather than true/false.  Ravi: this is what I was talking about,
622         the pattern is to use a static method as a "constructor" for
623         objects. 
624
625         Also, do not create arguments until the very last minute,
626         otherwise we always create the arguments even for lookups that
627         will never be performed. 
628
629         (UserImplicitCast::Resolve): Eliminate, objects of type
630         UserImplicitCast are born in a fully resolved state. 
631         
632         * typemanager.cs (InitCoreTypes): Init also value_type
633         (System.ValueType). 
634
635         * expression.cs (Cast::Resolve): First resolve the child expression.
636
637         (LValue): Add new method AddressOf to be used by
638         the `&' operator.  
639
640         Change the argument of Store to take an EmitContext instead of an
641         ILGenerator, because things like FieldExpr need to be able to call
642         their children expression to generate the instance code. 
643
644         (Expression::Error, Expression::Warning): Sugar functions for
645         reporting errors.
646
647         (Expression::MemberLookup): Accept a TypeContainer instead of a
648         Report as the first argument.
649
650         (Expression::ResolvePrimary): Killed.  I still want to improve
651         this as currently the code is just not right.
652
653         (Expression::ResolveMemberAccess): Simplify, but it is still
654         wrong. 
655
656         (Unary::Resolve): Catch errors in AddressOf operators.
657
658         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
659         index to a byte for the short-version, or the compiler will choose
660         the wrong Emit call, which generates the wrong data.
661
662         (ParameterReference::Emit, ::Store): same.
663
664         (FieldExpr::AddressOf): Implement.
665         
666         * typemanager.cs: TypeManager: made public variable instead of
667         property.
668         
669         * driver.cs: document --fatal.
670
671         * report.cs (ErrorMessage, WarningMessage): new names for the old
672         Error and Warning classes.
673
674         * cs-parser.jay (member_access): Turn built-in access to types
675         into a normal simplename
676
677 2001-09-27  Ravi Pratap  <ravi@ximian.com>
678
679         * expression.cs (Invocation::BetterConversion): Fix to cope
680         with q being null, since this was introducing a bug.
681
682         * expression.cs (ConvertImplicit): Do built-in conversions first.
683
684 2001-09-27  Ravi Pratap  <ravi@ximian.com>
685
686         * expression.cs (UserImplicitCast::Resolve): Fix bug.
687
688 2001-09-27  Ravi Pratap  <ravi@ximian.com>
689
690         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
691         I had introduced long ago (what's new ?).
692
693         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
694         the work of all the checking. 
695         (ConvertImplicit): Call CanConvert and only then create object if necessary.
696         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
697
698         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
699         that is the right way. 
700
701         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
702         overloading resolution. Use everywhere instead of cutting and pasting code.
703
704         (Binary::ResolveOperator): Use MakeUnionSet.
705
706         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
707         we have to convert to bool types. Not complete yet.
708         
709 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
710
711         * typemanager.cs (TypeManager::CSharpName): support ushort.
712
713         * expression.cs (Expression::TryImplicitIntConversion): Attempts
714         to provide an expression that performsn an implicit constant int
715         conversion (section 6.1.6).
716         (Expression::ConvertImplicitRequired): Reworked to include
717         implicit constant expression conversions.
718
719         (Expression::ConvertNumericExplicit): Finished.
720
721         (Invocation::Emit): If InstanceExpression is null, then it means
722         that we perform a call on this.
723         
724 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
725
726         * expression.cs (Unary::Emit): Remove some dead code.
727         (Probe): Implement Resolve and Emit for `is'.
728         (Expression::ConvertImplicitRequired): Attempt to do constant
729         expression conversions here.  Maybe should be moved to
730         ConvertImplicit, but I am not sure.
731         (Expression::ImplicitLongConstantConversionPossible,
732         Expression::ImplicitIntConstantConversionPossible): New functions
733         that tell whether is it possible to apply an implicit constant
734         expression conversion.
735
736         (ConvertNumericExplicit): Started work on explicit numeric
737         conversions.
738
739         * cs-parser.jay: Update operator constants.
740
741         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
742         (Parameters::GetSignature): Hook up VerifyArgs here.
743         (Parameters::VerifyArgs): Verifies that no two arguments have the
744         same name. 
745
746         * class.cs (Operator): Update the operator names to reflect the
747         ones that the spec expects (as we are just stringizing the
748         operator names).
749         
750         * expression.cs (Unary::ResolveOperator): Fix bug: Use
751         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
752         previous usage did only work for our methods.
753         (Expression::ConvertImplicit): Handle decimal implicit numeric
754         conversions as well.
755         (Expression::InternalTypeConstructor): Used to invoke constructors
756         on internal types for default promotions.
757
758         (Unary::Emit): Implement special handling for the pre/post
759         increment/decrement for overloaded operators, as they need to have
760         the same semantics as the other operators.
761
762         (Binary::ResolveOperator): ditto.
763         (Invocation::ConversionExists): ditto.
764         (UserImplicitCast::Resolve): ditto.
765         
766 2001-09-26  Ravi Pratap  <ravi@ximian.com>
767
768         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
769         operator, return after emitting body. Regression tests pass again !
770
771         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
772         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
773         (Invocation::OverloadResolve): Ditto.
774         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
775
776         * everywhere : update calls to the above methods accordingly.
777
778 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
779
780         * assign.cs (Assign): Make it inherit from ExpressionStatement.
781
782         * expression.cs (ExpressionStatement): New base class used for
783         expressions that can appear in statements, so that we can provide
784         an alternate path to generate expression that do not leave a value
785         on the stack.
786
787         (Expression::Emit, and all the derivatives): We no longer return
788         whether a value is left on the stack or not.  Every expression
789         after being emitted leaves a single value on the stack.
790
791         * codegen.cs (EmitContext::EmitStatementExpression): Use the
792         facilties of ExpressionStatement if possible.
793
794         * cs-parser.jay: Update statement_expression.
795
796 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
797
798         * driver.cs: Change the wording of message
799
800 2001-09-25  Ravi Pratap  <ravi@ximian.com>
801
802         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
803         the type of the expression to the return type of the method if
804         we have an overloaded operator match ! The regression tests pass again !
805         (Unary::ResolveOperator): Ditto.
806
807         * expression.cs (Invocation::ConversionExists): Correct the member lookup
808         to find "op_Implicit", not "implicit" ;-)
809         (UserImplicitCast): New class to take care of user-defined implicit conversions.
810         (ConvertImplicit, ForceConversion): Take TypeContainer argument
811
812         * everywhere : Correct calls to the above accordingly.
813
814         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
815         (ConvertImplicit): Do user-defined conversion if it exists.
816
817 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
818
819         * assign.cs: track location.
820         (Resolve): Use implicit conversions on assignment.
821
822         * literal.cs: Oops.  Not good, Emit of short access values should
823         pass (Bytes) or the wrong argument will be selected.
824
825         * expression.cs (Unary::Emit): Emit code for -expr.
826         
827         (Unary::ResolveOperator): Handle `Substract' for non-constants
828         (substract from zero from the non-constants).
829         Deal with Doubles as well. 
830         
831         (Expression::ConvertImplicitRequired): New routine that reports an
832         error if no implicit conversion exists. 
833
834         (Invocation::OverloadResolve): Store the converted implicit
835         expressions if we make them
836         
837 2001-09-24  Ravi Pratap  <ravi@ximian.com>
838
839         * class.cs (ConstructorInitializer): Take a Location argument.
840         (ConstructorBaseInitializer): Same here.
841         (ConstructorThisInitializer): Same here.
842
843         * cs-parser.jay : Update all calls accordingly.
844
845         * expression.cs (Unary, Binary, New): Take location argument.
846         Update accordingly everywhere.
847
848         * cs-parser.jay : Update all calls to the above to take a location
849         argument.
850
851         * class.cs : Ditto.
852
853 2001-09-24  Ravi Pratap  <ravi@ximian.com>
854
855         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
856         (Invocation::BetterConversion): Same here
857         (Invocation::ConversionExists): Ditto.
858
859         (Invocation::ConversionExists): Implement.
860
861 2001-09-22  Ravi Pratap  <ravi@ximian.com>
862
863         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
864         Also take an additional TypeContainer argument.
865
866         * All over : Pass in TypeContainer as argument to OverloadResolve.
867
868         * typemanager.cs (CSharpName): Update to check for the string type and return
869         that too.
870
871         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
872         a given method.
873         
874 2001-09-21  Ravi Pratap  <ravi@ximian.com>
875
876         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
877         (Invocation::BetterFunction): Implement.
878         (Invocation::BetterConversion): Implement.
879         (Invocation::ConversionExists): Skeleton, no implementation yet.
880
881         Okay, things work fine !
882
883 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
884
885         * typemanager.cs: declare and load enum_type, delegate_type and
886         void_type. 
887
888         * expression.cs (Expression::Emit): Now emit returns a value that
889         tells whether a value is left on the stack or not.  This strategy
890         might be reveted tomorrow with a mechanism that would address
891         multiple assignments.
892         (Expression::report118): Utility routine to report mismatches on
893         the ExprClass.
894
895         (Unary::Report23): Report impossible type/operator combination
896         utility function.
897
898         (Unary::IsIncrementableNumber): Whether the type can be
899         incremented or decremented with add.
900         (Unary::ResolveOperator): Also allow enumerations to be bitwise
901         complemented. 
902         (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
903
904         (Invocation::Emit): Deal with new Emit convetion.
905         
906         * All Expression derivatives: Updated their Emit method to return
907         whether they leave values on the stack or not.
908         
909         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
910         stack for expressions that are statements. 
911
912 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
913
914         * expression.cs (LValue): New interface.  Must be implemented by
915         LValue objects.
916         (LocalVariableReference, ParameterReference, FieldExpr): Implement
917         LValue interface.
918         
919         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
920         interface for generating code, simplifies the code.
921
922 2001-09-20  Ravi Pratap  <ravi@ximian.com>
923
924         * expression.cs (everywhere): Comment out return statements in ::Resolve
925         methods to avoid the warnings.
926
927 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
928
929         * driver.cs (parse): Report error 2001 if we can not open the
930         source file.
931
932         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
933         not resolve it.
934
935         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
936         object. 
937
938         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
939         otherwise nested blocks end up with the same index.
940
941         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
942
943         * expression.cs:  Instead of having FIXMEs in the Resolve
944         functions, throw exceptions so it is obvious that we are facing a
945         bug. 
946
947         * cs-parser.jay (invocation_expression): Pass Location information.
948
949         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
950         Use a basename for those routines because .NET does not like paths
951         on them. 
952
953         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
954         already defined.
955
956 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
957
958         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
959         are loading the correct data types (throws an exception if not).
960         (TypeManager::InitCoreTypes): Use CoreLookupType
961
962         * expression.cs (Unary::ResolveOperator): return the child
963         expression for expressions which are just +expr.
964         (Unary::ResolveOperator): Return negative literals for -LITERAL
965         expressions (otherwise they are Unary {Literal}).
966         (Invocation::Badness): Take into account `Implicit constant
967         expression conversions'.
968
969         * literal.cs (LongLiteral): Implement long literal class.
970         (IntLiteral): export the `Value' of the intliteral. 
971
972 2001-09-19  Ravi Pratap  <ravi@ximian.com>
973
974         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
975
976         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
977         instead of 'Operator'
978
979         * expression.cs (Binary::ResolveOperator): Update accordingly.
980         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
981         and 'Minus'
982
983         * cs-parser.jay (unary_expression): Update to use the new names.
984
985         * gen-treedump.cs (GetUnary): Same here.
986
987         * expression.cs (Unary::Resolve): Implement.
988         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
989         operators are found instead of making noise ;-)
990         (Unary::ResolveOperator): New method to do precisely the same thing which
991         Binary::ResolveOperator does for Binary expressions.
992         (Unary.method, .Arguments): Add.
993         (Unary::OperName): Implement.   
994         (Unary::ForceConversion): Copy and Paste !
995
996         * class.cs (Operator::Define): Fix a small bug for the case when we have 
997         a unary operator.
998
999         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
1000         for the inbuilt operators. Only overloading works for now ;-)
1001
1002 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
1003
1004         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
1005         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
1006
1007         * expression.cs (This::Emit): Implement. 
1008         (This::Resolve): Implement.
1009         (TypeOf:Resolve): Implement.
1010         (Expression::ResolveSimpleName): Add an implicit this to instance
1011         field references. 
1012         (MemberAccess::Resolve): Deal with Parameters and Fields. 
1013         Bind instance variable to Field expressions.
1014         (FieldExpr::Instance): New field used to track the expression that
1015         represents the object instance.
1016         (FieldExpr::Resolve): Track potential errors from MemberLookup not
1017         binding 
1018         (FieldExpr::Emit): Implement.
1019
1020         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
1021         the last instruction contains a return opcode to avoid generating
1022         the last `ret' instruction (this generates correct code, and it is
1023         nice to pass the peverify output).
1024
1025         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
1026         initializer for static and instance variables.
1027         (Constructor::Emit): Allow initializer to be null in the case of
1028         static constructors.  Only emit initializer for instance
1029         constructors. 
1030
1031         (TypeContainer::FindMembers): Return a null array if there are no
1032         matches.
1033
1034         Also fix the code for the MemberTypes.Method branch, as it was not
1035         scanning that for operators (or tried to access null variables before).
1036
1037         * assign.cs (Assign::Emit): Handle instance and static fields. 
1038
1039         * TODO: Updated.
1040
1041         * driver.cs: Stop compilation if there are parse errors.
1042
1043         * cs-parser.jay (constructor_declaration): Provide default base
1044         initializer for non-static constructors.
1045         (constructor_declarator): Do not provide a default base
1046         initializers if none was specified.
1047         Catch the fact that constructors should not have parameters.
1048
1049         * class.cs: Do not emit parent class initializers for static
1050         constructors, that should be flagged as an error.
1051
1052 2001-09-18  Ravi Pratap  <ravi@ximian.com>
1053
1054         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
1055         Move back code into TypeContainer::Populate.
1056
1057 2001-09-18  Ravi Pratap  <ravi@ximian.com>
1058
1059         * class.cs (TypeContainer::AddConstructor): Fix the check to
1060         compare against Name, not Basename. 
1061         (Operator::OpType): Change Plus and Minus to Add and Subtract.
1062
1063         * cs-parser.jay : Update accordingly.
1064
1065         * class.cs (TypeContainer::FindMembers): For the case where we are searching
1066         for methods, don't forget to look into the operators too.
1067         (RegisterMethodBuilder): Helper method to take care of this for
1068         methods, constructors and operators.
1069         (Operator::Define): Completely revamp.
1070         (Operator.OperatorMethod, MethodName): New fields.
1071         (TypeContainer::Populate): Move the registering of builders into
1072         RegisterMethodBuilder.
1073         (Operator::Emit): Re-write.
1074
1075         * expression.cs (Binary::Emit): Comment out code path to emit method
1076         invocation stuff for the case when we have a user defined operator. I am
1077         just not able to get it right !
1078         
1079 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
1080
1081         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
1082         argument. 
1083
1084         (Expression::MemberLookup): Provide a version that allows to
1085         specify the MemberTypes and BindingFlags. 
1086
1087         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
1088         so it was not fetching variable information from outer blocks.
1089
1090         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
1091         Beforefieldinit as it was buggy.
1092
1093         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
1094         that Ravi put here.  
1095
1096         * class.cs (Constructor::Emit): Only emit if block is not null.
1097         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
1098         deal with this by semantically definining it as if the user had
1099         done it.
1100
1101         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
1102         constructors as we now "emit" them at a higher level.
1103
1104         (TypeContainer::DefineDefaultConstructor): Used to define the
1105         default constructors if none was provided.
1106
1107         (ConstructorInitializer): Add methods Resolve and Emit. 
1108         
1109         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
1110
1111 2001-09-17  Ravi Pratap  <ravi@ximian.com>
1112
1113         * class.cs (TypeContainer::EmitDefaultConstructor): Register
1114         the default constructor builder with our hashtable for methodbuilders
1115         to methodcores.
1116
1117         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
1118         and argument_count is 0 in which case we have a match.
1119         (Binary::ResolveOperator): More null checking and miscellaneous coding
1120         style cleanup.
1121
1122 2001-09-17  Ravi Pratap  <ravi@ximian.com>
1123
1124         * rootcontext.cs (IsNameSpace): Compare against null.
1125
1126         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
1127
1128         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
1129         and Unary::Operator.
1130
1131         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
1132         accordingly.
1133
1134         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
1135         we have overloaded operators.
1136         (Binary::ResolveOperator): Implement the part which does the operator overload
1137         resolution.
1138
1139         * class.cs (Operator::Emit): Implement.
1140         (TypeContainer::Emit): Emit the operators we have too.
1141
1142         * expression.cs (Binary::Emit): Update to emit the appropriate code for
1143         the case when we have a user-defined operator.
1144         
1145 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
1146
1147         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
1148
1149 2001-09-16  Ravi Pratap  <ravi@ximian.com>
1150
1151         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
1152         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
1153         (Constructor::Emit): Implement.
1154         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
1155         if we have no work to do. 
1156         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
1157         Emit method.
1158
1159         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
1160         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
1161
1162         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
1163         of parent.parent.
1164
1165 2001-09-15  Ravi Pratap  <ravi@ximian.com>
1166
1167         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
1168         in the source.
1169         (Tree::RecordNamespace): Method to do what the name says ;-)
1170         (Tree::Namespaces): Property to get at the namespaces hashtable.
1171
1172         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
1173         keep track.
1174
1175         * rootcontext.cs (IsNamespace): Fixed it :-)
1176
1177 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
1178
1179         * class.cs (TypeContainer::FindMembers): Add support for
1180         constructors. 
1181         (MethodCore): New class that encapsulates both the shared aspects
1182         of a Constructor and a Method.  
1183         (Method, Constructor): Factored pieces into MethodCore.
1184
1185         * driver.cs: Added --fatal which makes errors throw exceptions.
1186         Load System assembly as well as part of the standard library.
1187
1188         * report.cs: Allow throwing exceptions on errors for debugging.
1189
1190         * modifiers.cs: Do not use `parent', instead use the real type
1191         container to evaluate permission settings.
1192
1193         * class.cs: Put Ravi's patch back in.  He is right, and we will
1194         have to cope with the
1195
1196 2001-09-14  Ravi Pratap  <ravi@ximian.com>
1197
1198         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
1199         FamORAssem, not FamANDAssem.
1200         
1201 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
1202
1203         * driver.cs: Added --parse option that only parses its input files
1204         and terminates.
1205
1206         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
1207         incorrect.  IsTopLevel is not used to tell whether an object is
1208         root_types or not (that can be achieved by testing this ==
1209         root_types).  But to see if this is a top-level *class* (not
1210         necessarly our "toplevel" container). 
1211
1212 2001-09-14  Ravi Pratap  <ravi@ximian.com>
1213
1214         * enum.cs (Enum::Define): Modify to call the Lookup method on the
1215         parent instead of a direct call to GetType.
1216
1217 2001-09-14  Ravi Pratap  <ravi@ximian.com>
1218
1219         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
1220         Modifiers.TypeAttr. This should just be a call to that method.
1221
1222         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
1223         object so that we can determine if we are top-level or not.
1224
1225         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
1226         TypeContainer too.
1227
1228         * enum.cs (Enum::Define): Ditto.
1229
1230         * modifiers.cs (FieldAttr): Re-write.
1231
1232         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
1233         (TypeContainer::HaveStaticConstructor): New property to provide access
1234         to precisely that info.
1235
1236         * modifiers.cs (MethodAttr): Re-write.
1237         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
1238
1239         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
1240         of top-level types as claimed.
1241         
1242 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
1243
1244         * expression.cs (MemberLookup): Fruitless attempt to lookup
1245         constructors.  Maybe I need to emit default constructors?  That
1246         might be it (currently .NET emits this for me automatically).
1247         (Invocation::OverloadResolve): Cope with Arguments == null.
1248         (Invocation::EmitArguments): new function, shared by the new
1249         constructor and us.
1250         (Invocation::Emit): Handle static and instance methods.  Emit
1251         proper call instruction for virtual or non-virtual invocations.
1252         (New::Emit): Implement.
1253         (New::Resolve): Implement.
1254         (MemberAccess:Resolve): Implement.
1255         (MethodGroupExpr::InstanceExpression): used conforming to the spec
1256         to track instances.
1257         (FieldExpr::Resolve): Set type.
1258
1259         * support.cs: Handle empty arguments.
1260                 
1261         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
1262         SimpleLookup): Auxiliary routines to help parse a qualifier
1263         identifier.  
1264
1265         Update qualifier_identifier rule.
1266
1267         * codegen.cs: Removed debugging messages.
1268
1269         * class.cs: Make this a global thing, this acts just as a "key" to
1270         objects that we might have around.
1271
1272         (Populate): Only initialize method_builders_to_methods once.
1273
1274         * expression.cs (PropertyExpr): Initialize type from the
1275         PropertyType. 
1276
1277         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
1278         Resolve pattern.  Attempt to implicitly convert value to boolean.
1279         Emit code.
1280
1281         * expression.cs: Set the type for the int32/int32 argument case.
1282         (Binary::ResolveOperator): Set the return type to boolean for
1283         comparission operators
1284
1285         * typemanager.cs: Remove debugging print code.
1286
1287         (Invocation::Resolve): resolve type.
1288
1289         * class.cs: Allocate a MemberInfo of the correct size, as the code
1290         elsewhere depends on the test to reflect the correct contents.
1291
1292         (Method::) Keep track of parameters, due to System.Reflection holes
1293
1294         (TypeContainer::Populate): Keep track of MethodBuilders to Method
1295         mapping here.
1296
1297         (TypeContainer::FindMembers): Use ArrayList and then copy an array
1298         of the exact size and return that.
1299
1300         (Class::LookupMethodByBuilder): New function that maps
1301         MethodBuilders to its methods.  Required to locate the information
1302         on methods because System.Reflection bit us again.
1303
1304         * support.cs: New file, contains an interface ParameterData and
1305         two implementations: ReflectionParameters and InternalParameters
1306         used to access Parameter information.  We will need to grow this
1307         as required.
1308
1309         * expression.cs (Invocation::GetParameterData): implement a cache
1310         and a wrapper around the ParameterData creation for methods. 
1311         (Invocation::OverloadResolve): Use new code.
1312
1313 2001-09-13  Ravi Pratap  <ravi@ximian.com>
1314
1315         * class.cs (TypeContainer::EmitField): Remove and move into 
1316         (Field::Define): here and modify accordingly.
1317         (Field.FieldBuilder): New member.
1318         (TypeContainer::Populate): Update accordingly.
1319         (TypeContainer::FindMembers): Implement.
1320
1321 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
1322
1323         * statement.cs: (VariableInfo::VariableType): New field to be
1324         initialized with the full type once it is resolved. 
1325
1326 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
1327
1328         * parameter.cs (GetParameterInfo): Use a type cache to compute
1329         things only once, and to reuse this information
1330
1331         * expression.cs (LocalVariableReference::Emit): Implement.
1332         (OpcodeCast::Emit): fix.
1333
1334         (ParameterReference::Resolve): Implement.
1335         (ParameterReference::Emit): Implement.
1336
1337         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
1338         that are expressions need to stay as Expressions.
1339
1340         * typemanager.cs (CSharpName): Returns the C# name of a type if
1341         possible. 
1342
1343         * expression.cs (Expression::ConvertImplicit): New function that
1344         implements implicit type conversions.
1345
1346         (Expression::ImplicitReferenceConversion): Implements implicit
1347         reference conversions.
1348
1349         (EmptyCast): New type for transparent casts.
1350
1351         (OpcodeCast): New type for casts of types that are performed with
1352         a sequence of bytecodes.
1353         
1354         (BoxedCast): New type used for casting value types into reference
1355         types.  Emits a box opcode.
1356
1357         (Binary::DoNumericPromotions): Implements numeric promotions of
1358         and computation of the Binary::Type.
1359
1360         (Binary::EmitBranchable): Optimization.
1361
1362         (Binary::Emit): Implement code emission for expressions.
1363         
1364         * typemanager.cs (TypeManager): Added two new core types: sbyte
1365         and byte.
1366
1367 2001-09-12  Ravi Pratap  <ravi@ximian.com>
1368
1369         * class.cs (TypeContainer::FindMembers): Method which does exactly
1370         what Type.FindMembers does, only we don't have to use reflection. No
1371         implementation yet.
1372
1373         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
1374         typecontainer objects as we need to get at them.
1375         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
1376
1377         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
1378         typecontainer object.
1379
1380         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
1381         of just a Report object.
1382
1383 2001-09-11  Ravi Pratap  <ravi@ximian.com>
1384
1385         * class.cs (Event::Define): Go back to using the prefixes "add_" and
1386         "remove_"
1387         (TypeContainer::Populate): Now define the delegates of the type too.
1388         (TypeContainer.Delegates): Property to access the list of delegates defined
1389         in the type.
1390
1391         * delegates.cs (Delegate::Define): Implement partially.
1392
1393         * modifiers.cs (TypeAttr): Handle more flags.
1394
1395 2001-09-11  Ravi Pratap  <ravi@ximian.com>
1396
1397         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
1398         and not <=
1399         (Operator::Define): Re-write logic to get types by using the LookupType method
1400         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
1401         (Indexer::Define): Ditto.
1402         (Event::Define): Ditto.
1403         (Property::Define): Ditto.
1404         
1405 2001-09-10  Ravi Pratap  <ravi@ximian.com>
1406
1407         * class.cs (TypeContainer::Populate): Now define operators too. 
1408         (TypeContainer.Operators): New property to access the list of operators
1409         in a type.
1410         (Operator.OperatorMethodBuilder): New member to hold the method builder
1411         for the operator we are defining.
1412         (Operator::Define): Implement.
1413
1414 2001-09-10  Ravi Pratap  <ravi@ximian.com>
1415
1416         * class.cs (Event::Define): Make the prefixes of the accessor methods
1417         addOn_ and removeOn_ 
1418
1419         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
1420         of the location being passed in too. Ideally, this should go later since all
1421         error reporting should be done through the Report object.
1422
1423         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
1424         (Populate): Iterate thru the indexers we have and define them too.
1425         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
1426         for the get and set accessors.
1427         (Indexer::Define): Implement.
1428         
1429 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
1430
1431         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
1432         my previous implementation, did not work.
1433
1434         * typemanager.cs: Add a couple of missing types (the longs).
1435
1436         * literal.cs: Use TypeManager.bool_type instead of getting it.
1437
1438         * expression.cs (EventExpr): New kind of expressions.
1439         (Expressio::ExprClassFromMemberInfo): finish
1440
1441 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
1442
1443         * assign.cs: Emit stores to static fields differently.
1444
1445 2001-09-08  Ravi Pratap  <ravi@ximian.com>
1446
1447         * Merge in changes and adjust code to tackle conflicts. Backed out my
1448         code in Assign::Resolve ;-) 
1449
1450 2001-09-08  Ravi Pratap  <ravi@ximian.com>
1451
1452         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
1453         instead Report.Error and also pass in the location.
1454         (CSharpParser::Lexer): New readonly property to return the reference
1455         to the Tokenizer object.
1456         (declare_local_variables): Use Report.Error with location instead of plain 
1457         old error.
1458         (CheckDef): Ditto.
1459
1460         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
1461         (Operator.CheckBinaryOperator): Ditto.
1462
1463         * cs-parser.jay (operator_declarator): Update accordingly.
1464
1465         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
1466         (CheckBinaryOperator): Same here.
1467
1468         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
1469         on the name without any prefixes of namespace names etc. This is because we
1470         already might have something already fully qualified like 
1471         'System.Console.WriteLine'
1472
1473         * assign.cs (Resolve): Begin implementation. Stuck ;-)
1474
1475 2001-09-07  Ravi Pratap  <ravi@ximian.com>
1476
1477         * cs-tokenizer.cs (location): Return a string which also contains
1478         the file name.
1479
1480         * expression.cs (ElementAccess): New class for expressions of the
1481         type 'element access.'
1482         (BaseAccess): New class for expressions of the type 'base access.'
1483         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
1484         respectively.
1485         
1486         * cs-parser.jay (element_access): Implement action.
1487         (base_access): Implement actions.
1488         (checked_expression, unchecked_expression): Implement.
1489
1490         * cs-parser.jay (local_variable_type): Correct and implement.
1491         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
1492
1493         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
1494
1495         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
1496         name and the specifiers.
1497
1498         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
1499         
1500         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
1501         making them all public ;-)
1502
1503         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
1504         class anyways.
1505         
1506 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
1507
1508         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
1509         PropertyExprs.
1510         (FieldExpr, PropertyExprs): New resolved expressions.
1511         (SimpleName::MemberStaticCheck): Perform static checks for access
1512         to non-static fields on static methods. Maybe this should be
1513         generalized for MemberAccesses. 
1514         (SimpleName::ResolveSimpleName): More work on simple name
1515         resolution. 
1516
1517         * cs-parser.jay (primary_expression/qualified_identifier): track
1518         the parameter index.
1519
1520         * codegen.cs (CodeGen::Save): Catch save exception, report error.
1521         (EmitContext::EmitBoolExpression): Chain to expression generation
1522         instead of temporary hack.
1523         (::EmitStatementExpression): Put generic expression code generation.
1524
1525         * assign.cs (Assign::Emit): Implement variable assignments to
1526         local variables, parameters and fields.
1527
1528 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
1529
1530         * statement.cs (Block::GetVariableInfo): New method, returns the
1531         VariableInfo for a variable name in a block.
1532         (Block::GetVariableType): Implement in terms of GetVariableInfo
1533
1534         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
1535         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
1536
1537 2001-09-06  Ravi Pratap  <ravi@ximian.com>
1538
1539         * cs-parser.jay (operator_declaration): Continue on my quest : update
1540         to take attributes argument.
1541         (event_declaration): Ditto.
1542         (enum_declaration): Ditto.
1543         (indexer_declaration): Ditto.
1544         
1545         * class.cs (Operator::Operator): Update constructor accordingly.
1546         (Event::Event): Ditto.
1547
1548         * delegate.cs (Delegate::Delegate): Same here.
1549
1550         * enum.cs (Enum::Enum): Same here.
1551         
1552 2001-09-05  Ravi Pratap  <ravi@ximian.com>
1553
1554         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
1555
1556         * ../tests/cs0658.cs : New file to demonstrate error 0658.
1557
1558         * attribute.cs (Attributes): New class to encapsulate all attributes which were
1559         being passed around as an arraylist.
1560         (Attributes::AddAttribute): Method to add attribute sections.
1561
1562         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
1563         (struct_declaration): Update accordingly.
1564         (constant_declaration): Update.
1565         (field_declaration): Update.
1566         (method_header): Update.
1567         (fixed_parameter): Update.
1568         (parameter_array): Ditto.
1569         (property_declaration): Ditto.
1570         (destructor_declaration): Ditto.
1571         
1572         * class.cs (Struct::Struct): Update constructors accordingly.
1573         (Class::Class): Ditto.
1574         (Field::Field): Ditto.
1575         (Method::Method): Ditto.
1576         (Property::Property): Ditto.
1577         (TypeContainer::OptAttribute): update property's return type.
1578         
1579         * interface.cs (Interface.opt_attributes): New member.
1580         (Interface::Interface): Update to take the extra Attributes argument.
1581
1582         * parameter.cs (Parameter::Parameter): Ditto.
1583
1584         * constant.cs (Constant::Constant): Ditto.
1585
1586         * interface.cs (InterfaceMemberBase): New OptAttributes field.
1587         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
1588         the attributes as a parameter.
1589         (InterfaceProperty): Update constructor call.
1590         (InterfaceEvent): Ditto.
1591         (InterfaceMethod): Ditto.
1592         (InterfaceIndexer): Ditto.
1593
1594         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
1595         pass the attributes too.
1596         (interface_event_declaration): Ditto.
1597         (interface_property_declaration): Ditto.
1598         (interface_method_declaration): Ditto.
1599         (interface_declaration): Ditto.
1600
1601 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
1602
1603         * class.cs (Method::Define): Track the "static Main" definition to
1604         create an entry point. 
1605
1606         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
1607         EntryPoint if we find it. 
1608
1609         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
1610         (EmitContext::ig): Make this variable public.
1611
1612         * driver.cs: Make the default output file be the first file name
1613         with the .exe extension.  
1614
1615         Detect empty compilations
1616
1617         Handle various kinds of output targets.  Handle --target and
1618         rename -t to --dumper.
1619
1620         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
1621         methods inherited from Expression return now an Expression.  This
1622         will is used during the tree rewriting as we resolve them during
1623         semantic analysis.
1624
1625         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
1626         the spec.  Missing entirely is the information about
1627         accessability of elements of it.
1628
1629         (Expression::ExprClassFromMemberInfo): New constructor for
1630         Expressions that creates a fully initialized Expression based on
1631         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
1632         a Type.
1633
1634         (Invocation::Resolve): Begin implementing resolution of invocations.
1635         
1636         * literal.cs (StringLiteral):  Implement Emit.
1637
1638 2001-09-05  Ravi Pratap  <ravi@ximian.com>
1639
1640         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
1641         member.
1642         
1643 2001-09-04  Ravi Pratap  <ravi@ximian.com>
1644
1645         * cs-parser.jay (attribute_arguments): Implement actions.
1646         (attribute): Fix bug in production. Implement action.
1647         (attribute_list): Implement.
1648         (attribute_target): Implement.
1649         (attribute_target_specifier, opt_target_specifier): Implement
1650         (CheckAttributeTarget): New method to check if the attribute target
1651         is valid.
1652         (attribute_section): Implement.
1653         (opt_attributes): Implement.
1654
1655         * attribute.cs : New file to handle attributes.
1656         (Attribute): Class to hold attribute info.
1657
1658         * cs-parser.jay (opt_attribute_target_specifier): Remove production
1659         (attribute_section): Modify production to use 2 different rules to 
1660         achieve the same thing. 1 s/r conflict down !
1661         Clean out commented, useless, non-reducing dimension_separator rules.
1662         
1663         * class.cs (TypeContainer.attributes): New member to hold list
1664         of attributes for a type.
1665         (Struct::Struct): Modify to take one more argument, the attribute list.
1666         (Class::Class): Ditto.
1667         (Field::Field): Ditto.
1668         (Method::Method): Ditto.
1669         (Property::Property): Ditto.
1670         
1671         * cs-parser.jay (struct_declaration): Update constructor call to
1672         pass in the attributes too.
1673         (class_declaration): Ditto.
1674         (constant_declaration): Ditto.
1675         (field_declaration): Ditto.
1676         (method_header): Ditto.
1677         (fixed_parameter): Ditto.
1678         (parameter_array): Ditto.
1679         (property_declaration): Ditto.
1680
1681         * constant.cs (Constant::Constant): Update constructor similarly.
1682         Use System.Collections.
1683
1684         * parameter.cs (Parameter::Parameter): Update as above.
1685
1686 2001-09-02  Ravi Pratap  <ravi@ximian.com>
1687
1688         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
1689         (TypeContainer.delegates): New member to hold list of delegates.
1690
1691         * cs-parser.jay (delegate_declaration): Implement the action correctly 
1692         this time as I seem to be on crack ;-)
1693
1694 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
1695
1696         * rootcontext.cs (RootContext::IsNamespace): new function, used to
1697         tell whether an identifier represents a namespace.
1698
1699         * expression.cs (NamespaceExpr): A namespace expression, used only
1700         temporarly during expression resolution.
1701         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
1702         utility functions to resolve names on expressions.
1703
1704 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
1705
1706         * codegen.cs: Add hook for StatementExpressions. 
1707
1708         * class.cs: Fix inverted test for static flag in methods.
1709
1710 2001-09-02  Ravi Pratap  <ravi@ximian.com>
1711
1712         * class.cs (Operator::CheckUnaryOperator): Correct error number used
1713         to make it coincide with MS' number.
1714         (Operator::CheckBinaryOperator): Ditto.
1715
1716         * ../errors/errors.txt : Remove error numbers added earlier.
1717
1718         * ../errors/cs1019.cs : Test case for error # 1019
1719
1720         * ../errros/cs1020.cs : Test case for error # 1020
1721
1722         * cs-parser.jay : Clean out commented cruft.
1723         (dimension_separators, dimension_separator): Comment out. Ostensibly not
1724         used anywhere - non-reducing rule.
1725         (namespace_declarations): Non-reducing rule - comment out.
1726
1727         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
1728         with TypeContainer::AddEnum.
1729
1730         * delegate.cs : New file for delegate handling classes.
1731         (Delegate): Class for declaring delegates.
1732
1733         * makefile : Update.
1734
1735         * cs-parser.jay (delegate_declaration): Implement.
1736
1737 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
1738
1739         * class.cs (Event::Define): Implement.
1740         (Event.EventBuilder): New member.
1741
1742         * class.cs (TypeContainer::Populate): Update to define all enums and events
1743         we have.
1744         (Events): New property for the events arraylist we hold. Shouldn't we move to using
1745         readonly fields for all these cases ?
1746
1747 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
1748
1749         * class.cs (Property): Revamp to use the convention of making fields readonly.
1750         Accordingly modify code elsewhere.
1751
1752         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
1753         the Define method of the Property class.
1754
1755         * class.cs : Clean up applied patch and update references to variables etc. Fix 
1756         trivial bug.
1757         (TypeContainer::Populate): Update to define all the properties we have. Also
1758         define all enumerations.
1759
1760         * enum.cs (Define): Implement.
1761         
1762 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
1763
1764         * cs-parser.jay (overloadable_operator): The semantic value is an
1765         enum of the Operator class.
1766         (operator_declarator): Implement actions.
1767         (operator_declaration): Implement.
1768
1769         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
1770         validity of definitions.
1771         (Operator::CheckBinaryOperator): Static method to check for binary operators
1772         (TypeContainer::AddOperator): New method to add an operator to a type.
1773
1774         * cs-parser.jay (indexer_declaration): Added line to actually call the
1775         AddIndexer method so it gets added ;-)
1776
1777         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
1778         already taken care of by the MS compiler ?  
1779
1780 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
1781
1782         * class.cs (Operator): New class for operator declarations.
1783         (Operator::OpType): Enum for the various operators.
1784
1785 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
1786
1787         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
1788         ostensibly handle this in semantic analysis.
1789
1790         * cs-parser.jay (general_catch_clause): Comment out
1791         (specific_catch_clauses, specific_catch_clause): Ditto.
1792         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
1793         (catch_args, opt_catch_args): New productions.
1794         (catch_clause): Rewrite to use the new productions above
1795         (catch_clauses): Modify accordingly.
1796         (opt_catch_clauses): New production to use in try_statement
1797         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
1798         and re-write the code in the actions to extract the specific and
1799         general catch clauses by being a little smart ;-)
1800
1801         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
1802         Hooray, try and catch statements parse fine !
1803         
1804 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
1805
1806         * statement.cs (Block::GetVariableType): Fix logic to extract the type
1807         string from the hashtable of variables.
1808
1809         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
1810         I end up making that mistake ;-)
1811         (catch_clauses): Fixed gross error which made Key and Value of the 
1812         DictionaryEntry the same : $1 !!
1813
1814 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
1815
1816         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
1817
1818         * cs-parser.jay (event_declaration): Correct to remove the semicolon
1819         when the add and remove accessors are specified. 
1820
1821 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
1822
1823         * cs-parser.jay (IndexerDeclaration): New helper class to hold
1824         information about indexer_declarator.
1825         (indexer_declarator): Implement actions.
1826         (parsing_indexer): New local boolean used to keep track of whether
1827         we are parsing indexers or properties. This is necessary because 
1828         implicit_parameters come into picture even for the get accessor in the 
1829         case of an indexer.
1830         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
1831
1832         * class.cs (Indexer): New class for indexer declarations.
1833         (TypeContainer::AddIndexer): New method to add an indexer to a type.
1834         (TypeContainer::indexers): New member to hold list of indexers for the
1835         type.
1836
1837 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
1838
1839         * cs-parser.jay (add_accessor_declaration): Implement action.
1840         (remove_accessor_declaration): Implement action.
1841         (event_accessors_declaration): Implement
1842         (variable_declarators): swap statements for first rule - trivial.
1843
1844         * class.cs (Event): New class to hold information about event
1845         declarations.
1846         (TypeContainer::AddEvent): New method to add an event to a type
1847         (TypeContainer::events): New member to hold list of events.
1848
1849         * cs-parser.jay (event_declaration): Implement actions.
1850
1851 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
1852
1853         * cs-parser.jay (dim_separators): Implement. Make it a string
1854         concatenating all the commas together, just as they appear.
1855         (opt_dim_separators): Modify accordingly
1856         (rank_specifiers): Update accordingly. Basically do the same
1857         thing - instead, collect the brackets here.
1858         (opt_rank_sepcifiers): Modify accordingly.
1859         (array_type): Modify to actually return the complete type string
1860         instead of ignoring the rank_specifiers.
1861         (expression_list): Implement to collect the expressions
1862         (variable_initializer): Implement. We make it a list of expressions
1863         essentially so that we can handle the array_initializer case neatly too.
1864         (variable_initializer_list): Implement.
1865         (array_initializer): Make it a list of variable_initializers
1866         (opt_array_initializer): Modify accordingly.
1867
1868         * expression.cs (New::NType): Add enumeration to help us
1869         keep track of whether we have an object/delegate creation
1870         or an array creation.
1871         (New:NewType, New::Rank, New::Indices, New::Initializers): New
1872         members to hold data about array creation.
1873         (New:New): Modify to update NewType
1874         (New:New): New Overloaded contructor for the array creation
1875         case.
1876
1877         * cs-parser.jay (array_creation_expression): Implement to call
1878         the overloaded New constructor.
1879         
1880 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
1881
1882         * class.cs (TypeContainer::Constructors): Return member
1883         constructors instead of returning null.
1884
1885 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
1886
1887         * typemanager.cs (InitCoreTypes): Initialize the various core
1888         types after we have populated the type manager with the user
1889         defined types (this distinction will be important later while
1890         compiling corlib.dll)
1891
1892         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
1893         on Expression Classification.  Now all expressions have a method
1894         `Resolve' and a method `Emit'.
1895
1896         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
1897         generation from working.     Also add some temporary debugging
1898         code. 
1899         
1900 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
1901
1902         * codegen.cs: Lots of code generation pieces.  This is only the
1903         beginning, will continue tomorrow with more touches of polish.  We
1904         handle the fundamentals of if, while, do, for, return.  Others are
1905         trickier and I need to start working on invocations soon.
1906         
1907         * gen-treedump.cs: Bug fix, use s.Increment here instead of
1908         s.InitStatement. 
1909
1910         * codegen.cs (EmitContext): New struct, used during code
1911         emission to keep a context.   Most of the code generation will be
1912         here. 
1913
1914         * cs-parser.jay: Add embedded blocks to the list of statements of
1915         this block.  So code generation proceeds in a top down fashion.
1916
1917 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
1918
1919         * statement.cs: Add support for multiple child blocks.
1920
1921 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
1922
1923         * codegen.cs (EmitCode): New function, will emit the code for a
1924         Block of code given a TypeContainer and its ILGenerator. 
1925
1926         * statement.cs (Block): Standard public readonly optimization.
1927         (Block::Block constructors): Link children. 
1928         (Block::Child): Child Linker.
1929         (Block::EmitVariables): Emits IL variable declarations.
1930
1931         * class.cs: Drop support for MethodGroups here, delay until
1932         Semantic Analysis.
1933         (Method::): Applied the same simplification that I did before, and
1934         move from Properties to public readonly fields.
1935         (Method::ParameterTypes): Returns the parameter types for the
1936         function, and implements a cache that will be useful later when I
1937         do error checking and the semantic analysis on the methods is
1938         performed.
1939         (Constructor::GetCallingConvention): Renamed from CallingConvetion
1940         and made a method, optional argument tells whether this is a class
1941         or a structure to apply the `has-this' bit.
1942         (Method::GetCallingConvention): Implement, returns the calling
1943         convention. 
1944         (Method::Define): Defines the type, a second pass is performed
1945         later to populate the methods.
1946
1947         (Constructor::ParameterTypes): implement a cache similar to the
1948         one on Method::ParameterTypes, useful later when we do semantic
1949         analysis. 
1950
1951         (TypeContainer::EmitMethod):  New method.  Emits methods.
1952
1953         * expression.cs: Removed MethodGroup class from here.
1954         
1955         * parameter.cs (Parameters::GetCallingConvention): new method.
1956
1957 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
1958
1959         * class.cs (TypeContainer::Populate): Drop RootContext from the
1960         argument. 
1961
1962         (Constructor::CallingConvention): Returns the calling convention.
1963         (Constructor::ParameterTypes): Returns the constructor parameter
1964         types. 
1965         
1966         (TypeContainer::AddConstructor): Keep track of default constructor
1967         and the default static constructor.
1968
1969         (Constructor::) Another class that starts using `public readonly'
1970         instead of properties. 
1971
1972         (Constructor::IsDefault): Whether this is a default constructor. 
1973
1974         (Field::) use readonly public fields instead of properties also.
1975
1976         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
1977         track of static constructors;  If none is used, turn on
1978         BeforeFieldInit in the TypeAttributes. 
1979
1980         * cs-parser.jay (opt_argument_list): now the return can be null
1981         for the cases where there are no arguments. 
1982
1983         (constructor_declarator): If there is no implicit `base' or
1984         `this', then invoke the default parent constructor. 
1985         
1986         * modifiers.cs (MethodAttr): New static function maps a set of
1987         modifiers flags into a MethodAttributes enum
1988         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
1989         MethodAttr, TypeAttr to represent the various mappings where the
1990         modifiers are used.
1991         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
1992
1993 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
1994
1995         * parameter.cs (GetParameterInfo): Fix bug where there would be no
1996         method arguments.
1997
1998         * interface.cs (PopulateIndexer): Implemented the code generator
1999         for interface indexers.
2000
2001 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
2002
2003         * interface.cs (InterfaceMemberBase): Now we track the new status
2004         here.  
2005
2006         (PopulateProperty): Implement property population.  Woohoo!  Got
2007         Methods and Properties going today. 
2008
2009         Removed all the properties for interfaces, and replaced them with
2010         `public readonly' fields. 
2011
2012 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
2013
2014         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
2015         initialize their hashtables/arraylists only when they are needed
2016         instead of doing this always.
2017
2018         * parameter.cs: Handle refs and out parameters.
2019
2020         * cs-parser.jay: Use an ArrayList to construct the arguments
2021         instead of the ParameterCollection, and then cast that to a
2022         Parameter[] array.
2023
2024         * parameter.cs: Drop the use of ParameterCollection and use
2025         instead arrays of Parameters.
2026
2027         (GetParameterInfo): Use the Type, not the Name when resolving
2028         types. 
2029
2030 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
2031
2032         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
2033         and instead use public readonly fields.
2034
2035         * class.cs: Put back walking code for type containers.
2036
2037 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
2038
2039         * class.cs (MakeConstant): Code to define constants.
2040
2041         * rootcontext.cs (LookupType): New function.  Used to locate types 
2042
2043         
2044 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
2045
2046         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
2047         this System.Reflection code is.  Kudos to Microsoft
2048         
2049         * typemanager.cs: Implement a type cache and avoid loading all
2050         types at boot time.  Wrap in LookupType the internals.  This made
2051         the compiler so much faster.  Wow.  I rule!
2052         
2053         * driver.cs: Make sure we always load mscorlib first (for
2054         debugging purposes, nothing really important).
2055
2056         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
2057         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
2058
2059         * rootcontext.cs: Lookup types on their namespace;  Lookup types
2060         on namespaces that have been imported using the `using' keyword.
2061
2062         * class.cs (TypeContainer::TypeAttr): Virtualize.
2063         (Class::TypeAttr): Return attributes suitable for this bad boy.
2064         (Struct::TypeAttr): ditto.
2065         Handle nested classes.
2066         (TypeContainer::) Remove all the type visiting code, it is now
2067         replaced with the rootcontext.cs code
2068
2069         * rootcontext.cs (GetClassBases): Added support for structs. 
2070
2071 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
2072
2073         * interface.cs, statement.cs, class.cs, parameter.cs,
2074         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
2075         Drop use of TypeRefs, and use strings instead.
2076
2077 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
2078
2079         * rootcontext.cs: 
2080
2081         * class.cs (Struct::Struct): set the SEALED flags after
2082         checking the modifiers.
2083         (TypeContainer::TypeAttr): new property, returns the
2084         TypeAttributes for a class.  
2085
2086         * cs-parser.jay (type_list): Oops, list production was creating a
2087         new list of base types.
2088
2089         * rootcontext.cs (StdLib): New property.
2090         (GetInterfaceTypeByName): returns an interface by type name, and
2091         encapsulates error handling here.
2092         (GetInterfaces): simplified.
2093         (ResolveTree): Encapsulated all the tree resolution here.
2094         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
2095         types. 
2096         
2097         * driver.cs: Add support for --nostdlib, to avoid loading the
2098         default assemblies.
2099         (Main): Do not put tree resolution here. 
2100
2101         * rootcontext.cs: Beginning of the class resolution.
2102
2103 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
2104
2105         * rootcontext.cs: Provide better error reporting. 
2106
2107         * cs-parser.jay (interface_base): set our $$ to be interfaces.
2108
2109         * rootcontext.cs (CreateInterface): Handle the case where there
2110         are no parent interfaces.
2111         
2112         (CloseTypes): Routine to flush types at the end.
2113         (CreateInterface): Track types.
2114         (GetInterfaces): Returns an array of Types from the list of
2115         defined interfaces.
2116
2117         * typemanager.c (AddUserType): Mechanism to track user types (puts
2118         the type on the global type hash, and allows us to close it at the
2119         end). 
2120         
2121 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
2122
2123         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
2124         RecordInterface instead.
2125
2126         * cs-parser.jay: Updated to reflect changes above.
2127
2128         * decl.cs (Definition): Keep track of the TypeBuilder type that
2129         represents this type here.  Not sure we will use it in the long
2130         run, but wont hurt for now.
2131
2132         * driver.cs: Smaller changes to accomodate the new code.
2133
2134         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
2135         when done. 
2136
2137         * rootcontext.cs (CreateInterface):  New method, used to create
2138         the System.TypeBuilder type for interfaces.
2139         (ResolveInterfaces): new entry point to resolve the interface
2140         hierarchy. 
2141         (CodeGen): Property, used to keep track of the code generator.
2142
2143 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
2144
2145         * cs-parser.jay: Add a second production for delegate_declaration
2146         with `VOID'.
2147
2148         (enum_body): Put an opt_comma here instead of putting it on
2149         enum_body or enum_member_declarations so we can handle trailing
2150         commas on enumeration members.  Gets rid of a shift/reduce.
2151         
2152         (type_list): Need a COMMA in the middle.
2153
2154         (indexer_declaration): Tell tokenizer to recognize get/set
2155
2156         * Remove old targets.
2157
2158         * Re-add the parser target.
2159
2160 2001-07-13  Simon Cozens <simon@simon-cozens.org>
2161
2162         * cs-parser.jay: Add precendence rules for a number of operators
2163         ot reduce the number of shift/reduce conflicts in the grammar.
2164         
2165 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
2166
2167         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
2168         and put it here.
2169
2170         Get rid of old crufty code.
2171
2172         * rootcontext.cs: Use this to keep track of the parsed
2173         representation and the defined types available to the program. 
2174
2175         * gen-treedump.cs: adjust for new convention.
2176
2177         * type.cs: Split out the type manager, and the assembly builder
2178         from here. 
2179
2180         * typemanager.cs: the type manager will live here now.
2181
2182         * cil-codegen.cs: And the code generator here. 
2183
2184 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
2185
2186         * makefile: Fixed up for easy making.
2187
2188 2001-07-13  Simon Cozens <simon@simon-cozens.org>
2189
2190         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
2191         the 
2192
2193         (unary_expression): Expand pre_increment_expression and
2194         post_decrement_expression to reduce a shift/reduce.
2195
2196 2001-07-11  Simon Cozens
2197
2198         * cs-tokenizer.cs: Hex numbers should begin with a 0.
2199
2200         Improve allow_keyword_as_indent name.
2201
2202 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
2203
2204         * Adjustments for Beta2. 
2205
2206 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
2207
2208         * decl.cs: Added `Define' abstract method.
2209         (InTransit): new property, used to catch recursive definitions. 
2210
2211         * interface.cs: Implement `Define'. 
2212
2213         * modifiers.cs: Map Modifiers.constants to
2214         System.Reflection.TypeAttribute flags.
2215
2216         * class.cs: Keep track of types and user-defined types.
2217         (BuilderInit): New method for creating an assembly
2218         (ResolveType): New function to launch the resolution process, only
2219         used by interfaces for now.
2220
2221         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
2222         that are inserted into the name space. 
2223
2224 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
2225
2226         * ARGH.  I have screwed up my tree so many times due to the use of
2227         rsync rather than using CVS.  Going to fix this at once. 
2228
2229         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
2230         load types.
2231
2232 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
2233
2234         * Experiment successful: Use System.Type rather that our own
2235         version of Type.  
2236
2237 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
2238
2239         * cs-parser.jay: Removed nsAliases from here.
2240
2241         Use new namespaces, handle `using XXX;' 
2242
2243         * namespace.cs: Reimplemented namespace handling, use a recursive
2244         definition of the class.  Now we can keep track of using clauses
2245         and catch invalid using clauses.
2246
2247 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
2248
2249         * gen-treedump.cs: Adapted for all the renaming.
2250
2251         * expression.cs (Expression): this class now has a Type property
2252         which returns an expression Type.
2253
2254         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
2255         `Type', as this has a different meaning now in the base
2256
2257 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
2258
2259         * interface.cs, class.cs: Removed from all the sources the
2260         references to signature computation, as we can not do method
2261         signature computation during the parsing time, as we are not
2262         trying to solve at that point distinguishing:
2263
2264         class X {
2265                 void a (Blah x) {}
2266                 void a (NS.Blah x) {}
2267         }
2268
2269         Which depending on the context might be valid or not, as we do not
2270         know if Blah is the same thing as NS.Blah at that point.
2271
2272         * Redid everything so the code uses TypeRefs now instead of
2273         Types.  TypeRefs are just temporary type placeholders, that need
2274         to be resolved.  They initially have a pointer to a string and the
2275         current scope in which they are used.  This is used later by the
2276         compiler to resolve the reference to an actual Type. 
2277
2278         * DeclSpace is no longer a CIR.Type, and neither are
2279         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
2280         are all DeclSpaces, but no Types. 
2281
2282         * type.cs (TypeRefManager): This implements the TypeRef manager,
2283         which keeps track of all the types that need to be resolved after
2284         the parsing has finished. 
2285
2286 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
2287
2288         * ARGH.  We are going to have to store `foreach' as a class rather
2289         than resolving it, as we need to verify error 1579 after name
2290         resolution.   *OR* we could keep a flag that says `This request to
2291         IEnumerator comes from a foreach statement' which we can then use
2292         to generate the error.
2293
2294 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
2295
2296         * class.cs (TypeContainer.AddMethod): we now add methods to the
2297         MethodGroup instead of the method hashtable.  
2298
2299         * expression.cs: Add MethodGroup abstraction, which gets us one
2300         step closer to the specification in the way we handle method
2301         declarations.  
2302
2303         * cs-parser.jay (primary_expression): qualified_identifier now
2304         tried to match up an identifier to a local variable reference or
2305         to a parameter reference.
2306
2307         current_local_parameters is now a parser global variable that
2308         points to the current parameters for the block, used during name
2309         lookup.
2310
2311         (property_declaration): Now creates an implicit `value' argument to
2312         the set accessor.
2313
2314 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
2315
2316         * parameter.cs: Do not use `param' arguments as part of the
2317         signature, per the spec.
2318
2319 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
2320
2321         * decl.cs: Base class for classes, structs and interfaces.  This
2322         is the "Declaration Space" 
2323
2324         * cs-parser.jay: Use CheckDef for checking declaration errors
2325         instead of having one on each function.
2326
2327         * class.cs: Factor out some code for handling error handling in
2328         accordance to the "Declarations" section in the "Basic Concepts"
2329         chapter in the ECMA C# spec.
2330
2331         * interface.cs: Make all interface member classes derive from
2332         InterfaceMemberBase.
2333
2334 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
2335
2336         * Many things: all interfaces are parsed and generated in
2337         gen-treedump.  Support for member variables, constructors,
2338         destructors, properties, constants is there.
2339
2340         Beginning of the IL backend, but very little done, just there for
2341         testing purposes. 
2342
2343 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
2344
2345         * cs-parser.jay: Fix labeled statement.
2346
2347         * cs-tokenizer.cs (escape): Escape " and ' always.
2348         ref_line, ref_name: keep track of the line/filename as instructed
2349         by #line by the compiler.
2350         Parse #line.
2351
2352 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
2353
2354         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
2355         to match the values in System.CodeDOM.
2356
2357         Divid renamed to Divide.
2358
2359         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
2360         statements. 
2361         (Statements.set): remove.
2362
2363         * System.CodeDOM/CodeCatchClause.cs: always have a valid
2364         statements. 
2365
2366         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
2367         falseStatements always have valid values. 
2368
2369         * cs-parser.jay: Use System.CodeDOM now.
2370