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