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