2002-02-21 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
1 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
2
3         * expression.cs (Binary.ResolveOperator): Remove redundant
4         MemberLookup pn parent type.
5         Optimize union call, we do not need a union if the types are the same.
6         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7         type.
8
9         Specialize the use of MemberLookup everywhere, instead of using
10         the default settings. 
11
12         (StackAlloc): Implement stackalloc keyword.
13
14         * cs-parser.jay: Add rule to parse stackalloc.
15         
16         * driver.cs: Handle /h, /help, /?
17
18         * expression.cs (MakeByteBlob): Removed the hacks we had in place
19         before we supported unsafe code.
20         
21         * makefile: add --unsafe to the self compilation of mcs.
22
23 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
24
25         * expression.cs (PointerArithmetic): New class that is used to
26         perform pointer arithmetic.
27         (Binary.Resolve): Handle pointer arithmetic
28         Handle pointer comparission.
29         (ArrayPtr): Utility expression class that is used to take the
30         address of an array.
31
32         (ElementAccess): Implement array access for pointers
33         
34         * statement.cs (Fixed): Implement fixed statement for arrays, we
35         are missing one more case before we are done.
36
37         * expression.cs (Indirection): Implement EmitAssign and set the
38         ExprClass to Variable.  This allows pointer dereferences to be
39         treated as variables, and to have values assigned to them.
40         
41         * ecore.cs (Expression.StoreFromPtr): New utility function to
42         store values dereferencing.
43
44 2002-02-20  Ravi Pratap  <ravi@ximian.com>
45
46         * expression.cs (Binary.ResolveOperator): Ensure that we are
47         not trying to operate on a void type - this fixes the reported
48         bug.
49
50         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
51         the parent implementation is sealed.
52
53         * ../errors/cs0239.cs : Add.
54
55         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
56
57         * typemanager.cs (unverifiable_code_type): Corresponds to 
58         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
59         which have unsafe code in them.
60
61         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
62         unsafe context.
63
64 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
65
66         * cs-tokenizer.cs: Add support for @"litreal strings"
67
68         Make tokenizer accept pre-processor directives
69         on any column (remove the old C-like limitation). 
70
71         * rootcontext.cs (EmitCode): Emit any global attributes.
72         (AddGlobalAttributes): Used to keep track of assembly attributes. 
73
74         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
75
76         * cs-parser.jay: Add support for global attributes.  
77
78 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
79
80         * expression.cs (Indirection): New helper class.  Unary will
81         create Indirection classes to be able to implement the
82         IMemoryLocation interface on it.
83
84 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
85
86         * cs-parser.jay (fixed_statement): reference the right statement.
87
88         * statement.cs (Fixed.Emit): Finish implementing the fixed
89         statement for the &x case.
90
91 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
92
93         * class.cs (Property.Define, Method.Define): Remove newslot when
94         `implementing'.  
95
96         * modifiers.cs: My use of NewSlot when `Abstract' was set was
97         wrong.  NewSlot should only be used if the `new' keyword is present.
98
99         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
100         locating our system dir.  Sorry about this.
101
102 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
103
104         * driver.cs (GetSystemDir): Compute correctly the location of our
105         system assemblies.  I was using the compiler directory instead of
106         the library directory.
107
108 2002-02-13  Ravi Pratap  <ravi@ximian.com>
109
110         * expression.cs (BetterFunction): Put back in what Miguel commented out
111         since it is the correct fix. The problem is elsewhere ;-)
112
113         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
114         parameters of the parms method are themselves compatible or not !
115
116         (StandardConversionExists): Fix very dangerous bug where we were forgetting
117         to check that a class implements an interface before saying that an implicit
118         conversion was allowed. Use ImplementsInterface to do the checking.
119
120 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
121
122         * class.cs (Method.Define): Track whether we are an explicit
123         implementation or not.  And only call DefineMethodOverride if we
124         are an explicit implementation.
125
126         (Property.DefineMethod): Ditto.
127
128 2002-02-11  Ravi Pratap  <ravi@ximian.com>
129
130         * expression.cs (BetterFunction): Catch hideous bug which was
131          preventing us from detecting ambiguous calls due to implicit casts i.e
132         cs0121.
133
134 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
135
136         * support.cs (Pair): Remove un-needed method.  I figured why I was
137         getting the error in cs-parser.jay, the variable in a foreach loop
138         is readonly, and the compiler does not really treat this as a variable.
139
140         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
141         instead of EQUALS in grammar.  
142
143         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
144
145         * expression.cs (Unary.DoResolve): Check whether the argument is
146         managed or not.
147
148 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
149
150         * support.cs: Api for Pair to set a value.  Despite the fact that
151         the variables are public the MS C# compiler refuses to compile
152         code that accesses the field if the variable is part of a foreach
153         statement. 
154
155         * statement.cs (Fixed): Begin implementation of the fixed
156         statement.
157
158         (Block.AddVariable): Return the VariableInfo on success and null
159         on failure instead of true/false. 
160
161         * cs-parser.jay (foreach): Catch errors on variables already
162         defined (we were ignoring this value before) and properly unwind
163         the block hierarchy
164
165         (fixed_statement): grammar for the fixed statement.
166
167 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
168
169         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
170         pointer types to be incretemented.
171
172         (SizeOf): Implement.
173
174         * cs-parser.jay (pointer_member_access): Implement
175         expr->IDENTIFIER production.
176
177         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
178         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
179         on safe contexts.
180
181         (Unary): Implement indirection.
182
183         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
184         use in non-unsafe context).
185
186         (SimpleName.DoResolve): Check for pointers in field access on safe
187         contexts. 
188
189         (Expression.LoadFromPtr): Factor the load-indirect code in this
190         function.  This was duplicated in UnboxCast and ParameterReference
191
192 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
193
194         * expression.cs (ComposedCast): report an error if a pointer cast
195         is used in a safe region.
196
197         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
198         pointer type casts in unsafe context.
199
200         * codegen.cs (EmitContext): Set up IsUnsafe.
201
202         * cs-parser.jay (non_expression_type): Add productions for pointer
203         casts. 
204
205         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
206         code.  We should not use force into static mode if the method is
207         not virtual.  Fixes bug in MIS
208
209         * statement.cs (Do.Emit, While.Emit, For.Emit,
210         Statement.EmitBoolExpression): Add support to Do and While to
211         propagate infinite loop as `I do return' semantics.
212
213         Improve the For case to also test for boolean constants.
214
215         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
216         to the list of attributes we can add.
217
218         Remove `EmitContext' argument.
219
220         * class.cs (Method.Define): Apply parameter attributes.
221         (Constructor.Define): Apply parameter attributes.
222         (MethodCore.LabelParameters): Move here the core of labeling
223         parameters. 
224
225         * support.cs (ReflectionParameters.ParameterModifier,
226         InternalParameters.ParameterModifier): Use IsByRef on the type and
227         only return the OUT bit for these parameters instead of in/out/ref
228         flags.
229
230         This is because I miss-understood things.  The ParameterInfo.IsIn
231         and IsOut represent whether the parameter has the [In] and [Out]
232         attributes set.  
233
234 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
235
236         * ecore.cs (FieldExpr.Emit): Release temporaries.
237
238         * assign.cs (LocalTemporary.Release): new function.
239
240         * codegen.cs (EmitContext.GetTemporaryStorage,
241         EmitContext.FreeTemporaryStorage): Rework the way we deal with
242         temporary storage.  Now we can "put back" localbuilders when we
243         are done with them
244
245 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
246
247         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
248         need to make a copy of the variable to generate verifiable code.
249
250 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
251
252         * driver.cs: Compute dynamically the system directory.
253
254         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
255         Slower, but more generally useful.  Used by the abstract
256         registering implementation. 
257
258         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
259         the rules for the special rule on Type/instances.  First check if
260         we have the same name, and if so, try that special static path
261         rather than the instance path.
262         
263 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
264
265         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
266         for, while and if.
267
268         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
269         Enum, ValueType, Delegate or Array for non-corlib compiles.
270
271         * cs-tokenizer.cs: Catch long identifiers (645)
272
273         * typemanager.cs (IndexerPropetyName): Ravi never tested this
274         piece of code.
275
276         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
277         fix, we were returning too early, so we were not registering
278         pending methods from abstract classes.
279
280         Do not register pending methods if the class is abstract.
281
282         * expression.cs (Conditional.DoResolve): Report circular implicit
283         conversions when we neecd to compute it for conditional
284         expressions. 
285
286         (Is.DoResolve): If the expression is always of the provided type,
287         flag warning 183.  If the expression can not ever be of the
288         provided type flag warning 184.
289
290         * class.cs: Catch 169 as well.
291
292         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
293         read. 
294
295 2002-01-18  Nick Drochak  <ndrochak@gol.com>
296
297         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
298
299 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
300
301         * interface.cs: (PopulateMethod): Check for pointers being defined
302         only if the unsafe context is active.
303         (PopulateProperty): ditto.
304         (PopulateIndexer): ditto.
305
306         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
307         specified.  If pointers are present, make sure that they are
308         present in an unsafe context.
309         (Constructor, Constructor.Define): ditto.
310         (Field, Field.Define): ditto.
311         (Property, Property.Define): ditto.
312         (Event, Event.Define): ditto.
313
314         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
315         hashtable if there are classes or structs defined.
316
317         * expression.cs (LocalVariableReference.DoResolve): Simplify this
318         code, as the constant resolution moved.
319
320         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
321         the metadata, so we can flag error 133. 
322
323         * decl.cs (MemberCore.UnsafeOK): New function to test that a
324         pointer is being declared in an unsafe context.
325
326 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
327
328         * modifiers.cs (Modifiers.Check): Require a Location argument.
329         Report error 227 for Unsafe use.
330
331         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
332
333         * statement.cs (For.Emit): If the test is null, then report that
334         we do `return', as we wont reach anything afterwards.
335
336         (Switch.SwitchGoverningType): Track the expression that matched
337         the conversion.
338
339         * driver.cs: Allow negative numbers as an error code to flag.
340
341         * cs-parser.jay: Handle 1551.
342
343         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
344
345 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
346
347         * cs-parser.jay: Report 1518 (type declaration can only contain
348         class, struct, interface, enum or delegate)
349
350         (switch_label): Report 1523 (keywords `case' or `default' must
351         preced code)
352
353         (opt_switch_sections): Report 1522 (empty switch)
354
355         * driver.cs: Report 1515 (response file specified multiple times)
356         Report 1516 (Source file specified multiple times).
357
358         * expression.cs (Argument.Resolve): Signal 1510
359
360         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
361         access not allowed in static code)
362
363 2002-01-11  Ravi Pratap  <ravi@ximian.com>
364
365         * typemanager.cs (IsPointerType): Utility method which we are going
366         to need a lot.
367
368         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
369         the object type, so we take care of that.
370
371         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
372         
373         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
374         added to non-params parameters :-)
375
376         * typemanager.cs (CSharpName): Include 'void' type too. 
377
378         (void_ptr_type): Include in the set of core types.
379
380         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
381         duplicating code.
382
383         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
384         an unsafe context.
385
386         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
387         completely forgotten about it.
388
389 2002-01-10  Ravi Pratap  <ravi@ximian.com>
390
391         * cs-parser.jay (pointer_type): Add. This begins our implementation
392         of parsing rules for unsafe code.
393
394         (unsafe_statement): Implement.
395
396         (embedded_statement): Modify to include the above.
397
398         * statement.cs (Unsafe): Implement new class for unsafe blocks.
399
400         * codegen.cs (EmitContext.InUnsafe): Add. This determines
401         if the current context is an unsafe one.
402
403         * cs-parser.jay (local_variable_pointer_type): Since local variable types
404         are handled differently, we need separate rules for them.
405
406         (local_variable_declaration): Update to use local_variable_pointer_type
407         to allow variable declarations of unmanaged pointer types.
408
409         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
410         in unsafe contexts.
411
412         * ../errors/cs0214.cs : Add.
413
414 2002-01-16  Nick Drochak  <ndrochak@gol.com>
415
416         * makefile: remove 'response' file when cleaning.
417
418 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
419
420         * cs-parser.jay: Report 1524.
421
422 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
423
424         * typemanager.cs (RegisterMethod): drop checking if we have
425         registered this from here
426
427 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
428
429         * class.cs (Method.EmitDestructor): Implement calling our base
430         destructor. 
431
432         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
433         value of InFinally.
434
435         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
436         this routine and will wrap the call in a try/catch block.  Deal
437         with the case.
438
439 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
440
441         * ecore.cs (Expression.MemberLookup): instead of taking a
442         parameter `same_type' that was used to tell whether we could
443         access private members we compute our containing type from the
444         EmitContext.
445
446         (FieldExpr): Added partial support for volatile fields.  This does
447         not work for volatile fields exposed from assemblies, as I can not
448         figure out how to extract the modreq from it.
449
450         Updated all the source files to use this.
451
452         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
453         because it is referenced by MemberLookup very often. 
454
455 2002-01-09  Ravi Pratap  <ravi@ximian.com>
456
457         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
458         TypeBuilder.GetCustomAttributes to retrieve what we need.
459
460         Get rid of redundant default_member_attr_type as this is the same as
461         default_member_type which already exists.
462
463         * interface.cs, attribute.cs : Update accordingly.
464         
465 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
466
467         * typemanager.cs: Enable IndexerPropertyName again.  It does not
468         work for TYpeBuilders though.  Ravi, can you please fix this?
469
470         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
471
472         * expression.cs (Argument.Emit): Handle the case of ref objects
473         being passed to ref functions;  
474
475         (ParameterReference.EmitLoad): Loads the content of the pointer
476         without dereferencing.
477
478 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
479
480         * cs-tokenizer.cs: Implemented the pre-processing expressions.
481
482 2002-01-08  Ravi Pratap  <ravi@ximian.com>
483
484         * class.cs (Indexer.DefineMethod): Incorporate the interface
485         type in the name of the method if we are doing explicit interface
486         implementation.
487
488         * expression.cs (ConversionExists): Remove as it is completely obsolete.
489
490         (BetterConversion): Fix extremely trivial bug where we were referring to
491         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
492         again !
493
494         * ../errors/bug16.cs : Add although we have fixed it.
495
496 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
497
498         * expression.cs (BaseIndexer): Begin implementation.
499
500         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
501
502         * cs-parser.jay (indexer_declarator): Use qualified_identifier
503         production directly to remove a shift/reduce, and implement
504         explicit interface implementation.
505
506         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
507         after a floating point suffix.
508
509         * expression.cs (DoNumericPromotions): Improved the conversion for
510         uint/uint.  If we have a constant, we avoid doing a typecast to a
511         larger type.
512
513         * class.cs (Indexer): Implement explicit interface implementation
514         for indexers.
515         
516 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
517
518         * class.cs: make the default instance constructor public and hidebysig.
519
520 2001-01-03  Ravi Pratap  <ravi@ximian.com>
521
522         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
523         so we can call it from elsewhere.
524
525         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
526         we emit it internally if the class has a defined indexer; otherwise the user
527         emits it by decorating the class definition with the DefaultMemberAttribute.
528
529         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
530         attribute is not used on a type which defines an indexer.
531
532         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
533         character when we skip whitespace.
534
535         * ../errors/cs0646.cs : Add.
536
537 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
538
539         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
540         again. 
541
542         * makefile: Add practical target `mcs3.exe' which builds the third
543         generation compiler. 
544
545         * expression.cs (New): Fix structures constructor calling.
546
547         * class.cs (Property, Method, Indexer): Emit Final flag on the
548         method if we are an interface implementation and we are not
549         abstract. 
550
551         * ecore.cs (PropertyExpr): New public field `IsBase', tells
552         whether this property is referencing a `base' method.
553
554         * expression.cs (Invocation.EmitCall): take an extra argument:
555         is_base, this is used to determine whether the `call' or
556         `callvirt' opcode should be used.
557
558         
559         * delegate.cs: update EmitCall.
560
561         * class.cs (Method.Define): Set NewSlot for the cases where we are
562         not implementing an interface method.
563
564         (Property.Define): ditto.
565
566 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
567
568         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
569         'r'.  Allows mcs to parse itself fully.
570
571 2002-01-02  Ravi Pratap  <ravi@ximian.com>
572
573         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
574         of the number of initializers that require the InitializeArray method.
575
576         (CheckIndices): Store the Expression in all cases - not the plain value. Also
577         update the above field where necessary.
578
579         (MakeByteBlob): Update accordingly.
580
581         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
582         greater than 2.
583
584         (EmitDynamicInitializers): Update in accordance with the new optimization.
585
586         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
587         same OpCode applies.
588
589         * cs-parser.jay : Fix some glaring errors I introduced.
590
591 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
592
593         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
594         so that we can check for name clashes there too.
595
596         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
597         for interface indexers.
598
599         * interfaces.cs (Define): Emit the default member attribute.
600
601         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
602         variable was being referred to while setting the value ;-)
603
604 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
605
606         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
607         byte-by-byte information when we know the data is zero.
608
609         Make the block always a multiple of 4, because
610         DefineInitializedData has a bug.
611
612         * assign.cs: Fix, we should assign from the temporary, not from
613         the source. 
614
615         * expression.cs (MakeByteBlob): Fix my incorrect code.
616
617 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
618
619         * typemanager.cs (EnumToUnderlying): This function is used to get
620         the underlying type from an enumeration, because it does not
621         always work. 
622
623         * constant.cs: Use the I4_S form for values between -128 and 127.
624
625         * statement.cs (Block.LookupLabel): Looks up a label.
626         (Block): Drop support for labeled blocks.
627
628         (LabeledStatement): New kind of statement that represents a label
629         only.
630
631         (Goto): Finally implement this bad boy.
632         
633         * cs-parser.jay: Update to reflect new mechanism to implement
634         labels.
635
636 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
637
638         * codegen.cs (EmitContext.This): a codegen property that keeps the
639         a single instance of this instead of creating many different this
640         instances. 
641
642         * delegate.cs (Delegate.DoResolve): Update to use the property;
643
644         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
645
646         * expression.cs (BaseAccess.DoResolve): Ditto.
647
648 2001-12-29  Ravi Pratap  <ravi@ximian.com>
649
650         * typemanager.cs (methodimpl_attr_type): Add to hold the type
651         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
652
653         (InitCoreTypes): Update accordingly.
654
655         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
656         so we can quickly store the state.
657
658         (ApplyAttributes): Set the correct implementation flags
659         for InternalCall methods.
660
661 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
662
663         * expression.cs (EmitCall): if a method is not virtual, then do
664         not use callvirt on it.
665
666         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
667         user defined stuff) requires the use of stobj, which takes an
668         address on the stack instead of an array and an index.  So emit
669         the Ldelema operation for it.
670
671         (EmitStoreOpcode): Use stobj for valuetypes.
672
673         (UnaryMutator.EmitCode): Use the right 1 value depending on
674         whether we are dealing with int64/uint64, float or doubles.
675
676         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
677         constructors that I implemented last night.
678
679         (Constructor.IsDefault): Fix to work properly for static
680         constructors.
681
682         * cs-parser.jay (CheckDef): report method signature errors.
683         Update error number 103 to be 132.
684
685         * decl.cs: New AdditionResult enumeration value: MethodExists.
686         Although we do this check for methods later on in the semantic
687         analysis, catching repeated default constructors is so easy that
688         we catch these here. 
689         
690         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
691         promotions code.
692
693         (ParameterReference.EmitAssign, Emit): handle
694         bools as bytes.
695
696         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
697         (ArrayAccess.EmitStoreOpcode): ditto.
698
699         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
700
701         * expression.cs (MakeByteBlob): Complete all the missing types
702         (uint, short, ushort, byte, sbyte)
703
704         * class.cs: Only init instance field initializers on instance
705         constructors. 
706
707         Rename `constructors' to instance_constructors. 
708
709         (TypeContainer.AddConstructor): Only add constructors to the list
710         if it is not static.
711
712         Make sure that we handle default_static_constructor independently
713         everywhere where we handle instance_constructors
714
715 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
716
717         * class.cs: Do not lookup or create a base initializer for a
718         static constructor.
719
720         (ConstructorInitializer.Resolve): use the proper type to lookup
721         for constructors.
722
723         * cs-parser.jay: Report error 1585 (modifiers between type and name).
724
725         * enum.cs, interface.cs: Remove CloseType, this is taken care by
726         in DeclSpace. 
727
728         * decl.cs: CloseType is now an virtual method, the default
729         implementation just closes this type.
730         
731 2001-12-28  Ravi Pratap  <ravi@ximian.com>
732
733         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
734         to PreserveSig by default. Also emit HideBySig on such methods.
735
736         Basically, set the defaults to standard values.
737
738         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
739         argument, if candidate is better, it can't be worse than the best !
740
741         (Invocation): Re-write bits to differentiate between methods being
742         applicable in their expanded form and their normal form - for params
743         methods of course.
744
745         Get rid of use_standard everywhere as only standard conversions are allowed
746         in overload resolution. 
747
748         More spec conformance.
749         
750 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
751
752         * driver.cs: Add --timestamp, to see where the compiler spends
753         most of its time.
754
755         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
756         `this' in static code.
757
758         (SimpleName.DoResolve): Implement in terms of a helper function
759         that allows static-references to be passed upstream to
760         MemberAccess.
761
762         (Expression.ResolveWithSimpleName): Resolve specially simple
763         names when called by MemberAccess to implement the special
764         semantics. 
765
766         (Expression.ImplicitReferenceConversion): Handle conversions from
767         Null to reference types before others, as Null's type is
768         System.Object. 
769
770         * expression.cs (Invocation.EmitCall): Handle the special case of
771         calling methods declared on a reference type from a ValueType
772         (Base classes System.Object and System.Enum)
773
774         (MemberAccess.Resolve): Only perform lookups on Enumerations if
775         the left hand side is a TypeExpr, not on every enumeration. 
776
777         (Binary.Resolve): If types are reference types, then do a cast to
778         object on operators != and == of both arguments.
779         
780         * typemanager.cs (FindMembers): Extract instance and static
781         members if requested.
782
783         * interface.cs (PopulateProperty): Use void_type instead of null
784         as the return type for the setter method.
785
786         (PopulateIndexer): ditto.
787
788 2001-12-27  Ravi Pratap  <ravi@ximian.com>
789
790         * support.cs (ReflectionParameters): Fix minor bug where we
791         were examining the wrong parameter for the ParamArray attribute.
792
793         Cope with requests for the type of the parameter at position
794         greater than the params parameter's. We now return the element
795         type of the params array as that makes more sense.
796
797         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
798         accordingly as we no longer have to extract the element type
799         ourselves.
800
801         (Invocation.OverloadResolve): Update.
802
803 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
804
805         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
806         against IEnumerator, test whether the return value is a descendant
807         of the IEnumerator interface.
808
809         * class.cs (Indexer.Define): Use an auxiliary method to implement
810         the other bits of the method definition.  Begin support for
811         explicit interface implementation.
812
813         (Property.DefineMethod): Use TypeManager.void_type instead of null
814         for an empty return value.
815
816 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
817
818         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
819         dealing with a FieldExpr which is composed of a FieldBuilder, in
820         the code path we did extract the constant, but we should have
821         obtained the underlying value to be able to cast it (otherwise we
822         end up in an infinite loop, this is what Ravi was running into).
823
824         (ArrayCreation.UpdateIndices): Arrays might be empty.
825
826         (MemberAccess.ResolveMemberAccess): Add support for section
827         14.5.4.1 that deals with the special case of E.I when E is a type
828         and something else, that I can be a reference to a static member.
829
830         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
831         handle a particular array type to create byte blobs, it is just
832         something we dont generate byteblobs for.
833
834         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
835         arguments. 
836
837         * location.cs (Push): remove the key from the hashtable that we
838         are about to add.   This happens for empty files.
839
840         * driver.cs: Dispose files after we have parsed them.
841
842         (tokenize): new function that only runs the tokenizer on its
843         input, for speed testing.
844
845 2001-12-26  Ravi Pratap  <ravi@ximian.com>
846
847         * class.cs (Event.Define): Define the private field only if there
848         are no accessors defined.
849
850         * expression.cs (ResolveMemberAccess): If there is no associated
851         field with the event, that means we have an event defined with its
852         own accessors and we should flag error cs0070 since transforming
853         ourselves into a field is not valid in that case.
854
855         * ecore.cs (SimpleName.DoResolve): Same as above.
856
857         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
858         and charset to sane values.
859
860 2001-12-25  Ravi Pratap  <ravi@ximian.com>
861
862         * assign.cs (DoResolve): Perform check on events only if they 
863         are being accessed outside the declaring type.
864
865         * cs-parser.jay (event_declarations): Update rules to correctly
866         set the type of the implicit parameter etc.
867
868         (add_accessor, remove_accessor): Set current local parameters.
869
870         * expression.cs (Binary): For delegate addition and subtraction,
871         cast the return value from the method into the appropriate delegate
872         type.
873
874 2001-12-24  Ravi Pratap  <ravi@ximian.com>
875
876         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
877         of these as the workaround is unnecessary.
878
879         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
880         delegate data - none of that is needed at all.
881
882         Re-write bits to extract the instance expression and the delegate method
883         correctly.
884
885         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
886         on delegates too.
887
888         * attribute.cs (ApplyAttributes): New method to take care of common tasks
889         of attaching attributes instead of duplicating code everywhere.
890
891         * everywhere : Update code to do attribute emission using the above method.
892
893 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
894
895         * expression.cs (IsParamsMethodApplicable): if there are not
896         parameters, return immediately.
897
898         * ecore.cs: The 0 literal can be implicity converted to an enum
899         type. 
900
901         (SimpleName.DoResolve): First lookup the type, then lookup the
902         members. 
903
904         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
905         want to get its address.  If the InstanceExpression is not
906         addressable, store the result in a temporary variable, then get
907         the address of it.
908
909         * codegen.cs: Only display 219 errors on warning level or above. 
910
911         * expression.cs (ArrayAccess): Make it implement the
912         IMemoryLocation interface.
913
914         (Binary.DoResolve): handle the operator == (object a, object b)
915         and operator != (object a, object b) without incurring into a
916         BoxedCast (because 5 != o should never be performed).
917
918         Handle binary enumerator operators.
919
920         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
921         value type, otherwise use Ldelem_ref.
922
923         Use precomputed names;
924
925         (AddressOf): Implement address of
926
927         * cs-parser.jay (labeled_statement): Fix recursive block
928         addition by reworking the production.
929
930         * expression.cs (New.DoEmit): New has a special case:
931                 
932                  If we are dealing with a ValueType, we have a few
933                  situations to deal with:
934                 
935                     * The target of New is a ValueType variable, that is
936                       easy, we just pass this as the variable reference
937                 
938                     * The target of New is being passed as an argument,
939                       to a boxing operation or a function that takes a
940                       ValueType.
941                 
942                       In this case, we need to create a temporary variable
943                       that is the argument of New.
944
945
946 2001-12-23  Ravi Pratap  <ravi@ximian.com>
947
948         * rootcontext.cs (LookupType): Check that current_type is not null before
949         going about looking at nested types.
950
951         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
952         not implement the IAssignMethod interface any more.
953
954         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
955         where we tranform them into FieldExprs if they are being resolved from within
956         the declaring type.
957
958         * ecore.cs (SimpleName.DoResolve): Do the same here.
959
960         * assign.cs (DoResolve, Emit): Clean up code considerably. 
961
962         * ../errors/bug10.cs : Add.
963
964         * ../errors/cs0070.cs : Add.
965
966         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
967
968         * assign.cs : Get rid of EventIsLocal everywhere.
969         
970 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
971
972         * ecore.cs (ConvertIntLiteral): finished the implementation.
973
974         * statement.cs (SwitchLabel): Convert the value we are using as a
975         key before looking up the table.
976
977 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
978
979         * codegen.cs (EmitTopBlock): Require a Location argument now.
980
981         * cs-parser.jay (constructor_declarator): We need to setup
982         current_local_parameters before we parse the
983         opt_constructor_initializer, to allow the variables to be bound
984         to the constructor arguments.
985
986         * rootcontext.cs (LookupType): First lookup nested classes in our
987         class and our parents before we go looking outside our class.
988
989         * expression.cs (ConstantFold): Extract/debox the values at the
990         beginnning. 
991
992         * rootcontext.cs (EmitCode): Resolve the constants first before we
993         resolve the types.  This is not really needed, but it helps debugging.
994
995         * statement.cs: report location.
996         
997         * cs-parser.jay: pass location to throw statement.
998
999         * driver.cs: Small bug fix.
1000
1001         * report.cs: Updated format to be 4-zero filled digits.
1002
1003 2001-12-22  Ravi Pratap  <ravi@ximian.com>
1004
1005         * expression.cs (CheckIndices): Fix minor bug where the wrong
1006         variable was being referred to ;-)
1007
1008         (DoEmit): Do not call EmitStaticInitializers when the 
1009         underlying type is System.Object.
1010
1011 2001-12-21  Ravi Pratap  <ravi@ximian.com>
1012
1013         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
1014         and do the usual workaround for SRE.
1015
1016         * class.cs (MyEventBuilder.EventType): New member to get at the type
1017         of the event, quickly.
1018
1019         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
1020
1021         * assign.cs (Assign.DoResolve): Handle the case when the target
1022         is an EventExpr and perform the necessary checks.
1023
1024         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
1025         interface.
1026
1027         (SimpleName.MemberStaticCheck): Include check for EventExpr.
1028
1029         (EventExpr): Set the type in the constructor itself since we 
1030         are meant to be born fully resolved.
1031
1032         (EventExpr.Define): Revert code I wrote earlier.
1033                 
1034         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
1035         instance expression is null. The instance expression is a This in that case
1036         or a null, depending on whether it is a static method or not.
1037
1038         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
1039         refers to more than one method.
1040
1041         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
1042         and accordingly flag errors.
1043
1044 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
1045
1046         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
1047
1048 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
1049
1050         * location.cs (ToString): Provide useful rutine.
1051
1052 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
1053
1054         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
1055         objects, return the actual integral boxed.
1056
1057         * statement.cs (SwitchLabel): define an ILLabel for each
1058         SwitchLabel. 
1059         
1060         (Switch.CheckSwitch): If the value is a Literal, extract
1061         the underlying literal.
1062         
1063         Also in the unused hashtable we had, add the SwitchLabel so we can
1064         quickly look this value up.
1065
1066         * constant.cs: Implement a bunch of new constants.  Rewrite
1067         Literal based on this.  Made changes everywhere to adapt to this.
1068         
1069         * expression.cs (Expression.MakeByteBlob): Optimize routine by
1070         dereferencing array only once, and also copes with enumrations.
1071
1072         bytes are two bytes wide, not one.
1073
1074         (Cast): Perform constant conversions.
1075         
1076         * ecore.cs (TryImplicitIntConversion): Return literals instead of
1077         wrappers to the literals here.
1078
1079         * expression.cs (DoNumericPromotions): long literals can converted
1080         to ulong implicity (this is taken care of elsewhere, but I was
1081         missing this spot).
1082
1083         * ecore.cs (Expression.Literalize): Make the return type Literal,
1084         to improve type checking.
1085
1086         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
1087
1088 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
1089
1090         * literal.cs: Revert code from ravi that checked the bounds.  The
1091         bounds are sane by the definition of the type itself. 
1092
1093         * typemanager.cs: Fix implementation of ImplementsInterface.  We
1094         need to actually look up in our parent hierarchy for interfaces
1095         implemented. 
1096
1097         * const.cs: Use the underlying type for enumerations
1098
1099         * delegate.cs: Compute the basename for the delegate creation,
1100         that should fix the delegate test case, and restore the correct
1101         Type Lookup semantics in rootcontext
1102
1103         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
1104         referencing a nested type with the Reflection API is using the "+"
1105         sign. 
1106
1107         * cs-parser.jay: Do not require EOF token at the end.
1108
1109 2001-12-20  Ravi Pratap  <ravi@ximian.com>
1110
1111         * rootcontext.cs (LookupType): Concatenate type names with
1112         a '.' instead of a '+' The test suite passes again.
1113
1114         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
1115         field of the enumeration.
1116
1117         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
1118         the case when the member is an EventExpr.
1119
1120         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
1121         static has an associated instance expression.
1122
1123         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
1124
1125         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
1126
1127         * class.cs (Event.Define): Register event and perform appropriate checks
1128         for error #111.
1129
1130         We define the Add and Remove methods even if the use provides none because
1131         in that case, we provide default implementations ourselves.
1132
1133         Define a private field of the type of the event. This is done by the CSC compiler
1134         and we should be doing it too ;-)
1135
1136         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
1137         More methods we use in code we generate.
1138
1139         (multicast_delegate_type, delegate_type): Two separate types since the distinction
1140         is important.
1141
1142         (InitCoreTypes): Update accordingly for the above.
1143
1144         * class.cs (Event.Emit): Generate code for default accessors that we provide
1145
1146         (EmitDefaultMethod): Do the job in the above.
1147
1148         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
1149         appropriate place.
1150
1151 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
1152
1153         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
1154         builders even if we were missing one.
1155
1156         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
1157         pass the Basename as our class name instead of the Name.  The
1158         basename will be correctly composed for us.
1159
1160         * parameter.cs (Paramters): Now takes a Location argument.
1161
1162         * decl.cs (DeclSpace.LookupType): Removed convenience function and
1163         make all the code call directly LookupType in RootContext and take
1164         this chance to pass the Location information everywhere.
1165
1166         * Everywhere: pass Location information.
1167
1168 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
1169
1170         * class.cs (Constructor.Define): Updated way of detecting the
1171         length of the parameters.
1172
1173         (TypeContainer.DefineType): Use basename as the type name for
1174         nested types.
1175
1176         (TypeContainer.Define): Do not recursively define types here, as
1177         definition is taken care in order by the RootContext.
1178
1179         * tree.cs: Keep track of namespaces in a per-file basis.
1180
1181         * parameter.cs (Parameter.ComputeSignature): Update to use
1182         DeclSpace. 
1183
1184         (Parameters.GetSignature): ditto.
1185
1186         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
1187         instead of a TypeContainer.
1188
1189         (Interface.SemanticAnalysis): Use `this' instead of our parent to
1190         resolve names.  Because we need to be resolve in our context, not
1191         our parents.
1192         
1193         * driver.cs: Implement response files.
1194
1195         * class.cs (TypeContainer.DefineType): If we are defined, do not
1196         redefine ourselves.
1197         
1198         (Event.Emit): Emit the code for add/remove handlers.
1199         (Event.Define): Save the MethodBuilders for add/remove.
1200
1201         * typemanager.cs: Use pair here too.
1202
1203         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
1204         DictionaryEntry requires the first argument to be non-null.  
1205         
1206         (enum_declaration): Compute full name for registering the
1207         enumeration.
1208         
1209         (delegate_declaration): Instead of using
1210         formal_parameter_list, use opt_formal_parameter_list as the list
1211         can be empty.
1212
1213         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
1214         (EventParsing): New property that controls whether `add' and
1215         `remove' are returned as tokens or identifiers (for events);
1216
1217 2001-12-19  Ravi Pratap  <ravi@ximian.com>
1218
1219         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
1220         use MyEventBuilder only and let it wrap the real builder for us.
1221
1222         (MyEventBuilder): Revamp constructor etc.
1223
1224         Implement all operations that we perform on EventBuilder in precisely the same
1225         way here too.
1226
1227         (FindMembers): Update to use the EventBuilder member.
1228
1229         (Event.Emit): Update accordingly.
1230
1231 2001-12-18  Ravi Pratap  <ravi@ximian.com>
1232
1233         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
1234         by calling the appropriate methods.
1235
1236         (GetCustomAttributes): Make stubs as they cannot possibly do anything
1237         useful.
1238
1239         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
1240
1241 2001-12-17  Ravi Pratap  <ravi@ximian.com>
1242
1243         * delegate.cs (Delegate.Populate): Check that the return type
1244         and various parameters types are indeed accessible.
1245
1246         * class.cs (Constructor.Define): Same here.
1247
1248         (Field.Define): Ditto.
1249
1250         (Event.Define): Ditto.
1251
1252         (Operator.Define): Check that the underlying Method defined itself
1253         correctly - so it's MethodBuilder should not be null.
1254
1255         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
1256         expression happens to be null.
1257
1258         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
1259         members but as of now we don't seem to be able to do anything really useful with it.
1260
1261         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
1262         not the EventBuilder.
1263
1264 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
1265
1266         * cs-tokenizer.cs: Add support for defines.
1267         Add support for #if, #elif, #else, #endif
1268         
1269         (eval_var): evaluates a variable.
1270         (eval): stubbed for evaluating functions.
1271
1272         * cs-parser.jay: Pass the defines information
1273
1274         * driver.cs: Add --define command line option.
1275
1276         * decl.cs: Move MemberCore here.
1277
1278         Make it the base class for DeclSpace.  This allows us to catch and
1279         report 108 and 109 for everything now.
1280
1281         * class.cs (TypeContainer.Define): Extract all the members
1282         before populating and emit the warning 108 (new keyword required
1283         to override) instead of having each member implement this.
1284
1285         (MemberCore.Define): New abstract method, we will be using this in
1286         the warning reporting engine in Populate.
1287         
1288         (Operator.Define): Adjust to new MemberCore protocol. 
1289
1290         * const.cs (Const): This does not derive from Expression, it is a
1291         temporary object we use to create fields, it is a MemberCore. 
1292
1293         * class.cs (Method.Define): Allow the entry point to be in a
1294         specific class.
1295
1296         * driver.cs: Rewrite the argument handler to clean it up a bit.
1297
1298         * rootcontext.cs: Made it just an auxiliary namespace feature by
1299         making everything static.
1300
1301         * driver.cs: Adapt code to use RootContext type name instead of
1302         instance variable.
1303
1304         * delegate.cs: Remove RootContext argument.
1305
1306         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
1307         argument. 
1308
1309         * class.cs (Event.Define): The lookup can fail.
1310         
1311         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
1312
1313         * expression.cs: Resolve the this instance before invoking the code.
1314
1315 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
1316
1317         * cs-parser.jay: Add a production in element_access that allows
1318         the thing to become a "type" reference.  This way we can parse
1319         things like "(string [])" as a type.
1320
1321         Note that this still does not handle the more complex rules of
1322         casts. 
1323         
1324
1325         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
1326
1327         * ecore.cs: (CopyNewMethods): new utility function used to
1328         assemble the list of methods from running FindMembers.
1329
1330         (MemberLookup): Rework FindMembers so that 
1331
1332 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
1333
1334         * class.cs (TypeContainer): Remove Delegates who fail to be
1335         defined.
1336
1337         * delegate.cs (Populate): Verify that we dont get null return
1338         values.   TODO: Check for AsAccessible.
1339
1340         * cs-parser.jay: Use basename to emit error 574 (destructor should
1341         have the same name as container class), not the full name.
1342
1343         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
1344         possible representation.  
1345
1346         Also implements integer type suffixes U and L.
1347
1348 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
1349
1350         * expression.cs (ArrayCreation.DoResolve): We need to do the
1351         argument resolution *always*.
1352
1353         * decl.cs: Make this hold the namespace.  Hold the root context as
1354         well.
1355         (LookupType): Move here.
1356
1357         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
1358
1359         * location.cs (Row, Name): Fixed the code, it was always returning
1360         references to the first file.
1361
1362         * interface.cs: Register properties defined through interfaces.
1363
1364         * driver.cs: Add support for globbing on the command line
1365
1366         * class.cs (Field): Make it derive from MemberCore as well.
1367         (Event): ditto.
1368
1369 2001-12-15  Ravi Pratap  <ravi@ximian.com>
1370
1371         * class.cs (Event::Define): Check that the type of the event is a delegate
1372         type else flag error #66.
1373
1374         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
1375         same.
1376
1377         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
1378         values of EntryPoint, CharSet etc etc.
1379
1380         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
1381
1382         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
1383         be null and we should ignore this. I am not sure if this is really clean. Apparently,
1384         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
1385         which needs this to do its work.
1386
1387         * ../errors/cs0066.cs : Add.
1388
1389 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
1390
1391         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
1392         helper functions.
1393
1394         * class.cs: (MethodSignature.MethodSignature): Removed hack that
1395         clears out the parameters field.
1396         (MemberSignatureCompare): Cleanup
1397
1398         (MemberCore): New base class used to share code between MethodCore
1399         and Property.
1400
1401         (RegisterRequiredImplementations) BindingFlags.Public requires
1402         either BindingFlags.Instace or Static.  Use instance here.
1403
1404         (Property): Refactored code to cope better with the full spec.
1405
1406         * parameter.cs (GetParameterInfo): Return an empty array instead
1407         of null on error.
1408
1409         * class.cs (Property): Abstract or extern properties have no bodies.
1410
1411         * parameter.cs (GetParameterInfo): return a zero-sized array.
1412
1413         * class.cs (TypeContainer.MethodModifiersValid): Move all the
1414         method modifier validation to the typecontainer so we can reuse
1415         this on properties.
1416
1417         (MethodCore.ParameterTypes): return an empty sized array of types.
1418
1419         (Property.Define): Test property modifier validity.
1420
1421         Add tests for sealed/override too.
1422
1423         (Method.Emit): abstract or extern methods have no bodies.
1424
1425 2001-12-14  Ravi Pratap  <ravi@ximian.com>
1426
1427         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
1428         thing.
1429
1430         (Method::Define, ::Emit): Modify accordingly.
1431
1432         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
1433
1434         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
1435
1436         * makefile: Pass in /unsafe.
1437
1438 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
1439
1440         * class.cs (MakeKey): Kill routine.
1441         
1442         * class.cs (TypeContainer.Define): Correctly define explicit
1443         method implementations (they require the full interface name plus
1444         the method name).
1445
1446         * typemanager.cs: Deply the PtrHashtable here and stop using the
1447         lame keys.  Things work so much better.
1448
1449         This of course broke everyone who depended on `RegisterMethod' to
1450         do the `test for existance' test.  This has to be done elsewhere.
1451
1452         * support.cs (PtrHashtable): A hashtable that avoid comparing with
1453         the object stupid Equals method (because, that like fails all over
1454         the place).  We still do not use it.
1455
1456         * class.cs (TypeContainer.SetRequiredInterface,
1457         TypeContainer.RequireMethods): Killed these two routines and moved
1458         all the functionality to RegisterRequiredImplementations.
1459
1460         (TypeContainer.RegisterRequiredImplementations): This routine now
1461         registers all the implementations required in an array for the
1462         interfaces and abstract methods.  We use an array of structures
1463         which can be computed ahead of time to reduce memory usage and we
1464         also assume that lookups are cheap as most classes will not
1465         implement too many interfaces.
1466
1467         We also avoid creating too many MethodSignatures.
1468
1469         (TypeContainer.IsInterfaceMethod): Update and optionally does not
1470         clear the "pending" bit if we find that there are problems with
1471         the declaration.
1472
1473         (TypeContainer.VerifyPendingMethods): Update to report errors of
1474         methods that look like implementations but are not.
1475
1476         (TypeContainer.Define): Add support for explicit interface method
1477         implementation. 
1478         
1479 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
1480
1481         * typemanager.cs: Keep track of the parameters here instead of
1482         being a feature of the TypeContainer.
1483
1484         * class.cs: Drop the registration of parameters here, as
1485         InterfaceMethods are also interface declarations.
1486
1487         * delegate.cs: Register methods with the TypeManager not only with
1488         the TypeContainer.  This code was buggy.
1489
1490         * interface.cs: Full registation here.
1491
1492 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
1493
1494         * expression.cs: Remove reducer for binary expressions, it can not
1495         be done this way.
1496
1497         * const.cs: Put here the code that used to go into constant.cs
1498
1499         * constant.cs: Put here the code for constants, this is a new base
1500         class for Literals.
1501
1502         * literal.cs: Make Literal derive from Constant.
1503
1504 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
1505
1506         * statement.cs (Return.Emit): Report error 157 if the user
1507         attempts to return from a finally block.
1508
1509         (Return.Emit): Instead of emitting a return, jump to the end of
1510         the function.
1511
1512         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
1513         LocalBuilder to store the result of the function.  ReturnLabel is
1514         the target where we jump.
1515         
1516
1517 2001-12-09  Radek Doulik  <rodo@ximian.com>
1518
1519         * cs-parser.jay: remember alias in current namespace
1520
1521         * ecore.cs (SimpleName::DoResolve): use aliases for types or
1522         namespaces
1523
1524         * class.cs (LookupAlias): lookup alias in my_namespace
1525
1526         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
1527         aliases hashtable
1528         (LookupAlias): lookup alias in this and if needed in parent
1529         namespaces
1530
1531 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
1532
1533         * support.cs: 
1534
1535         * rootcontext.cs: (ModuleBuilder) Made static, first step into
1536         making things static.  I need this to avoid passing the
1537         TypeContainer when calling ParameterType.
1538
1539         * support.cs (InternalParameters.ParameterType): Remove ugly hack
1540         that did string manipulation to compute the type and then call
1541         GetType.  Use Parameter.ParameterType instead.
1542
1543         * cs-tokenizer.cs: Consume the suffix for floating values.
1544
1545         * expression.cs (ParameterReference): figure out whether this is a
1546         reference parameter or not.  Kill an extra variable by computing
1547         the arg_idx during emission.
1548
1549         * parameter.cs (Parameters.GetParameterInfo): New overloaded
1550         function that returns whether a parameter is an out/ref value or not.
1551
1552         (Parameter.ParameterType): The type of the parameter (base,
1553         without ref/out applied).
1554         
1555         (Parameter.Resolve): Perform resolution here.
1556         (Parameter.ExternalType): The full type (with ref/out applied).
1557
1558         * statement.cs (Using.Emit, Using.EmitExpression): Implement
1559         support for expressions on the using statement.
1560
1561 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
1562
1563         * statement.cs (Using.EmitLocalVariableDecls): Split the
1564         localvariable handling of the using statement.
1565
1566         (Block.EmitMeta): Keep track of variable count across blocks.  We
1567         were reusing slots on separate branches of blocks.
1568
1569         (Try.Emit): Emit the general code block, we were not emitting it. 
1570
1571         Check the type of the declaration to be an IDisposable or
1572         something that can be implicity converted to it. 
1573
1574         Emit conversions if required.
1575
1576         * ecore.cs (EmptyExpression): New utility class.
1577         (Expression.ImplicitConversionExists): New utility function.
1578
1579 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
1580
1581         * statement.cs (Using): Implement.
1582
1583         * expression.cs (LocalVariableReference): Support read only variables.
1584
1585         * statement.cs: Remove the explicit emit for the Leave opcode.
1586         (VariableInfo): Add a readonly field.
1587
1588 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
1589
1590         * ecore.cs (ConvCast): new class used to encapsulate the various
1591         explicit integer conversions that works in both checked and
1592         unchecked contexts.
1593
1594         (Expression.ConvertNumericExplicit): Use new ConvCast class to
1595         properly generate the overflow opcodes.
1596
1597 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
1598
1599         * statement.cs: The correct type for the EmptyExpression is the
1600         element_type, not the variable type.  Ravi pointed this out.
1601
1602 2001-12-04  Ravi Pratap  <ravi@ximian.com>
1603
1604         * class.cs (Method::Define): Handle PInvoke methods specially
1605         by using DefinePInvokeMethod instead of the usual one.
1606
1607         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
1608         above to do the task of extracting information and defining the method.
1609         
1610 2001-12-04  Ravi Pratap  <ravi@ximian.com>
1611
1612         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
1613         of the condition for string type.
1614
1615         (Emit): Move that here. 
1616
1617         (ArrayCreation::CheckIndices): Keep string literals in their expression
1618         form.
1619
1620         (EmitDynamicInitializers): Handle strings appropriately.
1621
1622 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
1623
1624         * codegen.cs (EmitContext): Replace multiple variables with a
1625         single pointer to the current Switch statement.
1626
1627         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
1628         EmitContext.
1629
1630 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
1631
1632         * statement.cs 
1633
1634         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
1635         default'.
1636         
1637         (Foreach.Emit): Foreach on arrays was not setting
1638         up the loop variables (for break/continue).
1639
1640         (GotoCase): Semi-implented.
1641         
1642 2001-12-03  Ravi Pratap  <ravi@ximian.com>
1643
1644         * attribute.cs (CheckAttribute): Handle system attributes by using
1645         Attribute.GetAttributes to examine information we need.
1646
1647         (GetValidPlaces): Same here.
1648
1649         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
1650
1651         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
1652
1653         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
1654
1655         (Method::Define): Set appropriate flags if we have a DllImport attribute.
1656
1657         (Method::Emit): Handle the case when we are a PInvoke method.
1658
1659 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
1660
1661         * expression.cs: Use ResolveWithSimpleName on compound names.
1662
1663 2001-12-02  Ravi Pratap  <ravi@ximian.com>
1664
1665         * constant.cs (EmitConstant): Make sure we resolve the associated expression
1666         before trying to reduce it.
1667
1668         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
1669
1670         * constant.cs (LookupConstantValue): Implement.
1671
1672         (EmitConstant): Use the above in emitting the constant.
1673
1674         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
1675         that are user-defined by doing a LookupConstantValue on them.
1676
1677         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
1678         too, like above.
1679
1680 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
1681
1682         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
1683
1684         (BaseAccess.DoResolve): Implement.
1685
1686         (MemberAccess.DoResolve): Split this routine into a
1687         ResolveMemberAccess routine that can be used independently
1688
1689 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
1690
1691         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
1692         As that share bits of the implementation.  Is returns a boolean,
1693         while As returns the Type that is being probed.
1694
1695 2001-12-01  Ravi Pratap  <ravi@ximian.com>
1696
1697         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
1698         instead of a Literal - much easier.
1699
1700         (EnumInTransit): Remove - utterly useless :-)
1701
1702         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
1703
1704         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
1705
1706         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
1707         chain when we have no associated expression.
1708
1709 2001-11-30  Ravi Pratap  <ravi@ximian.com>
1710
1711         * constant.cs (Define): Use Location while reporting the errror.
1712
1713         Also emit a warning when 'new' is used and there is no inherited
1714         member to hide.
1715
1716         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
1717         populated.
1718
1719         (LookupEnumValue): Implement to lookup an enum member's value and define it
1720         if necessary.
1721
1722         (Populate): Re-write accordingly to use the above routine.
1723
1724 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
1725
1726         * expression.cs (This): Fix prototype for DoResolveLValue to
1727         override the base class DoResolveLValue.
1728
1729         * cs-parser.cs: Report errors cs574 and cs575 (destructor
1730         declarations) 
1731
1732         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
1733         (we need to load the address of the field here).  This fixes
1734         test-22. 
1735         
1736         (FieldExpr.DoResolveLValue): Call the DoResolve
1737         function to initialize the Instance expression.
1738         
1739         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
1740         correctly the GetEnumerator operation on a value type.
1741
1742         * cs-parser.jay: Add more simple parsing error catches.
1743
1744         * statement.cs (Switch): Add support for string switches.
1745         Handle null specially.
1746
1747         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
1748
1749 2001-11-28  Ravi Pratap  <ravi@ximian.com>
1750
1751         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
1752
1753         (declare_local_constant): New helper function.
1754
1755         * statement.cs (AddConstant): Keep a separate record of constants
1756
1757         (IsConstant): Implement to determine if a variable is a constant.
1758
1759         (GetConstantExpression): Implement.
1760
1761         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
1762
1763         * statement.cs (IsVariableDefined): Re-write.
1764
1765 2001-11-27  Ravi Pratap  <ravi@ximian.com>
1766
1767         * class.cs (TypeContainer::FindMembers): Look for constants
1768         in the case when we are looking for MemberTypes.Field
1769
1770         * expression.cs (MemberAccess::DoResolve): Check that in the
1771         case we are a FieldExpr and a Literal, we are not being accessed
1772         by an instance reference.
1773
1774         * cs-parser.jay (local_constant_declaration): Implement.
1775
1776         (declaration_statement): Implement for constant declarations.
1777
1778 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
1779
1780         * statement.cs (Switch): Catch double defaults.
1781
1782         (Switch): More work on the switch() statement
1783         implementation.  It works for integral values now, need to finish
1784         string support.
1785
1786
1787 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
1788
1789         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
1790         integer literals into other integer literals.  To be used by
1791         switch. 
1792
1793 2001-11-24  Ravi Pratap  <ravi@ximian.com>
1794
1795         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
1796         some memory.
1797
1798         (EmitDynamicInitializers): Cope with the above since we extract data
1799         directly from ArrayData now.
1800
1801         (ExpectInitializers): Keep track of whether initializers are mandatory
1802         or not.
1803
1804         (Bounds): Make it a hashtable to prevent the same dimension being 
1805         recorded for every element in that dimension.
1806
1807         (EmitDynamicInitializers): Fix bug which prevented the Set array method
1808         from being found.
1809
1810         Also fix bug which was causing the indices to be emitted in the reverse
1811         order.
1812
1813 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
1814
1815         * expression.cs (ArrayCreation): Implement the bits that Ravi left
1816         unfinished.  They do not work, because the underlying code is
1817         sloppy.
1818
1819 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
1820
1821         * cs-parser.jay: Remove bogus fixme.
1822
1823         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
1824         on Switch statement.
1825         
1826 2001-11-23  Ravi Pratap  <ravi@ximian.com>
1827
1828         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
1829         the same. 
1830         
1831         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
1832         parameter. Apparently, any expression is allowed. 
1833
1834         (ValidateInitializers): Update accordingly.
1835
1836         (CheckIndices): Fix some tricky bugs thanks to recursion.
1837
1838         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
1839         I was being completely brain-dead.
1840
1841         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
1842         and re-write acordingly.
1843
1844         (DelegateInvocation): Re-write accordingly.
1845
1846         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
1847
1848         (MakeByteBlob): Handle types more correctly.
1849
1850         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
1851         initialization from expressions but it is incomplete because I am a complete
1852         Dodo :-|
1853
1854 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
1855
1856         * statement.cs (If.Emit): Fix a bug that generated incorrect code
1857         on If.  Basically, we have to return `true' (ie, we do return to
1858         our caller) only if both branches of the if return.
1859
1860         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
1861         short-circuit operators, handle them as short circuit operators. 
1862
1863         (Cast.DoResolve): Resolve type.
1864         (Cast.Cast): Take an expression as the target type.
1865
1866         * cs-parser.jay (cast_expression): Remove old hack that only
1867         allowed a limited set of types to be handled.  Now we take a
1868         unary_expression and we resolve to a type during semantic
1869         analysis.
1870
1871         Use the grammar productions from Rhys to handle casts (this is
1872         not complete like Rhys syntax yet, we fail to handle that corner
1873         case that C# has regarding (-x), but we will get there.
1874         
1875 2001-11-22  Ravi Pratap  <ravi@ximian.com>
1876
1877         * class.cs (EmitFieldInitializer): Take care of the case when we have a
1878         field which is an array type.
1879
1880         * cs-parser.jay (declare_local_variables): Support array initialization too.
1881
1882         * typemanager.cs (MakeKey): Implement.
1883
1884         (everywhere): Use the above appropriately.
1885
1886         * cs-parser.jay (for_statement): Update for array initialization while
1887         declaring variables.
1888
1889         * ecore.cs : The error message was correct, it's the variable's names that
1890         were misleading ;-) Make the code more readable.
1891
1892         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
1893         the correct type etc.
1894
1895         (ConvertExplicit): Handle Enum types by examining the underlying type.
1896
1897 2001-11-21  Ravi Pratap  <ravi@ximian.com>
1898
1899         * parameter.cs (GetCallingConvention): Always return
1900         CallingConventions.Standard for now.
1901
1902 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
1903
1904         * expression.cs (Binary.ResolveOperator): Update the values of `l'
1905         and `r' after calling DoNumericPromotions.
1906
1907         * ecore.cs: Fix error message (the types were in the wrong order).
1908
1909         * statement.cs (Foreach.ProbeCollectionType): Need to pass
1910         BindingFlags.Instance as well 
1911
1912         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
1913         implicit int literal conversion in an empty cast so that we
1914         propagate the right type upstream.
1915
1916         (UnboxCast): new class used to unbox value types.
1917         (Expression.ConvertExplicit): Add explicit type conversions done
1918         by unboxing.
1919
1920         (Expression.ImplicitNumericConversion): Oops, forgot to test for
1921         the target type before applying the implicit LongLiterals to ULong
1922         literal cast.
1923
1924 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
1925
1926         * cs-parser.jay (for_statement): Reworked the way For works: now
1927         we declare manually any variables that are introduced in
1928         for_initializer to solve the problem of having out-of-band code
1929         emition (that is what got for broken).
1930
1931         (declaration_statement): Perform the actual variable declaration
1932         that used to be done in local_variable_declaration here.
1933
1934         (local_variable_declaration): Do not declare anything, just pass
1935         the information on a DictionaryEntry
1936
1937 2001-11-20  Ravi Pratap  <ravi@ximian.com>
1938
1939         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
1940         re-write of the logic to now make it recursive.
1941
1942         (UpdateIndices): Re-write accordingly.
1943
1944         Store element data in a separate ArrayData list in the above methods.
1945
1946         (MakeByteBlob): Implement to dump the array data into a byte array.
1947
1948 2001-11-19  Ravi Pratap  <ravi@ximian.com>
1949
1950         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
1951         into CheckIndices.
1952
1953         * constant.cs (Define): Implement.
1954
1955         (EmitConstant): Re-write fully.
1956
1957         Pass in location info.
1958
1959         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
1960         respectively.
1961
1962         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
1963         DictionaryEntry since we need location info too.
1964
1965         (constant_declaration): Update accordingly.
1966
1967         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
1968         code into another method : UpdateIndices.
1969
1970 2001-11-18  Ravi Pratap  <ravi@ximian.com>
1971
1972         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
1973         some type checking etc.
1974
1975 2001-11-17  Ravi Pratap  <ravi@ximian.com>
1976
1977         * expression.cs (ArrayCreation::ValidateInitializers): Implement
1978         bits to provide dimension info if the user skips doing that.
1979
1980         Update second constructor to store the rank correctly.
1981
1982 2001-11-16  Ravi Pratap  <ravi@ximian.com>
1983
1984         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
1985         and try to implement.
1986
1987         * ../errors/cs0150.cs : Add.
1988
1989         * ../errors/cs0178.cs : Add.
1990
1991 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
1992
1993         * statement.cs: Implement foreach on multi-dimensional arrays. 
1994
1995         * parameter.cs (Parameters.GetParameterByName): Also lookup the
1996         name of the params argument.
1997
1998         * expression.cs: Use EmitStoreOpcode to get the right opcode while
1999         initializing the array.
2000
2001         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
2002         we can use this elsewhere.
2003
2004         * statement.cs: Finish implementation of foreach for single
2005         dimension arrays.
2006
2007         * cs-parser.jay: Use an out-of-band stack to pass information
2008         around, I wonder why I need this.
2009
2010         foreach_block: Make the new foreach_block the current_block.
2011
2012         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
2013         function used to return a static Parameters structure.  Used for
2014         empty parameters, as those are created very frequently.
2015
2016         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
2017
2018 2001-11-15  Ravi Pratap  <ravi@ximian.com>
2019
2020         * interface.cs : Default modifier is private, not public. The
2021         make verify test passes again.
2022
2023 2001-11-15  Ravi Pratap  <ravi@ximian.com>
2024
2025         * support.cs (ReflectionParameters): Fix logic to determine
2026         whether the last parameter is a params one. Test 9 passes again.
2027
2028         * delegate.cs (Populate): Register the builders we define with
2029         RegisterParameterForBuilder. Test 19 passes again.
2030
2031         * cs-parser.jay (property_declaration): Reference $6 instead
2032         of $$ to get at the location.
2033
2034         (indexer_declaration): Similar stuff.
2035
2036         (attribute): Ditto.
2037
2038         * class.cs (Property): Register parameters for the Get and Set methods
2039         if they exist. Test 23 passes again.
2040
2041         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
2042         call to EmitArguments as we are sure there aren't any params arguments. 
2043         Test 32 passes again.
2044
2045         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
2046         IndexOutOfRangeException. 
2047
2048         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
2049         Test 33 now passes again.
2050         
2051 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
2052
2053         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
2054         broke a bunch of things.  Will have to come up with a better way
2055         of tracking locations.
2056
2057         * statement.cs: Implemented foreach for single dimension arrays.
2058
2059 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
2060
2061         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
2062         an error.  This removes the lookup from the critical path.
2063
2064         * cs-parser.jay: Removed use of temporary_loc, which is completely
2065         broken. 
2066
2067 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
2068
2069         * support.cs (ReflectionParameters.ParameterModifier): Report
2070         whether the argument is a PARAMS argument or not.
2071
2072         * class.cs: Set the attribute `ParamArrayAttribute' on the
2073         parameter argument.
2074
2075         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
2076         and cons_param_array_attribute (ConstructorInfo for
2077         ParamArrayAttribute)., 
2078
2079         * codegen.cs: Emit the return using the `Return' statement, that
2080         way we can report the error correctly for missing return values. 
2081
2082         * class.cs (Method.Emit): Clean up.
2083
2084         * expression.cs (Argument.Resolve): Take another argument: the
2085         location where this argument is used.  Notice that this is not
2086         part of the "Argument" class as to reduce the size of the
2087         structure (we know the approximate location anyways).
2088
2089         Test if the argument is a variable-reference, if not, then
2090         complain with a 206.
2091
2092         (Argument.Emit): Emit addresses of variables.
2093
2094         (Argument.FullDesc): Simplify.
2095
2096         (Invocation.DoResolve): Update for Argument.Resolve.
2097
2098         (ElementAccess.DoResolve): ditto.
2099
2100         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
2101         method should be virtual, as this method is always virtual.
2102
2103         (NewDelegate.DoResolve): Update for Argument.Resolve.
2104
2105         * class.cs (ConstructorInitializer.DoResolve): ditto.
2106         
2107         * attribute.cs (Attribute.Resolve): ditto.
2108
2109 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
2110
2111         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
2112
2113         * expression.cs (ParameterReference): Drop IStackStorage and implement
2114         IAssignMethod instead. 
2115
2116         (LocalVariableReference): ditto.
2117         
2118         * ecore.cs (FieldExpr): Drop IStackStorage and implement
2119         IAssignMethod instead. 
2120
2121 2001-11-13  Miguel de Icaza <miguel@ximian.com>
2122
2123         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
2124         enumerations that are used in heavily used structures derive from
2125         byte in a laughable and pathetic attempt to reduce memory usage.
2126         This is the kind of pre-optimzations that you should not do at
2127         home without adult supervision.
2128
2129         * expression.cs (UnaryMutator): New class, used to handle ++ and
2130         -- separatedly from the other unary operators.  Cleans up the
2131         code, and kills the ExpressionStatement dependency in Unary.
2132
2133         (Unary): Removed `method' and `Arguments' from this class, making
2134         it smaller, and moving it all to SimpleCall, so I can reuse this
2135         code in other locations and avoid creating a lot of transient data
2136         strucutres when not required.
2137
2138         * cs-parser.jay: Adjust for new changes.
2139
2140 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
2141
2142         * enum.cs (Enum.Populate): If there is a failure during
2143         definition, return
2144
2145         * cs-parser.jay (opt_enum_base): we used to catch type errors
2146         here, but this is really incorrect.  The type error should be
2147         catched during semantic analysis.
2148
2149 2001-12-11  Ravi Pratap  <ravi@ximian.com>
2150
2151         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
2152         current_local_parameters as expected since I, in my stupidity, had forgotten
2153         to do this :-)
2154
2155         * attribute.cs (GetValidPlaces): Fix stupid bug.
2156
2157         * class.cs (Method::Emit): Perform check on applicability of attributes.
2158
2159         (Constructor::Emit): Ditto.
2160
2161         (Field::Emit): Ditto.
2162
2163         (Field.Location): Store location information.
2164
2165         (Property, Event, Indexer, Operator): Ditto.
2166
2167         * cs-parser.jay (field_declaration): Pass in location for each field.
2168
2169         * ../errors/cs0592.cs : Add.
2170
2171 2001-11-12  Ravi Pratap  <ravi@ximian.com>
2172
2173         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
2174
2175         (InitCoreTypes): Update accordingly.
2176
2177         (RegisterAttrType, LookupAttr): Implement.
2178
2179         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
2180         info about the same.
2181
2182         (Resolve): Update to populate the above as necessary.
2183
2184         (Error592): Helper.
2185
2186         (GetValidPlaces): Helper to the above.
2187
2188         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
2189
2190         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
2191
2192 2001-11-12  Ravi Pratap  <ravi@ximian.com>
2193
2194         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
2195
2196         * ../errors/cs0617.cs : Add.
2197
2198 2001-11-11  Ravi Pratap  <ravi@ximian.com>
2199
2200         * enum.cs (Emit): Rename to Populate to be more consistent with what
2201         we expect it to do and when exactly it is called.
2202
2203         * class.cs, rootcontext.cs : Update accordingly.
2204
2205         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
2206         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
2207
2208         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
2209
2210         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
2211         of a fieldinfo using the above, when dealing with a FieldBuilder.
2212
2213 2001-11-10  Ravi Pratap  <ravi@ximian.com>
2214
2215         * ../errors/cs0031.cs : Add.
2216
2217         * ../errors/cs1008.cs : Add.
2218
2219         * ../errrors/cs0543.cs : Add.
2220
2221         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
2222         enum type.
2223
2224         (FindMembers): Implement.
2225
2226         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
2227         enums and delegates too.
2228
2229         (enum_types): Rename to builder_to_enum.
2230
2231         (delegate_types): Rename to builder_to_delegate.
2232
2233         * delegate.cs (FindMembers): Implement.
2234
2235 2001-11-09  Ravi Pratap  <ravi@ximian.com>
2236
2237         * typemanager.cs (IsEnumType): Implement.
2238
2239         * enum.cs (Emit): Re-write parts to account for the underlying type
2240         better and perform checking etc.
2241
2242         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
2243         of the underlying type.
2244
2245         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
2246         value
2247
2248         * enum.cs (error31): Helper to report error #31.
2249
2250         * cs-parser.jay (enum_declaration): Store location of each member too.
2251
2252         * enum.cs (member_to_location): New hashtable. 
2253
2254         (AddEnumMember): Update location hashtable.
2255
2256         (Emit): Use the location of each member while reporting errors.
2257
2258 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
2259
2260         * cs-parser.jay: A for_initializer if is a
2261         local_variable_declaration really ammount to have an implicit
2262         block with the variable declaration and no initializer for for.
2263
2264         * statement.cs (For.Emit): Cope with null initializers.
2265
2266         This fixes the infinite loop on for initializers.
2267
2268 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
2269
2270         * enum.cs: More cleanup.
2271
2272         * ecore.cs: Remove dead code.
2273
2274         * class.cs (Property.Emit): More simplification.
2275         (Event.Emit): ditto.
2276
2277         Reworked to have less levels of indentation.
2278         
2279 2001-11-08  Ravi Pratap  <ravi@ximian.com>
2280
2281         * class.cs (Property): Emit attributes.
2282
2283         (Field): Ditto.
2284         
2285         (Event): Ditto.
2286
2287         (Indexer): Ditto.
2288
2289         (Operator): Ditto.
2290
2291         * enum.cs (Emit): Ditto.
2292
2293         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
2294         Enums too.
2295
2296         * class.cs (Field, Event, etc.): Move attribute generation into the
2297         Emit method everywhere.
2298
2299         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
2300         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
2301         as we had no way of defining nested enums !
2302
2303         * rootcontext.cs : Adjust code accordingly.
2304
2305         * typemanager.cs (AddEnumType): To keep track of enum types separately.
2306
2307 2001-11-07  Ravi Pratap  <ravi@ximian.com>
2308
2309         * expression.cs (EvalConstantExpression): Move into ecore.cs
2310         
2311         * enum.cs (Enum): Rename some members and make them public and readonly
2312         according to our convention.
2313
2314         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
2315         nothing else.
2316
2317         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
2318
2319         (Enum::Emit): Write a simple version for now which doesn't try to compute
2320         expressions. I shall modify this to be more robust in just a while.
2321
2322         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
2323
2324         (TypeContainer::CloseType): Create the Enum types too.
2325
2326         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
2327
2328         * expression.cs (EvalConstantExpression): Get rid of completely.
2329
2330         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
2331         user-defined values and other cases.
2332
2333         (IsValidEnumLiteral): Helper function.
2334
2335         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
2336         out there in the case we had a literal FieldExpr.
2337
2338         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
2339
2340         (Literalize): Revamp a bit to take two arguments.
2341         
2342         (EnumLiteral): New class which derives from Literal to wrap enum literals.
2343         
2344 2001-11-06  Ravi Pratap  <ravi@ximian.com>
2345
2346         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
2347
2348         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
2349
2350         (Resolve): Use the above to ensure we have proper initializers.
2351
2352 2001-11-05  Ravi Pratap  <ravi@ximian.com>
2353
2354         * expression.cs (Expression::EvalConstantExpression): New method to 
2355         evaluate constant expressions.
2356
2357         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
2358
2359 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
2360
2361         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
2362         in an array.
2363
2364         (Binary.ResolveOperator): Handle operator != (object a, object b)
2365         and operator == (object a, object b);
2366
2367         (Binary.DoNumericPromotions): Indicate whether the numeric
2368         promotion was possible.
2369
2370         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
2371         Implement.  
2372
2373         Made the ArrayAccess implement interface IAssignMethod instead of
2374         IStackStore as the order in which arguments are passed reflects
2375         this.
2376
2377         * assign.cs: Instead of using expr.ExprClass to select the way of
2378         assinging, probe for the IStackStore/IAssignMethod interfaces.
2379
2380         * typemanager.cs: Load InitializeArray definition.
2381
2382         * rootcontext.cs (RootContext.MakeStaticData): Used to define
2383         static data that can be used to initialize arrays. 
2384
2385 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
2386
2387         * expression.cs: Handle operator== and operator!= for booleans.
2388
2389         (Conditioal.Reduce): Implement reducer for the ?: operator.
2390
2391         (Conditional.Resolve): Implement dead code elimination.
2392
2393         (Binary.Resolve): Catch string literals and return a new
2394         concatenated string.
2395
2396         (Unary.Reduce): Implement reduction of unary expressions.
2397
2398         * ecore.cs: Split out the expression core handling here.
2399
2400         (Expression.Reduce): New method used to perform constant folding
2401         and CSE.  This is needed to support constant-expressions. 
2402         
2403         * statement.cs (Statement.EmitBoolExpression): Pass true and false
2404         targets, and optimize for !x.
2405
2406 2001-11-04  Ravi Pratap  <ravi@ximian.com>
2407
2408         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
2409         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
2410         set custom atttributes.
2411
2412         * literal.cs (Literal::GetValue): New abstract method to return the actual
2413         value of the literal, cast as an object.
2414
2415         (*Literal): Implement GetValue method.
2416
2417         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
2418         expressions to the arraylist but objects of type Argument.
2419
2420         * class.cs (TypeContainer::Emit): Emit our attributes too.
2421
2422         (Method::Emit, Constructor::Emit): Ditto.
2423
2424         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
2425         to be ignoring earlier.
2426
2427 2001-11-03  Ravi Pratap  <ravi@ximian.com>
2428
2429         * attribute.cs (AttributeSection::Define): Implement to do the business
2430         of constructing a CustomAttributeBuilder.
2431
2432         (Attribute): New trivial class. Increases readability of code.  
2433
2434         * cs-parser.jay : Update accordingly.
2435
2436         (positional_argument_list, named_argument_list, named_argument): New rules
2437
2438         (attribute_arguments): Use the above so that we are more correct.
2439         
2440 2001-11-02  Ravi Pratap  <ravi@ximian.com>
2441         
2442         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
2443         to perform all checks for a method with a params parameter.
2444
2445         (Invocation::OverloadResolve): Update to use the above method and therefore
2446         cope correctly with params method invocations.
2447
2448         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
2449         params too.
2450
2451         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
2452         constructors in our parent too because we can't afford to miss out on 
2453         protected ones ;-)
2454
2455         * attribute.cs (AttributeSection): New name for the class Attribute
2456
2457         Other trivial changes to improve readability.
2458
2459         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
2460         use the new class names.
2461         
2462 2001-11-01  Ravi Pratap  <ravi@ximian.com>
2463
2464         * class.cs (Method::Define): Complete definition for params types too
2465
2466         (Indexer::Define): Ditto.
2467
2468         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
2469         Cope everywhere with a request for info about the array parameter.
2470
2471 2001-11-01  Ravi Pratap  <ravi@ximian.com>
2472
2473         * tree.cs (RecordNamespace): Fix up to check for the correct key.
2474
2475         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
2476         local_variable_type to extract the string corresponding to the type.
2477
2478         (local_variable_type): Fixup the action to use the new helper method.
2479
2480         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
2481         go.
2482
2483         * expression.cs : Clean out code which uses the above.
2484
2485 2001-10-31  Ravi Pratap  <ravi@ximian.com>
2486         
2487         * typemanager.cs (RegisterMethod): Check if we already have an existing key
2488         and bale out if necessary by returning a false.
2489
2490         (RegisterProperty): Ditto.
2491
2492         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
2493         and print out appropriate error messages.
2494
2495         * interface.cs (everywhere): Ditto.
2496
2497         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
2498         location to constructor.
2499
2500         * class.cs (Property, Event, Indexer): Update accordingly.
2501
2502         * ../errors/cs111.cs : Added.
2503
2504         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
2505         of a method, as laid down by the spec.
2506
2507         (Invocation::OverloadResolve): Use the above method.
2508
2509 2001-10-31  Ravi Pratap  <ravi@ximian.com>
2510
2511         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
2512         now take a TypeContainer and a Parameters object.
2513
2514         (ParameterData): Modify return type of ParameterModifier method to be 
2515         Parameter.Modifier and not a string.
2516
2517         (ReflectionParameters, InternalParameters): Update accordingly.
2518
2519         * expression.cs (Argument::GetParameterModifier): Same here.
2520
2521         * support.cs (InternalParameters::ParameterType): Find a better way of determining
2522         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
2523         symbol in it at all so maybe this is only for now.
2524
2525 2001-10-30  Ravi Pratap  <ravi@ximian.com>
2526
2527         * support.cs (InternalParameters): Constructor now takes an extra argument 
2528         which is the actual Parameters class.
2529
2530         (ParameterDesc): Update to provide info on ref/out modifiers.
2531
2532         * class.cs (everywhere): Update call to InternalParameters to pass in
2533         the second argument too.
2534
2535         * support.cs (ParameterData): Add ParameterModifier, which is a method 
2536         to return the modifier info [ref/out etc]
2537
2538         (InternalParameters, ReflectionParameters): Implement the above.
2539
2540         * expression.cs (Argument::ParameterModifier): Similar function to return
2541         info about the argument's modifiers.
2542
2543         (Invocation::OverloadResolve): Update to take into account matching modifiers 
2544         too.
2545
2546         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
2547         a new SetFormalParameters object which we pass to InternalParameters.
2548
2549 2001-10-30  Ravi Pratap  <ravi@ximian.com>
2550
2551         * expression.cs (NewArray): Merge into the ArrayCreation class.
2552
2553 2001-10-29  Ravi Pratap  <ravi@ximian.com>
2554
2555         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
2556         NewUserdefinedArray into one as there wasn't much of a use in having
2557         two separate ones.
2558
2559         * expression.cs (Argument): Change field's name to ArgType from Type.
2560
2561         (Type): New readonly property which returns the proper type, taking into 
2562         account ref/out modifiers.
2563
2564         (everywhere): Adjust code accordingly for the above.
2565
2566         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
2567         whether we are emitting for a ref or out parameter.
2568
2569         * expression.cs (Argument::Emit): Use the above field to set the state.
2570
2571         (LocalVariableReference::Emit): Update to honour the flag and emit the
2572         right stuff.
2573
2574         * parameter.cs (Attributes): Set the correct flags for ref parameters.
2575
2576         * expression.cs (Argument::FullDesc): New function to provide a full desc.
2577
2578         * support.cs (ParameterData): Add method ParameterDesc to the interface.
2579
2580         (ReflectionParameters, InternalParameters): Implement the above method.
2581
2582         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
2583         reporting errors.
2584
2585         (Invocation::FullMethodDesc): Ditto. 
2586
2587 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
2588
2589         * cs-parser.jay: Add extra production for the second form of array
2590         creation. 
2591
2592         * expression.cs (ArrayCreation): Update to reflect the above
2593         change. 
2594
2595         * Small changes to prepare for Array initialization.
2596
2597 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
2598
2599         * typemanager.cs (ImplementsInterface): interface might be null;
2600         Deal with this problem;
2601
2602         Also, we do store negative hits on the cache (null values), so use
2603         this instead of calling t.GetInterfaces on the type everytime.
2604
2605 2001-10-28  Ravi Pratap  <ravi@ximian.com>
2606
2607         * typemanager.cs (IsBuiltinType): New method to help determine the same.
2608
2609         * expression.cs (New::DoResolve): Get rid of array creation code and instead
2610         split functionality out into different classes.
2611
2612         (New::FormArrayType): Move into NewBuiltinArray.
2613
2614         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
2615         quite useless.
2616
2617         (NewBuiltinArray): New class to handle creation of built-in arrays.
2618
2619         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
2620         account creation of one-dimensional arrays.
2621
2622         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
2623
2624         (NewUserdefinedArray::DoResolve): Implement.
2625
2626         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
2627
2628         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
2629         we maintain inside the TypeManager. This is necessary to perform lookups on the
2630         module builder.
2631
2632         (LookupType): Update to perform GetType on the module builders too.     
2633
2634         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
2635
2636         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
2637
2638 2001-10-23  Ravi Pratap  <ravi@ximian.com>
2639
2640         * expression.cs (New::DoResolve): Implement guts of array creation.
2641
2642         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
2643         
2644 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
2645
2646         * expression.cs: Fix bug I introduced lsat night that broke
2647         Delegates. 
2648
2649         (Expression.Resolve): Report a 246 error (can not resolve name)
2650         if we find a SimpleName in the stream.
2651         
2652         (Expression.ResolveLValue): Ditto.
2653         
2654         (Expression.ResolveWithSimpleName): This function is a variant of
2655         ResolveName, this one allows SimpleNames to be returned without a
2656         warning.  The only consumer of SimpleNames is MemberAccess
2657
2658 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
2659
2660         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
2661         might arrive here.  I have my doubts that this is correct.
2662
2663         * statement.cs (Lock): Implement lock statement.
2664
2665         * cs-parser.jay: Small fixes to support `lock' and `using'
2666
2667         * cs-tokenizer.cs: Remove extra space
2668
2669         * driver.cs: New flag --checked, allows to turn on integer math
2670         checking. 
2671
2672         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
2673         Threading.Monitor.Exit 
2674         
2675 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
2676
2677         * expression.cs (IndexerAccess::DoResolveLValue): Set the
2678         Expression Class to be IndexerAccess.
2679
2680         Notice that Indexer::DoResolve sets the eclass to Value.
2681
2682 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
2683
2684         * class.cs (TypeContainer::Emit): Emit code for indexers.
2685
2686         * assign.cs (IAssignMethod): New interface implemented by Indexers
2687         and Properties for handling assignment.
2688
2689         (Assign::Emit): Simplify and reuse code. 
2690         
2691         * expression.cs (IndexerAccess, PropertyExpr): Implement
2692         IAssignMethod, clean up old code. 
2693
2694 2001-10-22  Ravi Pratap  <ravi@ximian.com>
2695
2696         * typemanager.cs (ImplementsInterface): New method to determine if a type
2697         implements a given interface. Provides a nice cache too.
2698
2699         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
2700         method.
2701
2702         (ConvertReferenceExplicit): Ditto.
2703
2704         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
2705         various methods, with correct names etc.
2706
2707         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
2708         Operator.UnaryNegation.
2709
2710         * cs-parser.jay (operator_declarator): Be a little clever in the case where
2711         we have a unary plus or minus operator.
2712
2713         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
2714         UnaryMinus.
2715
2716         * everywhere : update accordingly.
2717
2718         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
2719         respectively.
2720
2721         * class.cs (Method::Define): For the case where we are implementing a method
2722         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
2723         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
2724         
2725 2001-10-21  Ravi Pratap  <ravi@ximian.com>
2726
2727         * interface.cs (FindMembers): Implement to work around S.R.E
2728         lameness.
2729
2730         * typemanager.cs (IsInterfaceType): Implement.
2731
2732         (FindMembers): Update to handle interface types too.
2733
2734         * expression.cs (ImplicitReferenceConversion): Re-write bits which
2735         use IsAssignableFrom as that is not correct - it doesn't work.
2736
2737         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
2738         and accordingly override EmitStatement.
2739
2740         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
2741         using the correct logic :-)
2742
2743 2001-10-19  Ravi Pratap  <ravi@ximian.com>
2744
2745         * ../errors/cs-11.cs : Add to demonstrate error -11 
2746
2747 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
2748
2749         * assign.cs (Assign::Resolve): Resolve right hand side first, and
2750         then pass this as a hint to ResolveLValue.
2751         
2752         * expression.cs (FieldExpr): Add Location information
2753
2754         (FieldExpr::LValueResolve): Report assignment to readonly
2755         variable. 
2756         
2757         (Expression::ExprClassFromMemberInfo): Pass location information.
2758
2759         (Expression::ResolveLValue): Add new method that resolves an
2760         LValue. 
2761
2762         (Expression::DoResolveLValue): Default invocation calls
2763         DoResolve. 
2764
2765         (Indexers): New class used to keep track of indexers in a given
2766         Type. 
2767
2768         (IStackStore): Renamed from LValue, as it did not really describe
2769         what this did.  Also ResolveLValue is gone from this interface and
2770         now is part of Expression.
2771
2772         (ElementAccess): Depending on the element access type
2773         
2774         * typemanager.cs: Add `indexer_name_type' as a Core type
2775         (System.Runtime.CompilerServices.IndexerNameAttribute)
2776
2777         * statement.cs (Goto): Take a location.
2778         
2779 2001-10-18  Ravi Pratap  <ravi@ximian.com>
2780
2781         * delegate.cs (Delegate::VerifyDelegate): New method to verify
2782         if two delegates are compatible.
2783
2784         (NewDelegate::DoResolve): Update to take care of the case when
2785         we instantiate a delegate from another delegate.
2786
2787         * typemanager.cs (FindMembers): Don't even try to look up members
2788         of Delegate types for now.
2789
2790 2001-10-18  Ravi Pratap  <ravi@ximian.com>
2791
2792         * delegate.cs (NewDelegate): New class to take care of delegate
2793         instantiation.
2794
2795         * expression.cs (New): Split the delegate related code out into 
2796         the NewDelegate class.
2797
2798         * delegate.cs (DelegateInvocation): New class to handle delegate 
2799         invocation.
2800
2801         * expression.cs (Invocation): Split out delegate related code into
2802         the DelegateInvocation class.
2803
2804 2001-10-17  Ravi Pratap  <ravi@ximian.com>
2805
2806         * expression.cs (New::DoResolve): Implement delegate creation fully
2807         and according to the spec.
2808
2809         (New::DoEmit): Update to handle delegates differently.
2810
2811         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
2812         because of which we were printing out arguments in reverse order !
2813
2814         * delegate.cs (VerifyMethod): Implement to check if the given method
2815         matches the delegate.
2816
2817         (FullDelegateDesc): Implement.
2818
2819         (VerifyApplicability): Implement.
2820
2821         * expression.cs (Invocation::DoResolve): Update to accordingly handle
2822         delegate invocations too.
2823
2824         (Invocation::Emit): Ditto.
2825
2826         * ../errors/cs1593.cs : Added.
2827
2828         * ../errors/cs1594.cs : Added.
2829
2830         * delegate.cs (InstanceExpression, TargetMethod): New properties.
2831
2832 2001-10-16  Ravi Pratap  <ravi@ximian.com>
2833
2834         * typemanager.cs (intptr_type): Core type for System.IntPtr
2835
2836         (InitCoreTypes): Update for the same.
2837
2838         (iasyncresult_type, asynccallback_type): Ditto.
2839
2840         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
2841         correct.
2842
2843         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
2844         too.
2845
2846         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
2847         the builders for the 4 members of a delegate type :-)
2848
2849         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
2850         type.
2851
2852         * expression.cs (New::DoResolve): Implement guts for delegate creation.
2853
2854         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
2855
2856 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
2857
2858         * statement.cs (Break::Emit): Implement.   
2859         (Continue::Emit): Implement.
2860
2861         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
2862         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
2863         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
2864         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
2865         end loop
2866         
2867         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
2868         properties that track the label for the current loop (begin of the
2869         loop and end of the loop).
2870
2871 2001-10-15  Ravi Pratap  <ravi@ximian.com>
2872
2873         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
2874         use of emitting anything at all.
2875
2876         * class.cs, rootcontext.cs : Get rid of calls to the same.
2877
2878         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
2879
2880         (Populate): Define the constructor correctly and set the implementation
2881         attributes.
2882
2883         * typemanager.cs (delegate_types): New hashtable to hold delegates that
2884         have been defined.
2885
2886         (AddDelegateType): Implement.
2887
2888         (IsDelegateType): Implement helper method.
2889
2890         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
2891
2892         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
2893         and accordingly handle it.
2894
2895         * delegate.cs (Populate): Take TypeContainer argument.
2896         Implement bits to define the Invoke method. However, I still haven't figured out
2897         how to take care of the native int bit :-(
2898
2899         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
2900         Qualify the name of the delegate, not its return type !
2901
2902         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
2903         conversion.
2904
2905         (StandardConversionExists): Checking for array types turns out to be recursive.
2906
2907         (ConvertReferenceExplicit): Implement array conversion.
2908
2909         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
2910         
2911 2001-10-12  Ravi Pratap  <ravi@ximian.com>
2912
2913         * cs-parser.jay (delegate_declaration): Store the fully qualified
2914         name as it is a type declaration.
2915
2916         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
2917         readonly.
2918
2919         (DefineDelegate): Renamed from Define. Does the same thing essentially,
2920         as TypeContainer::DefineType.
2921
2922         (Populate): Method in which all the definition of the various methods (Invoke)
2923         etc is done.
2924
2925         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
2926         see.
2927         
2928         (CloseDelegate): Finally creates the delegate.
2929
2930         * class.cs (TypeContainer::DefineType): Update to define delegates.
2931         (Populate, Emit and CloseType): Do the same thing here too.
2932
2933         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
2934         delegates in all these operations.
2935
2936 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
2937
2938         * expression.cs: LocalTemporary: a new expression used to
2939         reference a temporary that has been created.
2940
2941         * assign.cs: Handle PropertyAccess back here, so that we can
2942         provide the proper semantic access to properties.
2943
2944         * expression.cs (Expression::ConvertReferenceExplicit): Implement
2945         a few more explicit conversions. 
2946
2947         * modifiers.cs: `NEW' modifier maps to HideBySig.
2948
2949         * expression.cs (PropertyExpr): Make this into an
2950         ExpressionStatement, and support the EmitStatement code path. 
2951
2952         Perform get/set error checking, clean up the interface.
2953
2954         * assign.cs: recognize PropertyExprs as targets, and if so, turn
2955         them into toplevel access objects.
2956
2957 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
2958
2959         * expression.cs: PropertyExpr::PropertyExpr: use work around the
2960         SRE.
2961
2962         * typemanager.cs: Keep track here of our PropertyBuilders again to
2963         work around lameness in SRE.
2964
2965 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
2966
2967         * expression.cs (LValue::LValueResolve): New method in the
2968         interface, used to perform a second resolution pass for LValues. 
2969         
2970         (This::DoResolve): Catch the use of this in static methods.
2971
2972         (This::LValueResolve): Implement.
2973
2974         (This::Store): Remove warning, assigning to `this' in structures
2975         is 
2976
2977         (Invocation::Emit): Deal with invocation of
2978         methods on value types.  We need to pass the address to structure
2979         methods rather than the object itself.  (The equivalent code to
2980         emit "this" for structures leaves the entire structure on the
2981         stack instead of a pointer to it). 
2982
2983         (ParameterReference::DoResolve): Compute the real index for the
2984         argument based on whether the method takes or not a `this' pointer
2985         (ie, the method is static).
2986
2987         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
2988         value types returned from functions when we need to invoke a
2989         method on the sturcture.
2990         
2991
2992 2001-10-11  Ravi Pratap  <ravi@ximian.com>
2993
2994         * class.cs (TypeContainer::DefineType): Method to actually do the business of
2995         defining the type in the Modulebuilder or Typebuilder. This is to take
2996         care of nested types which need to be defined on the TypeBuilder using
2997         DefineNestedMethod.
2998
2999         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
3000         methods in RootContext, only ported to be part of TypeContainer.
3001
3002         (TypeContainer::GetInterfaceOrClass): Ditto.
3003
3004         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
3005
3006         * interface.cs (Interface::DefineInterface): New method. Does exactly
3007         what RootContext.CreateInterface did earlier, only it takes care of nested types 
3008         too.
3009
3010         (Interface::GetInterfaces): Move from RootContext here and port.
3011
3012         (Interface::GetInterfaceByName): Same here.
3013
3014         * rootcontext.cs (ResolveTree): Re-write.
3015
3016         (PopulateTypes): Re-write.
3017
3018         * class.cs (TypeContainer::Populate): Populate nested types too.
3019         (TypeContainer::Emit): Emit nested members too.
3020
3021         * typemanager.cs (AddUserType): Do not make use of the FullName property,
3022         instead just use the name argument passed in as it is already fully
3023         qualified.
3024
3025         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
3026         to TypeContainer mapping to see if a type is user-defined.
3027
3028         * class.cs (TypeContainer::CloseType): Implement. 
3029
3030         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
3031         the default constructor.
3032         
3033         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
3034         twice.
3035
3036         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
3037
3038         * interface.cs (CloseType): Create the type here.
3039         
3040         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
3041         the hierarchy.
3042
3043         Remove all the methods which are now in TypeContainer.
3044
3045 2001-10-10  Ravi Pratap  <ravi@ximian.com>
3046
3047         * delegate.cs (Define): Re-write bits to define the delegate
3048         correctly.
3049
3050 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
3051
3052         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
3053
3054         * expression.cs (ImplicitReferenceConversion): handle null as well
3055         as a source to convert to any reference type.
3056
3057         * statement.cs (Return): Perform any implicit conversions to
3058         expected return type.  
3059
3060         Validate use of return statement.  
3061
3062         * codegen.cs (EmitContext): Pass the expected return type here.
3063
3064         * class.cs (Method, Constructor, Property): Pass expected return
3065         type to EmitContext.
3066
3067 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
3068
3069         * expression.cs: Make DoResolve take an EmitContext instead of a
3070         TypeContainer.
3071
3072         Replaced `l' and `location' for `loc', for consistency.
3073         
3074         (Error, Warning): Remove unneeded Tc argument.
3075
3076         * assign.cs, literal.cs, constant.cs: Update to new calling
3077         convention. 
3078         
3079         * codegen.cs: EmitContext now contains a flag indicating whether
3080         code is being generated in a static method or not.
3081
3082         * cs-parser.jay: DecomposeQI, new function that replaces the old
3083         QualifiedIdentifier.  Now we always decompose the assembled
3084         strings from qualified_identifier productions into a group of
3085         memberaccesses.
3086
3087 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
3088
3089         * rootcontext.cs: Deal with field-less struct types correctly now
3090         by passing the size option to Define Type.
3091
3092         * class.cs: Removed hack that created one static field. 
3093
3094 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
3095
3096         * statement.cs: Moved most of the code generation here. 
3097
3098 2001-10-09  Ravi Pratap  <ravi@ximian.com>
3099
3100         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
3101         seem very right.
3102
3103         (ElementAccess): Remove useless bits for now - keep checks as the spec
3104         says.
3105
3106 2001-10-08  Ravi Pratap  <ravi@ximian.com>
3107
3108         * expression.cs (ElementAccess::DoResolve): Remove my crap code
3109         and start performing checks according to the spec.
3110
3111 2001-10-07  Ravi Pratap  <ravi@ximian.com>
3112
3113         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
3114         rank_specifiers instead.
3115
3116         (rank_specifiers): Change the order in which the rank specifiers are stored
3117
3118         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
3119
3120         * expression.cs (ElementAccess): Implement the LValue interface too.
3121         
3122 2001-10-06  Ravi Pratap  <ravi@ximian.com>
3123         
3124         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
3125         except that user defined conversions are not included.
3126
3127         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
3128         perform the conversion of the return type, if necessary.
3129
3130         (New::DoResolve): Check whether we are creating an array or an object
3131         and accordingly do the needful.
3132
3133         (New::Emit): Same here.
3134
3135         (New::DoResolve): Implement guts of array creation.
3136
3137         (New::FormLookupType): Helper function.
3138
3139 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
3140
3141         * codegen.cs: Removed most of the code generation here, and move the
3142         corresponding code generation bits to the statement classes. 
3143
3144         Added support for try/catch/finalize and throw.
3145         
3146         * cs-parser.jay: Added support for try/catch/finalize.
3147
3148         * class.cs: Catch static methods having the flags override,
3149         virtual or abstract.
3150
3151         * expression.cs (UserCast): This user cast was not really doing
3152         what it was supposed to do.  Which is to be born in fully resolved
3153         state.  Parts of the resolution were being performed at Emit time! 
3154
3155         Fixed this code.
3156
3157 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
3158
3159         * expression.cs: Implicity convert the result from UserCast.
3160
3161 2001-10-05  Ravi Pratap  <ravi@ximian.com>
3162
3163         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
3164         prevented it from working correctly. 
3165
3166         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
3167         merely ConvertImplicit.
3168
3169 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
3170
3171         * typemanager.cs: Make the LookupTypeContainer function static,
3172         and not per-instance.  
3173
3174         * class.cs: Make static FindMembers (the one that takes a Type
3175         argument). 
3176
3177         * codegen.cs: Add EmitForeach here.
3178
3179         * cs-parser.jay: Make foreach a toplevel object instead of the
3180         inline expansion, as we need to perform semantic analysis on it. 
3181
3182 2001-10-05  Ravi Pratap  <ravi@ximian.com>
3183
3184         * expression.cs (Expression::ImplicitUserConversion): Rename to
3185         UserDefinedConversion.
3186
3187         (Expression::UserDefinedConversion): Take an extra argument specifying 
3188         whether we look for explicit user conversions too.
3189
3190         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
3191
3192         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
3193
3194         (ExplicitUserConversion): Make it a call to UserDefinedConversion
3195         with the appropriate arguments.
3196
3197         * cs-parser.jay (cast_expression): Record location too.
3198
3199         * expression.cs (Cast): Record location info.
3200
3201         (Expression::ConvertExplicit): Take location argument.
3202
3203         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
3204         to determine if we are doing explicit conversions.
3205
3206         (UserCast::Emit): Update accordingly.
3207
3208         (Expression::ConvertExplicit): Report an error if everything fails.
3209
3210         * ../errors/cs0030.cs : Add.
3211
3212 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
3213
3214         * modifiers.cs: If the ABSTRACT keyword is present, also set the
3215         virtual and newslot bits. 
3216
3217         * class.cs (TypeContainer::RegisterRequiredImplementations):
3218         Record methods we need.
3219
3220         (TypeContainer::MakeKey): Helper function to make keys for
3221         MethodBases, since the Methodbase key is useless.
3222
3223         (TypeContainer::Populate): Call RegisterRequiredImplementations
3224         before defining the methods.   
3225
3226         Create a mapping for method_builders_to_methods ahead of time
3227         instead of inside a tight loop.
3228
3229         (::RequireMethods):  Accept an object as the data to set into the
3230         hashtable so we can report interface vs abstract method mismatch.
3231
3232 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
3233
3234         * report.cs: Make all of it static.
3235
3236         * rootcontext.cs: Drop object_type and value_type computations, as
3237         we have those in the TypeManager anyways.
3238
3239         Drop report instance variable too, now it is a global.
3240
3241         * driver.cs: Use try/catch on command line handling.
3242
3243         Add --probe option to debug the error reporting system with a test
3244         suite. 
3245
3246         * report.cs: Add support for exiting program when a probe
3247         condition is reached.
3248
3249 2001-10-03  Ravi Pratap  <ravi@ximian.com>
3250
3251         * expression.cs (Binary::DoNumericPromotions): Fix the case when
3252         we do a forcible conversion regardless of type, to check if 
3253         ForceConversion returns a null.
3254
3255         (Binary::error19): Use location to report error.
3256
3257         (Unary::error23): Use location here too.
3258
3259         * ../errors/cs0019.cs : Check in.
3260
3261         * ../errors/cs0023.cs : Check in.
3262
3263         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
3264         case of a non-null MethodInfo object with a length of 0 !
3265
3266         (Binary::ResolveOperator): Flag error if overload resolution fails to find
3267         an applicable member - according to the spec :-)
3268         Also fix logic to find members in base types.
3269
3270         (Unary::ResolveOperator): Same here.
3271
3272         (Unary::report23): Change name to error23 and make first argument a TypeContainer
3273         as I was getting thoroughly confused between this and error19 :-)
3274         
3275         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
3276         (::FindMostEncompassedType): Implement.
3277         (::FindMostEncompassingType): Implement.
3278         (::StandardConversionExists): Implement.
3279
3280         (UserImplicitCast): Re-vamp. We now need info about most specific
3281         source and target types so that we can do the necessary conversions.
3282
3283         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
3284         mathematical union with no duplicates.
3285
3286 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
3287
3288         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
3289         in order from base classes to child classes, so that we can in
3290         child classes look up in our parent for method names and
3291         attributes (required for handling abstract, virtual, new, override
3292         constructs: we need to instrospect our base class, and if we dont
3293         populate the classes in order, the introspection might be
3294         incorrect.  For example, a method could query its parent before
3295         the parent has any methods and would determine that the parent has
3296         no abstract methods (while it could have had them)).
3297
3298         (RootContext::CreateType): Record the order in which we define the
3299         classes.
3300
3301 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
3302
3303         * class.cs (TypeContainer::Populate): Also method definitions can
3304         fail now, keep track of this.
3305
3306         (TypeContainer::FindMembers): Implement support for
3307         DeclaredOnly/noDeclaredOnly flag.
3308
3309         (Constructor::Emit) Return the ConstructorBuilder.
3310
3311         (Method::Emit) Return the MethodBuilder. 
3312         Check for abstract or virtual methods to be public.
3313
3314         * rootcontext.cs (RootContext::CreateType): Register all the
3315         abstract methods required for the class to be complete and the
3316         interface methods that must be implemented. 
3317
3318         * cs-parser.jay: Report error 501 (method requires body if it is
3319         not marked abstract or extern).
3320
3321         * expression.cs (TypeOf::Emit): Implement.
3322
3323         * typemanager.cs: runtime_handle_type, new global type.
3324
3325         * class.cs (Property::Emit): Generate code for properties.
3326
3327 2001-10-02  Ravi Pratap  <ravi@ximian.com>
3328
3329         * expression.cs (Unary::ResolveOperator): Find operators on base type
3330         too - we now conform exactly to the spec.
3331
3332         (Binary::ResolveOperator): Same here.
3333
3334         * class.cs (Operator::Define): Fix minor quirk in the tests.
3335
3336         * ../errors/cs0215.cs : Added.
3337
3338         * ../errors/cs0556.cs : Added.
3339
3340         * ../errors/cs0555.cs : Added.
3341
3342 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
3343
3344         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
3345         single integer which is really efficient
3346
3347 2001-10-01  Ravi Pratap  <ravi@ximian.com>
3348
3349         *  expression.cs (Expression::ImplicitUserConversion): Use location
3350         even in the case when we are examining True operators.
3351  
3352         * class.cs (Operator::Define): Perform extensive checks to conform
3353         with the rules for operator overloading in the spec.
3354
3355         * expression.cs (Expression::ImplicitReferenceConversion): Implement
3356         some of the other conversions mentioned in the spec.
3357
3358         * typemanager.cs (array_type): New static member for the System.Array built-in
3359         type.
3360
3361         (cloneable_interface): For System.ICloneable interface.
3362
3363         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
3364         we start resolving the tree and populating types.
3365
3366         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
3367  
3368 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
3369
3370         * expression.cs (Expression::ExprClassFromMemberInfo,
3371         Expression::Literalize): Create literal expressions from
3372         FieldInfos which are literals.
3373
3374         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
3375         type casts, because they were wrong.  The test suite in tests
3376         caught these ones.
3377
3378         (ImplicitNumericConversion): ushort to ulong requires a widening
3379         cast. 
3380
3381         Int32 constant to long requires widening cast as well.
3382
3383         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
3384         for integers because the type on the stack is not i4.
3385
3386 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
3387
3388         * expression.cs (report118): require location argument. 
3389
3390         * parameter.cs: Do not dereference potential null value.
3391
3392         * class.cs: Catch methods that lack the `new' keyword when
3393         overriding a name.  Report warnings when `new' is used without
3394         anything being there to override.
3395
3396         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
3397
3398         * class.cs: Only add constructor to hashtable if it is non-null
3399         (as now constructors can fail on define).
3400
3401         (TypeManager, Class, Struct): Take location arguments.
3402
3403         Catch field instance initialization in structs as errors.
3404
3405         accepting_filter: a new filter for FindMembers that is static so
3406         that we dont create an instance per invocation.
3407
3408         (Constructor::Define): Catch errors where a struct constructor is
3409         parameterless 
3410
3411         * cs-parser.jay: Pass location information for various new
3412         constructs. 
3413         
3414         * delegate.cs (Delegate): take a location argument.
3415
3416         * driver.cs: Do not call EmitCode if there were problesm in the
3417         Definition of the types, as many Builders wont be there. 
3418
3419         * decl.cs (Decl::Decl): Require a location argument.
3420
3421         * cs-tokenizer.cs: Handle properly hex constants that can not fit
3422         into integers, and find the most appropiate integer for it.
3423
3424         * literal.cs: Implement ULongLiteral.
3425
3426         * rootcontext.cs: Provide better information about the location of
3427         failure when CreateType fails.
3428         
3429 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
3430
3431         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
3432         as well.
3433
3434         * expression.cs (Binary::CheckShiftArguments): Add missing type
3435         computation.
3436         (Binary::ResolveOperator): Add type to the logical and and logical
3437         or, Bitwise And/Or and Exclusive Or code paths, it was missing
3438         before.
3439
3440         (Binary::DoNumericPromotions): In the case where either argument
3441         is ulong (and most signed types combined with ulong cause an
3442         error) perform implicit integer constant conversions as well.
3443
3444 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
3445
3446         * expression.cs (UserImplicitCast): Method should always be
3447         non-null. 
3448         (Invocation::BetterConversion): Simplified test for IntLiteral.
3449
3450         (Expression::ImplicitNumericConversion): Split this routine out.
3451         Put the code that performs implicit constant integer conversions
3452         here. 
3453
3454         (Expression::Resolve): Become a wrapper around DoResolve so we can
3455         check eclass and type being set after resolve.
3456
3457         (Invocation::Badness): Remove this dead function
3458
3459         (Binary::ResolveOperator): Do not compute the expensive argumnets
3460         unless we have a union for it.
3461
3462         (Probe::Emit): Is needs to do an isinst and then
3463         compare against null.
3464
3465         (::CanConvert): Added Location argument.  If the Location argument
3466         is null (Location.Null), then we do not report errors.  This is
3467         used by the `probe' mechanism of the Explicit conversion.  We do
3468         not want to generate an error for something that the user
3469         explicitly requested to be casted.  But the pipeline for an
3470         explicit cast first tests for potential implicit casts.
3471
3472         So for now, if the Location is null, it means `Probe only' to
3473         avoid adding another argument.   Might have to revise this
3474         strategy later.
3475
3476         (ClassCast): New class used to type cast objects into arbitrary
3477         classes (used in Explicit Reference Conversions).
3478
3479         Implement `as' as well.
3480
3481         Reverted all the patches from Ravi below: they were broken:
3482
3483                 * The use of `level' as a mechanism to stop recursive
3484                   invocations is wrong.  That was there just to catch the
3485                   bug with a strack trace but not as a way of addressing
3486                   the problem.
3487
3488                   To fix the problem we have to *understand* what is going
3489                   on and the interactions and come up with a plan, not
3490                   just get things going.
3491
3492                 * The use of the type conversion cache that I proposed
3493                   last night had an open topic: How does this work across
3494                   protection domains.  A user defined conversion might not
3495                   be public in the location where we are applying the
3496                   conversion, a different conversion might be selected
3497                   (ie, private A->B (better) but public B->A (worse),
3498                   inside A, A->B applies, but outside it, B->A will
3499                   apply).
3500
3501                 * On top of that (ie, even if the above is solved),
3502                   conversions in a cache need to be abstract.  Ie, `To
3503                   convert from an Int to a Short use an OpcodeCast', not
3504                   `To convert from an Int to a Short use the OpcodeCast on
3505                   the variable 5' (which is what this patch was doing).
3506         
3507 2001-09-28  Ravi Pratap  <ravi@ximian.com>
3508
3509         * expression.cs (Invocation::ConversionExists): Re-write to use
3510         the conversion cache
3511         
3512         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
3513         cache all conversions done, not just user-defined ones.
3514
3515         (Invocation::BetterConversion): The real culprit. Use ConversionExists
3516         to determine if a conversion exists instead of acutually trying to 
3517         perform the conversion. It's faster too.
3518
3519         (Expression::ConvertExplicit): Modify to use ConversionExists to check
3520         and only then attempt the implicit conversion.
3521
3522 2001-09-28  Ravi Pratap  <ravi@ximian.com>
3523
3524         * expression.cs (ConvertImplicit): Use a cache for conversions
3525         already found. Check level of recursion and bail out if necessary.
3526         
3527 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
3528
3529         * typemanager.cs (string_concat_string_string, string_concat_object_object):
3530         Export standard methods that we expect for string operations.
3531         
3532         * statement.cs (Block::UsageWarning): Track usage of variables and
3533         report the errors for not used variables.
3534
3535         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
3536         operator. 
3537
3538 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
3539
3540         * codegen.cs: remove unnneded code 
3541
3542         * expression.cs: Removed BuiltinTypeAccess class
3543
3544         Fix the order in which implicit conversions are
3545         done.  
3546
3547         The previous fixed dropped support for boxed conversions (adding a
3548         test to the test suite now)
3549
3550         (UserImplicitCast::CanConvert): Remove test for source being null,
3551         that code is broken.  We should not feed a null to begin with, if
3552         we do, then we should track the bug where the problem originates
3553         and not try to cover it up here.
3554
3555         Return a resolved expression of type UserImplicitCast on success
3556         rather than true/false.  Ravi: this is what I was talking about,
3557         the pattern is to use a static method as a "constructor" for
3558         objects. 
3559
3560         Also, do not create arguments until the very last minute,
3561         otherwise we always create the arguments even for lookups that
3562         will never be performed. 
3563
3564         (UserImplicitCast::Resolve): Eliminate, objects of type
3565         UserImplicitCast are born in a fully resolved state. 
3566         
3567         * typemanager.cs (InitCoreTypes): Init also value_type
3568         (System.ValueType). 
3569
3570         * expression.cs (Cast::Resolve): First resolve the child expression.
3571
3572         (LValue): Add new method AddressOf to be used by
3573         the `&' operator.  
3574
3575         Change the argument of Store to take an EmitContext instead of an
3576         ILGenerator, because things like FieldExpr need to be able to call
3577         their children expression to generate the instance code. 
3578
3579         (Expression::Error, Expression::Warning): Sugar functions for
3580         reporting errors.
3581
3582         (Expression::MemberLookup): Accept a TypeContainer instead of a
3583         Report as the first argument.
3584
3585         (Expression::ResolvePrimary): Killed.  I still want to improve
3586         this as currently the code is just not right.
3587
3588         (Expression::ResolveMemberAccess): Simplify, but it is still
3589         wrong. 
3590
3591         (Unary::Resolve): Catch errors in AddressOf operators.
3592
3593         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
3594         index to a byte for the short-version, or the compiler will choose
3595         the wrong Emit call, which generates the wrong data.
3596
3597         (ParameterReference::Emit, ::Store): same.
3598
3599         (FieldExpr::AddressOf): Implement.
3600         
3601         * typemanager.cs: TypeManager: made public variable instead of
3602         property.
3603         
3604         * driver.cs: document --fatal.
3605
3606         * report.cs (ErrorMessage, WarningMessage): new names for the old
3607         Error and Warning classes.
3608
3609         * cs-parser.jay (member_access): Turn built-in access to types
3610         into a normal simplename
3611
3612 2001-09-27  Ravi Pratap  <ravi@ximian.com>
3613
3614         * expression.cs (Invocation::BetterConversion): Fix to cope
3615         with q being null, since this was introducing a bug.
3616
3617         * expression.cs (ConvertImplicit): Do built-in conversions first.
3618
3619 2001-09-27  Ravi Pratap  <ravi@ximian.com>
3620
3621         * expression.cs (UserImplicitCast::Resolve): Fix bug.
3622
3623 2001-09-27  Ravi Pratap  <ravi@ximian.com>
3624
3625         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
3626         I had introduced long ago (what's new ?).
3627
3628         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
3629         the work of all the checking. 
3630         (ConvertImplicit): Call CanConvert and only then create object if necessary.
3631         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
3632
3633         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
3634         that is the right way. 
3635
3636         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
3637         overloading resolution. Use everywhere instead of cutting and pasting code.
3638
3639         (Binary::ResolveOperator): Use MakeUnionSet.
3640
3641         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
3642         we have to convert to bool types. Not complete yet.
3643         
3644 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
3645
3646         * typemanager.cs (TypeManager::CSharpName): support ushort.
3647
3648         * expression.cs (Expression::TryImplicitIntConversion): Attempts
3649         to provide an expression that performsn an implicit constant int
3650         conversion (section 6.1.6).
3651         (Expression::ConvertImplicitRequired): Reworked to include
3652         implicit constant expression conversions.
3653
3654         (Expression::ConvertNumericExplicit): Finished.
3655
3656         (Invocation::Emit): If InstanceExpression is null, then it means
3657         that we perform a call on this.
3658         
3659 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
3660
3661         * expression.cs (Unary::Emit): Remove some dead code.
3662         (Probe): Implement Resolve and Emit for `is'.
3663         (Expression::ConvertImplicitRequired): Attempt to do constant
3664         expression conversions here.  Maybe should be moved to
3665         ConvertImplicit, but I am not sure.
3666         (Expression::ImplicitLongConstantConversionPossible,
3667         Expression::ImplicitIntConstantConversionPossible): New functions
3668         that tell whether is it possible to apply an implicit constant
3669         expression conversion.
3670
3671         (ConvertNumericExplicit): Started work on explicit numeric
3672         conversions.
3673
3674         * cs-parser.jay: Update operator constants.
3675
3676         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
3677         (Parameters::GetSignature): Hook up VerifyArgs here.
3678         (Parameters::VerifyArgs): Verifies that no two arguments have the
3679         same name. 
3680
3681         * class.cs (Operator): Update the operator names to reflect the
3682         ones that the spec expects (as we are just stringizing the
3683         operator names).
3684         
3685         * expression.cs (Unary::ResolveOperator): Fix bug: Use
3686         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
3687         previous usage did only work for our methods.
3688         (Expression::ConvertImplicit): Handle decimal implicit numeric
3689         conversions as well.
3690         (Expression::InternalTypeConstructor): Used to invoke constructors
3691         on internal types for default promotions.
3692
3693         (Unary::Emit): Implement special handling for the pre/post
3694         increment/decrement for overloaded operators, as they need to have
3695         the same semantics as the other operators.
3696
3697         (Binary::ResolveOperator): ditto.
3698         (Invocation::ConversionExists): ditto.
3699         (UserImplicitCast::Resolve): ditto.
3700         
3701 2001-09-26  Ravi Pratap  <ravi@ximian.com>
3702
3703         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
3704         operator, return after emitting body. Regression tests pass again !
3705
3706         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
3707         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
3708         (Invocation::OverloadResolve): Ditto.
3709         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
3710
3711         * everywhere : update calls to the above methods accordingly.
3712
3713 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
3714
3715         * assign.cs (Assign): Make it inherit from ExpressionStatement.
3716
3717         * expression.cs (ExpressionStatement): New base class used for
3718         expressions that can appear in statements, so that we can provide
3719         an alternate path to generate expression that do not leave a value
3720         on the stack.
3721
3722         (Expression::Emit, and all the derivatives): We no longer return
3723         whether a value is left on the stack or not.  Every expression
3724         after being emitted leaves a single value on the stack.
3725
3726         * codegen.cs (EmitContext::EmitStatementExpression): Use the
3727         facilties of ExpressionStatement if possible.
3728
3729         * cs-parser.jay: Update statement_expression.
3730
3731 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
3732
3733         * driver.cs: Change the wording of message
3734
3735 2001-09-25  Ravi Pratap  <ravi@ximian.com>
3736
3737         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
3738         the type of the expression to the return type of the method if
3739         we have an overloaded operator match ! The regression tests pass again !
3740         (Unary::ResolveOperator): Ditto.
3741
3742         * expression.cs (Invocation::ConversionExists): Correct the member lookup
3743         to find "op_Implicit", not "implicit" ;-)
3744         (UserImplicitCast): New class to take care of user-defined implicit conversions.
3745         (ConvertImplicit, ForceConversion): Take TypeContainer argument
3746
3747         * everywhere : Correct calls to the above accordingly.
3748
3749         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
3750         (ConvertImplicit): Do user-defined conversion if it exists.
3751
3752 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
3753
3754         * assign.cs: track location.
3755         (Resolve): Use implicit conversions on assignment.
3756
3757         * literal.cs: Oops.  Not good, Emit of short access values should
3758         pass (Bytes) or the wrong argument will be selected.
3759
3760         * expression.cs (Unary::Emit): Emit code for -expr.
3761         
3762         (Unary::ResolveOperator): Handle `Substract' for non-constants
3763         (substract from zero from the non-constants).
3764         Deal with Doubles as well. 
3765         
3766         (Expression::ConvertImplicitRequired): New routine that reports an
3767         error if no implicit conversion exists. 
3768
3769         (Invocation::OverloadResolve): Store the converted implicit
3770         expressions if we make them
3771         
3772 2001-09-24  Ravi Pratap  <ravi@ximian.com>
3773
3774         * class.cs (ConstructorInitializer): Take a Location argument.
3775         (ConstructorBaseInitializer): Same here.
3776         (ConstructorThisInitializer): Same here.
3777
3778         * cs-parser.jay : Update all calls accordingly.
3779
3780         * expression.cs (Unary, Binary, New): Take location argument.
3781         Update accordingly everywhere.
3782
3783         * cs-parser.jay : Update all calls to the above to take a location
3784         argument.
3785
3786         * class.cs : Ditto.
3787
3788 2001-09-24  Ravi Pratap  <ravi@ximian.com>
3789
3790         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
3791         (Invocation::BetterConversion): Same here
3792         (Invocation::ConversionExists): Ditto.
3793
3794         (Invocation::ConversionExists): Implement.
3795
3796 2001-09-22  Ravi Pratap  <ravi@ximian.com>
3797
3798         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
3799         Also take an additional TypeContainer argument.
3800
3801         * All over : Pass in TypeContainer as argument to OverloadResolve.
3802
3803         * typemanager.cs (CSharpName): Update to check for the string type and return
3804         that too.
3805
3806         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
3807         a given method.
3808         
3809 2001-09-21  Ravi Pratap  <ravi@ximian.com>
3810
3811         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
3812         (Invocation::BetterFunction): Implement.
3813         (Invocation::BetterConversion): Implement.
3814         (Invocation::ConversionExists): Skeleton, no implementation yet.
3815
3816         Okay, things work fine !
3817
3818 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
3819
3820         * typemanager.cs: declare and load enum_type, delegate_type and
3821         void_type. 
3822
3823         * expression.cs (Expression::Emit): Now emit returns a value that
3824         tells whether a value is left on the stack or not.  This strategy
3825         might be reveted tomorrow with a mechanism that would address
3826         multiple assignments.
3827         (Expression::report118): Utility routine to report mismatches on
3828         the ExprClass.
3829
3830         (Unary::Report23): Report impossible type/operator combination
3831         utility function.
3832
3833         (Unary::IsIncrementableNumber): Whether the type can be
3834         incremented or decremented with add.
3835         (Unary::ResolveOperator): Also allow enumerations to be bitwise
3836         complemented. 
3837         (Unary::ResolveOperator): Implement ++, !, ~, ++ and --.
3838
3839         (Invocation::Emit): Deal with new Emit convetion.
3840         
3841         * All Expression derivatives: Updated their Emit method to return
3842         whether they leave values on the stack or not.
3843         
3844         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
3845         stack for expressions that are statements. 
3846
3847 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
3848
3849         * expression.cs (LValue): New interface.  Must be implemented by
3850         LValue objects.
3851         (LocalVariableReference, ParameterReference, FieldExpr): Implement
3852         LValue interface.
3853         
3854         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
3855         interface for generating code, simplifies the code.
3856
3857 2001-09-20  Ravi Pratap  <ravi@ximian.com>
3858
3859         * expression.cs (everywhere): Comment out return statements in ::Resolve
3860         methods to avoid the warnings.
3861
3862 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
3863
3864         * driver.cs (parse): Report error 2001 if we can not open the
3865         source file.
3866
3867         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
3868         not resolve it.
3869
3870         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
3871         object. 
3872
3873         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
3874         otherwise nested blocks end up with the same index.
3875
3876         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
3877
3878         * expression.cs:  Instead of having FIXMEs in the Resolve
3879         functions, throw exceptions so it is obvious that we are facing a
3880         bug. 
3881
3882         * cs-parser.jay (invocation_expression): Pass Location information.
3883
3884         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
3885         Use a basename for those routines because .NET does not like paths
3886         on them. 
3887
3888         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
3889         already defined.
3890
3891 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
3892
3893         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
3894         are loading the correct data types (throws an exception if not).
3895         (TypeManager::InitCoreTypes): Use CoreLookupType
3896
3897         * expression.cs (Unary::ResolveOperator): return the child
3898         expression for expressions which are just +expr.
3899         (Unary::ResolveOperator): Return negative literals for -LITERAL
3900         expressions (otherwise they are Unary {Literal}).
3901         (Invocation::Badness): Take into account `Implicit constant
3902         expression conversions'.
3903
3904         * literal.cs (LongLiteral): Implement long literal class.
3905         (IntLiteral): export the `Value' of the intliteral. 
3906
3907 2001-09-19  Ravi Pratap  <ravi@ximian.com>
3908
3909         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
3910
3911         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
3912         instead of 'Operator'
3913
3914         * expression.cs (Binary::ResolveOperator): Update accordingly.
3915         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
3916         and 'Minus'
3917
3918         * cs-parser.jay (unary_expression): Update to use the new names.
3919
3920         * gen-treedump.cs (GetUnary): Same here.
3921
3922         * expression.cs (Unary::Resolve): Implement.
3923         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
3924         operators are found instead of making noise ;-)
3925         (Unary::ResolveOperator): New method to do precisely the same thing which
3926         Binary::ResolveOperator does for Binary expressions.
3927         (Unary.method, .Arguments): Add.
3928         (Unary::OperName): Implement.   
3929         (Unary::ForceConversion): Copy and Paste !
3930
3931         * class.cs (Operator::Define): Fix a small bug for the case when we have 
3932         a unary operator.
3933
3934         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
3935         for the inbuilt operators. Only overloading works for now ;-)
3936
3937 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
3938
3939         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
3940         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
3941
3942         * expression.cs (This::Emit): Implement. 
3943         (This::Resolve): Implement.
3944         (TypeOf:Resolve): Implement.
3945         (Expression::ResolveSimpleName): Add an implicit this to instance
3946         field references. 
3947         (MemberAccess::Resolve): Deal with Parameters and Fields. 
3948         Bind instance variable to Field expressions.
3949         (FieldExpr::Instance): New field used to track the expression that
3950         represents the object instance.
3951         (FieldExpr::Resolve): Track potential errors from MemberLookup not
3952         binding 
3953         (FieldExpr::Emit): Implement.
3954
3955         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
3956         the last instruction contains a return opcode to avoid generating
3957         the last `ret' instruction (this generates correct code, and it is
3958         nice to pass the peverify output).
3959
3960         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
3961         initializer for static and instance variables.
3962         (Constructor::Emit): Allow initializer to be null in the case of
3963         static constructors.  Only emit initializer for instance
3964         constructors. 
3965
3966         (TypeContainer::FindMembers): Return a null array if there are no
3967         matches.
3968
3969         Also fix the code for the MemberTypes.Method branch, as it was not
3970         scanning that for operators (or tried to access null variables before).
3971
3972         * assign.cs (Assign::Emit): Handle instance and static fields. 
3973
3974         * TODO: Updated.
3975
3976         * driver.cs: Stop compilation if there are parse errors.
3977
3978         * cs-parser.jay (constructor_declaration): Provide default base
3979         initializer for non-static constructors.
3980         (constructor_declarator): Do not provide a default base
3981         initializers if none was specified.
3982         Catch the fact that constructors should not have parameters.
3983
3984         * class.cs: Do not emit parent class initializers for static
3985         constructors, that should be flagged as an error.
3986
3987 2001-09-18  Ravi Pratap  <ravi@ximian.com>
3988
3989         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
3990         Move back code into TypeContainer::Populate.
3991
3992 2001-09-18  Ravi Pratap  <ravi@ximian.com>
3993
3994         * class.cs (TypeContainer::AddConstructor): Fix the check to
3995         compare against Name, not Basename. 
3996         (Operator::OpType): Change Plus and Minus to Add and Subtract.
3997
3998         * cs-parser.jay : Update accordingly.
3999
4000         * class.cs (TypeContainer::FindMembers): For the case where we are searching
4001         for methods, don't forget to look into the operators too.
4002         (RegisterMethodBuilder): Helper method to take care of this for
4003         methods, constructors and operators.
4004         (Operator::Define): Completely revamp.
4005         (Operator.OperatorMethod, MethodName): New fields.
4006         (TypeContainer::Populate): Move the registering of builders into
4007         RegisterMethodBuilder.
4008         (Operator::Emit): Re-write.
4009
4010         * expression.cs (Binary::Emit): Comment out code path to emit method
4011         invocation stuff for the case when we have a user defined operator. I am
4012         just not able to get it right !
4013         
4014 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
4015
4016         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
4017         argument. 
4018
4019         (Expression::MemberLookup): Provide a version that allows to
4020         specify the MemberTypes and BindingFlags. 
4021
4022         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
4023         so it was not fetching variable information from outer blocks.
4024
4025         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
4026         Beforefieldinit as it was buggy.
4027
4028         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
4029         that Ravi put here.  
4030
4031         * class.cs (Constructor::Emit): Only emit if block is not null.
4032         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
4033         deal with this by semantically definining it as if the user had
4034         done it.
4035
4036         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
4037         constructors as we now "emit" them at a higher level.
4038
4039         (TypeContainer::DefineDefaultConstructor): Used to define the
4040         default constructors if none was provided.
4041
4042         (ConstructorInitializer): Add methods Resolve and Emit. 
4043         
4044         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
4045
4046 2001-09-17  Ravi Pratap  <ravi@ximian.com>
4047
4048         * class.cs (TypeContainer::EmitDefaultConstructor): Register
4049         the default constructor builder with our hashtable for methodbuilders
4050         to methodcores.
4051
4052         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
4053         and argument_count is 0 in which case we have a match.
4054         (Binary::ResolveOperator): More null checking and miscellaneous coding
4055         style cleanup.
4056
4057 2001-09-17  Ravi Pratap  <ravi@ximian.com>
4058
4059         * rootcontext.cs (IsNameSpace): Compare against null.
4060
4061         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
4062
4063         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
4064         and Unary::Operator.
4065
4066         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
4067         accordingly.
4068
4069         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
4070         we have overloaded operators.
4071         (Binary::ResolveOperator): Implement the part which does the operator overload
4072         resolution.
4073
4074         * class.cs (Operator::Emit): Implement.
4075         (TypeContainer::Emit): Emit the operators we have too.
4076
4077         * expression.cs (Binary::Emit): Update to emit the appropriate code for
4078         the case when we have a user-defined operator.
4079         
4080 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
4081
4082         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
4083
4084 2001-09-16  Ravi Pratap  <ravi@ximian.com>
4085
4086         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
4087         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
4088         (Constructor::Emit): Implement.
4089         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
4090         if we have no work to do. 
4091         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
4092         Emit method.
4093
4094         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
4095         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
4096
4097         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
4098         of parent.parent.
4099
4100 2001-09-15  Ravi Pratap  <ravi@ximian.com>
4101
4102         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
4103         in the source.
4104         (Tree::RecordNamespace): Method to do what the name says ;-)
4105         (Tree::Namespaces): Property to get at the namespaces hashtable.
4106
4107         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
4108         keep track.
4109
4110         * rootcontext.cs (IsNamespace): Fixed it :-)
4111
4112 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
4113
4114         * class.cs (TypeContainer::FindMembers): Add support for
4115         constructors. 
4116         (MethodCore): New class that encapsulates both the shared aspects
4117         of a Constructor and a Method.  
4118         (Method, Constructor): Factored pieces into MethodCore.
4119
4120         * driver.cs: Added --fatal which makes errors throw exceptions.
4121         Load System assembly as well as part of the standard library.
4122
4123         * report.cs: Allow throwing exceptions on errors for debugging.
4124
4125         * modifiers.cs: Do not use `parent', instead use the real type
4126         container to evaluate permission settings.
4127
4128         * class.cs: Put Ravi's patch back in.  He is right, and we will
4129         have to cope with the
4130
4131 2001-09-14  Ravi Pratap  <ravi@ximian.com>
4132
4133         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
4134         FamORAssem, not FamANDAssem.
4135         
4136 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
4137
4138         * driver.cs: Added --parse option that only parses its input files
4139         and terminates.
4140
4141         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
4142         incorrect.  IsTopLevel is not used to tell whether an object is
4143         root_types or not (that can be achieved by testing this ==
4144         root_types).  But to see if this is a top-level *class* (not
4145         necessarly our "toplevel" container). 
4146
4147 2001-09-14  Ravi Pratap  <ravi@ximian.com>
4148
4149         * enum.cs (Enum::Define): Modify to call the Lookup method on the
4150         parent instead of a direct call to GetType.
4151
4152 2001-09-14  Ravi Pratap  <ravi@ximian.com>
4153
4154         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
4155         Modifiers.TypeAttr. This should just be a call to that method.
4156
4157         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
4158         object so that we can determine if we are top-level or not.
4159
4160         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
4161         TypeContainer too.
4162
4163         * enum.cs (Enum::Define): Ditto.
4164
4165         * modifiers.cs (FieldAttr): Re-write.
4166
4167         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
4168         (TypeContainer::HaveStaticConstructor): New property to provide access
4169         to precisely that info.
4170
4171         * modifiers.cs (MethodAttr): Re-write.
4172         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
4173
4174         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
4175         of top-level types as claimed.
4176         
4177 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
4178
4179         * expression.cs (MemberLookup): Fruitless attempt to lookup
4180         constructors.  Maybe I need to emit default constructors?  That
4181         might be it (currently .NET emits this for me automatically).
4182         (Invocation::OverloadResolve): Cope with Arguments == null.
4183         (Invocation::EmitArguments): new function, shared by the new
4184         constructor and us.
4185         (Invocation::Emit): Handle static and instance methods.  Emit
4186         proper call instruction for virtual or non-virtual invocations.
4187         (New::Emit): Implement.
4188         (New::Resolve): Implement.
4189         (MemberAccess:Resolve): Implement.
4190         (MethodGroupExpr::InstanceExpression): used conforming to the spec
4191         to track instances.
4192         (FieldExpr::Resolve): Set type.
4193
4194         * support.cs: Handle empty arguments.
4195                 
4196         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
4197         SimpleLookup): Auxiliary routines to help parse a qualifier
4198         identifier.  
4199
4200         Update qualifier_identifier rule.
4201
4202         * codegen.cs: Removed debugging messages.
4203
4204         * class.cs: Make this a global thing, this acts just as a "key" to
4205         objects that we might have around.
4206
4207         (Populate): Only initialize method_builders_to_methods once.
4208
4209         * expression.cs (PropertyExpr): Initialize type from the
4210         PropertyType. 
4211
4212         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
4213         Resolve pattern.  Attempt to implicitly convert value to boolean.
4214         Emit code.
4215
4216         * expression.cs: Set the type for the int32/int32 argument case.
4217         (Binary::ResolveOperator): Set the return type to boolean for
4218         comparission operators
4219
4220         * typemanager.cs: Remove debugging print code.
4221
4222         (Invocation::Resolve): resolve type.
4223
4224         * class.cs: Allocate a MemberInfo of the correct size, as the code
4225         elsewhere depends on the test to reflect the correct contents.
4226
4227         (Method::) Keep track of parameters, due to System.Reflection holes
4228
4229         (TypeContainer::Populate): Keep track of MethodBuilders to Method
4230         mapping here.
4231
4232         (TypeContainer::FindMembers): Use ArrayList and then copy an array
4233         of the exact size and return that.
4234
4235         (Class::LookupMethodByBuilder): New function that maps
4236         MethodBuilders to its methods.  Required to locate the information
4237         on methods because System.Reflection bit us again.
4238
4239         * support.cs: New file, contains an interface ParameterData and
4240         two implementations: ReflectionParameters and InternalParameters
4241         used to access Parameter information.  We will need to grow this
4242         as required.
4243
4244         * expression.cs (Invocation::GetParameterData): implement a cache
4245         and a wrapper around the ParameterData creation for methods. 
4246         (Invocation::OverloadResolve): Use new code.
4247
4248 2001-09-13  Ravi Pratap  <ravi@ximian.com>
4249
4250         * class.cs (TypeContainer::EmitField): Remove and move into 
4251         (Field::Define): here and modify accordingly.
4252         (Field.FieldBuilder): New member.
4253         (TypeContainer::Populate): Update accordingly.
4254         (TypeContainer::FindMembers): Implement.
4255
4256 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
4257
4258         * statement.cs: (VariableInfo::VariableType): New field to be
4259         initialized with the full type once it is resolved. 
4260
4261 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
4262
4263         * parameter.cs (GetParameterInfo): Use a type cache to compute
4264         things only once, and to reuse this information
4265
4266         * expression.cs (LocalVariableReference::Emit): Implement.
4267         (OpcodeCast::Emit): fix.
4268
4269         (ParameterReference::Resolve): Implement.
4270         (ParameterReference::Emit): Implement.
4271
4272         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
4273         that are expressions need to stay as Expressions.
4274
4275         * typemanager.cs (CSharpName): Returns the C# name of a type if
4276         possible. 
4277
4278         * expression.cs (Expression::ConvertImplicit): New function that
4279         implements implicit type conversions.
4280
4281         (Expression::ImplicitReferenceConversion): Implements implicit
4282         reference conversions.
4283
4284         (EmptyCast): New type for transparent casts.
4285
4286         (OpcodeCast): New type for casts of types that are performed with
4287         a sequence of bytecodes.
4288         
4289         (BoxedCast): New type used for casting value types into reference
4290         types.  Emits a box opcode.
4291
4292         (Binary::DoNumericPromotions): Implements numeric promotions of
4293         and computation of the Binary::Type.
4294
4295         (Binary::EmitBranchable): Optimization.
4296
4297         (Binary::Emit): Implement code emission for expressions.
4298         
4299         * typemanager.cs (TypeManager): Added two new core types: sbyte
4300         and byte.
4301
4302 2001-09-12  Ravi Pratap  <ravi@ximian.com>
4303
4304         * class.cs (TypeContainer::FindMembers): Method which does exactly
4305         what Type.FindMembers does, only we don't have to use reflection. No
4306         implementation yet.
4307
4308         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
4309         typecontainer objects as we need to get at them.
4310         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
4311
4312         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
4313         typecontainer object.
4314
4315         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
4316         of just a Report object.
4317
4318 2001-09-11  Ravi Pratap  <ravi@ximian.com>
4319
4320         * class.cs (Event::Define): Go back to using the prefixes "add_" and
4321         "remove_"
4322         (TypeContainer::Populate): Now define the delegates of the type too.
4323         (TypeContainer.Delegates): Property to access the list of delegates defined
4324         in the type.
4325
4326         * delegates.cs (Delegate::Define): Implement partially.
4327
4328         * modifiers.cs (TypeAttr): Handle more flags.
4329
4330 2001-09-11  Ravi Pratap  <ravi@ximian.com>
4331
4332         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
4333         and not <=
4334         (Operator::Define): Re-write logic to get types by using the LookupType method
4335         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
4336         (Indexer::Define): Ditto.
4337         (Event::Define): Ditto.
4338         (Property::Define): Ditto.
4339         
4340 2001-09-10  Ravi Pratap  <ravi@ximian.com>
4341
4342         * class.cs (TypeContainer::Populate): Now define operators too. 
4343         (TypeContainer.Operators): New property to access the list of operators
4344         in a type.
4345         (Operator.OperatorMethodBuilder): New member to hold the method builder
4346         for the operator we are defining.
4347         (Operator::Define): Implement.
4348
4349 2001-09-10  Ravi Pratap  <ravi@ximian.com>
4350
4351         * class.cs (Event::Define): Make the prefixes of the accessor methods
4352         addOn_ and removeOn_ 
4353
4354         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
4355         of the location being passed in too. Ideally, this should go later since all
4356         error reporting should be done through the Report object.
4357
4358         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
4359         (Populate): Iterate thru the indexers we have and define them too.
4360         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
4361         for the get and set accessors.
4362         (Indexer::Define): Implement.
4363         
4364 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
4365
4366         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
4367         my previous implementation, did not work.
4368
4369         * typemanager.cs: Add a couple of missing types (the longs).
4370
4371         * literal.cs: Use TypeManager.bool_type instead of getting it.
4372
4373         * expression.cs (EventExpr): New kind of expressions.
4374         (Expressio::ExprClassFromMemberInfo): finish
4375
4376 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
4377
4378         * assign.cs: Emit stores to static fields differently.
4379
4380 2001-09-08  Ravi Pratap  <ravi@ximian.com>
4381
4382         * Merge in changes and adjust code to tackle conflicts. Backed out my
4383         code in Assign::Resolve ;-) 
4384
4385 2001-09-08  Ravi Pratap  <ravi@ximian.com>
4386
4387         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
4388         instead Report.Error and also pass in the location.
4389         (CSharpParser::Lexer): New readonly property to return the reference
4390         to the Tokenizer object.
4391         (declare_local_variables): Use Report.Error with location instead of plain 
4392         old error.
4393         (CheckDef): Ditto.
4394
4395         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
4396         (Operator.CheckBinaryOperator): Ditto.
4397
4398         * cs-parser.jay (operator_declarator): Update accordingly.
4399
4400         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
4401         (CheckBinaryOperator): Same here.
4402
4403         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
4404         on the name without any prefixes of namespace names etc. This is because we
4405         already might have something already fully qualified like 
4406         'System.Console.WriteLine'
4407
4408         * assign.cs (Resolve): Begin implementation. Stuck ;-)
4409
4410 2001-09-07  Ravi Pratap  <ravi@ximian.com>
4411
4412         * cs-tokenizer.cs (location): Return a string which also contains
4413         the file name.
4414
4415         * expression.cs (ElementAccess): New class for expressions of the
4416         type 'element access.'
4417         (BaseAccess): New class for expressions of the type 'base access.'
4418         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
4419         respectively.
4420         
4421         * cs-parser.jay (element_access): Implement action.
4422         (base_access): Implement actions.
4423         (checked_expression, unchecked_expression): Implement.
4424
4425         * cs-parser.jay (local_variable_type): Correct and implement.
4426         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
4427
4428         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
4429
4430         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
4431         name and the specifiers.
4432
4433         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
4434         
4435         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
4436         making them all public ;-)
4437
4438         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
4439         class anyways.
4440         
4441 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
4442
4443         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
4444         PropertyExprs.
4445         (FieldExpr, PropertyExprs): New resolved expressions.
4446         (SimpleName::MemberStaticCheck): Perform static checks for access
4447         to non-static fields on static methods. Maybe this should be
4448         generalized for MemberAccesses. 
4449         (SimpleName::ResolveSimpleName): More work on simple name
4450         resolution. 
4451
4452         * cs-parser.jay (primary_expression/qualified_identifier): track
4453         the parameter index.
4454
4455         * codegen.cs (CodeGen::Save): Catch save exception, report error.
4456         (EmitContext::EmitBoolExpression): Chain to expression generation
4457         instead of temporary hack.
4458         (::EmitStatementExpression): Put generic expression code generation.
4459
4460         * assign.cs (Assign::Emit): Implement variable assignments to
4461         local variables, parameters and fields.
4462
4463 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
4464
4465         * statement.cs (Block::GetVariableInfo): New method, returns the
4466         VariableInfo for a variable name in a block.
4467         (Block::GetVariableType): Implement in terms of GetVariableInfo
4468
4469         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
4470         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
4471
4472 2001-09-06  Ravi Pratap  <ravi@ximian.com>
4473
4474         * cs-parser.jay (operator_declaration): Continue on my quest : update
4475         to take attributes argument.
4476         (event_declaration): Ditto.
4477         (enum_declaration): Ditto.
4478         (indexer_declaration): Ditto.
4479         
4480         * class.cs (Operator::Operator): Update constructor accordingly.
4481         (Event::Event): Ditto.
4482
4483         * delegate.cs (Delegate::Delegate): Same here.
4484
4485         * enum.cs (Enum::Enum): Same here.
4486         
4487 2001-09-05  Ravi Pratap  <ravi@ximian.com>
4488
4489         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
4490
4491         * ../tests/cs0658.cs : New file to demonstrate error 0658.
4492
4493         * attribute.cs (Attributes): New class to encapsulate all attributes which were
4494         being passed around as an arraylist.
4495         (Attributes::AddAttribute): Method to add attribute sections.
4496
4497         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
4498         (struct_declaration): Update accordingly.
4499         (constant_declaration): Update.
4500         (field_declaration): Update.
4501         (method_header): Update.
4502         (fixed_parameter): Update.
4503         (parameter_array): Ditto.
4504         (property_declaration): Ditto.
4505         (destructor_declaration): Ditto.
4506         
4507         * class.cs (Struct::Struct): Update constructors accordingly.
4508         (Class::Class): Ditto.
4509         (Field::Field): Ditto.
4510         (Method::Method): Ditto.
4511         (Property::Property): Ditto.
4512         (TypeContainer::OptAttribute): update property's return type.
4513         
4514         * interface.cs (Interface.opt_attributes): New member.
4515         (Interface::Interface): Update to take the extra Attributes argument.
4516
4517         * parameter.cs (Parameter::Parameter): Ditto.
4518
4519         * constant.cs (Constant::Constant): Ditto.
4520
4521         * interface.cs (InterfaceMemberBase): New OptAttributes field.
4522         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
4523         the attributes as a parameter.
4524         (InterfaceProperty): Update constructor call.
4525         (InterfaceEvent): Ditto.
4526         (InterfaceMethod): Ditto.
4527         (InterfaceIndexer): Ditto.
4528
4529         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
4530         pass the attributes too.
4531         (interface_event_declaration): Ditto.
4532         (interface_property_declaration): Ditto.
4533         (interface_method_declaration): Ditto.
4534         (interface_declaration): Ditto.
4535
4536 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
4537
4538         * class.cs (Method::Define): Track the "static Main" definition to
4539         create an entry point. 
4540
4541         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
4542         EntryPoint if we find it. 
4543
4544         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
4545         (EmitContext::ig): Make this variable public.
4546
4547         * driver.cs: Make the default output file be the first file name
4548         with the .exe extension.  
4549
4550         Detect empty compilations
4551
4552         Handle various kinds of output targets.  Handle --target and
4553         rename -t to --dumper.
4554
4555         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
4556         methods inherited from Expression return now an Expression.  This
4557         will is used during the tree rewriting as we resolve them during
4558         semantic analysis.
4559
4560         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
4561         the spec.  Missing entirely is the information about
4562         accessability of elements of it.
4563
4564         (Expression::ExprClassFromMemberInfo): New constructor for
4565         Expressions that creates a fully initialized Expression based on
4566         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
4567         a Type.
4568
4569         (Invocation::Resolve): Begin implementing resolution of invocations.
4570         
4571         * literal.cs (StringLiteral):  Implement Emit.
4572
4573 2001-09-05  Ravi Pratap  <ravi@ximian.com>
4574
4575         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
4576         member.
4577         
4578 2001-09-04  Ravi Pratap  <ravi@ximian.com>
4579
4580         * cs-parser.jay (attribute_arguments): Implement actions.
4581         (attribute): Fix bug in production. Implement action.
4582         (attribute_list): Implement.
4583         (attribute_target): Implement.
4584         (attribute_target_specifier, opt_target_specifier): Implement
4585         (CheckAttributeTarget): New method to check if the attribute target
4586         is valid.
4587         (attribute_section): Implement.
4588         (opt_attributes): Implement.
4589
4590         * attribute.cs : New file to handle attributes.
4591         (Attribute): Class to hold attribute info.
4592
4593         * cs-parser.jay (opt_attribute_target_specifier): Remove production
4594         (attribute_section): Modify production to use 2 different rules to 
4595         achieve the same thing. 1 s/r conflict down !
4596         Clean out commented, useless, non-reducing dimension_separator rules.
4597         
4598         * class.cs (TypeContainer.attributes): New member to hold list
4599         of attributes for a type.
4600         (Struct::Struct): Modify to take one more argument, the attribute list.
4601         (Class::Class): Ditto.
4602         (Field::Field): Ditto.
4603         (Method::Method): Ditto.
4604         (Property::Property): Ditto.
4605         
4606         * cs-parser.jay (struct_declaration): Update constructor call to
4607         pass in the attributes too.
4608         (class_declaration): Ditto.
4609         (constant_declaration): Ditto.
4610         (field_declaration): Ditto.
4611         (method_header): Ditto.
4612         (fixed_parameter): Ditto.
4613         (parameter_array): Ditto.
4614         (property_declaration): Ditto.
4615
4616         * constant.cs (Constant::Constant): Update constructor similarly.
4617         Use System.Collections.
4618
4619         * parameter.cs (Parameter::Parameter): Update as above.
4620
4621 2001-09-02  Ravi Pratap  <ravi@ximian.com>
4622
4623         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
4624         (TypeContainer.delegates): New member to hold list of delegates.
4625
4626         * cs-parser.jay (delegate_declaration): Implement the action correctly 
4627         this time as I seem to be on crack ;-)
4628
4629 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
4630
4631         * rootcontext.cs (RootContext::IsNamespace): new function, used to
4632         tell whether an identifier represents a namespace.
4633
4634         * expression.cs (NamespaceExpr): A namespace expression, used only
4635         temporarly during expression resolution.
4636         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
4637         utility functions to resolve names on expressions.
4638
4639 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
4640
4641         * codegen.cs: Add hook for StatementExpressions. 
4642
4643         * class.cs: Fix inverted test for static flag in methods.
4644
4645 2001-09-02  Ravi Pratap  <ravi@ximian.com>
4646
4647         * class.cs (Operator::CheckUnaryOperator): Correct error number used
4648         to make it coincide with MS' number.
4649         (Operator::CheckBinaryOperator): Ditto.
4650
4651         * ../errors/errors.txt : Remove error numbers added earlier.
4652
4653         * ../errors/cs1019.cs : Test case for error # 1019
4654
4655         * ../errros/cs1020.cs : Test case for error # 1020
4656
4657         * cs-parser.jay : Clean out commented cruft.
4658         (dimension_separators, dimension_separator): Comment out. Ostensibly not
4659         used anywhere - non-reducing rule.
4660         (namespace_declarations): Non-reducing rule - comment out.
4661
4662         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
4663         with TypeContainer::AddEnum.
4664
4665         * delegate.cs : New file for delegate handling classes.
4666         (Delegate): Class for declaring delegates.
4667
4668         * makefile : Update.
4669
4670         * cs-parser.jay (delegate_declaration): Implement.
4671
4672 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
4673
4674         * class.cs (Event::Define): Implement.
4675         (Event.EventBuilder): New member.
4676
4677         * class.cs (TypeContainer::Populate): Update to define all enums and events
4678         we have.
4679         (Events): New property for the events arraylist we hold. Shouldn't we move to using
4680         readonly fields for all these cases ?
4681
4682 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
4683
4684         * class.cs (Property): Revamp to use the convention of making fields readonly.
4685         Accordingly modify code elsewhere.
4686
4687         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
4688         the Define method of the Property class.
4689
4690         * class.cs : Clean up applied patch and update references to variables etc. Fix 
4691         trivial bug.
4692         (TypeContainer::Populate): Update to define all the properties we have. Also
4693         define all enumerations.
4694
4695         * enum.cs (Define): Implement.
4696         
4697 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
4698
4699         * cs-parser.jay (overloadable_operator): The semantic value is an
4700         enum of the Operator class.
4701         (operator_declarator): Implement actions.
4702         (operator_declaration): Implement.
4703
4704         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
4705         validity of definitions.
4706         (Operator::CheckBinaryOperator): Static method to check for binary operators
4707         (TypeContainer::AddOperator): New method to add an operator to a type.
4708
4709         * cs-parser.jay (indexer_declaration): Added line to actually call the
4710         AddIndexer method so it gets added ;-)
4711
4712         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
4713         already taken care of by the MS compiler ?  
4714
4715 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
4716
4717         * class.cs (Operator): New class for operator declarations.
4718         (Operator::OpType): Enum for the various operators.
4719
4720 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
4721
4722         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
4723         ostensibly handle this in semantic analysis.
4724
4725         * cs-parser.jay (general_catch_clause): Comment out
4726         (specific_catch_clauses, specific_catch_clause): Ditto.
4727         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
4728         (catch_args, opt_catch_args): New productions.
4729         (catch_clause): Rewrite to use the new productions above
4730         (catch_clauses): Modify accordingly.
4731         (opt_catch_clauses): New production to use in try_statement
4732         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
4733         and re-write the code in the actions to extract the specific and
4734         general catch clauses by being a little smart ;-)
4735
4736         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
4737         Hooray, try and catch statements parse fine !
4738         
4739 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
4740
4741         * statement.cs (Block::GetVariableType): Fix logic to extract the type
4742         string from the hashtable of variables.
4743
4744         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
4745         I end up making that mistake ;-)
4746         (catch_clauses): Fixed gross error which made Key and Value of the 
4747         DictionaryEntry the same : $1 !!
4748
4749 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
4750
4751         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
4752
4753         * cs-parser.jay (event_declaration): Correct to remove the semicolon
4754         when the add and remove accessors are specified. 
4755
4756 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
4757
4758         * cs-parser.jay (IndexerDeclaration): New helper class to hold
4759         information about indexer_declarator.
4760         (indexer_declarator): Implement actions.
4761         (parsing_indexer): New local boolean used to keep track of whether
4762         we are parsing indexers or properties. This is necessary because 
4763         implicit_parameters come into picture even for the get accessor in the 
4764         case of an indexer.
4765         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
4766
4767         * class.cs (Indexer): New class for indexer declarations.
4768         (TypeContainer::AddIndexer): New method to add an indexer to a type.
4769         (TypeContainer::indexers): New member to hold list of indexers for the
4770         type.
4771
4772 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
4773
4774         * cs-parser.jay (add_accessor_declaration): Implement action.
4775         (remove_accessor_declaration): Implement action.
4776         (event_accessors_declaration): Implement
4777         (variable_declarators): swap statements for first rule - trivial.
4778
4779         * class.cs (Event): New class to hold information about event
4780         declarations.
4781         (TypeContainer::AddEvent): New method to add an event to a type
4782         (TypeContainer::events): New member to hold list of events.
4783
4784         * cs-parser.jay (event_declaration): Implement actions.
4785
4786 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
4787
4788         * cs-parser.jay (dim_separators): Implement. Make it a string
4789         concatenating all the commas together, just as they appear.
4790         (opt_dim_separators): Modify accordingly
4791         (rank_specifiers): Update accordingly. Basically do the same
4792         thing - instead, collect the brackets here.
4793         (opt_rank_sepcifiers): Modify accordingly.
4794         (array_type): Modify to actually return the complete type string
4795         instead of ignoring the rank_specifiers.
4796         (expression_list): Implement to collect the expressions
4797         (variable_initializer): Implement. We make it a list of expressions
4798         essentially so that we can handle the array_initializer case neatly too.
4799         (variable_initializer_list): Implement.
4800         (array_initializer): Make it a list of variable_initializers
4801         (opt_array_initializer): Modify accordingly.
4802
4803         * expression.cs (New::NType): Add enumeration to help us
4804         keep track of whether we have an object/delegate creation
4805         or an array creation.
4806         (New:NewType, New::Rank, New::Indices, New::Initializers): New
4807         members to hold data about array creation.
4808         (New:New): Modify to update NewType
4809         (New:New): New Overloaded contructor for the array creation
4810         case.
4811
4812         * cs-parser.jay (array_creation_expression): Implement to call
4813         the overloaded New constructor.
4814         
4815 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
4816
4817         * class.cs (TypeContainer::Constructors): Return member
4818         constructors instead of returning null.
4819
4820 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
4821
4822         * typemanager.cs (InitCoreTypes): Initialize the various core
4823         types after we have populated the type manager with the user
4824         defined types (this distinction will be important later while
4825         compiling corlib.dll)
4826
4827         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
4828         on Expression Classification.  Now all expressions have a method
4829         `Resolve' and a method `Emit'.
4830
4831         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
4832         generation from working.     Also add some temporary debugging
4833         code. 
4834         
4835 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
4836
4837         * codegen.cs: Lots of code generation pieces.  This is only the
4838         beginning, will continue tomorrow with more touches of polish.  We
4839         handle the fundamentals of if, while, do, for, return.  Others are
4840         trickier and I need to start working on invocations soon.
4841         
4842         * gen-treedump.cs: Bug fix, use s.Increment here instead of
4843         s.InitStatement. 
4844
4845         * codegen.cs (EmitContext): New struct, used during code
4846         emission to keep a context.   Most of the code generation will be
4847         here. 
4848
4849         * cs-parser.jay: Add embedded blocks to the list of statements of
4850         this block.  So code generation proceeds in a top down fashion.
4851
4852 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
4853
4854         * statement.cs: Add support for multiple child blocks.
4855
4856 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
4857
4858         * codegen.cs (EmitCode): New function, will emit the code for a
4859         Block of code given a TypeContainer and its ILGenerator. 
4860
4861         * statement.cs (Block): Standard public readonly optimization.
4862         (Block::Block constructors): Link children. 
4863         (Block::Child): Child Linker.
4864         (Block::EmitVariables): Emits IL variable declarations.
4865
4866         * class.cs: Drop support for MethodGroups here, delay until
4867         Semantic Analysis.
4868         (Method::): Applied the same simplification that I did before, and
4869         move from Properties to public readonly fields.
4870         (Method::ParameterTypes): Returns the parameter types for the
4871         function, and implements a cache that will be useful later when I
4872         do error checking and the semantic analysis on the methods is
4873         performed.
4874         (Constructor::GetCallingConvention): Renamed from CallingConvetion
4875         and made a method, optional argument tells whether this is a class
4876         or a structure to apply the `has-this' bit.
4877         (Method::GetCallingConvention): Implement, returns the calling
4878         convention. 
4879         (Method::Define): Defines the type, a second pass is performed
4880         later to populate the methods.
4881
4882         (Constructor::ParameterTypes): implement a cache similar to the
4883         one on Method::ParameterTypes, useful later when we do semantic
4884         analysis. 
4885
4886         (TypeContainer::EmitMethod):  New method.  Emits methods.
4887
4888         * expression.cs: Removed MethodGroup class from here.
4889         
4890         * parameter.cs (Parameters::GetCallingConvention): new method.
4891
4892 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
4893
4894         * class.cs (TypeContainer::Populate): Drop RootContext from the
4895         argument. 
4896
4897         (Constructor::CallingConvention): Returns the calling convention.
4898         (Constructor::ParameterTypes): Returns the constructor parameter
4899         types. 
4900         
4901         (TypeContainer::AddConstructor): Keep track of default constructor
4902         and the default static constructor.
4903
4904         (Constructor::) Another class that starts using `public readonly'
4905         instead of properties. 
4906
4907         (Constructor::IsDefault): Whether this is a default constructor. 
4908
4909         (Field::) use readonly public fields instead of properties also.
4910
4911         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
4912         track of static constructors;  If none is used, turn on
4913         BeforeFieldInit in the TypeAttributes. 
4914
4915         * cs-parser.jay (opt_argument_list): now the return can be null
4916         for the cases where there are no arguments. 
4917
4918         (constructor_declarator): If there is no implicit `base' or
4919         `this', then invoke the default parent constructor. 
4920         
4921         * modifiers.cs (MethodAttr): New static function maps a set of
4922         modifiers flags into a MethodAttributes enum
4923         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
4924         MethodAttr, TypeAttr to represent the various mappings where the
4925         modifiers are used.
4926         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
4927
4928 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
4929
4930         * parameter.cs (GetParameterInfo): Fix bug where there would be no
4931         method arguments.
4932
4933         * interface.cs (PopulateIndexer): Implemented the code generator
4934         for interface indexers.
4935
4936 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
4937
4938         * interface.cs (InterfaceMemberBase): Now we track the new status
4939         here.  
4940
4941         (PopulateProperty): Implement property population.  Woohoo!  Got
4942         Methods and Properties going today. 
4943
4944         Removed all the properties for interfaces, and replaced them with
4945         `public readonly' fields. 
4946
4947 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
4948
4949         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
4950         initialize their hashtables/arraylists only when they are needed
4951         instead of doing this always.
4952
4953         * parameter.cs: Handle refs and out parameters.
4954
4955         * cs-parser.jay: Use an ArrayList to construct the arguments
4956         instead of the ParameterCollection, and then cast that to a
4957         Parameter[] array.
4958
4959         * parameter.cs: Drop the use of ParameterCollection and use
4960         instead arrays of Parameters.
4961
4962         (GetParameterInfo): Use the Type, not the Name when resolving
4963         types. 
4964
4965 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
4966
4967         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
4968         and instead use public readonly fields.
4969
4970         * class.cs: Put back walking code for type containers.
4971
4972 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
4973
4974         * class.cs (MakeConstant): Code to define constants.
4975
4976         * rootcontext.cs (LookupType): New function.  Used to locate types 
4977
4978         
4979 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
4980
4981         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
4982         this System.Reflection code is.  Kudos to Microsoft
4983         
4984         * typemanager.cs: Implement a type cache and avoid loading all
4985         types at boot time.  Wrap in LookupType the internals.  This made
4986         the compiler so much faster.  Wow.  I rule!
4987         
4988         * driver.cs: Make sure we always load mscorlib first (for
4989         debugging purposes, nothing really important).
4990
4991         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
4992         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
4993
4994         * rootcontext.cs: Lookup types on their namespace;  Lookup types
4995         on namespaces that have been imported using the `using' keyword.
4996
4997         * class.cs (TypeContainer::TypeAttr): Virtualize.
4998         (Class::TypeAttr): Return attributes suitable for this bad boy.
4999         (Struct::TypeAttr): ditto.
5000         Handle nested classes.
5001         (TypeContainer::) Remove all the type visiting code, it is now
5002         replaced with the rootcontext.cs code
5003
5004         * rootcontext.cs (GetClassBases): Added support for structs. 
5005
5006 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
5007
5008         * interface.cs, statement.cs, class.cs, parameter.cs,
5009         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
5010         Drop use of TypeRefs, and use strings instead.
5011
5012 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
5013
5014         * rootcontext.cs: 
5015
5016         * class.cs (Struct::Struct): set the SEALED flags after
5017         checking the modifiers.
5018         (TypeContainer::TypeAttr): new property, returns the
5019         TypeAttributes for a class.  
5020
5021         * cs-parser.jay (type_list): Oops, list production was creating a
5022         new list of base types.
5023
5024         * rootcontext.cs (StdLib): New property.
5025         (GetInterfaceTypeByName): returns an interface by type name, and
5026         encapsulates error handling here.
5027         (GetInterfaces): simplified.
5028         (ResolveTree): Encapsulated all the tree resolution here.
5029         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
5030         types. 
5031         
5032         * driver.cs: Add support for --nostdlib, to avoid loading the
5033         default assemblies.
5034         (Main): Do not put tree resolution here. 
5035
5036         * rootcontext.cs: Beginning of the class resolution.
5037
5038 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
5039
5040         * rootcontext.cs: Provide better error reporting. 
5041
5042         * cs-parser.jay (interface_base): set our $$ to be interfaces.
5043
5044         * rootcontext.cs (CreateInterface): Handle the case where there
5045         are no parent interfaces.
5046         
5047         (CloseTypes): Routine to flush types at the end.
5048         (CreateInterface): Track types.
5049         (GetInterfaces): Returns an array of Types from the list of
5050         defined interfaces.
5051
5052         * typemanager.c (AddUserType): Mechanism to track user types (puts
5053         the type on the global type hash, and allows us to close it at the
5054         end). 
5055         
5056 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
5057
5058         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
5059         RecordInterface instead.
5060
5061         * cs-parser.jay: Updated to reflect changes above.
5062
5063         * decl.cs (Definition): Keep track of the TypeBuilder type that
5064         represents this type here.  Not sure we will use it in the long
5065         run, but wont hurt for now.
5066
5067         * driver.cs: Smaller changes to accomodate the new code.
5068
5069         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
5070         when done. 
5071
5072         * rootcontext.cs (CreateInterface):  New method, used to create
5073         the System.TypeBuilder type for interfaces.
5074         (ResolveInterfaces): new entry point to resolve the interface
5075         hierarchy. 
5076         (CodeGen): Property, used to keep track of the code generator.
5077
5078 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
5079
5080         * cs-parser.jay: Add a second production for delegate_declaration
5081         with `VOID'.
5082
5083         (enum_body): Put an opt_comma here instead of putting it on
5084         enum_body or enum_member_declarations so we can handle trailing
5085         commas on enumeration members.  Gets rid of a shift/reduce.
5086         
5087         (type_list): Need a COMMA in the middle.
5088
5089         (indexer_declaration): Tell tokenizer to recognize get/set
5090
5091         * Remove old targets.
5092
5093         * Re-add the parser target.
5094
5095 2001-07-13  Simon Cozens <simon@simon-cozens.org>
5096
5097         * cs-parser.jay: Add precendence rules for a number of operators
5098         ot reduce the number of shift/reduce conflicts in the grammar.
5099         
5100 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
5101
5102         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
5103         and put it here.
5104
5105         Get rid of old crufty code.
5106
5107         * rootcontext.cs: Use this to keep track of the parsed
5108         representation and the defined types available to the program. 
5109
5110         * gen-treedump.cs: adjust for new convention.
5111
5112         * type.cs: Split out the type manager, and the assembly builder
5113         from here. 
5114
5115         * typemanager.cs: the type manager will live here now.
5116
5117         * cil-codegen.cs: And the code generator here. 
5118
5119 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
5120
5121         * makefile: Fixed up for easy making.
5122
5123 2001-07-13  Simon Cozens <simon@simon-cozens.org>
5124
5125         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
5126         the 
5127
5128         (unary_expression): Expand pre_increment_expression and
5129         post_decrement_expression to reduce a shift/reduce.
5130
5131 2001-07-11  Simon Cozens
5132
5133         * cs-tokenizer.cs: Hex numbers should begin with a 0.
5134
5135         Improve allow_keyword_as_indent name.
5136
5137 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
5138
5139         * Adjustments for Beta2. 
5140
5141 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
5142
5143         * decl.cs: Added `Define' abstract method.
5144         (InTransit): new property, used to catch recursive definitions. 
5145
5146         * interface.cs: Implement `Define'. 
5147
5148         * modifiers.cs: Map Modifiers.constants to
5149         System.Reflection.TypeAttribute flags.
5150
5151         * class.cs: Keep track of types and user-defined types.
5152         (BuilderInit): New method for creating an assembly
5153         (ResolveType): New function to launch the resolution process, only
5154         used by interfaces for now.
5155
5156         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
5157         that are inserted into the name space. 
5158
5159 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
5160
5161         * ARGH.  I have screwed up my tree so many times due to the use of
5162         rsync rather than using CVS.  Going to fix this at once. 
5163
5164         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
5165         load types.
5166
5167 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
5168
5169         * Experiment successful: Use System.Type rather that our own
5170         version of Type.  
5171
5172 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
5173
5174         * cs-parser.jay: Removed nsAliases from here.
5175
5176         Use new namespaces, handle `using XXX;' 
5177
5178         * namespace.cs: Reimplemented namespace handling, use a recursive
5179         definition of the class.  Now we can keep track of using clauses
5180         and catch invalid using clauses.
5181
5182 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
5183
5184         * gen-treedump.cs: Adapted for all the renaming.
5185
5186         * expression.cs (Expression): this class now has a Type property
5187         which returns an expression Type.
5188
5189         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
5190         `Type', as this has a different meaning now in the base
5191
5192 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
5193
5194         * interface.cs, class.cs: Removed from all the sources the
5195         references to signature computation, as we can not do method
5196         signature computation during the parsing time, as we are not
5197         trying to solve at that point distinguishing:
5198
5199         class X {
5200                 void a (Blah x) {}
5201                 void a (NS.Blah x) {}
5202         }
5203
5204         Which depending on the context might be valid or not, as we do not
5205         know if Blah is the same thing as NS.Blah at that point.
5206
5207         * Redid everything so the code uses TypeRefs now instead of
5208         Types.  TypeRefs are just temporary type placeholders, that need
5209         to be resolved.  They initially have a pointer to a string and the
5210         current scope in which they are used.  This is used later by the
5211         compiler to resolve the reference to an actual Type. 
5212
5213         * DeclSpace is no longer a CIR.Type, and neither are
5214         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
5215         are all DeclSpaces, but no Types. 
5216
5217         * type.cs (TypeRefManager): This implements the TypeRef manager,
5218         which keeps track of all the types that need to be resolved after
5219         the parsing has finished. 
5220
5221 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
5222
5223         * ARGH.  We are going to have to store `foreach' as a class rather
5224         than resolving it, as we need to verify error 1579 after name
5225         resolution.   *OR* we could keep a flag that says `This request to
5226         IEnumerator comes from a foreach statement' which we can then use
5227         to generate the error.
5228
5229 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
5230
5231         * class.cs (TypeContainer.AddMethod): we now add methods to the
5232         MethodGroup instead of the method hashtable.  
5233
5234         * expression.cs: Add MethodGroup abstraction, which gets us one
5235         step closer to the specification in the way we handle method
5236         declarations.  
5237
5238         * cs-parser.jay (primary_expression): qualified_identifier now
5239         tried to match up an identifier to a local variable reference or
5240         to a parameter reference.
5241
5242         current_local_parameters is now a parser global variable that
5243         points to the current parameters for the block, used during name
5244         lookup.
5245
5246         (property_declaration): Now creates an implicit `value' argument to
5247         the set accessor.
5248
5249 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
5250
5251         * parameter.cs: Do not use `param' arguments as part of the
5252         signature, per the spec.
5253
5254 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
5255
5256         * decl.cs: Base class for classes, structs and interfaces.  This
5257         is the "Declaration Space" 
5258
5259         * cs-parser.jay: Use CheckDef for checking declaration errors
5260         instead of having one on each function.
5261
5262         * class.cs: Factor out some code for handling error handling in
5263         accordance to the "Declarations" section in the "Basic Concepts"
5264         chapter in the ECMA C# spec.
5265
5266         * interface.cs: Make all interface member classes derive from
5267         InterfaceMemberBase.
5268
5269 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
5270
5271         * Many things: all interfaces are parsed and generated in
5272         gen-treedump.  Support for member variables, constructors,
5273         destructors, properties, constants is there.
5274
5275         Beginning of the IL backend, but very little done, just there for
5276         testing purposes. 
5277
5278 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
5279
5280         * cs-parser.jay: Fix labeled statement.
5281
5282         * cs-tokenizer.cs (escape): Escape " and ' always.
5283         ref_line, ref_name: keep track of the line/filename as instructed
5284         by #line by the compiler.
5285         Parse #line.
5286
5287 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
5288
5289         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
5290         to match the values in System.CodeDOM.
5291
5292         Divid renamed to Divide.
5293
5294         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
5295         statements. 
5296         (Statements.set): remove.
5297
5298         * System.CodeDOM/CodeCatchClause.cs: always have a valid
5299         statements. 
5300
5301         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
5302         falseStatements always have valid values. 
5303
5304         * cs-parser.jay: Use System.CodeDOM now.
5305