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