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