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