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