Fix bug in BetterConversion and in ConvertImplicit
[mono.git] / mcs / mcs / ChangeLog
1 2001-09-27  Ravi Pratap  <ravi@ximian.com>
2
3         * expression.cs (Invocation::BetterConversion): Fix to cope
4         with q being null, since this was introducing a bug.
5
6         * expression.cs (ConvertImplicit): Do built-in conversions first.
7
8 2001-09-27  Ravi Pratap  <ravi@ximian.com>
9
10         * expression.cs (UserImplicitCast::Resolve): Fix bug.
11
12 2001-09-27  Ravi Pratap  <ravi@ximian.com>
13
14         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
15         I had introduced long ago (what's new ?).
16
17         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
18         the work of all the checking. 
19         (ConvertImplicit): Call CanConvert and only then create object if necessary.
20         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
21
22         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
23         that is the right way. 
24
25         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
26         overloading resolution. Use everywhere instead of cutting and pasting code.
27
28         (Binary::ResolveOperator): Use MakeUnionSet.
29
30         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
31         we have to convert to bool types. Not complete yet.
32         
33 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
34
35         * typemanager.cs (TypeManager::CSharpName): support ushort.
36
37         * expression.cs (Expression::TryImplicitIntConversion): Attempts
38         to provide an expression that performsn an implicit constant int
39         conversion (section 6.1.6).
40         (Expression::ConvertImplicitRequired): Reworked to include
41         implicit constant expression conversions.
42
43         (Expression::ConvertNumericExplicit): Finished.
44
45         (Invocation::Emit): If InstanceExpression is null, then it means
46         that we perform a call on this.
47         
48 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
49
50         * expression.cs (Unary::Emit): Remove some dead code.
51         (Probe): Implement Resolve and Emit for `is'.
52         (Expression::ConvertImplicitRequired): Attempt to do constant
53         expression conversions here.  Maybe should be moved to
54         ConvertImplicit, but I am not sure.
55         (Expression::ImplicitLongConstantConversionPossible,
56         Expression::ImplicitIntConstantConversionPossible): New functions
57         that tell whether is it possible to apply an implicit constant
58         expression conversion.
59
60         (ConvertNumericExplicit): Started work on explicit numeric
61         conversions.
62
63         * cs-parser.jay: Update operator constants.
64
65         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
66         (Parameters::GetSignature): Hook up VerifyArgs here.
67         (Parameters::VerifyArgs): Verifies that no two arguments have the
68         same name. 
69
70         * class.cs (Operator): Update the operator names to reflect the
71         ones that the spec expects (as we are just stringizing the
72         operator names).
73         
74         * expression.cs (Unary::ResolveOperator): Fix bug: Use
75         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
76         previous usage did only work for our methods.
77         (Expression::ConvertImplicit): Handle decimal implicit numeric
78         conversions as well.
79         (Expression::InternalTypeConstructor): Used to invoke constructors
80         on internal types for default promotions.
81
82         (Unary::Emit): Implement special handling for the pre/post
83         increment/decrement for overloaded operators, as they need to have
84         the same semantics as the other operators.
85
86         (Binary::ResolveOperator): ditto.
87         (Invocation::ConversionExists): ditto.
88         (UserImplicitCast::Resolve): ditto.
89         
90 2001-09-26  Ravi Pratap  <ravi@ximian.com>
91
92         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
93         operator, return after emitting body. Regression tests pass again !
94
95         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
96         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
97         (Invocation::OverloadResolve): Ditto.
98         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
99
100         * everywhere : update calls to the above methods accordingly.
101
102 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
103
104         * assign.cs (Assign): Make it inherit from ExpressionStatement.
105
106         * expression.cs (ExpressionStatement): New base class used for
107         expressions that can appear in statements, so that we can provide
108         an alternate path to generate expression that do not leave a value
109         on the stack.
110
111         (Expression::Emit, and all the derivatives): We no longer return
112         whether a value is left on the stack or not.  Every expression
113         after being emitted leaves a single value on the stack.
114
115         * codegen.cs (EmitContext::EmitStatementExpression): Use the
116         facilties of ExpressionStatement if possible.
117
118         * cs-parser.jay: Update statement_expression.
119
120 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
121
122         * driver.cs: Change the wording of message
123
124 2001-09-25  Ravi Pratap  <ravi@ximian.com>
125
126         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
127         the type of the expression to the return type of the method if
128         we have an overloaded operator match ! The regression tests pass again !
129         (Unary::ResolveOperator): Ditto.
130
131         * expression.cs (Invocation::ConversionExists): Correct the member lookup
132         to find "op_Implicit", not "implicit" ;-)
133         (UserImplicitCast): New class to take care of user-defined implicit conversions.
134         (ConvertImplicit, ForceConversion): Take TypeContainer argument
135
136         * everywhere : Correct calls to the above accordingly.
137
138         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
139         (ConvertImplicit): Do user-defined conversion if it exists.
140
141 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
142
143         * assign.cs: track location.
144         (Resolve): Use implicit conversions on assignment.
145
146         * literal.cs: Oops.  Not good, Emit of short access values should
147         pass (Bytes) or the wrong argument will be selected.
148
149         * expression.cs (Unary::Emit): Emit code for -expr.
150         
151         (Unary::ResolveOperator): Handle `Substract' for non-constants
152         (substract from zero from the non-constants).
153         Deal with Doubles as well. 
154         
155         (Expression::ConvertImplicitRequired): New routine that reports an
156         error if no implicit conversion exists. 
157
158         (Invocation::OverloadResolve): Store the converted implicit
159         expressions if we make them
160         
161 2001-09-24  Ravi Pratap  <ravi@ximian.com>
162
163         * class.cs (ConstructorInitializer): Take a Location argument.
164         (ConstructorBaseInitializer): Same here.
165         (ConstructorThisInitializer): Same here.
166
167         * cs-parser.jay : Update all calls accordingly.
168
169         * expression.cs (Unary, Binary, New): Take location argument.
170         Update accordingly everywhere.
171
172         * cs-parser.jay : Update all calls to the above to take a location
173         argument.
174
175         * class.cs : Ditto.
176
177 2001-09-24  Ravi Pratap  <ravi@ximian.com>
178
179         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
180         (Invocation::BetterConversion): Same here
181         (Invocation::ConversionExists): Ditto.
182
183         (Invocation::ConversionExists): Implement.
184
185 2001-09-22  Ravi Pratap  <ravi@ximian.com>
186
187         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
188         Also take an additional TypeContainer argument.
189
190         * All over : Pass in TypeContainer as argument to OverloadResolve.
191
192         * typemanager.cs (CSharpName): Update to check for the string type and return
193         that too.
194
195         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
196         a given method.
197         
198 2001-09-21  Ravi Pratap  <ravi@ximian.com>
199
200         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
201         (Invocation::BetterFunction): Implement.
202         (Invocation::BetterConversion): Implement.
203         (Invocation::ConversionExists): Skeleton, no implementation yet.
204
205         Okay, things work fine !
206
207 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
208
209         * typemanager.cs: declare and load enum_type, delegate_type and
210         void_type. 
211
212         * expression.cs (Expression::Emit): Now emit returns a value that
213         tells whether a value is left on the stack or not.  This strategy
214         might be reveted tomorrow with a mechanism that would address
215         multiple assignments.
216         (Expression::report118): Utility routine to report mismatches on
217         the ExprClass.
218
219         (Unary::Report23): Report impossible type/operator combination
220         utility function.
221
222         (Unary::IsIncrementableNumber): Whether the type can be
223         incremented or decremented with add.
224         (Unary::ResolveOperator): Also allow enumerations to be bitwise
225         complemented. 
226         (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
227
228         (Invocation::Emit): Deal with new Emit convetion.
229         
230         * All Expression derivatives: Updated their Emit method to return
231         whether they leave values on the stack or not.
232         
233         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
234         stack for expressions that are statements. 
235
236 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
237
238         * expression.cs (LValue): New interface.  Must be implemented by
239         LValue objects.
240         (LocalVariableReference, ParameterReference, FieldExpr): Implement
241         LValue interface.
242         
243         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
244         interface for generating code, simplifies the code.
245
246 2001-09-20  Ravi Pratap  <ravi@ximian.com>
247
248         * expression.cs (everywhere): Comment out return statements in ::Resolve
249         methods to avoid the warnings.
250
251 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
252
253         * driver.cs (parse): Report error 2001 if we can not open the
254         source file.
255
256         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
257         not resolve it.
258
259         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
260         object. 
261
262         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
263         otherwise nested blocks end up with the same index.
264
265         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
266
267         * expression.cs:  Instead of having FIXMEs in the Resolve
268         functions, throw exceptions so it is obvious that we are facing a
269         bug. 
270
271         * cs-parser.jay (invocation_expression): Pass Location information.
272
273         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
274         Use a basename for those routines because .NET does not like paths
275         on them. 
276
277         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
278         already defined.
279
280 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
281
282         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
283         are loading the correct data types (throws an exception if not).
284         (TypeManager::InitCoreTypes): Use CoreLookupType
285
286         * expression.cs (Unary::ResolveOperator): return the child
287         expression for expressions which are just +expr.
288         (Unary::ResolveOperator): Return negative literals for -LITERAL
289         expressions (otherwise they are Unary {Literal}).
290         (Invocation::Badness): Take into account `Implicit constant
291         expression conversions'.
292
293         * literal.cs (LongLiteral): Implement long literal class.
294         (IntLiteral): export the `Value' of the intliteral. 
295
296 2001-09-19  Ravi Pratap  <ravi@ximian.com>
297
298         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
299
300         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
301         instead of 'Operator'
302
303         * expression.cs (Binary::ResolveOperator): Update accordingly.
304         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
305         and 'Minus'
306
307         * cs-parser.jay (unary_expression): Update to use the new names.
308
309         * gen-treedump.cs (GetUnary): Same here.
310
311         * expression.cs (Unary::Resolve): Implement.
312         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
313         operators are found instead of making noise ;-)
314         (Unary::ResolveOperator): New method to do precisely the same thing which
315         Binary::ResolveOperator does for Binary expressions.
316         (Unary.method, .Arguments): Add.
317         (Unary::OperName): Implement.   
318         (Unary::ForceConversion): Copy and Paste !
319
320         * class.cs (Operator::Define): Fix a small bug for the case when we have 
321         a unary operator.
322
323         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
324         for the inbuilt operators. Only overloading works for now ;-)
325
326 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
327
328         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
329         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
330
331         * expression.cs (This::Emit): Implement. 
332         (This::Resolve): Implement.
333         (TypeOf:Resolve): Implement.
334         (Expression::ResolveSimpleName): Add an implicit this to instance
335         field references. 
336         (MemberAccess::Resolve): Deal with Parameters and Fields. 
337         Bind instance variable to Field expressions.
338         (FieldExpr::Instance): New field used to track the expression that
339         represents the object instance.
340         (FieldExpr::Resolve): Track potential errors from MemberLookup not
341         binding 
342         (FieldExpr::Emit): Implement.
343
344         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
345         the last instruction contains a return opcode to avoid generating
346         the last `ret' instruction (this generates correct code, and it is
347         nice to pass the peverify output).
348
349         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
350         initializer for static and instance variables.
351         (Constructor::Emit): Allow initializer to be null in the case of
352         static constructors.  Only emit initializer for instance
353         constructors. 
354
355         (TypeContainer::FindMembers): Return a null array if there are no
356         matches.
357
358         Also fix the code for the MemberTypes.Method branch, as it was not
359         scanning that for operators (or tried to access null variables before).
360
361         * assign.cs (Assign::Emit): Handle instance and static fields. 
362
363         * TODO: Updated.
364
365         * driver.cs: Stop compilation if there are parse errors.
366
367         * cs-parser.jay (constructor_declaration): Provide default base
368         initializer for non-static constructors.
369         (constructor_declarator): Do not provide a default base
370         initializers if none was specified.
371         Catch the fact that constructors should not have parameters.
372
373         * class.cs: Do not emit parent class initializers for static
374         constructors, that should be flagged as an error.
375
376 2001-09-18  Ravi Pratap  <ravi@ximian.com>
377
378         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
379         Move back code into TypeContainer::Populate.
380
381 2001-09-18  Ravi Pratap  <ravi@ximian.com>
382
383         * class.cs (TypeContainer::AddConstructor): Fix the check to
384         compare against Name, not Basename. 
385         (Operator::OpType): Change Plus and Minus to Add and Subtract.
386
387         * cs-parser.jay : Update accordingly.
388
389         * class.cs (TypeContainer::FindMembers): For the case where we are searching
390         for methods, don't forget to look into the operators too.
391         (RegisterMethodBuilder): Helper method to take care of this for
392         methods, constructors and operators.
393         (Operator::Define): Completely revamp.
394         (Operator.OperatorMethod, MethodName): New fields.
395         (TypeContainer::Populate): Move the registering of builders into
396         RegisterMethodBuilder.
397         (Operator::Emit): Re-write.
398
399         * expression.cs (Binary::Emit): Comment out code path to emit method
400         invocation stuff for the case when we have a user defined operator. I am
401         just not able to get it right !
402         
403 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
404
405         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
406         argument. 
407
408         (Expression::MemberLookup): Provide a version that allows to
409         specify the MemberTypes and BindingFlags. 
410
411         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
412         so it was not fetching variable information from outer blocks.
413
414         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
415         Beforefieldinit as it was buggy.
416
417         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
418         that Ravi put here.  
419
420         * class.cs (Constructor::Emit): Only emit if block is not null.
421         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
422         deal with this by semantically definining it as if the user had
423         done it.
424
425         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
426         constructors as we now "emit" them at a higher level.
427
428         (TypeContainer::DefineDefaultConstructor): Used to define the
429         default constructors if none was provided.
430
431         (ConstructorInitializer): Add methods Resolve and Emit. 
432         
433         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
434
435 2001-09-17  Ravi Pratap  <ravi@ximian.com>
436
437         * class.cs (TypeContainer::EmitDefaultConstructor): Register
438         the default constructor builder with our hashtable for methodbuilders
439         to methodcores.
440
441         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
442         and argument_count is 0 in which case we have a match.
443         (Binary::ResolveOperator): More null checking and miscellaneous coding
444         style cleanup.
445
446 2001-09-17  Ravi Pratap  <ravi@ximian.com>
447
448         * rootcontext.cs (IsNameSpace): Compare against null.
449
450         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
451
452         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
453         and Unary::Operator.
454
455         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
456         accordingly.
457
458         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
459         we have overloaded operators.
460         (Binary::ResolveOperator): Implement the part which does the operator overload
461         resolution.
462
463         * class.cs (Operator::Emit): Implement.
464         (TypeContainer::Emit): Emit the operators we have too.
465
466         * expression.cs (Binary::Emit): Update to emit the appropriate code for
467         the case when we have a user-defined operator.
468         
469 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
470
471         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
472
473 2001-09-16  Ravi Pratap  <ravi@ximian.com>
474
475         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
476         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
477         (Constructor::Emit): Implement.
478         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
479         if we have no work to do. 
480         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
481         Emit method.
482
483         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
484         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
485
486         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
487         of parent.parent.
488
489 2001-09-15  Ravi Pratap  <ravi@ximian.com>
490
491         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
492         in the source.
493         (Tree::RecordNamespace): Method to do what the name says ;-)
494         (Tree::Namespaces): Property to get at the namespaces hashtable.
495
496         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
497         keep track.
498
499         * rootcontext.cs (IsNamespace): Fixed it :-)
500
501 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
502
503         * class.cs (TypeContainer::FindMembers): Add support for
504         constructors. 
505         (MethodCore): New class that encapsulates both the shared aspects
506         of a Constructor and a Method.  
507         (Method, Constructor): Factored pieces into MethodCore.
508
509         * driver.cs: Added --fatal which makes errors throw exceptions.
510         Load System assembly as well as part of the standard library.
511
512         * report.cs: Allow throwing exceptions on errors for debugging.
513
514         * modifiers.cs: Do not use `parent', instead use the real type
515         container to evaluate permission settings.
516
517         * class.cs: Put Ravi's patch back in.  He is right, and we will
518         have to cope with the
519
520 2001-09-14  Ravi Pratap  <ravi@ximian.com>
521
522         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
523         FamORAssem, not FamANDAssem.
524         
525 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
526
527         * driver.cs: Added --parse option that only parses its input files
528         and terminates.
529
530         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
531         incorrect.  IsTopLevel is not used to tell whether an object is
532         root_types or not (that can be achieved by testing this ==
533         root_types).  But to see if this is a top-level *class* (not
534         necessarly our "toplevel" container). 
535
536 2001-09-14  Ravi Pratap  <ravi@ximian.com>
537
538         * enum.cs (Enum::Define): Modify to call the Lookup method on the
539         parent instead of a direct call to GetType.
540
541 2001-09-14  Ravi Pratap  <ravi@ximian.com>
542
543         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
544         Modifiers.TypeAttr. This should just be a call to that method.
545
546         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
547         object so that we can determine if we are top-level or not.
548
549         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
550         TypeContainer too.
551
552         * enum.cs (Enum::Define): Ditto.
553
554         * modifiers.cs (FieldAttr): Re-write.
555
556         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
557         (TypeContainer::HaveStaticConstructor): New property to provide access
558         to precisely that info.
559
560         * modifiers.cs (MethodAttr): Re-write.
561         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
562
563         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
564         of top-level types as claimed.
565         
566 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
567
568         * expression.cs (MemberLookup): Fruitless attempt to lookup
569         constructors.  Maybe I need to emit default constructors?  That
570         might be it (currently .NET emits this for me automatically).
571         (Invocation::OverloadResolve): Cope with Arguments == null.
572         (Invocation::EmitArguments): new function, shared by the new
573         constructor and us.
574         (Invocation::Emit): Handle static and instance methods.  Emit
575         proper call instruction for virtual or non-virtual invocations.
576         (New::Emit): Implement.
577         (New::Resolve): Implement.
578         (MemberAccess:Resolve): Implement.
579         (MethodGroupExpr::InstanceExpression): used conforming to the spec
580         to track instances.
581         (FieldExpr::Resolve): Set type.
582
583         * support.cs: Handle empty arguments.
584                 
585         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
586         SimpleLookup): Auxiliary routines to help parse a qualifier
587         identifier.  
588
589         Update qualifier_identifier rule.
590
591         * codegen.cs: Removed debugging messages.
592
593         * class.cs: Make this a global thing, this acts just as a "key" to
594         objects that we might have around.
595
596         (Populate): Only initialize method_builders_to_methods once.
597
598         * expression.cs (PropertyExpr): Initialize type from the
599         PropertyType. 
600
601         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
602         Resolve pattern.  Attempt to implicitly convert value to boolean.
603         Emit code.
604
605         * expression.cs: Set the type for the int32/int32 argument case.
606         (Binary::ResolveOperator): Set the return type to boolean for
607         comparission operators
608
609         * typemanager.cs: Remove debugging print code.
610
611         (Invocation::Resolve): resolve type.
612
613         * class.cs: Allocate a MemberInfo of the correct size, as the code
614         elsewhere depends on the test to reflect the correct contents.
615
616         (Method::) Keep track of parameters, due to System.Reflection holes
617
618         (TypeContainer::Populate): Keep track of MethodBuilders to Method
619         mapping here.
620
621         (TypeContainer::FindMembers): Use ArrayList and then copy an array
622         of the exact size and return that.
623
624         (Class::LookupMethodByBuilder): New function that maps
625         MethodBuilders to its methods.  Required to locate the information
626         on methods because System.Reflection bit us again.
627
628         * support.cs: New file, contains an interface ParameterData and
629         two implementations: ReflectionParameters and InternalParameters
630         used to access Parameter information.  We will need to grow this
631         as required.
632
633         * expression.cs (Invocation::GetParameterData): implement a cache
634         and a wrapper around the ParameterData creation for methods. 
635         (Invocation::OverloadResolve): Use new code.
636
637 2001-09-13  Ravi Pratap  <ravi@ximian.com>
638
639         * class.cs (TypeContainer::EmitField): Remove and move into 
640         (Field::Define): here and modify accordingly.
641         (Field.FieldBuilder): New member.
642         (TypeContainer::Populate): Update accordingly.
643         (TypeContainer::FindMembers): Implement.
644
645 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
646
647         * statement.cs: (VariableInfo::VariableType): New field to be
648         initialized with the full type once it is resolved. 
649
650 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
651
652         * parameter.cs (GetParameterInfo): Use a type cache to compute
653         things only once, and to reuse this information
654
655         * expression.cs (LocalVariableReference::Emit): Implement.
656         (OpcodeCast::Emit): fix.
657
658         (ParameterReference::Resolve): Implement.
659         (ParameterReference::Emit): Implement.
660
661         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
662         that are expressions need to stay as Expressions.
663
664         * typemanager.cs (CSharpName): Returns the C# name of a type if
665         possible. 
666
667         * expression.cs (Expression::ConvertImplicit): New function that
668         implements implicit type conversions.
669
670         (Expression::ImplicitReferenceConversion): Implements implicit
671         reference conversions.
672
673         (EmptyCast): New type for transparent casts.
674
675         (OpcodeCast): New type for casts of types that are performed with
676         a sequence of bytecodes.
677         
678         (BoxedCast): New type used for casting value types into reference
679         types.  Emits a box opcode.
680
681         (Binary::DoNumericPromotions): Implements numeric promotions of
682         and computation of the Binary::Type.
683
684         (Binary::EmitBranchable): Optimization.
685
686         (Binary::Emit): Implement code emission for expressions.
687         
688         * typemanager.cs (TypeManager): Added two new core types: sbyte
689         and byte.
690
691 2001-09-12  Ravi Pratap  <ravi@ximian.com>
692
693         * class.cs (TypeContainer::FindMembers): Method which does exactly
694         what Type.FindMembers does, only we don't have to use reflection. No
695         implementation yet.
696
697         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
698         typecontainer objects as we need to get at them.
699         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
700
701         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
702         typecontainer object.
703
704         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
705         of just a Report object.
706
707 2001-09-11  Ravi Pratap  <ravi@ximian.com>
708
709         * class.cs (Event::Define): Go back to using the prefixes "add_" and
710         "remove_"
711         (TypeContainer::Populate): Now define the delegates of the type too.
712         (TypeContainer.Delegates): Property to access the list of delegates defined
713         in the type.
714
715         * delegates.cs (Delegate::Define): Implement partially.
716
717         * modifiers.cs (TypeAttr): Handle more flags.
718
719 2001-09-11  Ravi Pratap  <ravi@ximian.com>
720
721         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
722         and not <=
723         (Operator::Define): Re-write logic to get types by using the LookupType method
724         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
725         (Indexer::Define): Ditto.
726         (Event::Define): Ditto.
727         (Property::Define): Ditto.
728         
729 2001-09-10  Ravi Pratap  <ravi@ximian.com>
730
731         * class.cs (TypeContainer::Populate): Now define operators too. 
732         (TypeContainer.Operators): New property to access the list of operators
733         in a type.
734         (Operator.OperatorMethodBuilder): New member to hold the method builder
735         for the operator we are defining.
736         (Operator::Define): Implement.
737
738 2001-09-10  Ravi Pratap  <ravi@ximian.com>
739
740         * class.cs (Event::Define): Make the prefixes of the accessor methods
741         addOn_ and removeOn_ 
742
743         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
744         of the location being passed in too. Ideally, this should go later since all
745         error reporting should be done through the Report object.
746
747         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
748         (Populate): Iterate thru the indexers we have and define them too.
749         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
750         for the get and set accessors.
751         (Indexer::Define): Implement.
752         
753 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
754
755         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
756         my previous implementation, did not work.
757
758         * typemanager.cs: Add a couple of missing types (the longs).
759
760         * literal.cs: Use TypeManager.bool_type instead of getting it.
761
762         * expression.cs (EventExpr): New kind of expressions.
763         (Expressio::ExprClassFromMemberInfo): finish
764
765 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
766
767         * assign.cs: Emit stores to static fields differently.
768
769 2001-09-08  Ravi Pratap  <ravi@ximian.com>
770
771         * Merge in changes and adjust code to tackle conflicts. Backed out my
772         code in Assign::Resolve ;-) 
773
774 2001-09-08  Ravi Pratap  <ravi@ximian.com>
775
776         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
777         instead Report.Error and also pass in the location.
778         (CSharpParser::Lexer): New readonly property to return the reference
779         to the Tokenizer object.
780         (declare_local_variables): Use Report.Error with location instead of plain 
781         old error.
782         (CheckDef): Ditto.
783
784         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
785         (Operator.CheckBinaryOperator): Ditto.
786
787         * cs-parser.jay (operator_declarator): Update accordingly.
788
789         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
790         (CheckBinaryOperator): Same here.
791
792         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
793         on the name without any prefixes of namespace names etc. This is because we
794         already might have something already fully qualified like 
795         'System.Console.WriteLine'
796
797         * assign.cs (Resolve): Begin implementation. Stuck ;-)
798
799 2001-09-07  Ravi Pratap  <ravi@ximian.com>
800
801         * cs-tokenizer.cs (location): Return a string which also contains
802         the file name.
803
804         * expression.cs (ElementAccess): New class for expressions of the
805         type 'element access.'
806         (BaseAccess): New class for expressions of the type 'base access.'
807         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
808         respectively.
809         
810         * cs-parser.jay (element_access): Implement action.
811         (base_access): Implement actions.
812         (checked_expression, unchecked_expression): Implement.
813
814         * cs-parser.jay (local_variable_type): Correct and implement.
815         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
816
817         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
818
819         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
820         name and the specifiers.
821
822         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
823         
824         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
825         making them all public ;-)
826
827         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
828         class anyways.
829         
830 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
831
832         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
833         PropertyExprs.
834         (FieldExpr, PropertyExprs): New resolved expressions.
835         (SimpleName::MemberStaticCheck): Perform static checks for access
836         to non-static fields on static methods. Maybe this should be
837         generalized for MemberAccesses. 
838         (SimpleName::ResolveSimpleName): More work on simple name
839         resolution. 
840
841         * cs-parser.jay (primary_expression/qualified_identifier): track
842         the parameter index.
843
844         * codegen.cs (CodeGen::Save): Catch save exception, report error.
845         (EmitContext::EmitBoolExpression): Chain to expression generation
846         instead of temporary hack.
847         (::EmitStatementExpression): Put generic expression code generation.
848
849         * assign.cs (Assign::Emit): Implement variable assignments to
850         local variables, parameters and fields.
851
852 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
853
854         * statement.cs (Block::GetVariableInfo): New method, returns the
855         VariableInfo for a variable name in a block.
856         (Block::GetVariableType): Implement in terms of GetVariableInfo
857
858         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
859         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
860
861 2001-09-06  Ravi Pratap  <ravi@ximian.com>
862
863         * cs-parser.jay (operator_declaration): Continue on my quest : update
864         to take attributes argument.
865         (event_declaration): Ditto.
866         (enum_declaration): Ditto.
867         (indexer_declaration): Ditto.
868         
869         * class.cs (Operator::Operator): Update constructor accordingly.
870         (Event::Event): Ditto.
871
872         * delegate.cs (Delegate::Delegate): Same here.
873
874         * enum.cs (Enum::Enum): Same here.
875         
876 2001-09-05  Ravi Pratap  <ravi@ximian.com>
877
878         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
879
880         * ../tests/cs0658.cs : New file to demonstrate error 0658.
881
882         * attribute.cs (Attributes): New class to encapsulate all attributes which were
883         being passed around as an arraylist.
884         (Attributes::AddAttribute): Method to add attribute sections.
885
886         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
887         (struct_declaration): Update accordingly.
888         (constant_declaration): Update.
889         (field_declaration): Update.
890         (method_header): Update.
891         (fixed_parameter): Update.
892         (parameter_array): Ditto.
893         (property_declaration): Ditto.
894         (destructor_declaration): Ditto.
895         
896         * class.cs (Struct::Struct): Update constructors accordingly.
897         (Class::Class): Ditto.
898         (Field::Field): Ditto.
899         (Method::Method): Ditto.
900         (Property::Property): Ditto.
901         (TypeContainer::OptAttribute): update property's return type.
902         
903         * interface.cs (Interface.opt_attributes): New member.
904         (Interface::Interface): Update to take the extra Attributes argument.
905
906         * parameter.cs (Parameter::Parameter): Ditto.
907
908         * constant.cs (Constant::Constant): Ditto.
909
910         * interface.cs (InterfaceMemberBase): New OptAttributes field.
911         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
912         the attributes as a parameter.
913         (InterfaceProperty): Update constructor call.
914         (InterfaceEvent): Ditto.
915         (InterfaceMethod): Ditto.
916         (InterfaceIndexer): Ditto.
917
918         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
919         pass the attributes too.
920         (interface_event_declaration): Ditto.
921         (interface_property_declaration): Ditto.
922         (interface_method_declaration): Ditto.
923         (interface_declaration): Ditto.
924
925 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
926
927         * class.cs (Method::Define): Track the "static Main" definition to
928         create an entry point. 
929
930         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
931         EntryPoint if we find it. 
932
933         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
934         (EmitContext::ig): Make this variable public.
935
936         * driver.cs: Make the default output file be the first file name
937         with the .exe extension.  
938
939         Detect empty compilations
940
941         Handle various kinds of output targets.  Handle --target and
942         rename -t to --dumper.
943
944         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
945         methods inherited from Expression return now an Expression.  This
946         will is used during the tree rewriting as we resolve them during
947         semantic analysis.
948
949         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
950         the spec.  Missing entirely is the information about
951         accessability of elements of it.
952
953         (Expression::ExprClassFromMemberInfo): New constructor for
954         Expressions that creates a fully initialized Expression based on
955         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
956         a Type.
957
958         (Invocation::Resolve): Begin implementing resolution of invocations.
959         
960         * literal.cs (StringLiteral):  Implement Emit.
961
962 2001-09-05  Ravi Pratap  <ravi@ximian.com>
963
964         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
965         member.
966         
967 2001-09-04  Ravi Pratap  <ravi@ximian.com>
968
969         * cs-parser.jay (attribute_arguments): Implement actions.
970         (attribute): Fix bug in production. Implement action.
971         (attribute_list): Implement.
972         (attribute_target): Implement.
973         (attribute_target_specifier, opt_target_specifier): Implement
974         (CheckAttributeTarget): New method to check if the attribute target
975         is valid.
976         (attribute_section): Implement.
977         (opt_attributes): Implement.
978
979         * attribute.cs : New file to handle attributes.
980         (Attribute): Class to hold attribute info.
981
982         * cs-parser.jay (opt_attribute_target_specifier): Remove production
983         (attribute_section): Modify production to use 2 different rules to 
984         achieve the same thing. 1 s/r conflict down !
985         Clean out commented, useless, non-reducing dimension_separator rules.
986         
987         * class.cs (TypeContainer.attributes): New member to hold list
988         of attributes for a type.
989         (Struct::Struct): Modify to take one more argument, the attribute list.
990         (Class::Class): Ditto.
991         (Field::Field): Ditto.
992         (Method::Method): Ditto.
993         (Property::Property): Ditto.
994         
995         * cs-parser.jay (struct_declaration): Update constructor call to
996         pass in the attributes too.
997         (class_declaration): Ditto.
998         (constant_declaration): Ditto.
999         (field_declaration): Ditto.
1000         (method_header): Ditto.
1001         (fixed_parameter): Ditto.
1002         (parameter_array): Ditto.
1003         (property_declaration): Ditto.
1004
1005         * constant.cs (Constant::Constant): Update constructor similarly.
1006         Use System.Collections.
1007
1008         * parameter.cs (Parameter::Parameter): Update as above.
1009
1010 2001-09-02  Ravi Pratap  <ravi@ximian.com>
1011
1012         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
1013         (TypeContainer.delegates): New member to hold list of delegates.
1014
1015         * cs-parser.jay (delegate_declaration): Implement the action correctly 
1016         this time as I seem to be on crack ;-)
1017
1018 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
1019
1020         * rootcontext.cs (RootContext::IsNamespace): new function, used to
1021         tell whether an identifier represents a namespace.
1022
1023         * expression.cs (NamespaceExpr): A namespace expression, used only
1024         temporarly during expression resolution.
1025         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
1026         utility functions to resolve names on expressions.
1027
1028 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
1029
1030         * codegen.cs: Add hook for StatementExpressions. 
1031
1032         * class.cs: Fix inverted test for static flag in methods.
1033
1034 2001-09-02  Ravi Pratap  <ravi@ximian.com>
1035
1036         * class.cs (Operator::CheckUnaryOperator): Correct error number used
1037         to make it coincide with MS' number.
1038         (Operator::CheckBinaryOperator): Ditto.
1039
1040         * ../errors/errors.txt : Remove error numbers added earlier.
1041
1042         * ../errors/cs1019.cs : Test case for error # 1019
1043
1044         * ../errros/cs1020.cs : Test case for error # 1020
1045
1046         * cs-parser.jay : Clean out commented cruft.
1047         (dimension_separators, dimension_separator): Comment out. Ostensibly not
1048         used anywhere - non-reducing rule.
1049         (namespace_declarations): Non-reducing rule - comment out.
1050
1051         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
1052         with TypeContainer::AddEnum.
1053
1054         * delegate.cs : New file for delegate handling classes.
1055         (Delegate): Class for declaring delegates.
1056
1057         * makefile : Update.
1058
1059         * cs-parser.jay (delegate_declaration): Implement.
1060
1061 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
1062
1063         * class.cs (Event::Define): Implement.
1064         (Event.EventBuilder): New member.
1065
1066         * class.cs (TypeContainer::Populate): Update to define all enums and events
1067         we have.
1068         (Events): New property for the events arraylist we hold. Shouldn't we move to using
1069         readonly fields for all these cases ?
1070
1071 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
1072
1073         * class.cs (Property): Revamp to use the convention of making fields readonly.
1074         Accordingly modify code elsewhere.
1075
1076         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
1077         the Define method of the Property class.
1078
1079         * class.cs : Clean up applied patch and update references to variables etc. Fix 
1080         trivial bug.
1081         (TypeContainer::Populate): Update to define all the properties we have. Also
1082         define all enumerations.
1083
1084         * enum.cs (Define): Implement.
1085         
1086 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
1087
1088         * cs-parser.jay (overloadable_operator): The semantic value is an
1089         enum of the Operator class.
1090         (operator_declarator): Implement actions.
1091         (operator_declaration): Implement.
1092
1093         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
1094         validity of definitions.
1095         (Operator::CheckBinaryOperator): Static method to check for binary operators
1096         (TypeContainer::AddOperator): New method to add an operator to a type.
1097
1098         * cs-parser.jay (indexer_declaration): Added line to actually call the
1099         AddIndexer method so it gets added ;-)
1100
1101         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
1102         already taken care of by the MS compiler ?  
1103
1104 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
1105
1106         * class.cs (Operator): New class for operator declarations.
1107         (Operator::OpType): Enum for the various operators.
1108
1109 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
1110
1111         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
1112         ostensibly handle this in semantic analysis.
1113
1114         * cs-parser.jay (general_catch_clause): Comment out
1115         (specific_catch_clauses, specific_catch_clause): Ditto.
1116         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
1117         (catch_args, opt_catch_args): New productions.
1118         (catch_clause): Rewrite to use the new productions above
1119         (catch_clauses): Modify accordingly.
1120         (opt_catch_clauses): New production to use in try_statement
1121         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
1122         and re-write the code in the actions to extract the specific and
1123         general catch clauses by being a little smart ;-)
1124
1125         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
1126         Hooray, try and catch statements parse fine !
1127         
1128 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
1129
1130         * statement.cs (Block::GetVariableType): Fix logic to extract the type
1131         string from the hashtable of variables.
1132
1133         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
1134         I end up making that mistake ;-)
1135         (catch_clauses): Fixed gross error which made Key and Value of the 
1136         DictionaryEntry the same : $1 !!
1137
1138 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
1139
1140         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
1141
1142         * cs-parser.jay (event_declaration): Correct to remove the semicolon
1143         when the add and remove accessors are specified. 
1144
1145 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
1146
1147         * cs-parser.jay (IndexerDeclaration): New helper class to hold
1148         information about indexer_declarator.
1149         (indexer_declarator): Implement actions.
1150         (parsing_indexer): New local boolean used to keep track of whether
1151         we are parsing indexers or properties. This is necessary because 
1152         implicit_parameters come into picture even for the get accessor in the 
1153         case of an indexer.
1154         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
1155
1156         * class.cs (Indexer): New class for indexer declarations.
1157         (TypeContainer::AddIndexer): New method to add an indexer to a type.
1158         (TypeContainer::indexers): New member to hold list of indexers for the
1159         type.
1160
1161 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
1162
1163         * cs-parser.jay (add_accessor_declaration): Implement action.
1164         (remove_accessor_declaration): Implement action.
1165         (event_accessors_declaration): Implement
1166         (variable_declarators): swap statements for first rule - trivial.
1167
1168         * class.cs (Event): New class to hold information about event
1169         declarations.
1170         (TypeContainer::AddEvent): New method to add an event to a type
1171         (TypeContainer::events): New member to hold list of events.
1172
1173         * cs-parser.jay (event_declaration): Implement actions.
1174
1175 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
1176
1177         * cs-parser.jay (dim_separators): Implement. Make it a string
1178         concatenating all the commas together, just as they appear.
1179         (opt_dim_separators): Modify accordingly
1180         (rank_specifiers): Update accordingly. Basically do the same
1181         thing - instead, collect the brackets here.
1182         (opt_rank_sepcifiers): Modify accordingly.
1183         (array_type): Modify to actually return the complete type string
1184         instead of ignoring the rank_specifiers.
1185         (expression_list): Implement to collect the expressions
1186         (variable_initializer): Implement. We make it a list of expressions
1187         essentially so that we can handle the array_initializer case neatly too.
1188         (variable_initializer_list): Implement.
1189         (array_initializer): Make it a list of variable_initializers
1190         (opt_array_initializer): Modify accordingly.
1191
1192         * expression.cs (New::NType): Add enumeration to help us
1193         keep track of whether we have an object/delegate creation
1194         or an array creation.
1195         (New:NewType, New::Rank, New::Indices, New::Initializers): New
1196         members to hold data about array creation.
1197         (New:New): Modify to update NewType
1198         (New:New): New Overloaded contructor for the array creation
1199         case.
1200
1201         * cs-parser.jay (array_creation_expression): Implement to call
1202         the overloaded New constructor.
1203         
1204 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
1205
1206         * class.cs (TypeContainer::Constructors): Return member
1207         constructors instead of returning null.
1208
1209 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
1210
1211         * typemanager.cs (InitCoreTypes): Initialize the various core
1212         types after we have populated the type manager with the user
1213         defined types (this distinction will be important later while
1214         compiling corlib.dll)
1215
1216         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
1217         on Expression Classification.  Now all expressions have a method
1218         `Resolve' and a method `Emit'.
1219
1220         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
1221         generation from working.     Also add some temporary debugging
1222         code. 
1223         
1224 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
1225
1226         * codegen.cs: Lots of code generation pieces.  This is only the
1227         beginning, will continue tomorrow with more touches of polish.  We
1228         handle the fundamentals of if, while, do, for, return.  Others are
1229         trickier and I need to start working on invocations soon.
1230         
1231         * gen-treedump.cs: Bug fix, use s.Increment here instead of
1232         s.InitStatement. 
1233
1234         * codegen.cs (EmitContext): New struct, used during code
1235         emission to keep a context.   Most of the code generation will be
1236         here. 
1237
1238         * cs-parser.jay: Add embedded blocks to the list of statements of
1239         this block.  So code generation proceeds in a top down fashion.
1240
1241 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
1242
1243         * statement.cs: Add support for multiple child blocks.
1244
1245 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
1246
1247         * codegen.cs (EmitCode): New function, will emit the code for a
1248         Block of code given a TypeContainer and its ILGenerator. 
1249
1250         * statement.cs (Block): Standard public readonly optimization.
1251         (Block::Block constructors): Link children. 
1252         (Block::Child): Child Linker.
1253         (Block::EmitVariables): Emits IL variable declarations.
1254
1255         * class.cs: Drop support for MethodGroups here, delay until
1256         Semantic Analysis.
1257         (Method::): Applied the same simplification that I did before, and
1258         move from Properties to public readonly fields.
1259         (Method::ParameterTypes): Returns the parameter types for the
1260         function, and implements a cache that will be useful later when I
1261         do error checking and the semantic analysis on the methods is
1262         performed.
1263         (Constructor::GetCallingConvention): Renamed from CallingConvetion
1264         and made a method, optional argument tells whether this is a class
1265         or a structure to apply the `has-this' bit.
1266         (Method::GetCallingConvention): Implement, returns the calling
1267         convention. 
1268         (Method::Define): Defines the type, a second pass is performed
1269         later to populate the methods.
1270
1271         (Constructor::ParameterTypes): implement a cache similar to the
1272         one on Method::ParameterTypes, useful later when we do semantic
1273         analysis. 
1274
1275         (TypeContainer::EmitMethod):  New method.  Emits methods.
1276
1277         * expression.cs: Removed MethodGroup class from here.
1278         
1279         * parameter.cs (Parameters::GetCallingConvention): new method.
1280
1281 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
1282
1283         * class.cs (TypeContainer::Populate): Drop RootContext from the
1284         argument. 
1285
1286         (Constructor::CallingConvention): Returns the calling convention.
1287         (Constructor::ParameterTypes): Returns the constructor parameter
1288         types. 
1289         
1290         (TypeContainer::AddConstructor): Keep track of default constructor
1291         and the default static constructor.
1292
1293         (Constructor::) Another class that starts using `public readonly'
1294         instead of properties. 
1295
1296         (Constructor::IsDefault): Whether this is a default constructor. 
1297
1298         (Field::) use readonly public fields instead of properties also.
1299
1300         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
1301         track of static constructors;  If none is used, turn on
1302         BeforeFieldInit in the TypeAttributes. 
1303
1304         * cs-parser.jay (opt_argument_list): now the return can be null
1305         for the cases where there are no arguments. 
1306
1307         (constructor_declarator): If there is no implicit `base' or
1308         `this', then invoke the default parent constructor. 
1309         
1310         * modifiers.cs (MethodAttr): New static function maps a set of
1311         modifiers flags into a MethodAttributes enum
1312         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
1313         MethodAttr, TypeAttr to represent the various mappings where the
1314         modifiers are used.
1315         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
1316
1317 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
1318
1319         * parameter.cs (GetParameterInfo): Fix bug where there would be no
1320         method arguments.
1321
1322         * interface.cs (PopulateIndexer): Implemented the code generator
1323         for interface indexers.
1324
1325 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
1326
1327         * interface.cs (InterfaceMemberBase): Now we track the new status
1328         here.  
1329
1330         (PopulateProperty): Implement property population.  Woohoo!  Got
1331         Methods and Properties going today. 
1332
1333         Removed all the properties for interfaces, and replaced them with
1334         `public readonly' fields. 
1335
1336 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
1337
1338         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
1339         initialize their hashtables/arraylists only when they are needed
1340         instead of doing this always.
1341
1342         * parameter.cs: Handle refs and out parameters.
1343
1344         * cs-parser.jay: Use an ArrayList to construct the arguments
1345         instead of the ParameterCollection, and then cast that to a
1346         Parameter[] array.
1347
1348         * parameter.cs: Drop the use of ParameterCollection and use
1349         instead arrays of Parameters.
1350
1351         (GetParameterInfo): Use the Type, not the Name when resolving
1352         types. 
1353
1354 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
1355
1356         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
1357         and instead use public readonly fields.
1358
1359         * class.cs: Put back walking code for type containers.
1360
1361 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
1362
1363         * class.cs (MakeConstant): Code to define constants.
1364
1365         * rootcontext.cs (LookupType): New function.  Used to locate types 
1366
1367         
1368 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
1369
1370         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
1371         this System.Reflection code is.  Kudos to Microsoft
1372         
1373         * typemanager.cs: Implement a type cache and avoid loading all
1374         types at boot time.  Wrap in LookupType the internals.  This made
1375         the compiler so much faster.  Wow.  I rule!
1376         
1377         * driver.cs: Make sure we always load mscorlib first (for
1378         debugging purposes, nothing really important).
1379
1380         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
1381         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
1382
1383         * rootcontext.cs: Lookup types on their namespace;  Lookup types
1384         on namespaces that have been imported using the `using' keyword.
1385
1386         * class.cs (TypeContainer::TypeAttr): Virtualize.
1387         (Class::TypeAttr): Return attributes suitable for this bad boy.
1388         (Struct::TypeAttr): ditto.
1389         Handle nested classes.
1390         (TypeContainer::) Remove all the type visiting code, it is now
1391         replaced with the rootcontext.cs code
1392
1393         * rootcontext.cs (GetClassBases): Added support for structs. 
1394
1395 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
1396
1397         * interface.cs, statement.cs, class.cs, parameter.cs,
1398         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
1399         Drop use of TypeRefs, and use strings instead.
1400
1401 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
1402
1403         * rootcontext.cs: 
1404
1405         * class.cs (Struct::Struct): set the SEALED flags after
1406         checking the modifiers.
1407         (TypeContainer::TypeAttr): new property, returns the
1408         TypeAttributes for a class.  
1409
1410         * cs-parser.jay (type_list): Oops, list production was creating a
1411         new list of base types.
1412
1413         * rootcontext.cs (StdLib): New property.
1414         (GetInterfaceTypeByName): returns an interface by type name, and
1415         encapsulates error handling here.
1416         (GetInterfaces): simplified.
1417         (ResolveTree): Encapsulated all the tree resolution here.
1418         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
1419         types. 
1420         
1421         * driver.cs: Add support for --nostdlib, to avoid loading the
1422         default assemblies.
1423         (Main): Do not put tree resolution here. 
1424
1425         * rootcontext.cs: Beginning of the class resolution.
1426
1427 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
1428
1429         * rootcontext.cs: Provide better error reporting. 
1430
1431         * cs-parser.jay (interface_base): set our $$ to be interfaces.
1432
1433         * rootcontext.cs (CreateInterface): Handle the case where there
1434         are no parent interfaces.
1435         
1436         (CloseTypes): Routine to flush types at the end.
1437         (CreateInterface): Track types.
1438         (GetInterfaces): Returns an array of Types from the list of
1439         defined interfaces.
1440
1441         * typemanager.c (AddUserType): Mechanism to track user types (puts
1442         the type on the global type hash, and allows us to close it at the
1443         end). 
1444         
1445 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
1446
1447         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
1448         RecordInterface instead.
1449
1450         * cs-parser.jay: Updated to reflect changes above.
1451
1452         * decl.cs (Definition): Keep track of the TypeBuilder type that
1453         represents this type here.  Not sure we will use it in the long
1454         run, but wont hurt for now.
1455
1456         * driver.cs: Smaller changes to accomodate the new code.
1457
1458         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
1459         when done. 
1460
1461         * rootcontext.cs (CreateInterface):  New method, used to create
1462         the System.TypeBuilder type for interfaces.
1463         (ResolveInterfaces): new entry point to resolve the interface
1464         hierarchy. 
1465         (CodeGen): Property, used to keep track of the code generator.
1466
1467 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
1468
1469         * cs-parser.jay: Add a second production for delegate_declaration
1470         with `VOID'.
1471
1472         (enum_body): Put an opt_comma here instead of putting it on
1473         enum_body or enum_member_declarations so we can handle trailing
1474         commas on enumeration members.  Gets rid of a shift/reduce.
1475         
1476         (type_list): Need a COMMA in the middle.
1477
1478         (indexer_declaration): Tell tokenizer to recognize get/set
1479
1480         * Remove old targets.
1481
1482         * Re-add the parser target.
1483
1484 2001-07-13  Simon Cozens <simon@simon-cozens.org>
1485
1486         * cs-parser.jay: Add precendence rules for a number of operators
1487         ot reduce the number of shift/reduce conflicts in the grammar.
1488         
1489 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
1490
1491         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
1492         and put it here.
1493
1494         Get rid of old crufty code.
1495
1496         * rootcontext.cs: Use this to keep track of the parsed
1497         representation and the defined types available to the program. 
1498
1499         * gen-treedump.cs: adjust for new convention.
1500
1501         * type.cs: Split out the type manager, and the assembly builder
1502         from here. 
1503
1504         * typemanager.cs: the type manager will live here now.
1505
1506         * cil-codegen.cs: And the code generator here. 
1507
1508 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
1509
1510         * makefile: Fixed up for easy making.
1511
1512 2001-07-13  Simon Cozens <simon@simon-cozens.org>
1513
1514         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
1515         the 
1516
1517         (unary_expression): Expand pre_increment_expression and
1518         post_decrement_expression to reduce a shift/reduce.
1519
1520 2001-07-11  Simon Cozens
1521
1522         * cs-tokenizer.cs: Hex numbers should begin with a 0.
1523
1524         Improve allow_keyword_as_indent name.
1525
1526 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
1527
1528         * Adjustments for Beta2. 
1529
1530 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
1531
1532         * decl.cs: Added `Define' abstract method.
1533         (InTransit): new property, used to catch recursive definitions. 
1534
1535         * interface.cs: Implement `Define'. 
1536
1537         * modifiers.cs: Map Modifiers.constants to
1538         System.Reflection.TypeAttribute flags.
1539
1540         * class.cs: Keep track of types and user-defined types.
1541         (BuilderInit): New method for creating an assembly
1542         (ResolveType): New function to launch the resolution process, only
1543         used by interfaces for now.
1544
1545         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
1546         that are inserted into the name space. 
1547
1548 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
1549
1550         * ARGH.  I have screwed up my tree so many times due to the use of
1551         rsync rather than using CVS.  Going to fix this at once. 
1552
1553         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
1554         load types.
1555
1556 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
1557
1558         * Experiment successful: Use System.Type rather that our own
1559         version of Type.  
1560
1561 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
1562
1563         * cs-parser.jay: Removed nsAliases from here.
1564
1565         Use new namespaces, handle `using XXX;' 
1566
1567         * namespace.cs: Reimplemented namespace handling, use a recursive
1568         definition of the class.  Now we can keep track of using clauses
1569         and catch invalid using clauses.
1570
1571 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
1572
1573         * gen-treedump.cs: Adapted for all the renaming.
1574
1575         * expression.cs (Expression): this class now has a Type property
1576         which returns an expression Type.
1577
1578         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
1579         `Type', as this has a different meaning now in the base
1580
1581 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
1582
1583         * interface.cs, class.cs: Removed from all the sources the
1584         references to signature computation, as we can not do method
1585         signature computation during the parsing time, as we are not
1586         trying to solve at that point distinguishing:
1587
1588         class X {
1589                 void a (Blah x) {}
1590                 void a (NS.Blah x) {}
1591         }
1592
1593         Which depending on the context might be valid or not, as we do not
1594         know if Blah is the same thing as NS.Blah at that point.
1595
1596         * Redid everything so the code uses TypeRefs now instead of
1597         Types.  TypeRefs are just temporary type placeholders, that need
1598         to be resolved.  They initially have a pointer to a string and the
1599         current scope in which they are used.  This is used later by the
1600         compiler to resolve the reference to an actual Type. 
1601
1602         * DeclSpace is no longer a CIR.Type, and neither are
1603         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
1604         are all DeclSpaces, but no Types. 
1605
1606         * type.cs (TypeRefManager): This implements the TypeRef manager,
1607         which keeps track of all the types that need to be resolved after
1608         the parsing has finished. 
1609
1610 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
1611
1612         * ARGH.  We are going to have to store `foreach' as a class rather
1613         than resolving it, as we need to verify error 1579 after name
1614         resolution.   *OR* we could keep a flag that says `This request to
1615         IEnumerator comes from a foreach statement' which we can then use
1616         to generate the error.
1617
1618 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
1619
1620         * class.cs (TypeContainer.AddMethod): we now add methods to the
1621         MethodGroup instead of the method hashtable.  
1622
1623         * expression.cs: Add MethodGroup abstraction, which gets us one
1624         step closer to the specification in the way we handle method
1625         declarations.  
1626
1627         * cs-parser.jay (primary_expression): qualified_identifier now
1628         tried to match up an identifier to a local variable reference or
1629         to a parameter reference.
1630
1631         current_local_parameters is now a parser global variable that
1632         points to the current parameters for the block, used during name
1633         lookup.
1634
1635         (property_declaration): Now creates an implicit `value' argument to
1636         the set accessor.
1637
1638 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
1639
1640         * parameter.cs: Do not use `param' arguments as part of the
1641         signature, per the spec.
1642
1643 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
1644
1645         * decl.cs: Base class for classes, structs and interfaces.  This
1646         is the "Declaration Space" 
1647
1648         * cs-parser.jay: Use CheckDef for checking declaration errors
1649         instead of having one on each function.
1650
1651         * class.cs: Factor out some code for handling error handling in
1652         accordance to the "Declarations" section in the "Basic Concepts"
1653         chapter in the ECMA C# spec.
1654
1655         * interface.cs: Make all interface member classes derive from
1656         InterfaceMemberBase.
1657
1658 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
1659
1660         * Many things: all interfaces are parsed and generated in
1661         gen-treedump.  Support for member variables, constructors,
1662         destructors, properties, constants is there.
1663
1664         Beginning of the IL backend, but very little done, just there for
1665         testing purposes. 
1666
1667 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
1668
1669         * cs-parser.jay: Fix labeled statement.
1670
1671         * cs-tokenizer.cs (escape): Escape " and ' always.
1672         ref_line, ref_name: keep track of the line/filename as instructed
1673         by #line by the compiler.
1674         Parse #line.
1675
1676 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
1677
1678         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
1679         to match the values in System.CodeDOM.
1680
1681         Divid renamed to Divide.
1682
1683         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
1684         statements. 
1685         (Statements.set): remove.
1686
1687         * System.CodeDOM/CodeCatchClause.cs: always have a valid
1688         statements. 
1689
1690         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
1691         falseStatements always have valid values. 
1692
1693         * cs-parser.jay: Use System.CodeDOM now.
1694