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