2002-06-21 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
1 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
2
3         * class.cs (Property.Define): Only define the property if we are
4         not explicitly implementing a property from an interface.  Use the
5         correct name also for those properties (the same CSC uses,
6         although that is really not needed).
7
8         (Property.Emit): Do not emit attributes for explicitly implemented
9         properties, as there is no TypeBuilder.
10
11         (Indexer.Emit): ditto.
12
13         Hiding then means that we do not really *implement* a pending
14         implementation, which makes code fail.
15
16 2002-06-22  Martin Baulig  <martin@gnome.org>
17
18         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
19         the return value of Object.GetType().  [FIXME: we need to do this whenever
20         we get a type back from the reflection library].
21
22 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
23
24         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
25
26 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
27
28         * attribute.cs: Return null if we can not look up the type.
29
30         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
31         the interface types found.
32
33         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
34         interface types found.
35
36         * typemanager.cs (GetInterfaces): Make this routine returns alll
37         the interfaces and work around the lame differences between
38         System.Type and System.Reflection.Emit.TypeBuilder in the results
39         result for GetInterfaces.
40         
41         (ExpandInterfaces): Given an array of interface types, expand and
42         eliminate repeated ocurrences of an interface.  This expands in
43         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
44         be IA, IB, IC.
45         
46 2002-06-21  Martin Baulig  <martin@gnome.org>
47
48         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
49         on System.Enum.
50
51 2002-06-21  Martin Baulig  <martin@gnome.org>
52
53         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
54         and called with one of the core types, return the corresponding typebuilder for
55         that type.
56
57         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
58         element type.
59
60 2002-06-21  Martin Baulig  <martin@gnome.org>
61
62         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
63         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
64         (Expression.ConvertReferenceExplicit): Likewise.
65
66         * expression.cs (ElementAccess.DoResolve): Likewise.
67         (ElementAccess.DoResolveLValue): Likewise.
68
69 2002-06-10  Martin Baulig  <martin@gnome.org>
70
71         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
72         add the "value" parameter to the parameter list.
73
74         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
75         to our caller.
76
77 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
78
79         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
80         the argument to an int, uint, long or ulong, per the spec.  Also
81         catch negative constants in array creation.
82
83 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
84
85         * class.cs: do not allow the same interface to appear twice in
86         the definition list.
87
88 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
89
90         * ecore.cs: don't use ldlen with System.Array.
91
92 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
93
94         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
95
96 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
97
98         * modifiers.cs: produce correct field attributes for protected
99         internal. Easy fix so miguel can work on ther harder stuff:-)
100
101 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
102
103         * pending.cs: New file.  Move the code from class.cs here.
104         Support clearning the pending flag for all methods (when not doing
105         explicit interface implementation).
106
107 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
108
109         * rootcontext.cs: added a couple more types needed to bootstrap.
110
111 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
112
113         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
114         constructor in the type, instead of any constructor in the type
115         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
116         a bug in the Mono runtime when applying the params attribute). 
117
118 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
119         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
120
121 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
122
123         * expression.cs (Unary.ResolveOperator): Use TypeManager
124         to resolve the type.
125         
126 2002-06-13  Ravi Pratap  <ravi@ximian.com>
127
128         * cs-parser.jay (enum_member_declaration): Pass in the attributes
129         attached.
130
131         * enum.cs (AddEnumMember): Add support to store the attributes associated 
132         with each member too.
133
134         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
135         field builders too - this takes care of the enum member case.
136
137 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
138
139         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
140         address-of operator on both value types and pointers.
141         
142 2002-06-10  Martin Baulig  <martin@gnome.org>
143
144         * interface.cs (Interface.PopulateIndexer): Add the indexer's
145         PropertyBuilder to the `property_builders' list.
146
147         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
148         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
149         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
150         find any indexers which are inherited from an interface.
151
152 2002-06-09  Martin Baulig  <martin@gnome.org>
153
154         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
155         the same type as the constant if necessary.  There's also a test-130.cs
156         for this.
157
158         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
159
160         * typemanager.cs (TypeManager.ChangeType): Previously known as
161         Enum.ChangeEnumType().
162
163 2002-06-09  Martin Baulig  <martin@gnome.org>
164
165         * expression.cs (Cast.TryReduce): Added support for consts.
166
167 2002-06-08  Ravi Pratap  <ravi@ximian.com>
168
169         * class.cs (Accessor): Hold attributes information so we can pass
170         it along.
171
172         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
173         Modify to pass in attributes attached to the methods.
174
175         (add_accessor_declaration, remove_accessor_declaration): Ditto.
176
177         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
178         to handle the Accessor kind :-)
179
180         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
181         
182 2002-06-08  Martin Baulig  <martin@gnome.org>
183
184         * expression.cs (Unary.TryReduceNegative): Added support for
185         ULongConstants.
186
187 2002-06-08  Martin Baulig  <martin@gnome.org>
188
189         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
190         name can't be found in the `defined_names' - the caller will do a
191         MemberLookup in this case and thus find methods in System.Enum
192         such as Enum.IsDefined().
193
194 2002-06-08  Martin Baulig  <martin@gnome.org>
195
196         * enum.cs (Enum.ChangeEnumType): This is a custom version of
197         Convert.ChangeType() which works with TypeBuilder created types.
198         (Enum.LookupEnumValue, Enum.Define): Use it here.
199
200         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
201         `TypeBuilder.BaseType != null' check.
202         (TypeContainer.FindMembers): Only lookup parent members if we
203         actually have a parent.
204         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
205         (ConstructorInitializer.Resolve): Likewise.
206
207         * interface.cs (Interface.FindMembers): Added
208         `TypeBuilder.BaseType != null' check.
209
210         * rootcontext.cs (RootContext.ResolveCore): Added
211         "System.Runtime.CompilerServices.IndexerNameAttribute" to
212         classes_second_stage.
213
214         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
215         debug_type and trace_type when compiling with --nostdlib.       
216
217 2002-06-07  Martin Baulig  <martin@gnome.org>
218
219         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
220         (AddField): Set it to true when adding a non-static field.
221         (DefineType): Use `have_nonstatic_fields' to find out whether we
222         have non-static fields, not `Fields != null'.
223
224 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
225
226         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
227         dereferencing a null on the static-field code path)
228
229 2002-05-30  Martin Baulig  <martin@gnome.org>
230
231         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
232         to take command line arguments.  Use reflection to call the new
233         custom `Initialize' function on the symbol writer and pass it the
234         command line arguments.
235
236         * driver.cs (--debug-args): New command line argument to pass command
237         line arguments to the symbol writer.
238
239 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
240
241         * assign.cs (DoResolve): Forgot to do the implicit conversion to
242         the target type for indexers and properties.  Thanks to Joe for
243         catching this.
244
245 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
246
247         * typemanager.cs (MethodFlags): returns the method flags
248         (Obsolete/ShouldIgnore) that control warning emission and whether
249         the invocation should be made, or ignored. 
250
251         * expression.cs (Invocation.Emit): Remove previous hack, we should
252         not do this on matching a base type, we should do this based on an attribute
253
254         Only emit calls to System.Diagnostics.Debug and
255         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
256         on the command line.
257
258         * rootcontext.cs: Global settings for tracing and debugging.
259
260         * cs-tokenizer.cs (define): New utility function to track
261         defines.   Set the global settings for TRACE and DEBUG if found.
262
263 2002-05-25  Ravi Pratap  <ravi@ximian.com>
264
265         * interface.cs (Populate*): Pass in the TypeContainer as well as
266         the DeclSpace as parameters so that we can create EmitContexts and
267         then use that to apply attributes etc.
268
269         (PopulateMethod, PopulateEvent, PopulateProperty)
270         (PopulateIndexer): Apply attributes everywhere.
271
272         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
273         etc.
274
275         (ApplyAttributes): Update accordingly.
276
277         We now apply interface attributes for all members too.
278
279 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
280
281         * class.cs (Indexer.Define); Correctly check if we are explicit
282         implementation (instead of checking the Name for a ".", we
283         directly look up if the InterfaceType was specified).
284
285         Delay the creation of the PropertyBuilder.
286
287         Only create the PropertyBuilder if we are not an explicit
288         interface implementation.   This means that explicit interface
289         implementation members do not participate in regular function
290         lookups, and hence fixes another major ambiguity problem in
291         overload resolution (that was the visible effect).
292
293         (DefineMethod): Return whether we are doing an interface
294         implementation. 
295         
296         * typemanager.cs: Temporary hack until we get attributes in
297         interfaces (Ravi is working on that) and we get IndexerName
298         support in interfaces.
299
300         * interface.cs: Register the indexers as properties.
301
302         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
303         warning, I have verified that this is a bug in the .NET runtime
304         (JavaScript suffers of the same problem).
305
306         * typemanager.cs (MemberLookup): When looking up members for
307         interfaces, the parent of an interface is the implicit
308         System.Object (so we succeed in searches of Object methods in an
309         interface method invocation.  Example:  IEnumerable x;  x.ToString
310         ()) 
311
312 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
313
314         * class.cs (Event): Events should also register if they do
315         implement the methods that an interface requires.
316
317         * typemanager.cs (MemberLookup); use the new GetInterfaces
318         method. 
319
320         (GetInterfaces): The code used to lookup interfaces for a type is
321         used in more than one place, factor it here. 
322
323         * driver.cs: Track the errors at the bottom of the file, we kept
324         on going.
325
326         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
327         instance if the method we are calling is static!
328
329 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
330
331         * attribute.cs (ApplyAttributes): Make this function filter out
332         the IndexerName attribute (as that attribute in reality is never
333         applied) and return the string constant for the IndexerName
334         attribute. 
335
336         * class.cs (TypeContainer.Emit): Validate that all the indexers
337         have the same IndexerName attribute, and if so, set the
338         DefaultName attribute on the class. 
339
340         * typemanager.cs: The return value might contain other stuff (not
341         only methods).  For instance, consider a method with an "Item"
342         property and an Item method.
343
344         * class.cs: If there is a problem with the parameter types,
345         return. 
346
347 2002-05-24  Ravi Pratap  <ravi@ximian.com>
348
349         * ecore.cs (ImplicitConversionExists): Wrapper function which also
350         looks at user defined conversion after making a call to 
351         StandardConversionExists - we need this for overload resolution.
352
353         * expression.cs : Update accordingly the various method calls.
354
355         This fixes 2 bugs filed against implicit user defined conversions 
356
357 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
358
359         * statement.cs: Track the result of the assignment.
360
361 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
362
363         * expression.cs (MemberAccess): Improved error reporting for
364         inaccessible members.
365
366 2002-05-22  Martin Baulig  <martin@gnome.org>
367
368         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
369         itself with debugging support.
370
371 2002-05-22  Martin Baulig  <martin@gnome.org>
372
373         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
374         Removed, this isn't needed anymore.
375
376 2002-05-20  Martin Baulig  <martin@gnome.org>
377
378         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
379         be underlying type for an enum.
380
381 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
382
383         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
384         that splits out the loading of just the core types.
385
386         * rootcontext.cs (ResolveCore): Split the struct resolution in
387         two, so we can load the enumeration underlying types before any
388         enums are used.
389
390         * expression.cs (Is): Bandaid until we fix properly Switch (see
391         bug #24985 for details).
392
393         * typemanager.cs (ImplementsInterface): The hashtable will contain
394         a null if there are no interfaces implemented.
395
396 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
397
398         * cs-parser.jay (indexer_declarator): It is fine to have array
399         parameters
400
401 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
402
403         * typemanager.cs: (RegisterBuilder): New function used to register
404         TypeBuilders that implement interfaces.  Since
405         TypeBuilder.GetInterfaces (as usual) does not work with lame
406         Reflection.Emit. 
407         (AddUserType): register interfaces.
408
409         (ImplementsInterface): Use the builder_to_ifaces hash if we are
410         dealing with TypeBuilder.  Also, arrays are showing up as
411         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
412         methods can not be invoked on them!
413
414         * ecore.cs (ExplicitReferenceConversionExists): Made public.
415         (ImplicitReferenceConversionExists): Split out from
416         StandardConversionExists. 
417
418         * expression.cs (As): We were only implementing one of the three
419         cases for the as operator.  We now implement them all.
420         (Is): Implement the various other cases for Is as well.
421
422         * typemanager.cs (CACHE): New define used to control if we want or
423         not the FindMembers cache.  Seems to have a negative impact on
424         performance currently
425
426         (MemberLookup): Nested types have full acess to
427         enclosing type members
428
429         Remove code that coped with instance/static returns for events, we
430         now catch this in RealFindMembers.
431
432         (RealFindMembers): only perform static lookup if the instance
433         lookup did not return a type or an event.  
434
435 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
436
437         * assign.cs (CompoundAssign): We pass more semantic information
438         now to Compound Assignments than we did before: now we have all
439         the information at hand, and now we resolve the target *before* we
440         do the expression expansion, which allows the "CacheValue" method
441         to have the effect we intended (before, a [x] += 1 would generate
442         two differen ArrayAccess expressions from the ElementAccess,
443         during the resolution process).
444
445         (CompoundAssign.DoResolve): Resolve target and original_source here.
446
447 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
448
449         * expression.cs (ArrayAccess): dropped debugging information. 
450
451         * typemanager.cs: Small bug fix: I was always returning i_members,
452         instead of one of i_members or s_members (depending on which had
453         the content).
454
455         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
456         method is invoked before any code generation takes place, and it
457         is a mechanism to inform that the expression will be invoked more
458         than once, and that the method should use temporary values to
459         avoid having side effects
460
461         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
462         
463         * ecore.cs (Expression.CacheTemporaries): Provide empty default
464         implementation.
465
466         * expression.cs (Indirection, ArrayAccess): Add support for
467         CacheTemporaries in these two bad boys. 
468
469         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
470         ldobj or ldind_ref.  
471         (StoreFromPtr): Handle stobj as well.
472
473         * expression.cs (UnaryMutator): Share more code.
474         
475         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
476         down: I was not tracking the Filter function as well, which
477         was affecting the results of the cache.
478
479 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
480
481         * attribute.cs: Remove the hack to handle the CharSet property on
482         StructLayouts. 
483
484 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
485
486         * attribute.cs (DoResolve): More uglyness, we now only try to
487         resolve the attribute partially, to extract the CharSet
488         information (only if we are a StructLayout attribute).  Otherwise 
489
490         (GetExtraTypeInfo): Add some code to conditionally kill in the
491         future this.   I am more and more convinced that the .NET
492         framework has special code to handle the attribute setting on
493         certain elements.
494
495         * expression.cs (IsParamsMethodApplicable): Revert my previous
496         foreach change here, it was wrong.
497
498 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
499
500         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
501         (pp_expr): do not abort on unknown input, just return.
502         (eval): abort if there are pending chars.
503
504         * attribute.cs (Attribute.Resolve): Positional parameters are
505         optional.  Deal with that case.
506
507         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
508         the Ansi/Unicode/Auto information for the type.
509
510         (TypeContainer.DefineType): instantiate the EmitContext here, as
511         we will be using it during the type definition (to resolve
512         attributes) and during the emit phase.
513
514         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
515         to pull type information out of the attributes
516
517         (Attribute.Resolve): track the constructor builder, and allow for
518         multiple invocations (structs and classes will use this).
519
520         * ecore.cs (MemberLookupFinal): new version with all the
521         parameters customizable.
522
523         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
524         constructors.  Return if the result value is null (as the error
525         would have been flagged already by MemberLookupFinal)
526
527         Do not allow instances of abstract classes or interfaces to be
528         created.
529         
530         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
531         We have to compare the assembly property here when dealing with
532         FamANDAssem and Assembly access modifiers, because we might be
533         creating an assembly from *modules* (that means that we are not
534         getting TypeBuilders for types defined in other modules that are
535         part of this assembly).
536
537         (Method.Emit): If the method is marked abstract and has a body,
538         emit an error. 
539
540         (TypeContainer.DefineMembers): If both the defined member and the
541         parent name match are methods, then do not emit any warnings: let
542         the Method.Define routine take care of flagging warnings.  But if
543         there is a mismatch (method overrides something else, or method is
544         overriwritten by something, then emit warning).
545
546         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
547         set to null, this means `do not check for the return type on the
548         signature'. 
549
550         (Method.Define): set the return type for the method signature to
551         null, so that we get methods with the same name and parameters and
552         different return types.  This is used to flag warning 114 (you are
553         hiding a method, and you probably want to use the new/override
554         keywords instead).
555
556         * typemanager.cs (MemberLookup): Implemented proper access
557         control, closing a long standing set of bug reports.  The problem
558         was that the Framework only has two bits: Public and NonPublic,
559         and NonPublic includes private and protected methods, but we need
560         to enforce the FamANDAssem, FamOrAssem and Family. 
561
562 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
563
564         * statement.cs (GotoCase): Return true: Ammounts to giving up
565         knowledge on whether we return or not, and letting the other case
566         be responsible for it.
567
568 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
569
570         * driver.cs: Do not load directories for each file processed, only
571         do it if there is a pattern.
572
573         * ecore.cs: Report readonly assigns here as well, as we might have
574         been resolved only by MemberAccess.
575
576         (SimpleName.SimpleNameResolve): Also be useful for LValue
577         resolution.   We need this to propagate assign to local readonly variables
578
579         * typemanager.cs: Use a ptrhashtable for the criteria, because we
580         do not want to reuse potential criteria memory.
581
582         * class.cs (MyEventBuilder): Set reflected_type;
583
584         * ecore.cs (Constantify): Added support for constifying bools.
585
586         (RootContext.LookupType): Added a cache for values looked up in
587         the declaration space.
588
589         * typemanager.cs (FindMembers): Now is a front-end to
590         RealFindMembers, and provides a two-level hashtable-based cache to
591         the request.  
592
593         15% performance improvement: from 22.5 to 19.2 seconds.
594
595         * expression.cs (IsParamsMethodApplicable): use foreach.
596         (Invocation.DoResolve): ditto.
597         (New.DoResolve): ditto.
598         (ArrayCreation.DoResolve): ditto.
599
600         * ecore.cs (FindMostEncompassingType): use foreach.
601
602         * delegate.cs (NewDelegate.DoResolve): Use foreach
603
604         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
605         (RemoveMethods): use foreach.
606
607         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
608         nested foreach statements instead of for, and also break out of
609         the inner loop once a match is found.
610         
611         (Invocation.OverloadResolve): Use foreach, simplify the code. 
612
613 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
614
615         * cfold.cs (BinaryFold): During an enumeration evaluation context,
616         we actually unwrap the expression to allow for extra information
617         to be extracted. 
618
619         * expression.cs: Use Shr_Un on unsigned operations. 
620
621 2002-05-08  Ravi Pratap  <ravi@ximian.com>
622
623         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
624         applicable operators was not being considered correctly. This closes
625         the bug Miguel reported.
626
627 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
628
629         * attribute.cs: check that the type derives from System.Attribute
630         and report the correct error in that case (moved the duplicate code to
631         its own method, too).
632
633 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
634
635         * attribute.cs: lookup attribute type name as the spec says: first the
636         bare attribute name and then name + "Attribute" (nant compiles with
637         mcs after this fix).
638
639 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
640
641         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
642         Because of the way we parse things, we should try to see if a
643         UIntConstant can fit in an integer.
644
645 2002-05-07  Ravi Pratap  <ravi@ximian.com>
646
647         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
648         when we are in an explicit context.
649
650         (ConvertReferenceExplicit): When converting from Iface type S to Class
651         T make sure the rules are implemented as an OR.
652
653         * parameter.cs (ParameterType): Make it a property for now although the
654         purpose really isn't anything immediate.
655         
656         * expression.cs (Is*Applicable): Do better checking on the parameter type
657         of a ref/out parameter. The ones from the system assemblies are already 
658         marked with the correct type so we don't need to do any correction.
659
660         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
661         the object type is standard too so include that.
662
663 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
664
665         * ecore.cs (StandardConversionExists): Augment with missing code:
666         deal with IntConstant, LongConstants and Enumerations.
667
668         * assign.cs: Report the error, instead of failing silently
669
670         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
671         typecontainer that they are declared, because the
672         typecontainer/namespace will have the list of using clauses that
673         need to be applied.
674
675         Assembly Attributes were escaping the normal registration
676         mechanism. 
677
678         (EmitCode): Apply attributes within an EmitContext that represents
679         the container they were declared on.
680         
681         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
682
683 2002-05-06  Ravi Pratap  <ravi@ximian.com>
684
685         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
686         Revamp completely - make much cleaner as we now operate only
687         on a set of Types.
688
689         (FindMostSpecificSource, FindMostSpecificTarget): New methods
690         to implement the logic detailed in the spec more correctly.
691
692         (UserDefinedConversion): Update accordingly.
693
694 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
695
696         * statement.cs: Return flow analysis information up.
697
698         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
699         and the default.
700
701         (token): Do not consume an extra character before calling
702         decimal_digits.
703
704 2002-05-06  Piers Haken <piersh@friskit.com>
705
706         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
707
708 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
709
710         * class.cs (Constructor.Emit): Set the IsStatic flag in the
711         EmitContext during the instance constructor initializer
712         resolution, to stop access to instance variables.
713
714         This is mandated by the spec, last paragraph of the `constructor
715         initializers' section. 
716
717 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
718
719         * cs-parser.jay, class.cs (Accessor): new class used to represent
720         an accessor (get or set).  In the past we used `null' to represent
721         a missing accessor.  But this is ambiguous because there was no
722         way to tell in abstract indexers/properties if one of them was
723         specified.
724
725         Now there is a way of addressing that.
726
727         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
728         instead of FindMembers.
729
730         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
731         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
732
733         * attribute.cs: Treat indexers and properties as the same in terms
734         of applying attributes
735
736         * ecore.cs (FindMostEncompassedType): Use statically initialized
737         EmptyExpressions()s like we do elsewhere to avoid creating useless
738         objects (and we take this out of the tight loop).
739
740         (GetConversionOperators): Move the code to extract the actual
741         operators to a separate routine to clean things up.
742
743 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
744
745         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
746         events are always registered FieldBuilders.
747         
748         * class.cs (FieldBase): New class shared by Fields 
749
750         * delegate.cs: If we are a toplevel delegate, use our full name.
751         If we are a nested delegate, then only use our tail name.
752
753 2002-05-02  Ravi Pratap  <ravi@ximian.com>
754
755         * expression.cs (IsApplicable): Ensure that we add the "&" to
756         ref/out types before comparing it with the type of the argument.
757
758         (IsParamsMethodApplicable): Ditto.
759
760         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
761         silly me ;-)
762
763         * delegate.cs : Handle the case when we have more than one applicable
764         method. Flag an error only when we finish checking all.
765
766 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
767
768         * expression.cs: Add support for boolean static initializers.
769
770 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
771
772         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
773
774         * parameter.cs (ComputeParameterTypes,
775         ComputeAndDefineParameterTypes): Better error handling: now we
776         clear the `types' cache if we fail during any of the type lookups.
777         We also return the status code correctly to our caller
778
779         * delegate.cs: If we fail to define a delegate, abort the extra
780         steps. 
781
782         * expression.cs (Binary.ResolveOperator): for
783         operator==(object,object) and operator !=(object, object) we also
784         have to verify that there is an implicit conversion from one to
785         the other.
786
787         (ArrayAccess.DoResolve): Array Access can operate on
788         non-variables. 
789
790 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
791
792         * assign.cs (CompoundAssign): A new class used as a "flag" that
793         the assignment actually is happening as part of a compound
794         assignment operator.
795
796         During compound assignment, a few new rules exist to enable things
797         like:
798
799         byte b |= 1 + 2
800
801         From the spec:
802         
803         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
804         to the type of x) if y is implicitly convertible to the type of x,
805         and the operator is a builtin operator and the return type of the
806         operator is explicitly convertible to the type of x. 
807
808         * rootcontext.cs: Reset warning level to 2.  4 catches various
809         "interesting" features in mcs, we must clean this up at some
810         point, but currently am trying to kill other bugs ;-)
811
812         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
813         in container classes as well.  
814
815         * expression.cs (Binary.ResolveOperator): Handle string case
816         before anything else (as operator overloading does emit an error
817         before doing anything else).
818
819         This code could go away when we move to a table driven model, but
820         i could not come up with a good plan last night.
821         
822 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
823
824         * typemanager.cs (CSharpName): reimplementation using regex.
825         * class.cs: added null check for fields in Emit
826         * rootcontext.cs: set warninglevel to 4
827
828 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
829
830         * typemanager.cs (CSharpName): reimplemented with Lupus
831         suggestion.
832
833 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
834
835         * statement.cs (If): correclty implement Resolve, because we were
836         not catching sem errors in there.  The same process is needed
837         everywhere else. 
838         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
839         
840
841         (Statement.Warning_DeadCodeFound): Factorize code.
842         (While): Report dead code here too.
843
844         (Statement): Added Resolve virtual method to allow
845         for resolution split from the emit code.
846
847 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
848
849         * statement.cs (EmitBoolExpression): No longer try to resolve the
850         expression here.    
851         (MakeBoolean): New utility function that resolve, implicitly
852         converts to boolean and tags the expression. 
853         
854
855         (If, Do): Implement dead code elimination.
856         (While): Implement loop inversion
857
858         (Do, While, For, If): Resolve the expression prior to calling our
859         code generation.
860
861 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
862
863         * class.cs:
864           - added method Report28 (warning: program has more than one entry point)
865           - added method IsEntryPoint, implements paragraph 10.1 of the spec
866           - modified method Method.Define, the part at the end of the method
867
868         * rootcontext.cs: added static public Location EntryPointLocation;
869           
870         * ../errors/cs0028.cs : Add test case for the above warning.              
871
872         * typemanager.cs:
873           - modified method CSharpName to allow arrays of primitive type to
874             be printed nicely (e.g. instead of System.Int32[][] it now prints
875             int[][])
876           - added method CSharpSignature: returns the signature of a method
877             in string format to be used in reporting errors, warnings, etc.
878
879         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
880         with String.Empty.
881         
882 2002-04-26  Ravi Pratap  <ravi@ximian.com>
883
884         * delegate.cs (Define): Fix extremely silly bug where I was
885         setting the type of the 'object' parameter of the BeginInvoke
886         method to System.IAsyncResult instead of System.Object ;-)
887
888 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
889
890         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
891         here. 
892
893         (Constructor.Emit): return if we fail to initialize the
894         constructor.  Another door closed!  
895
896         * expression.cs (New.DoResolve): Improve error message (from -6 to
897         1501).  Use DeclaredOnly lookup to find the exact constructor.
898
899         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
900         loop.  This is useful.
901
902         * cs-parser.jay: Adjust the default parameters so that destructors
903         have the proper signature.
904
905 2002-04-26  Martin Baulig  <martin@gnome.org>
906
907         * driver.cs (LoadAssembly): If `assembly' contains any characters
908         which are only valid in path names and not in assembly names
909         (currently slash, backslash and point), use Assembly.LoadFrom ()
910         instead of Assembly.Load () on the `assembly' (before iteration
911         over the link_paths).
912
913 2002-04-26  Martin Baulig  <martin@gnome.org>
914
915         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
916
917 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
918
919         * class.cs (Property): use the new typemanager.MemberLookup
920
921         (TypeContainer.MemberLookup): Implement using the
922         TypeManager.MemberLookup now. 
923         
924         * typemanager.cs: Make MemberLookup a function of the TypeManager,
925         and return MemberInfos, so that these can be used without an
926         EmitContext (what we had before).
927
928 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
929
930         * expression.cs: Fix the case where the argument to params if the
931         type of the params.  I omitted handling this before.   Fixed
932
933 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
934
935         * driver.cs: Call BootCorlib_PopulateCoreType
936
937         * class.cs (Property.CheckBase): Check for properties only, not
938         for all members. 
939
940         * interface.cs: Temporary hack: try/catch around the
941         CustomAttributeBuilder, because I am getting an exception that I
942         do not understand.
943
944         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
945         types whose definitions are required to be there (attributes are
946         defined before standard types).
947
948         Compute definitions as we boot the various types, as they are used
949         immediately (value_type class will need object_type, but if we do
950         not initialize object_type, we will pass a null, which will let
951         the runtime pick the System.Object from the existing corlib, which
952         is not what we want).
953
954 2002-04-22  Patrik Torstensson <totte@labs2.com>
955
956         * cs-tokenizer.cs: fixed a number of trim() issues.
957
958 2002-04-22  Ravi Pratap  <ravi@ximian.com>
959
960         * expression.cs (Argument.Type): Ensure that we return the correct
961         type when we have out or ref parameters [in which case we 
962         append a "&"].
963         
964 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
965
966         * class.cs (Property, Indexer): Allow extern modifier in there. 
967
968         * typemanager.cs (InitBaseTypes): Initializes object_type and
969         value_type, since those will be used early on during the bootstrap
970         process to compile corlib.
971
972         (InitCoreTypes): Move code from here to InitBaseTypes.
973
974 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
975
976         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
977         single-dimension arrays as using the ldlen opcode.  
978
979         Daniel Lewis discovered this optimization.  
980
981         * typemanager.cs: Add signature for System.Array::get_Length
982
983 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
984
985         * statement.cs: report the error when the foreach does not apply to an
986         array nor a collection.
987
988 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
989
990         * expression.cs: Add implicit conversions to the operator ~.
991
992         * constant.cs (DecimalConstant.Emit): Emit decimal value.
993
994         * typemanager.cs: Locate the decimal constructor.
995
996 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
997
998         * attribute.cs: use the new property of TypeOf.
999         * expression.cs: added 'get' property around typearg.
1000
1001         These changes fix a build breaker reported by NickD. Is this the
1002         correct way to fix?  If not, please, revert my changes and make it
1003         work :-).
1004
1005 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
1006
1007         * attribute.cs: Add support for typeof in attribute invocations.
1008         I am not sure that this is right though.
1009
1010 2002-04-14  Duncan Mak  <duncan@ximian.com>
1011
1012         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
1013         Binary.Operator.Division case.
1014
1015 2002-04-13  Ravi Pratap  <ravi@ximian.com>
1016
1017         * class.cs (DefineType): Ensure that we do a proper check on
1018         attribute types and also register it with the TypeManager.
1019
1020         (TypeContainer.Targets): The default for attribute types is
1021         AttributeTargets.All.
1022         
1023         * attribute.cs (ApplyAttributes): Registering the attribute type
1024         is done elsewhere, not when we discover we have a Usage attribute.
1025
1026 2002-04-12  Ravi Pratap  <ravi@ximian.com>
1027
1028         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
1029         and get rid of is_delegate parameter.
1030
1031         * everywhere : update.
1032         
1033 2002-04-12  Ravi Pratap  <ravi@ximian.com>
1034
1035         * cs-parser.jay (compilation_unit): Revamp completely to use
1036         some new ideas that I got from Rhys' grammar to solve the problems
1037         with assembly level attributes.
1038
1039         (outer_declaration): New grammar production.
1040
1041         (attribute_sections): Add.
1042
1043         (opt_attributes): Base on attribute_sections
1044
1045         (namespace_declaration): Allow opt_attributes to tackle the case
1046         when we have assembly level attributes - we are clever in this
1047         regard now ;-)
1048
1049         * attribute.cs (ApplyAttributes): Do not worry about assembly 
1050         attributes in the non-global context.
1051
1052         * rootcontext.cs (AddGlobalAttributes): Go back to using this
1053         instead of SetGlobalAttributes.
1054
1055         * class.cs, rootcontext.cs : Ensure we define and generate 
1056         attribute types before anything else.
1057
1058         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
1059         and flag the new error -20 for the case when the attribute type
1060         does not have valid targets specified. csc does not catch this.
1061
1062         * ../errors/errors.txt : update for error # -20
1063
1064 2002-04-11  Ravi Pratap  <ravi@ximian.com>
1065
1066         * support.cs (InternalParameters.ParameterModifier): Do some null
1067         checking and return sane values.
1068
1069         * class.cs (Method.Define): If we are a PInvoke method, ensure
1070         that we are static and extern. Report error # 601
1071
1072         * ../errors/cs0601.cs : Add test case for the above error.
1073
1074 2002-04-07  Ravi Pratap  <ravi@ximian.com>
1075
1076         * rootcontext.cs (attribute_types): We need to keep type of
1077         all attribute types separately and emit code for them first.
1078
1079         (RegisterAttribute) : Implement.
1080
1081         * class.cs (DefineType): Check if the current Type is a custom
1082         attribute type and register it accordingly.
1083
1084         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
1085         adding the first attribute twice and rename to
1086
1087         (SetGlobalAttributes): this.
1088
1089         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
1090         lookups.
1091
1092         * attribute.cs (ApplyAttributes): Take an additional argument telling us
1093         if we are processing global arguments. Hmm, I am unsure of this.
1094
1095 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1096
1097         * expression.cs: added static array of strings to avoid calling
1098         Enum.ToString () for Operator in Binary. Significant recover of
1099         performance.
1100
1101 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
1102
1103         * class.cs (FindMembers): Allow the Builders of the various
1104         members to be null.  If they are skip them.  This only happens
1105         during the PInvoke declaration.
1106
1107 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
1108
1109         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
1110         failure, so we do not keep going afterwards.
1111
1112         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
1113         wanted to pass `false' as the `is_delegate' argument.  If this is
1114         the case, why not use delegate_type == null to mean `is_delegate =
1115         false' and anything else as is_delegate = true.
1116
1117 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
1118
1119         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
1120         code for the section, not the beginning of the tests.
1121
1122 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
1123
1124         * cfold.cs: Handle operator + (Enum x, Underlying x) 
1125
1126         * expression.cs (Binary): same.  Warn about errors where we have
1127         Enum/Enum in operator + as well.
1128
1129 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
1130
1131         * statement.cs:
1132                 - added support for switch(bool)
1133                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
1134                 - add TableSwitchEmit() to handle table-based switch statements
1135
1136 2002-04-05  Ravi Pratap  <ravi@ximian.com>
1137
1138         * expression.cs (Invocation.OverloadResolve): Factor out code which
1139         does parameter compatibility checking with arguments so that we can 
1140         re-use the code even from Delegate.VerifyApplicability
1141
1142         (VerifyArgumentsCompat): Move above code here.
1143
1144         * delegate.cs (VerifyApplicability): Get rid of duplicate code
1145         and instead make a call to the above method.
1146
1147 2002-03-31  Ravi Pratap  <ravi@ximian.com>
1148
1149         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
1150         We use it to keep track of classes which are attribute types.
1151
1152 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
1153
1154         * delegate.cs (Delegate.Define): Correctly define the types in the
1155         presence of fixed and array parameters.
1156
1157         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
1158         doing FindMembers.
1159
1160         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
1161         include NonPublic after the first iteration.
1162
1163         * class.cs (Indexer.CheckBase): Only check if both parents are
1164         non-null. 
1165         
1166         * cs-parser.jay (accessor_body): If empty, set to null.
1167
1168         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
1169         same code path here to resolve constants names that we did have in
1170         MemberAccess.DoResolve.  There is too much code duplicated here.
1171
1172 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
1173
1174         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
1175
1176         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
1177         to MakeUnionSet.
1178
1179         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
1180         tokens, numbers and strings.
1181
1182         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
1183         parenthesis.
1184
1185         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
1186         asyncronous parameters and the regular parameters.  
1187
1188         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
1189         specify the target directory.
1190
1191         * expression.cs: (This.DoResolve): Simplify
1192         (As.Emit): Optimize, do not generate IsInst if the expression is
1193         always of the given type.
1194
1195         (Is.DoResolve): Bug fix, we were reporting both always/never for
1196         the is expression.
1197
1198         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
1199         creating too many unnecessary arrays.
1200
1201 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
1202
1203         * class.cs (EmitFieldInitializer): Use Assign expression to assign
1204         fields instead of rolling our own initializer.   Takes care of all
1205         implicit conversions, and drops unnecessary static checks/argument.
1206
1207 2002-03-31  Dick Porter  <dick@ximian.com>
1208
1209         * driver.cs: use the GetDirectories() return values properly, and
1210         use "/" as path separator.
1211
1212 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
1213
1214         * expression.cs (Unary): Optimize - - expr into expr.
1215         (Binary): Optimize a + (-b) into a -b.
1216
1217         * codegen.cs (CodeGen): Made all methods static.
1218
1219 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
1220
1221         * rootcontext.cs: 
1222
1223         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
1224         TypeBuilder property.
1225
1226         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
1227         instead. 
1228
1229         * tree.cs: Removed the various RecordXXXX, and replaced with a
1230         single RecordDecl.  Removed all the accessor methods, and just
1231         left a single access point Type 
1232
1233         * enum.cs: Rename DefineEnum to DefineType.
1234
1235         * decl.cs: New abstract method `DefineType' used to unify the
1236         Defines for Enumerations, Interfaces, TypeContainers and
1237         Delegates.
1238
1239         (FindType): Moved LookupInterfaceOrClass here.  Moved the
1240         LookupBaseClasses method that used to live in class.cs and
1241         interface.cs here, and renamed to FindType.
1242         
1243         * delegate.cs: Implement DefineType.  Take advantage of the
1244         refactored pattern for locating the parent builder without taking
1245         the parent_builder argument (which we know does not work if we are
1246         nested, and triggering a toplevel definition).
1247
1248 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
1249
1250         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
1251         accessibility of a member has changed during override and report
1252         an error if so.
1253
1254         * class.cs (Method.Define, Property.Define): Only complain on
1255         overrides if the method is private, any other accessibility is
1256         fine (and since we just checked the permission is the same, we are
1257         good to go).
1258
1259         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
1260         and elif are processed always.  The other pre-processing
1261         directives are only processed if we are "taking" the path
1262
1263 2002-03-29  Martin Baulig  <martin@gnome.org>
1264
1265         * class.cs (Method.Emit): Only emit symbolic debugging info if the
1266         current location is not Null.
1267
1268         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
1269         a separate method so we can profile it.
1270
1271         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
1272         `span.Seconds' are just seconds, but no minutes or hours.
1273         (MainDriver): Profile the CodeGen.SaveSymbols calls.
1274
1275 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
1276
1277         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
1278         Remove the gratuitous set of Final:
1279
1280                                 // If an interface implementation, then we can set Final.
1281                                 if (((flags & MethodAttributes.Abstract) == 0) &&
1282                                     implementing.DeclaringType.IsInterface)
1283                                         flags |= MethodAttributes.Final;
1284
1285         I do not know what I was smoking when I used that.
1286         
1287
1288         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
1289         step into fixing the name resolution issues for delegates and
1290         unifying the toplevel name resolution.
1291
1292 2002-03-28  Martin Baulig  <martin@gnome.org>
1293
1294         * class.cs (Method.Emit): If we have a symbol writer, call its
1295         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
1296         tell it about the current method.
1297
1298         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
1299         writer that we're going to emit the first byte of IL code for a new
1300         statement (a new source line).
1301         (EmitContext.EmitTopBlock): If we have a symbol writer, call
1302         EmitContext.Mark() before emitting any code.
1303
1304         * location.cs (SymbolDocument): Return null when we're Null.
1305
1306         * statement.cs (Statement): Moved the `Location loc' variable here.
1307         (Statement.EmitBoolExpression): If we have a symbol writer, call
1308         ec.Mark() before emitting any code to tell it that we're at the
1309         beginning of a new statement.
1310         (StatementExpression): Added `Location' argument to the constructor.
1311         (Block): Added public readonly variable `StartLocation' and public
1312         variable `EndLocation'.  The latter is to be set using SetEndLocation().
1313         (Block): Added constructor which takes a start and end location.
1314         (Block.SetEndLocation): New method. This sets the end location.
1315         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
1316         local variables we create.
1317         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
1318         each statement and do also mark the begin and end of the block.
1319
1320         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
1321         tell it the current lexer.Location, use Location.Null for the end of the
1322         block.
1323         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
1324         current block, set its end location using SetEndLocation().
1325         (statement_expression): StatementExpression constructor now takes the
1326         lexer.Location as additional argument.
1327         (for_statement, declare_local_variables): Likewise.
1328         (declare_local_variables): When creating a new implicit block, use the
1329         new Block constructor and pass it the lexer.Location.
1330
1331 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
1332
1333         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
1334         members also on the parent interfaces recursively.
1335
1336 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
1337
1338         * report.cs: Use new formats, since Gonzalo finished the missing
1339         bits. 
1340
1341         * expression.cs (Binary.ResolveOperator): added missing operator|
1342         operator& and operator^ for bool/bool.
1343
1344         * cs-parser.jay: CheckDef now takes a Location argument that is
1345         used to report errors more precisly (instead of reporting the end
1346         of a definition, we try to track something which is a lot closer
1347         to the source of the problem).
1348
1349         * cs-tokenizer.cs: Track global token use, so we can properly flag
1350         the use of #define/#undef after the first token has been seen.
1351
1352         Also, rename the reportXXXX to Error_DescriptiveName
1353
1354         * decl.cs (DeclSpace.IsTopLevel): Move property here from
1355         TypeContainer, so that Enum and Interface can use this too.
1356
1357         * class.cs (TypeContainer.LookupInterfaceOrClass,
1358         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
1359         `builder' argument.  Typically this was used to pass the parent
1360         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
1361         the definition).  
1362
1363         The problem is that a nested class could trigger the definition of
1364         a toplevel class, and the builder would be obviously wrong in that
1365         case. 
1366
1367         So we drop this argument, and we compute dynamically the
1368         TypeBuilder/ModuleBuilder (the correct information was available
1369         to us anyways from DeclSpace.Parent)
1370
1371         * interface.cs (Interface.DefineInterface): Drop builder
1372         parameter cleanup like class.cs
1373
1374         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
1375         like class.cs
1376
1377         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
1378         values. 
1379
1380         (Try.Emit): Propagate the returns value from the statement.
1381
1382         (Return.Emit): Even if we are leavning 
1383
1384         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
1385
1386         * modifiers.cs: Fix the computation of MethodAttributes flags.
1387
1388 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
1389
1390         * driver.cs: allow compilation of files that start with '/'.
1391         Add a default case when checking the argument of --target.
1392
1393 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
1394
1395         * interface.cs: Implement the same search algorithm for types in
1396         the interface code.
1397
1398         * delegate.cs: Do not allow multiple definition.
1399
1400         * Recovered ChangeLog that got accidentally amputated
1401
1402         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
1403
1404         * rootcontext.cs: Load manually enum to allow core classes to
1405         contain enumerations.
1406
1407         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
1408         Update to new static methods in TypeManager.
1409
1410         * typemanager.cs (GetMethod, GetConstructor): Use our
1411         implementation of FindMembers to find the members, since during
1412         corlib compilation, the types are TypeBuilders and GetMethod and
1413         GetConstructor do not work.
1414
1415         Make all methods in TypeManager static.
1416
1417         (InitCodeHelpers): Split the functionality from
1418         the InitCodeTypes function.
1419
1420         * driver.cs: Call InitCodeHelpers after we have populated the
1421         types. 
1422
1423         * cs-parser.jay (delegate_declaration): we did not used to compute
1424         the delegate name correctly for void delegates.
1425
1426 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
1427
1428         * rootcontext.cs (RootContext): Init the interface_resolve_order
1429         and type_container_resolve_order always.
1430
1431         (ResolveCore, BootstrapCorlib_ResolveClass,
1432         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
1433         compiler when compiling with --nostdlib
1434
1435         * class.cs (TypeContainer.DefineType): Check that our parent is
1436         not null.  This test is most important when we are bootstraping
1437         the core types.
1438
1439         * codegen.cs: Split out the symbol writing code.
1440
1441 2002-03-25  Martin Baulig  <martin@gnome.org>
1442
1443         * driver.cs (-g): Made -g an alias for --debug.
1444
1445 2002-03-24  Martin Baulig  <martin@gnome.org>
1446
1447         * codegen.cs (SymbolWriter): New public variable. Returns the
1448         current symbol writer.
1449         (CodeGen): Added `bool want_debugging_support' argument to the
1450          constructor. If true, tell the ModuleBuild that we want debugging
1451         support and ask it for the ISymbolWriter.
1452         (Save): If we have a symbol writer, call it's Close() method after
1453         saving the assembly.
1454
1455         * driver.c (--debug): New command line argument to create a
1456         debugger information file.
1457
1458         * location.cs (SymbolDocument): New public property. Returns an
1459         ISymbolDocumentWriter object for the current source file or null
1460         if we don't have a symbol writer.
1461
1462 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
1463
1464         * driver.cs (LoadAssembly): Correctly return when all the paths
1465         have been tried and not before.
1466
1467         * statement.cs (Switch.Emit): return the actual coverage for this
1468         statement (returns/not-returns)
1469
1470         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
1471         switch of the statement if we are the last switch section.  That
1472         kills two problems: try/catch problems (we used to emit an empty
1473         nop at the end) and switch statements where all branches would
1474         return. 
1475
1476 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
1477
1478         * driver.cs: Add default assemblies (the equivalent to the
1479         Microsoft CSC.RSP file)
1480
1481         * cs-tokenizer.cs: When updating `cols and setting it to zero,
1482         also update tokens_seen and set it to false.
1483
1484         * driver.cs: Implement --recurse for Mike.
1485
1486         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
1487         correctly splitting out the paths.
1488
1489 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
1490
1491         * interface.cs (Interface.PopulateProperty): Instead of using
1492         `parent' as the declaration space for the set parameters, use
1493         `this' 
1494
1495         * support.cs (InternalParameters): InternalParameters constructor
1496         takes a DeclSpace instead of a TypeContainer.
1497
1498         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
1499         types are being initialized, load the address of it before calling
1500         the function.  
1501
1502         (New): Provide a mechanism to disable the generation of local
1503         value type temporaries when the caller will be providing us with
1504         an address to store it.
1505
1506         (ArrayCreation.EmitDynamicInitializers): Use it.
1507
1508 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
1509
1510         * expression.cs (Invocation.EmitArguments): Only probe for array
1511         property if there is more than one argument.  Sorry about that.
1512
1513         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
1514         empty param arrays.
1515         
1516         * class.cs (Method.LabelParameters): Fix incorrect code path that
1517         prevented the `ParamArrayAttribute' from being applied to the
1518         params attribute.
1519
1520 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
1521
1522         * support.cs (ReflectionParameters): Correctly compute whether the
1523         last argument is a params array.  Fixes the problem with
1524         string.Split ('a')
1525
1526         * typemanager.cs: Make the assemblies array always be non-null
1527         (empty, but non-null)
1528
1529         * tree.cs (RecordDecl): New function that abstracts the recording
1530         of names.  This reports error 101, and provides a pointer to the
1531         previous declaration.  Fixes a crash in the compiler.
1532
1533         * cs-parser.jay (constructor_declaration): Update to new grammar,
1534         and provide a constructor_body that can be empty.
1535
1536 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
1537
1538         * driver.cs: Add support for --resources.
1539
1540         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
1541         Make all types for the various array helper methods be integer.
1542
1543         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
1544         CheckState to ConvCast.
1545
1546         (ConvCast): Now it takes a `checked' state argument, to avoid
1547         depending on the emit context for the conversion, and just using
1548         the resolve time setting.
1549
1550         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
1551         instead of Invocation.EmitArguments.  We do not emit the original
1552         arguments, instead we emit those which have been converted to
1553         unsigned int expressions.
1554
1555         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
1556
1557         * codegen.cs: ditto.
1558
1559         * expression.cs (LocalVariableReference): Drop the use of the
1560         Store function that depended on the variable index.
1561
1562         * statement.cs (VariableInfo): Drop the `Idx' property from this
1563         class, as this is not taking into account the indexes for
1564         temporaries tat we generate during the execution, getting the
1565         indexes wrong.
1566
1567         * class.cs: First emit class initializers, then call the parent
1568         constructor. 
1569
1570         * expression.cs (Binary): Fix opcode emision.
1571         (UnaryMutator.EmitCode): Support checked code generation
1572
1573         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
1574         matches for events for both the Static and Instance scans,
1575         pointing to the same element.   Fix that.
1576
1577 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
1578
1579         * rootcontext.cs (ResolveTree): Always set the
1580         interface_resolve_order, because nested interfaces will be calling
1581         into us.
1582
1583         * class.cs (GetInterfaceOrClass): Track the same resolution
1584         process used by TypeManager.LookupType.  This fixes the nested
1585         type lookups in class declarations (separate path from
1586         LookupType). 
1587
1588         (TypeContainer.DefineType): Also define nested interfaces.
1589         (TypeContainer.RegisterOrder): New public function used to
1590         register the order in which child interfaces need to be closed.
1591
1592         Nested interfaces need to be closed after their parents have been
1593         created. 
1594         
1595         * interface.cs (InterfaceAttr): Put all the logic for computing
1596         the interface attribute here. 
1597
1598         (DefineInterface): Register our interface order with the
1599         RootContext or with the TypeContainer depending on the case.
1600
1601 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
1602
1603         * cs-parser.jay: rework foreach statement to work with the new
1604         changes to the policy on SimpleNames.
1605         
1606         * report.cs: support Stacktrace on warnings as well.
1607
1608         * makefile: drop --unsafe and /unsafe from the compile.
1609
1610 2002-03-13  Ravi Pratap  <ravi@ximian.com>
1611
1612         * ecore.cs (StandardConversionExists): Modify to take an Expression
1613         as the first parameter. Ensure we do null -> reference type conversion
1614         checking.
1615
1616         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
1617         temporary Expression objects.
1618
1619 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
1620
1621         * interface.cs: workaround bug in method overloading resolution
1622         (there is already a bugzilla bug for it).
1623
1624 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
1625
1626         We could also solve this problem by having a separate path for
1627         performing type lookups, instead of DoResolve, we could have a
1628         ResolveType entry point, and only participating pieces of the
1629         production (simplename, deref, array) would implement this. 
1630         
1631         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
1632         signal SimpleName to only resolve type names and not attempt to
1633         resolve anything else.
1634
1635         * expression.cs (Cast): Set the flag.
1636
1637         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
1638
1639         * class.cs: Only report 108 if there is no `new' modifier.
1640
1641         * cs-parser.jay: rework foreach statement to work with the new
1642         changes to the policy on SimpleNames.
1643         
1644         * report.cs: support Stacktrace on warnings as well.
1645
1646         * makefile: drop --unsafe and /unsafe from the compile.
1647
1648 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
1649
1650         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
1651         lookups here, instead of doing that at parse time.  This means
1652         that our grammar will not introduce `LocalVariableReferences' as
1653         expressions at this point.  That solves the problem of code like
1654         this:
1655
1656         class X {
1657            static void Main ()
1658            { int X = 1;
1659             { X x = null }}}
1660
1661         This is only half the fix.  The full fix requires parameters to
1662         also be handled in this way.
1663
1664         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
1665         makes the use more obvious of the DeclSpace.  The
1666         ec.TypeContainer.TypeBuilder is now only used to pull the
1667         TypeBuilder for it.
1668
1669         My theory is that I can get rid of the TypeBuilder completely from
1670         the EmitContext, and have typecasts where it is used (from
1671         DeclSpace to where it matters).  
1672
1673         The only pending problem is that the code that implements Aliases
1674         is on TypeContainer, and probably should go in DeclSpace.
1675
1676         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
1677         lookups here, instead of doing that at parse time.  This means
1678         that our grammar will not introduce `LocalVariableReferences' as
1679         expressions at this point.  That solves the problem of code like
1680         this:
1681
1682         class X {
1683            static void Main ()
1684            { int X = 1;
1685             { X x = null }}}
1686
1687         This is only half the fix.  The full fix requires parameters to
1688         also be handled in this way.
1689
1690         * class.cs (Property.DefineMethod): When implementing an interface
1691         method, set newslot, when implementing an abstract method, do not
1692         set the flag (before we tried never setting it, or always setting
1693         it, which is the difference).
1694         (Indexer.DefineMethod): same.
1695         (Method.DefineMethod): same.
1696
1697         * ecore.cs: Only set the status used flag if we get back a Field.
1698
1699         * attribute.cs: Temporary hack, so Paolo can keep working.
1700
1701 2002-03-08  Ravi Pratap  <ravi@ximian.com>
1702
1703         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
1704         the unmanaged type in the case we have a MarshalAs attribute.
1705
1706         (Resolve): Handle the case when we are parsing the special MarshalAs
1707         attribute [we need to store the unmanaged type to use later]
1708         
1709         * typemanager.cs (marshal_as_attr_type): Built in type for the 
1710         MarshalAs Attribute.
1711
1712         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
1713         on parameters and accordingly set the marshalling info.
1714         
1715 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
1716
1717         * class.cs: Optimizing slightly by removing redundant code after
1718         we switched to the `NoTypes' return value.
1719         (Property.DefineMethod): use NoTypes here too.
1720
1721         This fixes the bug I introduced in my last batch of changes.
1722
1723 2002-03-05  Ravi Pratap  <ravi@ximian.com>
1724
1725         * tree.cs (RecordEnum): Add. We now keep track of enums too.
1726
1727         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
1728         Enums since those are types too. 
1729
1730         * cs-parser.jay (enum_declaration): Record enums as we parse them.
1731         
1732         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
1733         thanks to a call during the lookup process.
1734
1735 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
1736
1737         * statement.cs (Foreach): Lots of work to accomodate a particular
1738         kind of foreach statement that I had not kept in mind.  It is
1739         possible to have foreachs on classes that provide a GetEnumerator
1740         method that return objects that implement the "pattern" for using
1741         a foreach, there is no need to support GetEnumerator
1742         specifically. 
1743
1744         This is needed to compile nant.
1745
1746         * decl.cs: Only report 114 if the member is not `Finalize' and if
1747         the warning level is at least 2.
1748
1749         * class.cs: Moved the compare function from Method to
1750         MethodSignature. 
1751
1752         (MethodSignature.InheritableMemberSignatureCompare): Add new
1753         filter function that is used to extract inheritable methods from a
1754         class. 
1755
1756         (Method.Define): Use the new `inheritable_method_signature_filter'
1757         delegate
1758
1759         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
1760         command. 
1761
1762 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
1763
1764         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
1765
1766         * cs-parser.jay: Add opt_semicolon to the interface declaration.
1767
1768         * expression.cs: Pass location information to
1769         ConvertImplicitStandard. 
1770
1771         * class.cs: Added debugging code to track return values from
1772         interfaces. 
1773
1774 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
1775
1776         * expression.cs (Is.DoResolve): If either side of the `is' is an
1777         interface, do not flag the warning.
1778
1779         * ecore.cs (ImplicitReferenceConversion): We need a separate test
1780         for interfaces
1781
1782         * report.cs: Allow for --fatal to be used with --probe.
1783         
1784         * typemanager.cs (NoTypes): Move the definition for the empty Type
1785         array here. 
1786
1787         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
1788         properties. 
1789         (TypeContainer.DefineProxy): New function used to proxy to parent
1790         implementations when implementing interfaces.
1791         (TypeContainer.ParentImplements): used to lookup if our parent
1792         implements a public function that is required by an interface.
1793         (TypeContainer.VerifyPendingMethods): Hook this up.
1794
1795         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
1796         `modules' and `assemblies' arraylists into arrays.  We only grow
1797         these are the very early start up of the program, so this improves
1798         the speedof LookupType (nicely measured).
1799
1800         * expression.cs (MakeByteBlob): Replaced unsafe code with
1801         BitConverter, as suggested by Paolo.
1802
1803         * cfold.cs (ConstantFold.Binary): Special case: perform constant
1804         folding of string concatenation, but if either side is a string,
1805         and the other is not, then return null, and let the runtime use
1806         the concatenation on the string plus the object (using
1807         `Object.ToString'). 
1808
1809 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
1810
1811         Constant Folding has been implemented now.
1812         
1813         * expression.cs (Unary.Reduce): Do not throw an exception, catch
1814         the error instead on types that are not supported in one's
1815         complement. 
1816
1817         * constant.cs (Constant and all children): New set of functions to
1818         perform implict and explicit conversions.
1819         
1820         * ecore.cs (EnumConstant): Implement the new functions to perform
1821         conversion by proxying to the child expression.
1822
1823         * codegen.cs: (ConstantCheckState): Constant evaluation has its
1824         own separate setting that can not be turned off from the command
1825         line using --unchecked or --checked and is only controlled using
1826         the checked/unchecked statements and expressions.  This setting is
1827         used by the constant folder to flag errors.
1828
1829         * expression.cs (CheckedExpr, UncheckedExpr): Set the
1830         ConstantCheckState as well.   
1831
1832         During Resolve, they also have to flag the state, because the
1833         constant folder runs completely in the Resolve phase.
1834
1835         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
1836         well.
1837
1838 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
1839
1840         * cfold.cs: New file, this file contains the constant folder.
1841         
1842         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
1843         argument to track whether we are using the resulting address to
1844         load or store a value and provide better error messages. 
1845
1846         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
1847         new AddressOf arguments.
1848
1849         * statement.cs (Foreach.EmitCollectionForeach): Update
1850
1851         * expression.cs (Argument.Emit): Call AddressOf with proper
1852         arguments to track usage.
1853
1854         (New.DoEmit): Call AddressOf with new arguments.
1855
1856         (Unary.Emit): Adjust AddressOf call.
1857
1858 2002-03-01  Ravi Pratap  <ravi@ximian.com>
1859
1860         * cs-parser.jay (member_access): Change the case for pre-defined types
1861         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
1862         this suggestion.
1863
1864         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
1865         a method body.
1866
1867         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
1868         essentially like methods and apply attributes like MethodImplOptions to them too.
1869
1870         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
1871         not being null.
1872
1873         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
1874         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
1875         is the DeclSpace.
1876
1877         * Update code everywhere accordingly.
1878
1879         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
1880
1881         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
1882
1883 2002-02-28  Ravi Pratap  <ravi@ximian.com>
1884
1885         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
1886         try performing lookups against those instead of jumping straight into using
1887         the 'using' clauses.
1888
1889         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
1890
1891         (LookupType): Perform lookups in implicit parents too.
1892
1893         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
1894         sequence as RootContext.LookupType. 
1895
1896         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
1897         the various cases of namespace lookups into this method.
1898
1899 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
1900
1901         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
1902         in positional arguments)
1903
1904         * class.cs (Operator): Update the AllowedModifiers to contain
1905         extern. 
1906
1907         * cs-parser.jay: Update operator declaration to allow for the
1908         operator body to be empty.
1909
1910         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
1911         values. 
1912
1913 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
1914
1915         * class.cs (Method.Emit): Label parameters.
1916
1917         * driver.cs: Return 1 or 0 as the program exit code.
1918
1919 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
1920
1921         * expression.cs: Special case the `null' object when trying to
1922         auto-compute the type, as anything can be explicitly converted to
1923         that. 
1924
1925         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
1926         spotting this Paolo.
1927
1928         (Expression.ImplicitNumericConversion): Perform comparissions of
1929         the type using the underlying type in the case of an enumeration
1930         rather than using the enumeration type for the compare.
1931
1932         Cope with the underlying == type case, which is not possible to
1933         catch before. 
1934
1935         (Expression.ConvertNumericExplicit): Perform comparissions of
1936         the type using the underlying type in the case of an enumeration
1937         rather than using the enumeration type for the compare.
1938
1939         * driver.cs: If the user does not supply an extension, assume .exe
1940
1941         * cs-parser.jay (if_statement): Rewrote so that we can track the
1942         location for the if statement.
1943
1944         * expression.cs (Binary.ConstantFold): Only concat strings when
1945         the operation is "+", not everything ;-)
1946
1947         * statement.cs (Statement.EmitBoolExpression): Take a location
1948         argument. 
1949         (If, While, Do): Track location.
1950
1951         * expression.cs (Binary.ResolveOperator): In the object + string
1952         case, I was missing a call to ConvertImplicit
1953
1954 2002-02-25  Ravi Pratap  <ravi@ximian.com>
1955
1956         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
1957         Location arguments. Ensure we use RootContext.LookupType to do our work
1958         and not try to do a direct Type.GetType and ModuleBuilder.GetType
1959
1960         * interface.cs (PopulateMethod): Handle the type of the parameter being
1961         null gracefully.
1962
1963         * expression.cs (Invocation.BetterFunction): Handle the case when we 
1964         have a params method with no fixed arguments and a call is made with no
1965         arguments.
1966
1967 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
1968
1969         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
1970         the verbatim-string-literal
1971
1972         * support.cs (InternalParameters.ParameterModifier): handle null
1973         fixed parameters.
1974         (InternalParameters.ParameterType): ditto.
1975
1976         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
1977         duplicating the name of the variable parameter.
1978         (GetParameterByName): Fix bug where we were not looking up array
1979         paramters if they were the only present (thanks Paolo!).
1980         (GetParameterInfo): We only have an empty set of types if both
1981         fixed and array are set to null.
1982         (GetParameterInfo-idx): Handle FixedParameter == null
1983
1984         * cs-parser.jay: Handle the case where there is no catch
1985         statements (missing null test).
1986
1987 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
1988
1989         * driver.cs (MainDriver): Be conservative on our command line
1990         handling.
1991
1992         Catch DirectoryNotFoundException when calling GetFiles.
1993         
1994         (SplitPathAndPattern): Used to split the input specification into
1995         a path and a pattern that we can feed to Directory.GetFiles.
1996
1997 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
1998
1999         * statement.cs (Fixed): Implement the last case of the Fixed
2000         statement (string handling).
2001
2002         * expression.cs (StringPtr): New class used to return a char * to
2003         a string;  Used by the Fixed statement.
2004
2005         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
2006
2007         * expression.cs (Binary.ResolveOperator): Remove redundant
2008         MemberLookup pn parent type.
2009         Optimize union call, we do not need a union if the types are the same.
2010         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
2011         type.
2012
2013         Specialize the use of MemberLookup everywhere, instead of using
2014         the default settings. 
2015
2016         (StackAlloc): Implement stackalloc keyword.
2017
2018         * cs-parser.jay: Add rule to parse stackalloc.
2019         
2020         * driver.cs: Handle /h, /help, /?
2021
2022         * expression.cs (MakeByteBlob): Removed the hacks we had in place
2023         before we supported unsafe code.
2024         
2025         * makefile: add --unsafe to the self compilation of mcs.
2026
2027 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
2028
2029         * expression.cs (PointerArithmetic): New class that is used to
2030         perform pointer arithmetic.
2031         (Binary.Resolve): Handle pointer arithmetic
2032         Handle pointer comparission.
2033         (ArrayPtr): Utility expression class that is used to take the
2034         address of an array.
2035
2036         (ElementAccess): Implement array access for pointers
2037         
2038         * statement.cs (Fixed): Implement fixed statement for arrays, we
2039         are missing one more case before we are done.
2040
2041         * expression.cs (Indirection): Implement EmitAssign and set the
2042         ExprClass to Variable.  This allows pointer dereferences to be
2043         treated as variables, and to have values assigned to them.
2044         
2045         * ecore.cs (Expression.StoreFromPtr): New utility function to
2046         store values dereferencing.
2047
2048 2002-02-20  Ravi Pratap  <ravi@ximian.com>
2049
2050         * expression.cs (Binary.ResolveOperator): Ensure that we are
2051         not trying to operate on a void type - this fixes the reported
2052         bug.
2053
2054         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
2055         the parent implementation is sealed.
2056
2057         * ../errors/cs0239.cs : Add.
2058
2059         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
2060
2061         * typemanager.cs (unverifiable_code_type): Corresponds to 
2062         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
2063         which have unsafe code in them.
2064
2065         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
2066         unsafe context.
2067
2068 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
2069
2070         * cs-tokenizer.cs: Add support for @"litreal strings"
2071
2072         Make tokenizer accept pre-processor directives
2073         on any column (remove the old C-like limitation). 
2074
2075         * rootcontext.cs (EmitCode): Emit any global attributes.
2076         (AddGlobalAttributes): Used to keep track of assembly attributes. 
2077
2078         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
2079
2080         * cs-parser.jay: Add support for global attributes.  
2081
2082 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
2083
2084         * expression.cs (Indirection): New helper class.  Unary will
2085         create Indirection classes to be able to implement the
2086         IMemoryLocation interface on it.
2087
2088 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
2089
2090         * cs-parser.jay (fixed_statement): reference the right statement.
2091
2092         * statement.cs (Fixed.Emit): Finish implementing the fixed
2093         statement for the &x case.
2094
2095 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
2096
2097         * class.cs (Property.Define, Method.Define): Remove newslot when
2098         `implementing'.  
2099
2100         * modifiers.cs: My use of NewSlot when `Abstract' was set was
2101         wrong.  NewSlot should only be used if the `new' keyword is present.
2102
2103         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
2104         locating our system dir.  Sorry about this.
2105
2106 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
2107
2108         * driver.cs (GetSystemDir): Compute correctly the location of our
2109         system assemblies.  I was using the compiler directory instead of
2110         the library directory.
2111
2112 2002-02-13  Ravi Pratap  <ravi@ximian.com>
2113
2114         * expression.cs (BetterFunction): Put back in what Miguel commented out
2115         since it is the correct fix. The problem is elsewhere ;-)
2116
2117         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
2118         parameters of the parms method are themselves compatible or not !
2119
2120         (StandardConversionExists): Fix very dangerous bug where we were forgetting
2121         to check that a class implements an interface before saying that an implicit
2122         conversion was allowed. Use ImplementsInterface to do the checking.
2123
2124 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
2125
2126         * class.cs (Method.Define): Track whether we are an explicit
2127         implementation or not.  And only call DefineMethodOverride if we
2128         are an explicit implementation.
2129
2130         (Property.DefineMethod): Ditto.
2131
2132 2002-02-11  Ravi Pratap  <ravi@ximian.com>
2133
2134         * expression.cs (BetterFunction): Catch hideous bug which was
2135          preventing us from detecting ambiguous calls due to implicit casts i.e
2136         cs0121.
2137
2138 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
2139
2140         * support.cs (Pair): Remove un-needed method.  I figured why I was
2141         getting the error in cs-parser.jay, the variable in a foreach loop
2142         is readonly, and the compiler does not really treat this as a variable.
2143
2144         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
2145         instead of EQUALS in grammar.  
2146
2147         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
2148
2149         * expression.cs (Unary.DoResolve): Check whether the argument is
2150         managed or not.
2151
2152 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
2153
2154         * support.cs: Api for Pair to set a value.  Despite the fact that
2155         the variables are public the MS C# compiler refuses to compile
2156         code that accesses the field if the variable is part of a foreach
2157         statement. 
2158
2159         * statement.cs (Fixed): Begin implementation of the fixed
2160         statement.
2161
2162         (Block.AddVariable): Return the VariableInfo on success and null
2163         on failure instead of true/false. 
2164
2165         * cs-parser.jay (foreach): Catch errors on variables already
2166         defined (we were ignoring this value before) and properly unwind
2167         the block hierarchy
2168
2169         (fixed_statement): grammar for the fixed statement.
2170
2171 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
2172
2173         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
2174         pointer types to be incretemented.
2175
2176         (SizeOf): Implement.
2177
2178         * cs-parser.jay (pointer_member_access): Implement
2179         expr->IDENTIFIER production.
2180
2181         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
2182         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
2183         on safe contexts.
2184
2185         (Unary): Implement indirection.
2186
2187         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
2188         use in non-unsafe context).
2189
2190         (SimpleName.DoResolve): Check for pointers in field access on safe
2191         contexts. 
2192
2193         (Expression.LoadFromPtr): Factor the load-indirect code in this
2194         function.  This was duplicated in UnboxCast and ParameterReference
2195
2196 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
2197
2198         * expression.cs (ComposedCast): report an error if a pointer cast
2199         is used in a safe region.
2200
2201         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
2202         pointer type casts in unsafe context.
2203
2204         * codegen.cs (EmitContext): Set up IsUnsafe.
2205
2206         * cs-parser.jay (non_expression_type): Add productions for pointer
2207         casts. 
2208
2209         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
2210         code.  We should not use force into static mode if the method is
2211         not virtual.  Fixes bug in MIS
2212
2213         * statement.cs (Do.Emit, While.Emit, For.Emit,
2214         Statement.EmitBoolExpression): Add support to Do and While to
2215         propagate infinite loop as `I do return' semantics.
2216
2217         Improve the For case to also test for boolean constants.
2218
2219         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
2220         to the list of attributes we can add.
2221
2222         Remove `EmitContext' argument.
2223
2224         * class.cs (Method.Define): Apply parameter attributes.
2225         (Constructor.Define): Apply parameter attributes.
2226         (MethodCore.LabelParameters): Move here the core of labeling
2227         parameters. 
2228
2229         * support.cs (ReflectionParameters.ParameterModifier,
2230         InternalParameters.ParameterModifier): Use IsByRef on the type and
2231         only return the OUT bit for these parameters instead of in/out/ref
2232         flags.
2233
2234         This is because I miss-understood things.  The ParameterInfo.IsIn
2235         and IsOut represent whether the parameter has the [In] and [Out]
2236         attributes set.  
2237
2238 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
2239
2240         * ecore.cs (FieldExpr.Emit): Release temporaries.
2241
2242         * assign.cs (LocalTemporary.Release): new function.
2243
2244         * codegen.cs (EmitContext.GetTemporaryStorage,
2245         EmitContext.FreeTemporaryStorage): Rework the way we deal with
2246         temporary storage.  Now we can "put back" localbuilders when we
2247         are done with them
2248
2249 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
2250
2251         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
2252         need to make a copy of the variable to generate verifiable code.
2253
2254 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
2255
2256         * driver.cs: Compute dynamically the system directory.
2257
2258         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
2259         Slower, but more generally useful.  Used by the abstract
2260         registering implementation. 
2261
2262         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
2263         the rules for the special rule on Type/instances.  First check if
2264         we have the same name, and if so, try that special static path
2265         rather than the instance path.
2266         
2267 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
2268
2269         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
2270         for, while and if.
2271
2272         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
2273         Enum, ValueType, Delegate or Array for non-corlib compiles.
2274
2275         * cs-tokenizer.cs: Catch long identifiers (645)
2276
2277         * typemanager.cs (IndexerPropetyName): Ravi never tested this
2278         piece of code.
2279
2280         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
2281         fix, we were returning too early, so we were not registering
2282         pending methods from abstract classes.
2283
2284         Do not register pending methods if the class is abstract.
2285
2286         * expression.cs (Conditional.DoResolve): Report circular implicit
2287         conversions when we neecd to compute it for conditional
2288         expressions. 
2289
2290         (Is.DoResolve): If the expression is always of the provided type,
2291         flag warning 183.  If the expression can not ever be of the
2292         provided type flag warning 184.
2293
2294         * class.cs: Catch 169 as well.
2295
2296         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
2297         read. 
2298
2299 2002-01-18  Nick Drochak  <ndrochak@gol.com>
2300
2301         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
2302
2303 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
2304
2305         * interface.cs: (PopulateMethod): Check for pointers being defined
2306         only if the unsafe context is active.
2307         (PopulateProperty): ditto.
2308         (PopulateIndexer): ditto.
2309
2310         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
2311         specified.  If pointers are present, make sure that they are
2312         present in an unsafe context.
2313         (Constructor, Constructor.Define): ditto.
2314         (Field, Field.Define): ditto.
2315         (Property, Property.Define): ditto.
2316         (Event, Event.Define): ditto.
2317
2318         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
2319         hashtable if there are classes or structs defined.
2320
2321         * expression.cs (LocalVariableReference.DoResolve): Simplify this
2322         code, as the constant resolution moved.
2323
2324         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
2325         the metadata, so we can flag error 133. 
2326
2327         * decl.cs (MemberCore.UnsafeOK): New function to test that a
2328         pointer is being declared in an unsafe context.
2329
2330 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
2331
2332         * modifiers.cs (Modifiers.Check): Require a Location argument.
2333         Report error 227 for Unsafe use.
2334
2335         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
2336
2337         * statement.cs (For.Emit): If the test is null, then report that
2338         we do `return', as we wont reach anything afterwards.
2339
2340         (Switch.SwitchGoverningType): Track the expression that matched
2341         the conversion.
2342
2343         * driver.cs: Allow negative numbers as an error code to flag.
2344
2345         * cs-parser.jay: Handle 1551.
2346
2347         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
2348
2349 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
2350
2351         * cs-parser.jay: Report 1518 (type declaration can only contain
2352         class, struct, interface, enum or delegate)
2353
2354         (switch_label): Report 1523 (keywords `case' or `default' must
2355         preced code)
2356
2357         (opt_switch_sections): Report 1522 (empty switch)
2358
2359         * driver.cs: Report 1515 (response file specified multiple times)
2360         Report 1516 (Source file specified multiple times).
2361
2362         * expression.cs (Argument.Resolve): Signal 1510
2363
2364         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
2365         access not allowed in static code)
2366
2367 2002-01-11  Ravi Pratap  <ravi@ximian.com>
2368
2369         * typemanager.cs (IsPointerType): Utility method which we are going
2370         to need a lot.
2371
2372         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
2373         the object type, so we take care of that.
2374
2375         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
2376         
2377         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
2378         added to non-params parameters :-)
2379
2380         * typemanager.cs (CSharpName): Include 'void' type too. 
2381
2382         (void_ptr_type): Include in the set of core types.
2383
2384         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
2385         duplicating code.
2386
2387         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
2388         an unsafe context.
2389
2390         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
2391         completely forgotten about it.
2392
2393 2002-01-10  Ravi Pratap  <ravi@ximian.com>
2394
2395         * cs-parser.jay (pointer_type): Add. This begins our implementation
2396         of parsing rules for unsafe code.
2397
2398         (unsafe_statement): Implement.
2399
2400         (embedded_statement): Modify to include the above.
2401
2402         * statement.cs (Unsafe): Implement new class for unsafe blocks.
2403
2404         * codegen.cs (EmitContext.InUnsafe): Add. This determines
2405         if the current context is an unsafe one.
2406
2407         * cs-parser.jay (local_variable_pointer_type): Since local variable types
2408         are handled differently, we need separate rules for them.
2409
2410         (local_variable_declaration): Update to use local_variable_pointer_type
2411         to allow variable declarations of unmanaged pointer types.
2412
2413         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
2414         in unsafe contexts.
2415
2416         * ../errors/cs0214.cs : Add.
2417
2418 2002-01-16  Nick Drochak  <ndrochak@gol.com>
2419
2420         * makefile: remove 'response' file when cleaning.
2421
2422 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
2423
2424         * cs-parser.jay: Report 1524.
2425
2426 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
2427
2428         * typemanager.cs (RegisterMethod): drop checking if we have
2429         registered this from here
2430
2431 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
2432
2433         * class.cs (Method.EmitDestructor): Implement calling our base
2434         destructor. 
2435
2436         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
2437         value of InFinally.
2438
2439         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
2440         this routine and will wrap the call in a try/catch block.  Deal
2441         with the case.
2442
2443 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
2444
2445         * ecore.cs (Expression.MemberLookup): instead of taking a
2446         parameter `same_type' that was used to tell whether we could
2447         access private members we compute our containing type from the
2448         EmitContext.
2449
2450         (FieldExpr): Added partial support for volatile fields.  This does
2451         not work for volatile fields exposed from assemblies, as I can not
2452         figure out how to extract the modreq from it.
2453
2454         Updated all the source files to use this.
2455
2456         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
2457         because it is referenced by MemberLookup very often. 
2458
2459 2002-01-09  Ravi Pratap  <ravi@ximian.com>
2460
2461         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
2462         TypeBuilder.GetCustomAttributes to retrieve what we need.
2463
2464         Get rid of redundant default_member_attr_type as this is the same as
2465         default_member_type which already exists.
2466
2467         * interface.cs, attribute.cs : Update accordingly.
2468         
2469 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
2470
2471         * typemanager.cs: Enable IndexerPropertyName again.  It does not
2472         work for TYpeBuilders though.  Ravi, can you please fix this?
2473
2474         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
2475
2476         * expression.cs (Argument.Emit): Handle the case of ref objects
2477         being passed to ref functions;  
2478
2479         (ParameterReference.EmitLoad): Loads the content of the pointer
2480         without dereferencing.
2481
2482 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
2483
2484         * cs-tokenizer.cs: Implemented the pre-processing expressions.
2485
2486 2002-01-08  Ravi Pratap  <ravi@ximian.com>
2487
2488         * class.cs (Indexer.DefineMethod): Incorporate the interface
2489         type in the name of the method if we are doing explicit interface
2490         implementation.
2491
2492         * expression.cs (ConversionExists): Remove as it is completely obsolete.
2493
2494         (BetterConversion): Fix extremely trivial bug where we were referring to
2495         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
2496         again !
2497
2498         * ../errors/bug16.cs : Add although we have fixed it.
2499
2500 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
2501
2502         * expression.cs (BaseIndexer): Begin implementation.
2503
2504         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
2505
2506         * cs-parser.jay (indexer_declarator): Use qualified_identifier
2507         production directly to remove a shift/reduce, and implement
2508         explicit interface implementation.
2509
2510         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
2511         after a floating point suffix.
2512
2513         * expression.cs (DoNumericPromotions): Improved the conversion for
2514         uint/uint.  If we have a constant, we avoid doing a typecast to a
2515         larger type.
2516
2517         * class.cs (Indexer): Implement explicit interface implementation
2518         for indexers.
2519         
2520 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
2521
2522         * class.cs: make the default instance constructor public and hidebysig.
2523
2524 2001-01-03  Ravi Pratap  <ravi@ximian.com>
2525
2526         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
2527         so we can call it from elsewhere.
2528
2529         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
2530         we emit it internally if the class has a defined indexer; otherwise the user
2531         emits it by decorating the class definition with the DefaultMemberAttribute.
2532
2533         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
2534         attribute is not used on a type which defines an indexer.
2535
2536         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
2537         character when we skip whitespace.
2538
2539         * ../errors/cs0646.cs : Add.
2540
2541 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
2542
2543         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
2544         again. 
2545
2546         * makefile: Add practical target `mcs3.exe' which builds the third
2547         generation compiler. 
2548
2549         * expression.cs (New): Fix structures constructor calling.
2550
2551         * class.cs (Property, Method, Indexer): Emit Final flag on the
2552         method if we are an interface implementation and we are not
2553         abstract. 
2554
2555         * ecore.cs (PropertyExpr): New public field `IsBase', tells
2556         whether this property is referencing a `base' method.
2557
2558         * expression.cs (Invocation.EmitCall): take an extra argument:
2559         is_base, this is used to determine whether the `call' or
2560         `callvirt' opcode should be used.
2561
2562         
2563         * delegate.cs: update EmitCall.
2564
2565         * class.cs (Method.Define): Set NewSlot for the cases where we are
2566         not implementing an interface method.
2567
2568         (Property.Define): ditto.
2569
2570 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
2571
2572         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
2573         'r'.  Allows mcs to parse itself fully.
2574
2575 2002-01-02  Ravi Pratap  <ravi@ximian.com>
2576
2577         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
2578         of the number of initializers that require the InitializeArray method.
2579
2580         (CheckIndices): Store the Expression in all cases - not the plain value. Also
2581         update the above field where necessary.
2582
2583         (MakeByteBlob): Update accordingly.
2584
2585         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
2586         greater than 2.
2587
2588         (EmitDynamicInitializers): Update in accordance with the new optimization.
2589
2590         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
2591         same OpCode applies.
2592
2593         * cs-parser.jay : Fix some glaring errors I introduced.
2594
2595 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
2596
2597         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
2598         so that we can check for name clashes there too.
2599
2600         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
2601         for interface indexers.
2602
2603         * interfaces.cs (Define): Emit the default member attribute.
2604
2605         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
2606         variable was being referred to while setting the value ;-)
2607
2608 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
2609
2610         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
2611         byte-by-byte information when we know the data is zero.
2612
2613         Make the block always a multiple of 4, because
2614         DefineInitializedData has a bug.
2615
2616         * assign.cs: Fix, we should assign from the temporary, not from
2617         the source. 
2618
2619         * expression.cs (MakeByteBlob): Fix my incorrect code.
2620
2621 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
2622
2623         * typemanager.cs (EnumToUnderlying): This function is used to get
2624         the underlying type from an enumeration, because it does not
2625         always work. 
2626
2627         * constant.cs: Use the I4_S form for values between -128 and 127.
2628
2629         * statement.cs (Block.LookupLabel): Looks up a label.
2630         (Block): Drop support for labeled blocks.
2631
2632         (LabeledStatement): New kind of statement that represents a label
2633         only.
2634
2635         (Goto): Finally implement this bad boy.
2636         
2637         * cs-parser.jay: Update to reflect new mechanism to implement
2638         labels.
2639
2640 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
2641
2642         * codegen.cs (EmitContext.This): a codegen property that keeps the
2643         a single instance of this instead of creating many different this
2644         instances. 
2645
2646         * delegate.cs (Delegate.DoResolve): Update to use the property;
2647
2648         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
2649
2650         * expression.cs (BaseAccess.DoResolve): Ditto.
2651
2652 2001-12-29  Ravi Pratap  <ravi@ximian.com>
2653
2654         * typemanager.cs (methodimpl_attr_type): Add to hold the type
2655         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
2656
2657         (InitCoreTypes): Update accordingly.
2658
2659         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
2660         so we can quickly store the state.
2661
2662         (ApplyAttributes): Set the correct implementation flags
2663         for InternalCall methods.
2664
2665 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
2666
2667         * expression.cs (EmitCall): if a method is not virtual, then do
2668         not use callvirt on it.
2669
2670         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
2671         user defined stuff) requires the use of stobj, which takes an
2672         address on the stack instead of an array and an index.  So emit
2673         the Ldelema operation for it.
2674
2675         (EmitStoreOpcode): Use stobj for valuetypes.
2676
2677         (UnaryMutator.EmitCode): Use the right 1 value depending on
2678         whether we are dealing with int64/uint64, float or doubles.
2679
2680         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
2681         constructors that I implemented last night.
2682
2683         (Constructor.IsDefault): Fix to work properly for static
2684         constructors.
2685
2686         * cs-parser.jay (CheckDef): report method signature errors.
2687         Update error number 103 to be 132.
2688
2689         * decl.cs: New AdditionResult enumeration value: MethodExists.
2690         Although we do this check for methods later on in the semantic
2691         analysis, catching repeated default constructors is so easy that
2692         we catch these here. 
2693         
2694         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
2695         promotions code.
2696
2697         (ParameterReference.EmitAssign, Emit): handle
2698         bools as bytes.
2699
2700         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
2701         (ArrayAccess.EmitStoreOpcode): ditto.
2702
2703         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
2704
2705         * expression.cs (MakeByteBlob): Complete all the missing types
2706         (uint, short, ushort, byte, sbyte)
2707
2708         * class.cs: Only init instance field initializers on instance
2709         constructors. 
2710
2711         Rename `constructors' to instance_constructors. 
2712
2713         (TypeContainer.AddConstructor): Only add constructors to the list
2714         if it is not static.
2715
2716         Make sure that we handle default_static_constructor independently
2717         everywhere where we handle instance_constructors
2718
2719 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
2720
2721         * class.cs: Do not lookup or create a base initializer for a
2722         static constructor.
2723
2724         (ConstructorInitializer.Resolve): use the proper type to lookup
2725         for constructors.
2726
2727         * cs-parser.jay: Report error 1585 (modifiers between type and name).
2728
2729         * enum.cs, interface.cs: Remove CloseType, this is taken care by
2730         in DeclSpace. 
2731
2732         * decl.cs: CloseType is now an virtual method, the default
2733         implementation just closes this type.
2734         
2735 2001-12-28  Ravi Pratap  <ravi@ximian.com>
2736
2737         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
2738         to PreserveSig by default. Also emit HideBySig on such methods.
2739
2740         Basically, set the defaults to standard values.
2741
2742         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
2743         argument, if candidate is better, it can't be worse than the best !
2744
2745         (Invocation): Re-write bits to differentiate between methods being
2746         applicable in their expanded form and their normal form - for params
2747         methods of course.
2748
2749         Get rid of use_standard everywhere as only standard conversions are allowed
2750         in overload resolution. 
2751
2752         More spec conformance.
2753         
2754 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
2755
2756         * driver.cs: Add --timestamp, to see where the compiler spends
2757         most of its time.
2758
2759         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
2760         `this' in static code.
2761
2762         (SimpleName.DoResolve): Implement in terms of a helper function
2763         that allows static-references to be passed upstream to
2764         MemberAccess.
2765
2766         (Expression.ResolveWithSimpleName): Resolve specially simple
2767         names when called by MemberAccess to implement the special
2768         semantics. 
2769
2770         (Expression.ImplicitReferenceConversion): Handle conversions from
2771         Null to reference types before others, as Null's type is
2772         System.Object. 
2773
2774         * expression.cs (Invocation.EmitCall): Handle the special case of
2775         calling methods declared on a reference type from a ValueType
2776         (Base classes System.Object and System.Enum)
2777
2778         (MemberAccess.Resolve): Only perform lookups on Enumerations if
2779         the left hand side is a TypeExpr, not on every enumeration. 
2780
2781         (Binary.Resolve): If types are reference types, then do a cast to
2782         object on operators != and == of both arguments.
2783         
2784         * typemanager.cs (FindMembers): Extract instance and static
2785         members if requested.
2786
2787         * interface.cs (PopulateProperty): Use void_type instead of null
2788         as the return type for the setter method.
2789
2790         (PopulateIndexer): ditto.
2791
2792 2001-12-27  Ravi Pratap  <ravi@ximian.com>
2793
2794         * support.cs (ReflectionParameters): Fix minor bug where we
2795         were examining the wrong parameter for the ParamArray attribute.
2796
2797         Cope with requests for the type of the parameter at position
2798         greater than the params parameter's. We now return the element
2799         type of the params array as that makes more sense.
2800
2801         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
2802         accordingly as we no longer have to extract the element type
2803         ourselves.
2804
2805         (Invocation.OverloadResolve): Update.
2806
2807 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
2808
2809         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
2810         against IEnumerator, test whether the return value is a descendant
2811         of the IEnumerator interface.
2812
2813         * class.cs (Indexer.Define): Use an auxiliary method to implement
2814         the other bits of the method definition.  Begin support for
2815         explicit interface implementation.
2816
2817         (Property.DefineMethod): Use TypeManager.void_type instead of null
2818         for an empty return value.
2819
2820 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
2821
2822         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
2823         dealing with a FieldExpr which is composed of a FieldBuilder, in
2824         the code path we did extract the constant, but we should have
2825         obtained the underlying value to be able to cast it (otherwise we
2826         end up in an infinite loop, this is what Ravi was running into).
2827
2828         (ArrayCreation.UpdateIndices): Arrays might be empty.
2829
2830         (MemberAccess.ResolveMemberAccess): Add support for section
2831         14.5.4.1 that deals with the special case of E.I when E is a type
2832         and something else, that I can be a reference to a static member.
2833
2834         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
2835         handle a particular array type to create byte blobs, it is just
2836         something we dont generate byteblobs for.
2837
2838         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
2839         arguments. 
2840
2841         * location.cs (Push): remove the key from the hashtable that we
2842         are about to add.   This happens for empty files.
2843
2844         * driver.cs: Dispose files after we have parsed them.
2845
2846         (tokenize): new function that only runs the tokenizer on its
2847         input, for speed testing.
2848
2849 2001-12-26  Ravi Pratap  <ravi@ximian.com>
2850
2851         * class.cs (Event.Define): Define the private field only if there
2852         are no accessors defined.
2853
2854         * expression.cs (ResolveMemberAccess): If there is no associated
2855         field with the event, that means we have an event defined with its
2856         own accessors and we should flag error cs0070 since transforming
2857         ourselves into a field is not valid in that case.
2858
2859         * ecore.cs (SimpleName.DoResolve): Same as above.
2860
2861         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
2862         and charset to sane values.
2863
2864 2001-12-25  Ravi Pratap  <ravi@ximian.com>
2865
2866         * assign.cs (DoResolve): Perform check on events only if they 
2867         are being accessed outside the declaring type.
2868
2869         * cs-parser.jay (event_declarations): Update rules to correctly
2870         set the type of the implicit parameter etc.
2871
2872         (add_accessor, remove_accessor): Set current local parameters.
2873
2874         * expression.cs (Binary): For delegate addition and subtraction,
2875         cast the return value from the method into the appropriate delegate
2876         type.
2877
2878 2001-12-24  Ravi Pratap  <ravi@ximian.com>
2879
2880         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
2881         of these as the workaround is unnecessary.
2882
2883         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
2884         delegate data - none of that is needed at all.
2885
2886         Re-write bits to extract the instance expression and the delegate method
2887         correctly.
2888
2889         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
2890         on delegates too.
2891
2892         * attribute.cs (ApplyAttributes): New method to take care of common tasks
2893         of attaching attributes instead of duplicating code everywhere.
2894
2895         * everywhere : Update code to do attribute emission using the above method.
2896
2897 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
2898
2899         * expression.cs (IsParamsMethodApplicable): if there are not
2900         parameters, return immediately.
2901
2902         * ecore.cs: The 0 literal can be implicity converted to an enum
2903         type. 
2904
2905         (SimpleName.DoResolve): First lookup the type, then lookup the
2906         members. 
2907
2908         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
2909         want to get its address.  If the InstanceExpression is not
2910         addressable, store the result in a temporary variable, then get
2911         the address of it.
2912
2913         * codegen.cs: Only display 219 errors on warning level or above. 
2914
2915         * expression.cs (ArrayAccess): Make it implement the
2916         IMemoryLocation interface.
2917
2918         (Binary.DoResolve): handle the operator == (object a, object b)
2919         and operator != (object a, object b) without incurring into a
2920         BoxedCast (because 5 != o should never be performed).
2921
2922         Handle binary enumerator operators.
2923
2924         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
2925         value type, otherwise use Ldelem_ref.
2926
2927         Use precomputed names;
2928
2929         (AddressOf): Implement address of
2930
2931         * cs-parser.jay (labeled_statement): Fix recursive block
2932         addition by reworking the production.
2933
2934         * expression.cs (New.DoEmit): New has a special case:
2935                 
2936                  If we are dealing with a ValueType, we have a few
2937                  situations to deal with:
2938                 
2939                     * The target of New is a ValueType variable, that is
2940                       easy, we just pass this as the variable reference
2941                 
2942                     * The target of New is being passed as an argument,
2943                       to a boxing operation or a function that takes a
2944                       ValueType.
2945                 
2946                       In this case, we need to create a temporary variable
2947                       that is the argument of New.
2948
2949
2950 2001-12-23  Ravi Pratap  <ravi@ximian.com>
2951
2952         * rootcontext.cs (LookupType): Check that current_type is not null before
2953         going about looking at nested types.
2954
2955         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
2956         not implement the IAssignMethod interface any more.
2957
2958         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
2959         where we tranform them into FieldExprs if they are being resolved from within
2960         the declaring type.
2961
2962         * ecore.cs (SimpleName.DoResolve): Do the same here.
2963
2964         * assign.cs (DoResolve, Emit): Clean up code considerably. 
2965
2966         * ../errors/bug10.cs : Add.
2967
2968         * ../errors/cs0070.cs : Add.
2969
2970         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
2971
2972         * assign.cs : Get rid of EventIsLocal everywhere.
2973         
2974 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
2975
2976         * ecore.cs (ConvertIntLiteral): finished the implementation.
2977
2978         * statement.cs (SwitchLabel): Convert the value we are using as a
2979         key before looking up the table.
2980
2981 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
2982
2983         * codegen.cs (EmitTopBlock): Require a Location argument now.
2984
2985         * cs-parser.jay (constructor_declarator): We need to setup
2986         current_local_parameters before we parse the
2987         opt_constructor_initializer, to allow the variables to be bound
2988         to the constructor arguments.
2989
2990         * rootcontext.cs (LookupType): First lookup nested classes in our
2991         class and our parents before we go looking outside our class.
2992
2993         * expression.cs (ConstantFold): Extract/debox the values at the
2994         beginnning. 
2995
2996         * rootcontext.cs (EmitCode): Resolve the constants first before we
2997         resolve the types.  This is not really needed, but it helps debugging.
2998
2999         * statement.cs: report location.
3000         
3001         * cs-parser.jay: pass location to throw statement.
3002
3003         * driver.cs: Small bug fix.
3004
3005         * report.cs: Updated format to be 4-zero filled digits.
3006
3007 2001-12-22  Ravi Pratap  <ravi@ximian.com>
3008
3009         * expression.cs (CheckIndices): Fix minor bug where the wrong
3010         variable was being referred to ;-)
3011
3012         (DoEmit): Do not call EmitStaticInitializers when the 
3013         underlying type is System.Object.
3014
3015 2001-12-21  Ravi Pratap  <ravi@ximian.com>
3016
3017         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
3018         and do the usual workaround for SRE.
3019
3020         * class.cs (MyEventBuilder.EventType): New member to get at the type
3021         of the event, quickly.
3022
3023         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
3024
3025         * assign.cs (Assign.DoResolve): Handle the case when the target
3026         is an EventExpr and perform the necessary checks.
3027
3028         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
3029         interface.
3030
3031         (SimpleName.MemberStaticCheck): Include check for EventExpr.
3032
3033         (EventExpr): Set the type in the constructor itself since we 
3034         are meant to be born fully resolved.
3035
3036         (EventExpr.Define): Revert code I wrote earlier.
3037                 
3038         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
3039         instance expression is null. The instance expression is a This in that case
3040         or a null, depending on whether it is a static method or not.
3041
3042         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
3043         refers to more than one method.
3044
3045         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
3046         and accordingly flag errors.
3047
3048 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
3049
3050         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
3051
3052 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
3053
3054         * location.cs (ToString): Provide useful rutine.
3055
3056 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
3057
3058         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
3059         objects, return the actual integral boxed.
3060
3061         * statement.cs (SwitchLabel): define an ILLabel for each
3062         SwitchLabel. 
3063         
3064         (Switch.CheckSwitch): If the value is a Literal, extract
3065         the underlying literal.
3066         
3067         Also in the unused hashtable we had, add the SwitchLabel so we can
3068         quickly look this value up.
3069
3070         * constant.cs: Implement a bunch of new constants.  Rewrite
3071         Literal based on this.  Made changes everywhere to adapt to this.
3072         
3073         * expression.cs (Expression.MakeByteBlob): Optimize routine by
3074         dereferencing array only once, and also copes with enumrations.
3075
3076         bytes are two bytes wide, not one.
3077
3078         (Cast): Perform constant conversions.
3079         
3080         * ecore.cs (TryImplicitIntConversion): Return literals instead of
3081         wrappers to the literals here.
3082
3083         * expression.cs (DoNumericPromotions): long literals can converted
3084         to ulong implicity (this is taken care of elsewhere, but I was
3085         missing this spot).
3086
3087         * ecore.cs (Expression.Literalize): Make the return type Literal,
3088         to improve type checking.
3089
3090         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
3091
3092 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
3093
3094         * literal.cs: Revert code from ravi that checked the bounds.  The
3095         bounds are sane by the definition of the type itself. 
3096
3097         * typemanager.cs: Fix implementation of ImplementsInterface.  We
3098         need to actually look up in our parent hierarchy for interfaces
3099         implemented. 
3100
3101         * const.cs: Use the underlying type for enumerations
3102
3103         * delegate.cs: Compute the basename for the delegate creation,
3104         that should fix the delegate test case, and restore the correct
3105         Type Lookup semantics in rootcontext
3106
3107         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
3108         referencing a nested type with the Reflection API is using the "+"
3109         sign. 
3110
3111         * cs-parser.jay: Do not require EOF token at the end.
3112
3113 2001-12-20  Ravi Pratap  <ravi@ximian.com>
3114
3115         * rootcontext.cs (LookupType): Concatenate type names with
3116         a '.' instead of a '+' The test suite passes again.
3117
3118         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
3119         field of the enumeration.
3120
3121         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
3122         the case when the member is an EventExpr.
3123
3124         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
3125         static has an associated instance expression.
3126
3127         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
3128
3129         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
3130
3131         * class.cs (Event.Define): Register event and perform appropriate checks
3132         for error #111.
3133
3134         We define the Add and Remove methods even if the use provides none because
3135         in that case, we provide default implementations ourselves.
3136
3137         Define a private field of the type of the event. This is done by the CSC compiler
3138         and we should be doing it too ;-)
3139
3140         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
3141         More methods we use in code we generate.
3142
3143         (multicast_delegate_type, delegate_type): Two separate types since the distinction
3144         is important.
3145
3146         (InitCoreTypes): Update accordingly for the above.
3147
3148         * class.cs (Event.Emit): Generate code for default accessors that we provide
3149
3150         (EmitDefaultMethod): Do the job in the above.
3151
3152         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
3153         appropriate place.
3154
3155 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
3156
3157         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
3158         builders even if we were missing one.
3159
3160         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
3161         pass the Basename as our class name instead of the Name.  The
3162         basename will be correctly composed for us.
3163
3164         * parameter.cs (Paramters): Now takes a Location argument.
3165
3166         * decl.cs (DeclSpace.LookupType): Removed convenience function and
3167         make all the code call directly LookupType in RootContext and take
3168         this chance to pass the Location information everywhere.
3169
3170         * Everywhere: pass Location information.
3171
3172 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
3173
3174         * class.cs (Constructor.Define): Updated way of detecting the
3175         length of the parameters.
3176
3177         (TypeContainer.DefineType): Use basename as the type name for
3178         nested types.
3179
3180         (TypeContainer.Define): Do not recursively define types here, as
3181         definition is taken care in order by the RootContext.
3182
3183         * tree.cs: Keep track of namespaces in a per-file basis.
3184
3185         * parameter.cs (Parameter.ComputeSignature): Update to use
3186         DeclSpace. 
3187
3188         (Parameters.GetSignature): ditto.
3189
3190         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
3191         instead of a TypeContainer.
3192
3193         (Interface.SemanticAnalysis): Use `this' instead of our parent to
3194         resolve names.  Because we need to be resolve in our context, not
3195         our parents.
3196         
3197         * driver.cs: Implement response files.
3198
3199         * class.cs (TypeContainer.DefineType): If we are defined, do not
3200         redefine ourselves.
3201         
3202         (Event.Emit): Emit the code for add/remove handlers.
3203         (Event.Define): Save the MethodBuilders for add/remove.
3204
3205         * typemanager.cs: Use pair here too.
3206
3207         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
3208         DictionaryEntry requires the first argument to be non-null.  
3209         
3210         (enum_declaration): Compute full name for registering the
3211         enumeration.
3212         
3213         (delegate_declaration): Instead of using
3214         formal_parameter_list, use opt_formal_parameter_list as the list
3215         can be empty.
3216
3217         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
3218         (EventParsing): New property that controls whether `add' and
3219         `remove' are returned as tokens or identifiers (for events);
3220
3221 2001-12-19  Ravi Pratap  <ravi@ximian.com>
3222
3223         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
3224         use MyEventBuilder only and let it wrap the real builder for us.
3225
3226         (MyEventBuilder): Revamp constructor etc.
3227
3228         Implement all operations that we perform on EventBuilder in precisely the same
3229         way here too.
3230
3231         (FindMembers): Update to use the EventBuilder member.
3232
3233         (Event.Emit): Update accordingly.
3234
3235 2001-12-18  Ravi Pratap  <ravi@ximian.com>
3236
3237         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
3238         by calling the appropriate methods.
3239
3240         (GetCustomAttributes): Make stubs as they cannot possibly do anything
3241         useful.
3242
3243         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
3244
3245 2001-12-17  Ravi Pratap  <ravi@ximian.com>
3246
3247         * delegate.cs (Delegate.Populate): Check that the return type
3248         and various parameters types are indeed accessible.
3249
3250         * class.cs (Constructor.Define): Same here.
3251
3252         (Field.Define): Ditto.
3253
3254         (Event.Define): Ditto.
3255
3256         (Operator.Define): Check that the underlying Method defined itself
3257         correctly - so it's MethodBuilder should not be null.
3258
3259         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
3260         expression happens to be null.
3261
3262         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
3263         members but as of now we don't seem to be able to do anything really useful with it.
3264
3265         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
3266         not the EventBuilder.
3267
3268 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
3269
3270         * cs-tokenizer.cs: Add support for defines.
3271         Add support for #if, #elif, #else, #endif
3272         
3273         (eval_var): evaluates a variable.
3274         (eval): stubbed for evaluating functions.
3275
3276         * cs-parser.jay: Pass the defines information
3277
3278         * driver.cs: Add --define command line option.
3279
3280         * decl.cs: Move MemberCore here.
3281
3282         Make it the base class for DeclSpace.  This allows us to catch and
3283         report 108 and 109 for everything now.
3284
3285         * class.cs (TypeContainer.Define): Extract all the members
3286         before populating and emit the warning 108 (new keyword required
3287         to override) instead of having each member implement this.
3288
3289         (MemberCore.Define): New abstract method, we will be using this in
3290         the warning reporting engine in Populate.
3291         
3292         (Operator.Define): Adjust to new MemberCore protocol. 
3293
3294         * const.cs (Const): This does not derive from Expression, it is a
3295         temporary object we use to create fields, it is a MemberCore. 
3296
3297         * class.cs (Method.Define): Allow the entry point to be in a
3298         specific class.
3299
3300         * driver.cs: Rewrite the argument handler to clean it up a bit.
3301
3302         * rootcontext.cs: Made it just an auxiliary namespace feature by
3303         making everything static.
3304
3305         * driver.cs: Adapt code to use RootContext type name instead of
3306         instance variable.
3307
3308         * delegate.cs: Remove RootContext argument.
3309
3310         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
3311         argument. 
3312
3313         * class.cs (Event.Define): The lookup can fail.
3314         
3315         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
3316
3317         * expression.cs: Resolve the this instance before invoking the code.
3318
3319 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
3320
3321         * cs-parser.jay: Add a production in element_access that allows
3322         the thing to become a "type" reference.  This way we can parse
3323         things like "(string [])" as a type.
3324
3325         Note that this still does not handle the more complex rules of
3326         casts. 
3327         
3328
3329         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
3330
3331         * ecore.cs: (CopyNewMethods): new utility function used to
3332         assemble the list of methods from running FindMembers.
3333
3334         (MemberLookup): Rework FindMembers so that 
3335
3336 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
3337
3338         * class.cs (TypeContainer): Remove Delegates who fail to be
3339         defined.
3340
3341         * delegate.cs (Populate): Verify that we dont get null return
3342         values.   TODO: Check for AsAccessible.
3343
3344         * cs-parser.jay: Use basename to emit error 574 (destructor should
3345         have the same name as container class), not the full name.
3346
3347         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
3348         possible representation.  
3349
3350         Also implements integer type suffixes U and L.
3351
3352 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
3353
3354         * expression.cs (ArrayCreation.DoResolve): We need to do the
3355         argument resolution *always*.
3356
3357         * decl.cs: Make this hold the namespace.  Hold the root context as
3358         well.
3359         (LookupType): Move here.
3360
3361         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
3362
3363         * location.cs (Row, Name): Fixed the code, it was always returning
3364         references to the first file.
3365
3366         * interface.cs: Register properties defined through interfaces.
3367
3368         * driver.cs: Add support for globbing on the command line
3369
3370         * class.cs (Field): Make it derive from MemberCore as well.
3371         (Event): ditto.
3372
3373 2001-12-15  Ravi Pratap  <ravi@ximian.com>
3374
3375         * class.cs (Event::Define): Check that the type of the event is a delegate
3376         type else flag error #66.
3377
3378         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
3379         same.
3380
3381         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
3382         values of EntryPoint, CharSet etc etc.
3383
3384         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
3385
3386         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
3387         be null and we should ignore this. I am not sure if this is really clean. Apparently,
3388         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
3389         which needs this to do its work.
3390
3391         * ../errors/cs0066.cs : Add.
3392
3393 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
3394
3395         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
3396         helper functions.
3397
3398         * class.cs: (MethodSignature.MethodSignature): Removed hack that
3399         clears out the parameters field.
3400         (MemberSignatureCompare): Cleanup
3401
3402         (MemberCore): New base class used to share code between MethodCore
3403         and Property.
3404
3405         (RegisterRequiredImplementations) BindingFlags.Public requires
3406         either BindingFlags.Instace or Static.  Use instance here.
3407
3408         (Property): Refactored code to cope better with the full spec.
3409
3410         * parameter.cs (GetParameterInfo): Return an empty array instead
3411         of null on error.
3412
3413         * class.cs (Property): Abstract or extern properties have no bodies.
3414
3415         * parameter.cs (GetParameterInfo): return a zero-sized array.
3416
3417         * class.cs (TypeContainer.MethodModifiersValid): Move all the
3418         method modifier validation to the typecontainer so we can reuse
3419         this on properties.
3420
3421         (MethodCore.ParameterTypes): return an empty sized array of types.
3422
3423         (Property.Define): Test property modifier validity.
3424
3425         Add tests for sealed/override too.
3426
3427         (Method.Emit): abstract or extern methods have no bodies.
3428
3429 2001-12-14  Ravi Pratap  <ravi@ximian.com>
3430
3431         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
3432         thing.
3433
3434         (Method::Define, ::Emit): Modify accordingly.
3435
3436         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
3437
3438         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
3439
3440         * makefile: Pass in /unsafe.
3441
3442 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
3443
3444         * class.cs (MakeKey): Kill routine.
3445         
3446         * class.cs (TypeContainer.Define): Correctly define explicit
3447         method implementations (they require the full interface name plus
3448         the method name).
3449
3450         * typemanager.cs: Deply the PtrHashtable here and stop using the
3451         lame keys.  Things work so much better.
3452
3453         This of course broke everyone who depended on `RegisterMethod' to
3454         do the `test for existance' test.  This has to be done elsewhere.
3455
3456         * support.cs (PtrHashtable): A hashtable that avoid comparing with
3457         the object stupid Equals method (because, that like fails all over
3458         the place).  We still do not use it.
3459
3460         * class.cs (TypeContainer.SetRequiredInterface,
3461         TypeContainer.RequireMethods): Killed these two routines and moved
3462         all the functionality to RegisterRequiredImplementations.
3463
3464         (TypeContainer.RegisterRequiredImplementations): This routine now
3465         registers all the implementations required in an array for the
3466         interfaces and abstract methods.  We use an array of structures
3467         which can be computed ahead of time to reduce memory usage and we
3468         also assume that lookups are cheap as most classes will not
3469         implement too many interfaces.
3470
3471         We also avoid creating too many MethodSignatures.
3472
3473         (TypeContainer.IsInterfaceMethod): Update and optionally does not
3474         clear the "pending" bit if we find that there are problems with
3475         the declaration.
3476
3477         (TypeContainer.VerifyPendingMethods): Update to report errors of
3478         methods that look like implementations but are not.
3479
3480         (TypeContainer.Define): Add support for explicit interface method
3481         implementation. 
3482         
3483 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
3484
3485         * typemanager.cs: Keep track of the parameters here instead of
3486         being a feature of the TypeContainer.
3487
3488         * class.cs: Drop the registration of parameters here, as
3489         InterfaceMethods are also interface declarations.
3490
3491         * delegate.cs: Register methods with the TypeManager not only with
3492         the TypeContainer.  This code was buggy.
3493
3494         * interface.cs: Full registation here.
3495
3496 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
3497
3498         * expression.cs: Remove reducer for binary expressions, it can not
3499         be done this way.
3500
3501         * const.cs: Put here the code that used to go into constant.cs
3502
3503         * constant.cs: Put here the code for constants, this is a new base
3504         class for Literals.
3505
3506         * literal.cs: Make Literal derive from Constant.
3507
3508 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
3509
3510         * statement.cs (Return.Emit): Report error 157 if the user
3511         attempts to return from a finally block.
3512
3513         (Return.Emit): Instead of emitting a return, jump to the end of
3514         the function.
3515
3516         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
3517         LocalBuilder to store the result of the function.  ReturnLabel is
3518         the target where we jump.
3519         
3520
3521 2001-12-09  Radek Doulik  <rodo@ximian.com>
3522
3523         * cs-parser.jay: remember alias in current namespace
3524
3525         * ecore.cs (SimpleName::DoResolve): use aliases for types or
3526         namespaces
3527
3528         * class.cs (LookupAlias): lookup alias in my_namespace
3529
3530         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
3531         aliases hashtable
3532         (LookupAlias): lookup alias in this and if needed in parent
3533         namespaces
3534
3535 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
3536
3537         * support.cs: 
3538
3539         * rootcontext.cs: (ModuleBuilder) Made static, first step into
3540         making things static.  I need this to avoid passing the
3541         TypeContainer when calling ParameterType.
3542
3543         * support.cs (InternalParameters.ParameterType): Remove ugly hack
3544         that did string manipulation to compute the type and then call
3545         GetType.  Use Parameter.ParameterType instead.
3546
3547         * cs-tokenizer.cs: Consume the suffix for floating values.
3548
3549         * expression.cs (ParameterReference): figure out whether this is a
3550         reference parameter or not.  Kill an extra variable by computing
3551         the arg_idx during emission.
3552
3553         * parameter.cs (Parameters.GetParameterInfo): New overloaded
3554         function that returns whether a parameter is an out/ref value or not.
3555
3556         (Parameter.ParameterType): The type of the parameter (base,
3557         without ref/out applied).
3558         
3559         (Parameter.Resolve): Perform resolution here.
3560         (Parameter.ExternalType): The full type (with ref/out applied).
3561
3562         * statement.cs (Using.Emit, Using.EmitExpression): Implement
3563         support for expressions on the using statement.
3564
3565 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
3566
3567         * statement.cs (Using.EmitLocalVariableDecls): Split the
3568         localvariable handling of the using statement.
3569
3570         (Block.EmitMeta): Keep track of variable count across blocks.  We
3571         were reusing slots on separate branches of blocks.
3572
3573         (Try.Emit): Emit the general code block, we were not emitting it. 
3574
3575         Check the type of the declaration to be an IDisposable or
3576         something that can be implicity converted to it. 
3577
3578         Emit conversions if required.
3579
3580         * ecore.cs (EmptyExpression): New utility class.
3581         (Expression.ImplicitConversionExists): New utility function.
3582
3583 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
3584
3585         * statement.cs (Using): Implement.
3586
3587         * expression.cs (LocalVariableReference): Support read only variables.
3588
3589         * statement.cs: Remove the explicit emit for the Leave opcode.
3590         (VariableInfo): Add a readonly field.
3591
3592 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
3593
3594         * ecore.cs (ConvCast): new class used to encapsulate the various
3595         explicit integer conversions that works in both checked and
3596         unchecked contexts.
3597
3598         (Expression.ConvertNumericExplicit): Use new ConvCast class to
3599         properly generate the overflow opcodes.
3600
3601 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
3602
3603         * statement.cs: The correct type for the EmptyExpression is the
3604         element_type, not the variable type.  Ravi pointed this out.
3605
3606 2001-12-04  Ravi Pratap  <ravi@ximian.com>
3607
3608         * class.cs (Method::Define): Handle PInvoke methods specially
3609         by using DefinePInvokeMethod instead of the usual one.
3610
3611         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
3612         above to do the task of extracting information and defining the method.
3613         
3614 2001-12-04  Ravi Pratap  <ravi@ximian.com>
3615
3616         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
3617         of the condition for string type.
3618
3619         (Emit): Move that here. 
3620
3621         (ArrayCreation::CheckIndices): Keep string literals in their expression
3622         form.
3623
3624         (EmitDynamicInitializers): Handle strings appropriately.
3625
3626 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
3627
3628         * codegen.cs (EmitContext): Replace multiple variables with a
3629         single pointer to the current Switch statement.
3630
3631         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
3632         EmitContext.
3633
3634 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
3635
3636         * statement.cs 
3637
3638         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
3639         default'.
3640         
3641         (Foreach.Emit): Foreach on arrays was not setting
3642         up the loop variables (for break/continue).
3643
3644         (GotoCase): Semi-implented.
3645         
3646 2001-12-03  Ravi Pratap  <ravi@ximian.com>
3647
3648         * attribute.cs (CheckAttribute): Handle system attributes by using
3649         Attribute.GetAttributes to examine information we need.
3650
3651         (GetValidPlaces): Same here.
3652
3653         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
3654
3655         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
3656
3657         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
3658
3659         (Method::Define): Set appropriate flags if we have a DllImport attribute.
3660
3661         (Method::Emit): Handle the case when we are a PInvoke method.
3662
3663 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
3664
3665         * expression.cs: Use ResolveWithSimpleName on compound names.
3666
3667 2001-12-02  Ravi Pratap  <ravi@ximian.com>
3668
3669         * constant.cs (EmitConstant): Make sure we resolve the associated expression
3670         before trying to reduce it.
3671
3672         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
3673
3674         * constant.cs (LookupConstantValue): Implement.
3675
3676         (EmitConstant): Use the above in emitting the constant.
3677
3678         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
3679         that are user-defined by doing a LookupConstantValue on them.
3680
3681         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
3682         too, like above.
3683
3684 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
3685
3686         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
3687
3688         (BaseAccess.DoResolve): Implement.
3689
3690         (MemberAccess.DoResolve): Split this routine into a
3691         ResolveMemberAccess routine that can be used independently
3692
3693 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
3694
3695         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
3696         As that share bits of the implementation.  Is returns a boolean,
3697         while As returns the Type that is being probed.
3698
3699 2001-12-01  Ravi Pratap  <ravi@ximian.com>
3700
3701         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
3702         instead of a Literal - much easier.
3703
3704         (EnumInTransit): Remove - utterly useless :-)
3705
3706         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
3707
3708         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
3709
3710         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
3711         chain when we have no associated expression.
3712
3713 2001-11-30  Ravi Pratap  <ravi@ximian.com>
3714
3715         * constant.cs (Define): Use Location while reporting the errror.
3716
3717         Also emit a warning when 'new' is used and there is no inherited
3718         member to hide.
3719
3720         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
3721         populated.
3722
3723         (LookupEnumValue): Implement to lookup an enum member's value and define it
3724         if necessary.
3725
3726         (Populate): Re-write accordingly to use the above routine.
3727
3728 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
3729
3730         * expression.cs (This): Fix prototype for DoResolveLValue to
3731         override the base class DoResolveLValue.
3732
3733         * cs-parser.cs: Report errors cs574 and cs575 (destructor
3734         declarations) 
3735
3736         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
3737         (we need to load the address of the field here).  This fixes
3738         test-22. 
3739         
3740         (FieldExpr.DoResolveLValue): Call the DoResolve
3741         function to initialize the Instance expression.
3742         
3743         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
3744         correctly the GetEnumerator operation on a value type.
3745
3746         * cs-parser.jay: Add more simple parsing error catches.
3747
3748         * statement.cs (Switch): Add support for string switches.
3749         Handle null specially.
3750
3751         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
3752
3753 2001-11-28  Ravi Pratap  <ravi@ximian.com>
3754
3755         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
3756
3757         (declare_local_constant): New helper function.
3758
3759         * statement.cs (AddConstant): Keep a separate record of constants
3760
3761         (IsConstant): Implement to determine if a variable is a constant.
3762
3763         (GetConstantExpression): Implement.
3764
3765         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
3766
3767         * statement.cs (IsVariableDefined): Re-write.
3768
3769 2001-11-27  Ravi Pratap  <ravi@ximian.com>
3770
3771         * class.cs (TypeContainer::FindMembers): Look for constants
3772         in the case when we are looking for MemberTypes.Field
3773
3774         * expression.cs (MemberAccess::DoResolve): Check that in the
3775         case we are a FieldExpr and a Literal, we are not being accessed
3776         by an instance reference.
3777
3778         * cs-parser.jay (local_constant_declaration): Implement.
3779
3780         (declaration_statement): Implement for constant declarations.
3781
3782 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
3783
3784         * statement.cs (Switch): Catch double defaults.
3785
3786         (Switch): More work on the switch() statement
3787         implementation.  It works for integral values now, need to finish
3788         string support.
3789
3790
3791 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
3792
3793         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
3794         integer literals into other integer literals.  To be used by
3795         switch. 
3796
3797 2001-11-24  Ravi Pratap  <ravi@ximian.com>
3798
3799         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
3800         some memory.
3801
3802         (EmitDynamicInitializers): Cope with the above since we extract data
3803         directly from ArrayData now.
3804
3805         (ExpectInitializers): Keep track of whether initializers are mandatory
3806         or not.
3807
3808         (Bounds): Make it a hashtable to prevent the same dimension being 
3809         recorded for every element in that dimension.
3810
3811         (EmitDynamicInitializers): Fix bug which prevented the Set array method
3812         from being found.
3813
3814         Also fix bug which was causing the indices to be emitted in the reverse
3815         order.
3816
3817 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
3818
3819         * expression.cs (ArrayCreation): Implement the bits that Ravi left
3820         unfinished.  They do not work, because the underlying code is
3821         sloppy.
3822
3823 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
3824
3825         * cs-parser.jay: Remove bogus fixme.
3826
3827         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
3828         on Switch statement.
3829         
3830 2001-11-23  Ravi Pratap  <ravi@ximian.com>
3831
3832         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
3833         the same. 
3834         
3835         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
3836         parameter. Apparently, any expression is allowed. 
3837
3838         (ValidateInitializers): Update accordingly.
3839
3840         (CheckIndices): Fix some tricky bugs thanks to recursion.
3841
3842         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
3843         I was being completely brain-dead.
3844
3845         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
3846         and re-write acordingly.
3847
3848         (DelegateInvocation): Re-write accordingly.
3849
3850         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
3851
3852         (MakeByteBlob): Handle types more correctly.
3853
3854         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
3855         initialization from expressions but it is incomplete because I am a complete
3856         Dodo :-|
3857
3858 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
3859
3860         * statement.cs (If.Emit): Fix a bug that generated incorrect code
3861         on If.  Basically, we have to return `true' (ie, we do return to
3862         our caller) only if both branches of the if return.
3863
3864         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
3865         short-circuit operators, handle them as short circuit operators. 
3866
3867         (Cast.DoResolve): Resolve type.
3868         (Cast.Cast): Take an expression as the target type.
3869
3870         * cs-parser.jay (cast_expression): Remove old hack that only
3871         allowed a limited set of types to be handled.  Now we take a
3872         unary_expression and we resolve to a type during semantic
3873         analysis.
3874
3875         Use the grammar productions from Rhys to handle casts (this is
3876         not complete like Rhys syntax yet, we fail to handle that corner
3877         case that C# has regarding (-x), but we will get there.
3878         
3879 2001-11-22  Ravi Pratap  <ravi@ximian.com>
3880
3881         * class.cs (EmitFieldInitializer): Take care of the case when we have a
3882         field which is an array type.
3883
3884         * cs-parser.jay (declare_local_variables): Support array initialization too.
3885
3886         * typemanager.cs (MakeKey): Implement.
3887
3888         (everywhere): Use the above appropriately.
3889
3890         * cs-parser.jay (for_statement): Update for array initialization while
3891         declaring variables.
3892
3893         * ecore.cs : The error message was correct, it's the variable's names that
3894         were misleading ;-) Make the code more readable.
3895
3896         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
3897         the correct type etc.
3898
3899         (ConvertExplicit): Handle Enum types by examining the underlying type.
3900
3901 2001-11-21  Ravi Pratap  <ravi@ximian.com>
3902
3903         * parameter.cs (GetCallingConvention): Always return
3904         CallingConventions.Standard for now.
3905
3906 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
3907
3908         * expression.cs (Binary.ResolveOperator): Update the values of `l'
3909         and `r' after calling DoNumericPromotions.
3910
3911         * ecore.cs: Fix error message (the types were in the wrong order).
3912
3913         * statement.cs (Foreach.ProbeCollectionType): Need to pass
3914         BindingFlags.Instance as well 
3915
3916         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
3917         implicit int literal conversion in an empty cast so that we
3918         propagate the right type upstream.
3919
3920         (UnboxCast): new class used to unbox value types.
3921         (Expression.ConvertExplicit): Add explicit type conversions done
3922         by unboxing.
3923
3924         (Expression.ImplicitNumericConversion): Oops, forgot to test for
3925         the target type before applying the implicit LongLiterals to ULong
3926         literal cast.
3927
3928 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
3929
3930         * cs-parser.jay (for_statement): Reworked the way For works: now
3931         we declare manually any variables that are introduced in
3932         for_initializer to solve the problem of having out-of-band code
3933         emition (that is what got for broken).
3934
3935         (declaration_statement): Perform the actual variable declaration
3936         that used to be done in local_variable_declaration here.
3937
3938         (local_variable_declaration): Do not declare anything, just pass
3939         the information on a DictionaryEntry
3940
3941 2001-11-20  Ravi Pratap  <ravi@ximian.com>
3942
3943         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
3944         re-write of the logic to now make it recursive.
3945
3946         (UpdateIndices): Re-write accordingly.
3947
3948         Store element data in a separate ArrayData list in the above methods.
3949
3950         (MakeByteBlob): Implement to dump the array data into a byte array.
3951
3952 2001-11-19  Ravi Pratap  <ravi@ximian.com>
3953
3954         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
3955         into CheckIndices.
3956
3957         * constant.cs (Define): Implement.
3958
3959         (EmitConstant): Re-write fully.
3960
3961         Pass in location info.
3962
3963         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
3964         respectively.
3965
3966         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
3967         DictionaryEntry since we need location info too.
3968
3969         (constant_declaration): Update accordingly.
3970
3971         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
3972         code into another method : UpdateIndices.
3973
3974 2001-11-18  Ravi Pratap  <ravi@ximian.com>
3975
3976         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
3977         some type checking etc.
3978
3979 2001-11-17  Ravi Pratap  <ravi@ximian.com>
3980
3981         * expression.cs (ArrayCreation::ValidateInitializers): Implement
3982         bits to provide dimension info if the user skips doing that.
3983
3984         Update second constructor to store the rank correctly.
3985
3986 2001-11-16  Ravi Pratap  <ravi@ximian.com>
3987
3988         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
3989         and try to implement.
3990
3991         * ../errors/cs0150.cs : Add.
3992
3993         * ../errors/cs0178.cs : Add.
3994
3995 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
3996
3997         * statement.cs: Implement foreach on multi-dimensional arrays. 
3998
3999         * parameter.cs (Parameters.GetParameterByName): Also lookup the
4000         name of the params argument.
4001
4002         * expression.cs: Use EmitStoreOpcode to get the right opcode while
4003         initializing the array.
4004
4005         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
4006         we can use this elsewhere.
4007
4008         * statement.cs: Finish implementation of foreach for single
4009         dimension arrays.
4010
4011         * cs-parser.jay: Use an out-of-band stack to pass information
4012         around, I wonder why I need this.
4013
4014         foreach_block: Make the new foreach_block the current_block.
4015
4016         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
4017         function used to return a static Parameters structure.  Used for
4018         empty parameters, as those are created very frequently.
4019
4020         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
4021
4022 2001-11-15  Ravi Pratap  <ravi@ximian.com>
4023
4024         * interface.cs : Default modifier is private, not public. The
4025         make verify test passes again.
4026
4027 2001-11-15  Ravi Pratap  <ravi@ximian.com>
4028
4029         * support.cs (ReflectionParameters): Fix logic to determine
4030         whether the last parameter is a params one. Test 9 passes again.
4031
4032         * delegate.cs (Populate): Register the builders we define with
4033         RegisterParameterForBuilder. Test 19 passes again.
4034
4035         * cs-parser.jay (property_declaration): Reference $6 instead
4036         of $$ to get at the location.
4037
4038         (indexer_declaration): Similar stuff.
4039
4040         (attribute): Ditto.
4041
4042         * class.cs (Property): Register parameters for the Get and Set methods
4043         if they exist. Test 23 passes again.
4044
4045         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
4046         call to EmitArguments as we are sure there aren't any params arguments. 
4047         Test 32 passes again.
4048
4049         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
4050         IndexOutOfRangeException. 
4051
4052         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
4053         Test 33 now passes again.
4054         
4055 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
4056
4057         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
4058         broke a bunch of things.  Will have to come up with a better way
4059         of tracking locations.
4060
4061         * statement.cs: Implemented foreach for single dimension arrays.
4062
4063 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
4064
4065         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
4066         an error.  This removes the lookup from the critical path.
4067
4068         * cs-parser.jay: Removed use of temporary_loc, which is completely
4069         broken. 
4070
4071 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
4072
4073         * support.cs (ReflectionParameters.ParameterModifier): Report
4074         whether the argument is a PARAMS argument or not.
4075
4076         * class.cs: Set the attribute `ParamArrayAttribute' on the
4077         parameter argument.
4078
4079         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
4080         and cons_param_array_attribute (ConstructorInfo for
4081         ParamArrayAttribute)., 
4082
4083         * codegen.cs: Emit the return using the `Return' statement, that
4084         way we can report the error correctly for missing return values. 
4085
4086         * class.cs (Method.Emit): Clean up.
4087
4088         * expression.cs (Argument.Resolve): Take another argument: the
4089         location where this argument is used.  Notice that this is not
4090         part of the "Argument" class as to reduce the size of the
4091         structure (we know the approximate location anyways).
4092
4093         Test if the argument is a variable-reference, if not, then
4094         complain with a 206.
4095
4096         (Argument.Emit): Emit addresses of variables.
4097
4098         (Argument.FullDesc): Simplify.
4099
4100         (Invocation.DoResolve): Update for Argument.Resolve.
4101
4102         (ElementAccess.DoResolve): ditto.
4103
4104         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
4105         method should be virtual, as this method is always virtual.
4106
4107         (NewDelegate.DoResolve): Update for Argument.Resolve.
4108
4109         * class.cs (ConstructorInitializer.DoResolve): ditto.
4110         
4111         * attribute.cs (Attribute.Resolve): ditto.
4112
4113 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
4114
4115         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
4116
4117         * expression.cs (ParameterReference): Drop IStackStorage and implement
4118         IAssignMethod instead. 
4119
4120         (LocalVariableReference): ditto.
4121         
4122         * ecore.cs (FieldExpr): Drop IStackStorage and implement
4123         IAssignMethod instead. 
4124
4125 2001-11-13  Miguel de Icaza <miguel@ximian.com>
4126
4127         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
4128         enumerations that are used in heavily used structures derive from
4129         byte in a laughable and pathetic attempt to reduce memory usage.
4130         This is the kind of pre-optimzations that you should not do at
4131         home without adult supervision.
4132
4133         * expression.cs (UnaryMutator): New class, used to handle ++ and
4134         -- separatedly from the other unary operators.  Cleans up the
4135         code, and kills the ExpressionStatement dependency in Unary.
4136
4137         (Unary): Removed `method' and `Arguments' from this class, making
4138         it smaller, and moving it all to SimpleCall, so I can reuse this
4139         code in other locations and avoid creating a lot of transient data
4140         strucutres when not required.
4141
4142         * cs-parser.jay: Adjust for new changes.
4143
4144 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
4145
4146         * enum.cs (Enum.Populate): If there is a failure during
4147         definition, return
4148
4149         * cs-parser.jay (opt_enum_base): we used to catch type errors
4150         here, but this is really incorrect.  The type error should be
4151         catched during semantic analysis.
4152
4153 2001-12-11  Ravi Pratap  <ravi@ximian.com>
4154
4155         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
4156         current_local_parameters as expected since I, in my stupidity, had forgotten
4157         to do this :-)
4158
4159         * attribute.cs (GetValidPlaces): Fix stupid bug.
4160
4161         * class.cs (Method::Emit): Perform check on applicability of attributes.
4162
4163         (Constructor::Emit): Ditto.
4164
4165         (Field::Emit): Ditto.
4166
4167         (Field.Location): Store location information.
4168
4169         (Property, Event, Indexer, Operator): Ditto.
4170
4171         * cs-parser.jay (field_declaration): Pass in location for each field.
4172
4173         * ../errors/cs0592.cs : Add.
4174
4175 2001-11-12  Ravi Pratap  <ravi@ximian.com>
4176
4177         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
4178
4179         (InitCoreTypes): Update accordingly.
4180
4181         (RegisterAttrType, LookupAttr): Implement.
4182
4183         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
4184         info about the same.
4185
4186         (Resolve): Update to populate the above as necessary.
4187
4188         (Error592): Helper.
4189
4190         (GetValidPlaces): Helper to the above.
4191
4192         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
4193
4194         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
4195
4196 2001-11-12  Ravi Pratap  <ravi@ximian.com>
4197
4198         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
4199
4200         * ../errors/cs0617.cs : Add.
4201
4202 2001-11-11  Ravi Pratap  <ravi@ximian.com>
4203
4204         * enum.cs (Emit): Rename to Populate to be more consistent with what
4205         we expect it to do and when exactly it is called.
4206
4207         * class.cs, rootcontext.cs : Update accordingly.
4208
4209         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
4210         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
4211
4212         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
4213
4214         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
4215         of a fieldinfo using the above, when dealing with a FieldBuilder.
4216
4217 2001-11-10  Ravi Pratap  <ravi@ximian.com>
4218
4219         * ../errors/cs0031.cs : Add.
4220
4221         * ../errors/cs1008.cs : Add.
4222
4223         * ../errrors/cs0543.cs : Add.
4224
4225         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
4226         enum type.
4227
4228         (FindMembers): Implement.
4229
4230         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
4231         enums and delegates too.
4232
4233         (enum_types): Rename to builder_to_enum.
4234
4235         (delegate_types): Rename to builder_to_delegate.
4236
4237         * delegate.cs (FindMembers): Implement.
4238
4239 2001-11-09  Ravi Pratap  <ravi@ximian.com>
4240
4241         * typemanager.cs (IsEnumType): Implement.
4242
4243         * enum.cs (Emit): Re-write parts to account for the underlying type
4244         better and perform checking etc.
4245
4246         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
4247         of the underlying type.
4248
4249         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
4250         value
4251
4252         * enum.cs (error31): Helper to report error #31.
4253
4254         * cs-parser.jay (enum_declaration): Store location of each member too.
4255
4256         * enum.cs (member_to_location): New hashtable. 
4257
4258         (AddEnumMember): Update location hashtable.
4259
4260         (Emit): Use the location of each member while reporting errors.
4261
4262 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
4263
4264         * cs-parser.jay: A for_initializer if is a
4265         local_variable_declaration really ammount to have an implicit
4266         block with the variable declaration and no initializer for for.
4267
4268         * statement.cs (For.Emit): Cope with null initializers.
4269
4270         This fixes the infinite loop on for initializers.
4271
4272 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
4273
4274         * enum.cs: More cleanup.
4275
4276         * ecore.cs: Remove dead code.
4277
4278         * class.cs (Property.Emit): More simplification.
4279         (Event.Emit): ditto.
4280
4281         Reworked to have less levels of indentation.
4282         
4283 2001-11-08  Ravi Pratap  <ravi@ximian.com>
4284
4285         * class.cs (Property): Emit attributes.
4286
4287         (Field): Ditto.
4288         
4289         (Event): Ditto.
4290
4291         (Indexer): Ditto.
4292
4293         (Operator): Ditto.
4294
4295         * enum.cs (Emit): Ditto.
4296
4297         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
4298         Enums too.
4299
4300         * class.cs (Field, Event, etc.): Move attribute generation into the
4301         Emit method everywhere.
4302
4303         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
4304         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
4305         as we had no way of defining nested enums !
4306
4307         * rootcontext.cs : Adjust code accordingly.
4308
4309         * typemanager.cs (AddEnumType): To keep track of enum types separately.
4310
4311 2001-11-07  Ravi Pratap  <ravi@ximian.com>
4312
4313         * expression.cs (EvalConstantExpression): Move into ecore.cs
4314         
4315         * enum.cs (Enum): Rename some members and make them public and readonly
4316         according to our convention.
4317
4318         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
4319         nothing else.
4320
4321         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
4322
4323         (Enum::Emit): Write a simple version for now which doesn't try to compute
4324         expressions. I shall modify this to be more robust in just a while.
4325
4326         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
4327
4328         (TypeContainer::CloseType): Create the Enum types too.
4329
4330         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
4331
4332         * expression.cs (EvalConstantExpression): Get rid of completely.
4333
4334         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
4335         user-defined values and other cases.
4336
4337         (IsValidEnumLiteral): Helper function.
4338
4339         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
4340         out there in the case we had a literal FieldExpr.
4341
4342         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
4343
4344         (Literalize): Revamp a bit to take two arguments.
4345         
4346         (EnumLiteral): New class which derives from Literal to wrap enum literals.
4347         
4348 2001-11-06  Ravi Pratap  <ravi@ximian.com>
4349
4350         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
4351
4352         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
4353
4354         (Resolve): Use the above to ensure we have proper initializers.
4355
4356 2001-11-05  Ravi Pratap  <ravi@ximian.com>
4357
4358         * expression.cs (Expression::EvalConstantExpression): New method to 
4359         evaluate constant expressions.
4360
4361         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
4362
4363 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
4364
4365         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
4366         in an array.
4367
4368         (Binary.ResolveOperator): Handle operator != (object a, object b)
4369         and operator == (object a, object b);
4370
4371         (Binary.DoNumericPromotions): Indicate whether the numeric
4372         promotion was possible.
4373
4374         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
4375         Implement.  
4376
4377         Made the ArrayAccess implement interface IAssignMethod instead of
4378         IStackStore as the order in which arguments are passed reflects
4379         this.
4380
4381         * assign.cs: Instead of using expr.ExprClass to select the way of
4382         assinging, probe for the IStackStore/IAssignMethod interfaces.
4383
4384         * typemanager.cs: Load InitializeArray definition.
4385
4386         * rootcontext.cs (RootContext.MakeStaticData): Used to define
4387         static data that can be used to initialize arrays. 
4388
4389 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
4390
4391         * expression.cs: Handle operator== and operator!= for booleans.
4392
4393         (Conditioal.Reduce): Implement reducer for the ?: operator.
4394
4395         (Conditional.Resolve): Implement dead code elimination.
4396
4397         (Binary.Resolve): Catch string literals and return a new
4398         concatenated string.
4399
4400         (Unary.Reduce): Implement reduction of unary expressions.
4401
4402         * ecore.cs: Split out the expression core handling here.
4403
4404         (Expression.Reduce): New method used to perform constant folding
4405         and CSE.  This is needed to support constant-expressions. 
4406         
4407         * statement.cs (Statement.EmitBoolExpression): Pass true and false
4408         targets, and optimize for !x.
4409
4410 2001-11-04  Ravi Pratap  <ravi@ximian.com>
4411
4412         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
4413         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
4414         set custom atttributes.
4415
4416         * literal.cs (Literal::GetValue): New abstract method to return the actual
4417         value of the literal, cast as an object.
4418
4419         (*Literal): Implement GetValue method.
4420
4421         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
4422         expressions to the arraylist but objects of type Argument.
4423
4424         * class.cs (TypeContainer::Emit): Emit our attributes too.
4425
4426         (Method::Emit, Constructor::Emit): Ditto.
4427
4428         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
4429         to be ignoring earlier.
4430
4431 2001-11-03  Ravi Pratap  <ravi@ximian.com>
4432
4433         * attribute.cs (AttributeSection::Define): Implement to do the business
4434         of constructing a CustomAttributeBuilder.
4435
4436         (Attribute): New trivial class. Increases readability of code.  
4437
4438         * cs-parser.jay : Update accordingly.
4439
4440         (positional_argument_list, named_argument_list, named_argument): New rules
4441
4442         (attribute_arguments): Use the above so that we are more correct.
4443         
4444 2001-11-02  Ravi Pratap  <ravi@ximian.com>
4445         
4446         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
4447         to perform all checks for a method with a params parameter.
4448
4449         (Invocation::OverloadResolve): Update to use the above method and therefore
4450         cope correctly with params method invocations.
4451
4452         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
4453         params too.
4454
4455         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
4456         constructors in our parent too because we can't afford to miss out on 
4457         protected ones ;-)
4458
4459         * attribute.cs (AttributeSection): New name for the class Attribute
4460
4461         Other trivial changes to improve readability.
4462
4463         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
4464         use the new class names.
4465         
4466 2001-11-01  Ravi Pratap  <ravi@ximian.com>
4467
4468         * class.cs (Method::Define): Complete definition for params types too
4469
4470         (Indexer::Define): Ditto.
4471
4472         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
4473         Cope everywhere with a request for info about the array parameter.
4474
4475 2001-11-01  Ravi Pratap  <ravi@ximian.com>
4476
4477         * tree.cs (RecordNamespace): Fix up to check for the correct key.
4478
4479         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
4480         local_variable_type to extract the string corresponding to the type.
4481
4482         (local_variable_type): Fixup the action to use the new helper method.
4483
4484         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
4485         go.
4486
4487         * expression.cs : Clean out code which uses the above.
4488
4489 2001-10-31  Ravi Pratap  <ravi@ximian.com>
4490         
4491         * typemanager.cs (RegisterMethod): Check if we already have an existing key
4492         and bale out if necessary by returning a false.
4493
4494         (RegisterProperty): Ditto.
4495
4496         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
4497         and print out appropriate error messages.
4498
4499         * interface.cs (everywhere): Ditto.
4500
4501         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
4502         location to constructor.
4503
4504         * class.cs (Property, Event, Indexer): Update accordingly.
4505
4506         * ../errors/cs111.cs : Added.
4507
4508         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
4509         of a method, as laid down by the spec.
4510
4511         (Invocation::OverloadResolve): Use the above method.
4512
4513 2001-10-31  Ravi Pratap  <ravi@ximian.com>
4514
4515         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
4516         now take a TypeContainer and a Parameters object.
4517
4518         (ParameterData): Modify return type of ParameterModifier method to be 
4519         Parameter.Modifier and not a string.
4520
4521         (ReflectionParameters, InternalParameters): Update accordingly.
4522
4523         * expression.cs (Argument::GetParameterModifier): Same here.
4524
4525         * support.cs (InternalParameters::ParameterType): Find a better way of determining
4526         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
4527         symbol in it at all so maybe this is only for now.
4528
4529 2001-10-30  Ravi Pratap  <ravi@ximian.com>
4530
4531         * support.cs (InternalParameters): Constructor now takes an extra argument 
4532         which is the actual Parameters class.
4533
4534         (ParameterDesc): Update to provide info on ref/out modifiers.
4535
4536         * class.cs (everywhere): Update call to InternalParameters to pass in
4537         the second argument too.
4538
4539         * support.cs (ParameterData): Add ParameterModifier, which is a method 
4540         to return the modifier info [ref/out etc]
4541
4542         (InternalParameters, ReflectionParameters): Implement the above.
4543
4544         * expression.cs (Argument::ParameterModifier): Similar function to return
4545         info about the argument's modifiers.
4546
4547         (Invocation::OverloadResolve): Update to take into account matching modifiers 
4548         too.
4549
4550         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
4551         a new SetFormalParameters object which we pass to InternalParameters.
4552
4553 2001-10-30  Ravi Pratap  <ravi@ximian.com>
4554
4555         * expression.cs (NewArray): Merge into the ArrayCreation class.
4556
4557 2001-10-29  Ravi Pratap  <ravi@ximian.com>
4558
4559         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
4560         NewUserdefinedArray into one as there wasn't much of a use in having
4561         two separate ones.
4562
4563         * expression.cs (Argument): Change field's name to ArgType from Type.
4564
4565         (Type): New readonly property which returns the proper type, taking into 
4566         account ref/out modifiers.
4567
4568         (everywhere): Adjust code accordingly for the above.
4569
4570         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
4571         whether we are emitting for a ref or out parameter.
4572
4573         * expression.cs (Argument::Emit): Use the above field to set the state.
4574
4575         (LocalVariableReference::Emit): Update to honour the flag and emit the
4576         right stuff.
4577
4578         * parameter.cs (Attributes): Set the correct flags for ref parameters.
4579
4580         * expression.cs (Argument::FullDesc): New function to provide a full desc.
4581
4582         * support.cs (ParameterData): Add method ParameterDesc to the interface.
4583
4584         (ReflectionParameters, InternalParameters): Implement the above method.
4585
4586         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
4587         reporting errors.
4588
4589         (Invocation::FullMethodDesc): Ditto. 
4590
4591 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
4592
4593         * cs-parser.jay: Add extra production for the second form of array
4594         creation. 
4595
4596         * expression.cs (ArrayCreation): Update to reflect the above
4597         change. 
4598
4599         * Small changes to prepare for Array initialization.
4600
4601 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
4602
4603         * typemanager.cs (ImplementsInterface): interface might be null;
4604         Deal with this problem;
4605
4606         Also, we do store negative hits on the cache (null values), so use
4607         this instead of calling t.GetInterfaces on the type everytime.
4608
4609 2001-10-28  Ravi Pratap  <ravi@ximian.com>
4610
4611         * typemanager.cs (IsBuiltinType): New method to help determine the same.
4612
4613         * expression.cs (New::DoResolve): Get rid of array creation code and instead
4614         split functionality out into different classes.
4615
4616         (New::FormArrayType): Move into NewBuiltinArray.
4617
4618         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
4619         quite useless.
4620
4621         (NewBuiltinArray): New class to handle creation of built-in arrays.
4622
4623         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
4624         account creation of one-dimensional arrays.
4625
4626         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
4627
4628         (NewUserdefinedArray::DoResolve): Implement.
4629
4630         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
4631
4632         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
4633         we maintain inside the TypeManager. This is necessary to perform lookups on the
4634         module builder.
4635
4636         (LookupType): Update to perform GetType on the module builders too.     
4637
4638         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
4639
4640         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
4641
4642 2001-10-23  Ravi Pratap  <ravi@ximian.com>
4643
4644         * expression.cs (New::DoResolve): Implement guts of array creation.
4645
4646         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
4647         
4648 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
4649
4650         * expression.cs: Fix bug I introduced lsat night that broke
4651         Delegates. 
4652
4653         (Expression.Resolve): Report a 246 error (can not resolve name)
4654         if we find a SimpleName in the stream.
4655         
4656         (Expression.ResolveLValue): Ditto.
4657         
4658         (Expression.ResolveWithSimpleName): This function is a variant of
4659         ResolveName, this one allows SimpleNames to be returned without a
4660         warning.  The only consumer of SimpleNames is MemberAccess
4661
4662 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
4663
4664         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
4665         might arrive here.  I have my doubts that this is correct.
4666
4667         * statement.cs (Lock): Implement lock statement.
4668
4669         * cs-parser.jay: Small fixes to support `lock' and `using'
4670
4671         * cs-tokenizer.cs: Remove extra space
4672
4673         * driver.cs: New flag --checked, allows to turn on integer math
4674         checking. 
4675
4676         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
4677         Threading.Monitor.Exit 
4678         
4679 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
4680
4681         * expression.cs (IndexerAccess::DoResolveLValue): Set the
4682         Expression Class to be IndexerAccess.
4683
4684         Notice that Indexer::DoResolve sets the eclass to Value.
4685
4686 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
4687
4688         * class.cs (TypeContainer::Emit): Emit code for indexers.
4689
4690         * assign.cs (IAssignMethod): New interface implemented by Indexers
4691         and Properties for handling assignment.
4692
4693         (Assign::Emit): Simplify and reuse code. 
4694         
4695         * expression.cs (IndexerAccess, PropertyExpr): Implement
4696         IAssignMethod, clean up old code. 
4697
4698 2001-10-22  Ravi Pratap  <ravi@ximian.com>
4699
4700         * typemanager.cs (ImplementsInterface): New method to determine if a type
4701         implements a given interface. Provides a nice cache too.
4702
4703         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
4704         method.
4705
4706         (ConvertReferenceExplicit): Ditto.
4707
4708         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
4709         various methods, with correct names etc.
4710
4711         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
4712         Operator.UnaryNegation.
4713
4714         * cs-parser.jay (operator_declarator): Be a little clever in the case where
4715         we have a unary plus or minus operator.
4716
4717         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
4718         UnaryMinus.
4719
4720         * everywhere : update accordingly.
4721
4722         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
4723         respectively.
4724
4725         * class.cs (Method::Define): For the case where we are implementing a method
4726         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
4727         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
4728         
4729 2001-10-21  Ravi Pratap  <ravi@ximian.com>
4730
4731         * interface.cs (FindMembers): Implement to work around S.R.E
4732         lameness.
4733
4734         * typemanager.cs (IsInterfaceType): Implement.
4735
4736         (FindMembers): Update to handle interface types too.
4737
4738         * expression.cs (ImplicitReferenceConversion): Re-write bits which
4739         use IsAssignableFrom as that is not correct - it doesn't work.
4740
4741         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
4742         and accordingly override EmitStatement.
4743
4744         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
4745         using the correct logic :-)
4746
4747 2001-10-19  Ravi Pratap  <ravi@ximian.com>
4748
4749         * ../errors/cs-11.cs : Add to demonstrate error -11 
4750
4751 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
4752
4753         * assign.cs (Assign::Resolve): Resolve right hand side first, and
4754         then pass this as a hint to ResolveLValue.
4755         
4756         * expression.cs (FieldExpr): Add Location information
4757
4758         (FieldExpr::LValueResolve): Report assignment to readonly
4759         variable. 
4760         
4761         (Expression::ExprClassFromMemberInfo): Pass location information.
4762
4763         (Expression::ResolveLValue): Add new method that resolves an
4764         LValue. 
4765
4766         (Expression::DoResolveLValue): Default invocation calls
4767         DoResolve. 
4768
4769         (Indexers): New class used to keep track of indexers in a given
4770         Type. 
4771
4772         (IStackStore): Renamed from LValue, as it did not really describe
4773         what this did.  Also ResolveLValue is gone from this interface and
4774         now is part of Expression.
4775
4776         (ElementAccess): Depending on the element access type
4777         
4778         * typemanager.cs: Add `indexer_name_type' as a Core type
4779         (System.Runtime.CompilerServices.IndexerNameAttribute)
4780
4781         * statement.cs (Goto): Take a location.
4782         
4783 2001-10-18  Ravi Pratap  <ravi@ximian.com>
4784
4785         * delegate.cs (Delegate::VerifyDelegate): New method to verify
4786         if two delegates are compatible.
4787
4788         (NewDelegate::DoResolve): Update to take care of the case when
4789         we instantiate a delegate from another delegate.
4790
4791         * typemanager.cs (FindMembers): Don't even try to look up members
4792         of Delegate types for now.
4793
4794 2001-10-18  Ravi Pratap  <ravi@ximian.com>
4795
4796         * delegate.cs (NewDelegate): New class to take care of delegate
4797         instantiation.
4798
4799         * expression.cs (New): Split the delegate related code out into 
4800         the NewDelegate class.
4801
4802         * delegate.cs (DelegateInvocation): New class to handle delegate 
4803         invocation.
4804
4805         * expression.cs (Invocation): Split out delegate related code into
4806         the DelegateInvocation class.
4807
4808 2001-10-17  Ravi Pratap  <ravi@ximian.com>
4809
4810         * expression.cs (New::DoResolve): Implement delegate creation fully
4811         and according to the spec.
4812
4813         (New::DoEmit): Update to handle delegates differently.
4814
4815         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
4816         because of which we were printing out arguments in reverse order !
4817
4818         * delegate.cs (VerifyMethod): Implement to check if the given method
4819         matches the delegate.
4820
4821         (FullDelegateDesc): Implement.
4822
4823         (VerifyApplicability): Implement.
4824
4825         * expression.cs (Invocation::DoResolve): Update to accordingly handle
4826         delegate invocations too.
4827
4828         (Invocation::Emit): Ditto.
4829
4830         * ../errors/cs1593.cs : Added.
4831
4832         * ../errors/cs1594.cs : Added.
4833
4834         * delegate.cs (InstanceExpression, TargetMethod): New properties.
4835
4836 2001-10-16  Ravi Pratap  <ravi@ximian.com>
4837
4838         * typemanager.cs (intptr_type): Core type for System.IntPtr
4839
4840         (InitCoreTypes): Update for the same.
4841
4842         (iasyncresult_type, asynccallback_type): Ditto.
4843
4844         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
4845         correct.
4846
4847         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
4848         too.
4849
4850         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
4851         the builders for the 4 members of a delegate type :-)
4852
4853         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
4854         type.
4855
4856         * expression.cs (New::DoResolve): Implement guts for delegate creation.
4857
4858         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
4859
4860 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
4861
4862         * statement.cs (Break::Emit): Implement.   
4863         (Continue::Emit): Implement.
4864
4865         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
4866         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
4867         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
4868         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
4869         end loop
4870         
4871         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
4872         properties that track the label for the current loop (begin of the
4873         loop and end of the loop).
4874
4875 2001-10-15  Ravi Pratap  <ravi@ximian.com>
4876
4877         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
4878         use of emitting anything at all.
4879
4880         * class.cs, rootcontext.cs : Get rid of calls to the same.
4881
4882         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
4883
4884         (Populate): Define the constructor correctly and set the implementation
4885         attributes.
4886
4887         * typemanager.cs (delegate_types): New hashtable to hold delegates that
4888         have been defined.
4889
4890         (AddDelegateType): Implement.
4891
4892         (IsDelegateType): Implement helper method.
4893
4894         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
4895
4896         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
4897         and accordingly handle it.
4898
4899         * delegate.cs (Populate): Take TypeContainer argument.
4900         Implement bits to define the Invoke method. However, I still haven't figured out
4901         how to take care of the native int bit :-(
4902
4903         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
4904         Qualify the name of the delegate, not its return type !
4905
4906         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
4907         conversion.
4908
4909         (StandardConversionExists): Checking for array types turns out to be recursive.
4910
4911         (ConvertReferenceExplicit): Implement array conversion.
4912
4913         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
4914         
4915 2001-10-12  Ravi Pratap  <ravi@ximian.com>
4916
4917         * cs-parser.jay (delegate_declaration): Store the fully qualified
4918         name as it is a type declaration.
4919
4920         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
4921         readonly.
4922
4923         (DefineDelegate): Renamed from Define. Does the same thing essentially,
4924         as TypeContainer::DefineType.
4925
4926         (Populate): Method in which all the definition of the various methods (Invoke)
4927         etc is done.
4928
4929         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
4930         see.
4931         
4932         (CloseDelegate): Finally creates the delegate.
4933
4934         * class.cs (TypeContainer::DefineType): Update to define delegates.
4935         (Populate, Emit and CloseType): Do the same thing here too.
4936
4937         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
4938         delegates in all these operations.
4939
4940 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
4941
4942         * expression.cs: LocalTemporary: a new expression used to
4943         reference a temporary that has been created.
4944
4945         * assign.cs: Handle PropertyAccess back here, so that we can
4946         provide the proper semantic access to properties.
4947
4948         * expression.cs (Expression::ConvertReferenceExplicit): Implement
4949         a few more explicit conversions. 
4950
4951         * modifiers.cs: `NEW' modifier maps to HideBySig.
4952
4953         * expression.cs (PropertyExpr): Make this into an
4954         ExpressionStatement, and support the EmitStatement code path. 
4955
4956         Perform get/set error checking, clean up the interface.
4957
4958         * assign.cs: recognize PropertyExprs as targets, and if so, turn
4959         them into toplevel access objects.
4960
4961 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
4962
4963         * expression.cs: PropertyExpr::PropertyExpr: use work around the
4964         SRE.
4965
4966         * typemanager.cs: Keep track here of our PropertyBuilders again to
4967         work around lameness in SRE.
4968
4969 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
4970
4971         * expression.cs (LValue::LValueResolve): New method in the
4972         interface, used to perform a second resolution pass for LValues. 
4973         
4974         (This::DoResolve): Catch the use of this in static methods.
4975
4976         (This::LValueResolve): Implement.
4977
4978         (This::Store): Remove warning, assigning to `this' in structures
4979         is 
4980
4981         (Invocation::Emit): Deal with invocation of
4982         methods on value types.  We need to pass the address to structure
4983         methods rather than the object itself.  (The equivalent code to
4984         emit "this" for structures leaves the entire structure on the
4985         stack instead of a pointer to it). 
4986
4987         (ParameterReference::DoResolve): Compute the real index for the
4988         argument based on whether the method takes or not a `this' pointer
4989         (ie, the method is static).
4990
4991         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
4992         value types returned from functions when we need to invoke a
4993         method on the sturcture.
4994         
4995
4996 2001-10-11  Ravi Pratap  <ravi@ximian.com>
4997
4998         * class.cs (TypeContainer::DefineType): Method to actually do the business of
4999         defining the type in the Modulebuilder or Typebuilder. This is to take
5000         care of nested types which need to be defined on the TypeBuilder using
5001         DefineNestedMethod.
5002
5003         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
5004         methods in RootContext, only ported to be part of TypeContainer.
5005
5006         (TypeContainer::GetInterfaceOrClass): Ditto.
5007
5008         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
5009
5010         * interface.cs (Interface::DefineInterface): New method. Does exactly
5011         what RootContext.CreateInterface did earlier, only it takes care of nested types 
5012         too.
5013
5014         (Interface::GetInterfaces): Move from RootContext here and port.
5015
5016         (Interface::GetInterfaceByName): Same here.
5017
5018         * rootcontext.cs (ResolveTree): Re-write.
5019
5020         (PopulateTypes): Re-write.
5021
5022         * class.cs (TypeContainer::Populate): Populate nested types too.
5023         (TypeContainer::Emit): Emit nested members too.
5024
5025         * typemanager.cs (AddUserType): Do not make use of the FullName property,
5026         instead just use the name argument passed in as it is already fully
5027         qualified.
5028
5029         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
5030         to TypeContainer mapping to see if a type is user-defined.
5031
5032         * class.cs (TypeContainer::CloseType): Implement. 
5033
5034         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
5035         the default constructor.
5036         
5037         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
5038         twice.
5039
5040         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
5041
5042         * interface.cs (CloseType): Create the type here.
5043         
5044         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
5045         the hierarchy.
5046
5047         Remove all the methods which are now in TypeContainer.
5048
5049 2001-10-10  Ravi Pratap  <ravi@ximian.com>
5050
5051         * delegate.cs (Define): Re-write bits to define the delegate
5052         correctly.
5053
5054 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
5055
5056         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
5057
5058         * expression.cs (ImplicitReferenceConversion): handle null as well
5059         as a source to convert to any reference type.
5060
5061         * statement.cs (Return): Perform any implicit conversions to
5062         expected return type.  
5063
5064         Validate use of return statement.  
5065
5066         * codegen.cs (EmitContext): Pass the expected return type here.
5067
5068         * class.cs (Method, Constructor, Property): Pass expected return
5069         type to EmitContext.
5070
5071 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
5072
5073         * expression.cs: Make DoResolve take an EmitContext instead of a
5074         TypeContainer.
5075
5076         Replaced `l' and `location' for `loc', for consistency.
5077         
5078         (Error, Warning): Remove unneeded Tc argument.
5079
5080         * assign.cs, literal.cs, constant.cs: Update to new calling
5081         convention. 
5082         
5083         * codegen.cs: EmitContext now contains a flag indicating whether
5084         code is being generated in a static method or not.
5085
5086         * cs-parser.jay: DecomposeQI, new function that replaces the old
5087         QualifiedIdentifier.  Now we always decompose the assembled
5088         strings from qualified_identifier productions into a group of
5089         memberaccesses.
5090
5091 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
5092
5093         * rootcontext.cs: Deal with field-less struct types correctly now
5094         by passing the size option to Define Type.
5095
5096         * class.cs: Removed hack that created one static field. 
5097
5098 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
5099
5100         * statement.cs: Moved most of the code generation here. 
5101
5102 2001-10-09  Ravi Pratap  <ravi@ximian.com>
5103
5104         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
5105         seem very right.
5106
5107         (ElementAccess): Remove useless bits for now - keep checks as the spec
5108         says.
5109
5110 2001-10-08  Ravi Pratap  <ravi@ximian.com>
5111
5112         * expression.cs (ElementAccess::DoResolve): Remove my crap code
5113         and start performing checks according to the spec.
5114
5115 2001-10-07  Ravi Pratap  <ravi@ximian.com>
5116
5117         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
5118         rank_specifiers instead.
5119
5120         (rank_specifiers): Change the order in which the rank specifiers are stored
5121
5122         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
5123
5124         * expression.cs (ElementAccess): Implement the LValue interface too.
5125         
5126 2001-10-06  Ravi Pratap  <ravi@ximian.com>
5127         
5128         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
5129         except that user defined conversions are not included.
5130
5131         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
5132         perform the conversion of the return type, if necessary.
5133
5134         (New::DoResolve): Check whether we are creating an array or an object
5135         and accordingly do the needful.
5136
5137         (New::Emit): Same here.
5138
5139         (New::DoResolve): Implement guts of array creation.
5140
5141         (New::FormLookupType): Helper function.
5142
5143 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
5144
5145         * codegen.cs: Removed most of the code generation here, and move the
5146         corresponding code generation bits to the statement classes. 
5147
5148         Added support for try/catch/finalize and throw.
5149         
5150         * cs-parser.jay: Added support for try/catch/finalize.
5151
5152         * class.cs: Catch static methods having the flags override,
5153         virtual or abstract.
5154
5155         * expression.cs (UserCast): This user cast was not really doing
5156         what it was supposed to do.  Which is to be born in fully resolved
5157         state.  Parts of the resolution were being performed at Emit time! 
5158
5159         Fixed this code.
5160
5161 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
5162
5163         * expression.cs: Implicity convert the result from UserCast.
5164
5165 2001-10-05  Ravi Pratap  <ravi@ximian.com>
5166
5167         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
5168         prevented it from working correctly. 
5169
5170         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
5171         merely ConvertImplicit.
5172
5173 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
5174
5175         * typemanager.cs: Make the LookupTypeContainer function static,
5176         and not per-instance.  
5177
5178         * class.cs: Make static FindMembers (the one that takes a Type
5179         argument). 
5180
5181         * codegen.cs: Add EmitForeach here.
5182
5183         * cs-parser.jay: Make foreach a toplevel object instead of the
5184         inline expansion, as we need to perform semantic analysis on it. 
5185
5186 2001-10-05  Ravi Pratap  <ravi@ximian.com>
5187
5188         * expression.cs (Expression::ImplicitUserConversion): Rename to
5189         UserDefinedConversion.
5190
5191         (Expression::UserDefinedConversion): Take an extra argument specifying 
5192         whether we look for explicit user conversions too.
5193
5194         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
5195
5196         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
5197
5198         (ExplicitUserConversion): Make it a call to UserDefinedConversion
5199         with the appropriate arguments.
5200
5201         * cs-parser.jay (cast_expression): Record location too.
5202
5203         * expression.cs (Cast): Record location info.
5204
5205         (Expression::ConvertExplicit): Take location argument.
5206
5207         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
5208         to determine if we are doing explicit conversions.
5209
5210         (UserCast::Emit): Update accordingly.
5211
5212         (Expression::ConvertExplicit): Report an error if everything fails.
5213
5214         * ../errors/cs0030.cs : Add.
5215
5216 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
5217
5218         * modifiers.cs: If the ABSTRACT keyword is present, also set the
5219         virtual and newslot bits. 
5220
5221         * class.cs (TypeContainer::RegisterRequiredImplementations):
5222         Record methods we need.
5223
5224         (TypeContainer::MakeKey): Helper function to make keys for
5225         MethodBases, since the Methodbase key is useless.
5226
5227         (TypeContainer::Populate): Call RegisterRequiredImplementations
5228         before defining the methods.   
5229
5230         Create a mapping for method_builders_to_methods ahead of time
5231         instead of inside a tight loop.
5232
5233         (::RequireMethods):  Accept an object as the data to set into the
5234         hashtable so we can report interface vs abstract method mismatch.
5235
5236 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
5237
5238         * report.cs: Make all of it static.
5239
5240         * rootcontext.cs: Drop object_type and value_type computations, as
5241         we have those in the TypeManager anyways.
5242
5243         Drop report instance variable too, now it is a global.
5244
5245         * driver.cs: Use try/catch on command line handling.
5246
5247         Add --probe option to debug the error reporting system with a test
5248         suite. 
5249
5250         * report.cs: Add support for exiting program when a probe
5251         condition is reached.
5252
5253 2001-10-03  Ravi Pratap  <ravi@ximian.com>
5254
5255         * expression.cs (Binary::DoNumericPromotions): Fix the case when
5256         we do a forcible conversion regardless of type, to check if 
5257         ForceConversion returns a null.
5258
5259         (Binary::error19): Use location to report error.
5260
5261         (Unary::error23): Use location here too.
5262
5263         * ../errors/cs0019.cs : Check in.
5264
5265         * ../errors/cs0023.cs : Check in.
5266
5267         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
5268         case of a non-null MethodInfo object with a length of 0 !
5269
5270         (Binary::ResolveOperator): Flag error if overload resolution fails to find
5271         an applicable member - according to the spec :-)
5272         Also fix logic to find members in base types.
5273
5274         (Unary::ResolveOperator): Same here.
5275
5276         (Unary::report23): Change name to error23 and make first argument a TypeContainer
5277         as I was getting thoroughly confused between this and error19 :-)
5278         
5279         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
5280         (::FindMostEncompassedType): Implement.
5281         (::FindMostEncompassingType): Implement.
5282         (::StandardConversionExists): Implement.
5283
5284         (UserImplicitCast): Re-vamp. We now need info about most specific
5285         source and target types so that we can do the necessary conversions.
5286
5287         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
5288         mathematical union with no duplicates.
5289
5290 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
5291
5292         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
5293         in order from base classes to child classes, so that we can in
5294         child classes look up in our parent for method names and
5295         attributes (required for handling abstract, virtual, new, override
5296         constructs: we need to instrospect our base class, and if we dont
5297         populate the classes in order, the introspection might be
5298         incorrect.  For example, a method could query its parent before
5299         the parent has any methods and would determine that the parent has
5300         no abstract methods (while it could have had them)).
5301
5302         (RootContext::CreateType): Record the order in which we define the
5303         classes.
5304
5305 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
5306
5307         * class.cs (TypeContainer::Populate): Also method definitions can
5308         fail now, keep track of this.
5309
5310         (TypeContainer::FindMembers): Implement support for
5311         DeclaredOnly/noDeclaredOnly flag.
5312
5313         (Constructor::Emit) Return the ConstructorBuilder.
5314
5315         (Method::Emit) Return the MethodBuilder. 
5316         Check for abstract or virtual methods to be public.
5317
5318         * rootcontext.cs (RootContext::CreateType): Register all the
5319         abstract methods required for the class to be complete and the
5320         interface methods that must be implemented. 
5321
5322         * cs-parser.jay: Report error 501 (method requires body if it is
5323         not marked abstract or extern).
5324
5325         * expression.cs (TypeOf::Emit): Implement.
5326
5327         * typemanager.cs: runtime_handle_type, new global type.
5328
5329         * class.cs (Property::Emit): Generate code for properties.
5330
5331 2001-10-02  Ravi Pratap  <ravi@ximian.com>
5332
5333         * expression.cs (Unary::ResolveOperator): Find operators on base type
5334         too - we now conform exactly to the spec.
5335
5336         (Binary::ResolveOperator): Same here.
5337
5338         * class.cs (Operator::Define): Fix minor quirk in the tests.
5339
5340         * ../errors/cs0215.cs : Added.
5341
5342         * ../errors/cs0556.cs : Added.
5343
5344         * ../errors/cs0555.cs : Added.
5345
5346 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
5347
5348         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
5349         single integer which is really efficient
5350
5351 2001-10-01  Ravi Pratap  <ravi@ximian.com>
5352
5353         *  expression.cs (Expression::ImplicitUserConversion): Use location
5354         even in the case when we are examining True operators.
5355  
5356         * class.cs (Operator::Define): Perform extensive checks to conform
5357         with the rules for operator overloading in the spec.
5358
5359         * expression.cs (Expression::ImplicitReferenceConversion): Implement
5360         some of the other conversions mentioned in the spec.
5361
5362         * typemanager.cs (array_type): New static member for the System.Array built-in
5363         type.
5364
5365         (cloneable_interface): For System.ICloneable interface.
5366
5367         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
5368         we start resolving the tree and populating types.
5369
5370         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
5371  
5372 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
5373
5374         * expression.cs (Expression::ExprClassFromMemberInfo,
5375         Expression::Literalize): Create literal expressions from
5376         FieldInfos which are literals.
5377
5378         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
5379         type casts, because they were wrong.  The test suite in tests
5380         caught these ones.
5381
5382         (ImplicitNumericConversion): ushort to ulong requires a widening
5383         cast. 
5384
5385         Int32 constant to long requires widening cast as well.
5386
5387         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
5388         for integers because the type on the stack is not i4.
5389
5390 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
5391
5392         * expression.cs (report118): require location argument. 
5393
5394         * parameter.cs: Do not dereference potential null value.
5395
5396         * class.cs: Catch methods that lack the `new' keyword when
5397         overriding a name.  Report warnings when `new' is used without
5398         anything being there to override.
5399
5400         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
5401
5402         * class.cs: Only add constructor to hashtable if it is non-null
5403         (as now constructors can fail on define).
5404
5405         (TypeManager, Class, Struct): Take location arguments.
5406
5407         Catch field instance initialization in structs as errors.
5408
5409         accepting_filter: a new filter for FindMembers that is static so
5410         that we dont create an instance per invocation.
5411
5412         (Constructor::Define): Catch errors where a struct constructor is
5413         parameterless 
5414
5415         * cs-parser.jay: Pass location information for various new
5416         constructs. 
5417         
5418         * delegate.cs (Delegate): take a location argument.
5419
5420         * driver.cs: Do not call EmitCode if there were problesm in the
5421         Definition of the types, as many Builders wont be there. 
5422
5423         * decl.cs (Decl::Decl): Require a location argument.
5424
5425         * cs-tokenizer.cs: Handle properly hex constants that can not fit
5426         into integers, and find the most appropiate integer for it.
5427
5428         * literal.cs: Implement ULongLiteral.
5429
5430         * rootcontext.cs: Provide better information about the location of
5431         failure when CreateType fails.
5432         
5433 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
5434
5435         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
5436         as well.
5437
5438         * expression.cs (Binary::CheckShiftArguments): Add missing type
5439         computation.
5440         (Binary::ResolveOperator): Add type to the logical and and logical
5441         or, Bitwise And/Or and Exclusive Or code paths, it was missing
5442         before.
5443
5444         (Binary::DoNumericPromotions): In the case where either argument
5445         is ulong (and most signed types combined with ulong cause an
5446         error) perform implicit integer constant conversions as well.
5447
5448 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
5449
5450         * expression.cs (UserImplicitCast): Method should always be
5451         non-null. 
5452         (Invocation::BetterConversion): Simplified test for IntLiteral.
5453
5454         (Expression::ImplicitNumericConversion): Split this routine out.
5455         Put the code that performs implicit constant integer conversions
5456         here. 
5457
5458         (Expression::Resolve): Become a wrapper around DoResolve so we can
5459         check eclass and type being set after resolve.
5460
5461         (Invocation::Badness): Remove this dead function
5462
5463         (Binary::ResolveOperator): Do not compute the expensive argumnets
5464         unless we have a union for it.
5465
5466         (Probe::Emit): Is needs to do an isinst and then
5467         compare against null.
5468
5469         (::CanConvert): Added Location argument.  If the Location argument
5470         is null (Location.Null), then we do not report errors.  This is
5471         used by the `probe' mechanism of the Explicit conversion.  We do
5472         not want to generate an error for something that the user
5473         explicitly requested to be casted.  But the pipeline for an
5474         explicit cast first tests for potential implicit casts.
5475
5476         So for now, if the Location is null, it means `Probe only' to
5477         avoid adding another argument.   Might have to revise this
5478         strategy later.
5479
5480         (ClassCast): New class used to type cast objects into arbitrary
5481         classes (used in Explicit Reference Conversions).
5482
5483         Implement `as' as well.
5484
5485         Reverted all the patches from Ravi below: they were broken:
5486
5487                 * The use of `level' as a mechanism to stop recursive
5488                   invocations is wrong.  That was there just to catch the
5489                   bug with a strack trace but not as a way of addressing
5490                   the problem.
5491
5492                   To fix the problem we have to *understand* what is going
5493                   on and the interactions and come up with a plan, not
5494                   just get things going.
5495
5496                 * The use of the type conversion cache that I proposed
5497                   last night had an open topic: How does this work across
5498                   protection domains.  A user defined conversion might not
5499                   be public in the location where we are applying the
5500                   conversion, a different conversion might be selected
5501                   (ie, private A->B (better) but public B->A (worse),
5502                   inside A, A->B applies, but outside it, B->A will
5503                   apply).
5504
5505                 * On top of that (ie, even if the above is solved),
5506                   conversions in a cache need to be abstract.  Ie, `To
5507                   convert from an Int to a Short use an OpcodeCast', not
5508                   `To convert from an Int to a Short use the OpcodeCast on
5509                   the variable 5' (which is what this patch was doing).
5510         
5511 2001-09-28  Ravi Pratap  <ravi@ximian.com>
5512
5513         * expression.cs (Invocation::ConversionExists): Re-write to use
5514         the conversion cache
5515         
5516         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
5517         cache all conversions done, not just user-defined ones.
5518
5519         (Invocation::BetterConversion): The real culprit. Use ConversionExists
5520         to determine if a conversion exists instead of acutually trying to 
5521         perform the conversion. It's faster too.
5522
5523         (Expression::ConvertExplicit): Modify to use ConversionExists to check
5524         and only then attempt the implicit conversion.
5525
5526 2001-09-28  Ravi Pratap  <ravi@ximian.com>
5527
5528         * expression.cs (ConvertImplicit): Use a cache for conversions
5529         already found. Check level of recursion and bail out if necessary.
5530         
5531 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
5532
5533         * typemanager.cs (string_concat_string_string, string_concat_object_object):
5534         Export standard methods that we expect for string operations.
5535         
5536         * statement.cs (Block::UsageWarning): Track usage of variables and
5537         report the errors for not used variables.
5538
5539         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
5540         operator. 
5541
5542 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
5543
5544         * codegen.cs: remove unnneded code 
5545
5546         * expression.cs: Removed BuiltinTypeAccess class
5547
5548         Fix the order in which implicit conversions are
5549         done.  
5550
5551         The previous fixed dropped support for boxed conversions (adding a
5552         test to the test suite now)
5553
5554         (UserImplicitCast::CanConvert): Remove test for source being null,
5555         that code is broken.  We should not feed a null to begin with, if
5556         we do, then we should track the bug where the problem originates
5557         and not try to cover it up here.
5558
5559         Return a resolved expression of type UserImplicitCast on success
5560         rather than true/false.  Ravi: this is what I was talking about,
5561         the pattern is to use a static method as a "constructor" for
5562         objects. 
5563
5564         Also, do not create arguments until the very last minute,
5565         otherwise we always create the arguments even for lookups that
5566         will never be performed. 
5567
5568         (UserImplicitCast::Resolve): Eliminate, objects of type
5569         UserImplicitCast are born in a fully resolved state. 
5570         
5571         * typemanager.cs (InitCoreTypes): Init also value_type
5572         (System.ValueType). 
5573
5574         * expression.cs (Cast::Resolve): First resolve the child expression.
5575
5576         (LValue): Add new method AddressOf to be used by
5577         the `&' operator.  
5578
5579         Change the argument of Store to take an EmitContext instead of an
5580         ILGenerator, because things like FieldExpr need to be able to call
5581         their children expression to generate the instance code. 
5582
5583         (Expression::Error, Expression::Warning): Sugar functions for
5584         reporting errors.
5585
5586         (Expression::MemberLookup): Accept a TypeContainer instead of a
5587         Report as the first argument.
5588
5589         (Expression::ResolvePrimary): Killed.  I still want to improve
5590         this as currently the code is just not right.
5591
5592         (Expression::ResolveMemberAccess): Simplify, but it is still
5593         wrong. 
5594
5595         (Unary::Resolve): Catch errors in AddressOf operators.
5596
5597         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
5598         index to a byte for the short-version, or the compiler will choose
5599         the wrong Emit call, which generates the wrong data.
5600
5601         (ParameterReference::Emit, ::Store): same.
5602
5603         (FieldExpr::AddressOf): Implement.
5604         
5605         * typemanager.cs: TypeManager: made public variable instead of
5606         property.
5607         
5608         * driver.cs: document --fatal.
5609
5610         * report.cs (ErrorMessage, WarningMessage): new names for the old
5611         Error and Warning classes.
5612
5613         * cs-parser.jay (member_access): Turn built-in access to types
5614         into a normal simplename
5615
5616 2001-09-27  Ravi Pratap  <ravi@ximian.com>
5617
5618         * expression.cs (Invocation::BetterConversion): Fix to cope
5619         with q being null, since this was introducing a bug.
5620
5621         * expression.cs (ConvertImplicit): Do built-in conversions first.
5622
5623 2001-09-27  Ravi Pratap  <ravi@ximian.com>
5624
5625         * expression.cs (UserImplicitCast::Resolve): Fix bug.
5626
5627 2001-09-27  Ravi Pratap  <ravi@ximian.com>
5628
5629         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
5630         I had introduced long ago (what's new ?).
5631
5632         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
5633         the work of all the checking. 
5634         (ConvertImplicit): Call CanConvert and only then create object if necessary.
5635         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
5636
5637         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
5638         that is the right way. 
5639
5640         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
5641         overloading resolution. Use everywhere instead of cutting and pasting code.
5642
5643         (Binary::ResolveOperator): Use MakeUnionSet.
5644
5645         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
5646         we have to convert to bool types. Not complete yet.
5647         
5648 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
5649
5650         * typemanager.cs (TypeManager::CSharpName): support ushort.
5651
5652         * expression.cs (Expression::TryImplicitIntConversion): Attempts
5653         to provide an expression that performsn an implicit constant int
5654         conversion (section 6.1.6).
5655         (Expression::ConvertImplicitRequired): Reworked to include
5656         implicit constant expression conversions.
5657
5658         (Expression::ConvertNumericExplicit): Finished.
5659
5660         (Invocation::Emit): If InstanceExpression is null, then it means
5661         that we perform a call on this.
5662         
5663 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
5664
5665         * expression.cs (Unary::Emit): Remove some dead code.
5666         (Probe): Implement Resolve and Emit for `is'.
5667         (Expression::ConvertImplicitRequired): Attempt to do constant
5668         expression conversions here.  Maybe should be moved to
5669         ConvertImplicit, but I am not sure.
5670         (Expression::ImplicitLongConstantConversionPossible,
5671         Expression::ImplicitIntConstantConversionPossible): New functions
5672         that tell whether is it possible to apply an implicit constant
5673         expression conversion.
5674
5675         (ConvertNumericExplicit): Started work on explicit numeric
5676         conversions.
5677
5678         * cs-parser.jay: Update operator constants.
5679
5680         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
5681         (Parameters::GetSignature): Hook up VerifyArgs here.
5682         (Parameters::VerifyArgs): Verifies that no two arguments have the
5683         same name. 
5684
5685         * class.cs (Operator): Update the operator names to reflect the
5686         ones that the spec expects (as we are just stringizing the
5687         operator names).
5688         
5689         * expression.cs (Unary::ResolveOperator): Fix bug: Use
5690         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
5691         previous usage did only work for our methods.
5692         (Expression::ConvertImplicit): Handle decimal implicit numeric
5693         conversions as well.
5694         (Expression::InternalTypeConstructor): Used to invoke constructors
5695         on internal types for default promotions.
5696
5697         (Unary::Emit): Implement special handling for the pre/post
5698         increment/decrement for overloaded operators, as they need to have
5699         the same semantics as the other operators.
5700
5701         (Binary::ResolveOperator): ditto.
5702         (Invocation::ConversionExists): ditto.
5703         (UserImplicitCast::Resolve): ditto.
5704         
5705 2001-09-26  Ravi Pratap  <ravi@ximian.com>
5706
5707         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
5708         operator, return after emitting body. Regression tests pass again !
5709
5710         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
5711         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
5712         (Invocation::OverloadResolve): Ditto.
5713         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
5714
5715         * everywhere : update calls to the above methods accordingly.
5716
5717 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
5718
5719         * assign.cs (Assign): Make it inherit from ExpressionStatement.
5720
5721         * expression.cs (ExpressionStatement): New base class used for
5722         expressions that can appear in statements, so that we can provide
5723         an alternate path to generate expression that do not leave a value
5724         on the stack.
5725
5726         (Expression::Emit, and all the derivatives): We no longer return
5727         whether a value is left on the stack or not.  Every expression
5728         after being emitted leaves a single value on the stack.
5729
5730         * codegen.cs (EmitContext::EmitStatementExpression): Use the
5731         facilties of ExpressionStatement if possible.
5732
5733         * cs-parser.jay: Update statement_expression.
5734
5735 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
5736
5737         * driver.cs: Change the wording of message
5738
5739 2001-09-25  Ravi Pratap  <ravi@ximian.com>
5740
5741         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
5742         the type of the expression to the return type of the method if
5743         we have an overloaded operator match ! The regression tests pass again !
5744         (Unary::ResolveOperator): Ditto.
5745
5746         * expression.cs (Invocation::ConversionExists): Correct the member lookup
5747         to find "op_Implicit", not "implicit" ;-)
5748         (UserImplicitCast): New class to take care of user-defined implicit conversions.
5749         (ConvertImplicit, ForceConversion): Take TypeContainer argument
5750
5751         * everywhere : Correct calls to the above accordingly.
5752
5753         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
5754         (ConvertImplicit): Do user-defined conversion if it exists.
5755
5756 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
5757
5758         * assign.cs: track location.
5759         (Resolve): Use implicit conversions on assignment.
5760
5761         * literal.cs: Oops.  Not good, Emit of short access values should
5762         pass (Bytes) or the wrong argument will be selected.
5763
5764         * expression.cs (Unary::Emit): Emit code for -expr.
5765         
5766         (Unary::ResolveOperator): Handle `Substract' for non-constants
5767         (substract from zero from the non-constants).
5768         Deal with Doubles as well. 
5769         
5770         (Expression::ConvertImplicitRequired): New routine that reports an
5771         error if no implicit conversion exists. 
5772
5773         (Invocation::OverloadResolve): Store the converted implicit
5774         expressions if we make them
5775         
5776 2001-09-24  Ravi Pratap  <ravi@ximian.com>
5777
5778         * class.cs (ConstructorInitializer): Take a Location argument.
5779         (ConstructorBaseInitializer): Same here.
5780         (ConstructorThisInitializer): Same here.
5781
5782         * cs-parser.jay : Update all calls accordingly.
5783
5784         * expression.cs (Unary, Binary, New): Take location argument.
5785         Update accordingly everywhere.
5786
5787         * cs-parser.jay : Update all calls to the above to take a location
5788         argument.
5789
5790         * class.cs : Ditto.
5791
5792 2001-09-24  Ravi Pratap  <ravi@ximian.com>
5793
5794         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
5795         (Invocation::BetterConversion): Same here
5796         (Invocation::ConversionExists): Ditto.
5797
5798         (Invocation::ConversionExists): Implement.
5799
5800 2001-09-22  Ravi Pratap  <ravi@ximian.com>
5801
5802         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
5803         Also take an additional TypeContainer argument.
5804
5805         * All over : Pass in TypeContainer as argument to OverloadResolve.
5806
5807         * typemanager.cs (CSharpName): Update to check for the string type and return
5808         that too.
5809
5810         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
5811         a given method.
5812         
5813 2001-09-21  Ravi Pratap  <ravi@ximian.com>
5814
5815         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
5816         (Invocation::BetterFunction): Implement.
5817         (Invocation::BetterConversion): Implement.
5818         (Invocation::ConversionExists): Skeleton, no implementation yet.
5819
5820         Okay, things work fine !
5821
5822 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
5823
5824         * typemanager.cs: declare and load enum_type, delegate_type and
5825         void_type. 
5826
5827         * expression.cs (Expression::Emit): Now emit returns a value that
5828         tells whether a value is left on the stack or not.  This strategy
5829         might be reveted tomorrow with a mechanism that would address
5830         multiple assignments.
5831         (Expression::report118): Utility routine to report mismatches on
5832         the ExprClass.
5833
5834         (Unary::Report23): Report impossible type/operator combination
5835         utility function.
5836
5837         (Unary::IsIncrementableNumber): Whether the type can be
5838         incremented or decremented with add.
5839         (Unary::ResolveOperator): Also allow enumerations to be bitwise
5840         complemented. 
5841         (Unary::ResolveOperator): Implement ++, !, ~,
5842
5843         (Invocation::Emit): Deal with new Emit convetion.
5844         
5845         * All Expression derivatives: Updated their Emit method to return
5846         whether they leave values on the stack or not.
5847         
5848         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
5849         stack for expressions that are statements. 
5850
5851 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
5852
5853         * expression.cs (LValue): New interface.  Must be implemented by
5854         LValue objects.
5855         (LocalVariableReference, ParameterReference, FieldExpr): Implement
5856         LValue interface.
5857         
5858         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
5859         interface for generating code, simplifies the code.
5860
5861 2001-09-20  Ravi Pratap  <ravi@ximian.com>
5862
5863         * expression.cs (everywhere): Comment out return statements in ::Resolve
5864         methods to avoid the warnings.
5865
5866 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
5867
5868         * driver.cs (parse): Report error 2001 if we can not open the
5869         source file.
5870
5871         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
5872         not resolve it.
5873
5874         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
5875         object. 
5876
5877         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
5878         otherwise nested blocks end up with the same index.
5879
5880         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
5881
5882         * expression.cs:  Instead of having FIXMEs in the Resolve
5883         functions, throw exceptions so it is obvious that we are facing a
5884         bug. 
5885
5886         * cs-parser.jay (invocation_expression): Pass Location information.
5887
5888         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
5889         Use a basename for those routines because .NET does not like paths
5890         on them. 
5891
5892         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
5893         already defined.
5894
5895 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
5896
5897         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
5898         are loading the correct data types (throws an exception if not).
5899         (TypeManager::InitCoreTypes): Use CoreLookupType
5900
5901         * expression.cs (Unary::ResolveOperator): return the child
5902         expression for expressions which are just +expr.
5903         (Unary::ResolveOperator): Return negative literals for -LITERAL
5904         expressions (otherwise they are Unary {Literal}).
5905         (Invocation::Badness): Take into account `Implicit constant
5906         expression conversions'.
5907
5908         * literal.cs (LongLiteral): Implement long literal class.
5909         (IntLiteral): export the `Value' of the intliteral. 
5910
5911 2001-09-19  Ravi Pratap  <ravi@ximian.com>
5912
5913         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
5914
5915         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
5916         instead of 'Operator'
5917
5918         * expression.cs (Binary::ResolveOperator): Update accordingly.
5919         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
5920         and 'Minus'
5921
5922         * cs-parser.jay (unary_expression): Update to use the new names.
5923
5924         * gen-treedump.cs (GetUnary): Same here.
5925
5926         * expression.cs (Unary::Resolve): Implement.
5927         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
5928         operators are found instead of making noise ;-)
5929         (Unary::ResolveOperator): New method to do precisely the same thing which
5930         Binary::ResolveOperator does for Binary expressions.
5931         (Unary.method, .Arguments): Add.
5932         (Unary::OperName): Implement.   
5933         (Unary::ForceConversion): Copy and Paste !
5934
5935         * class.cs (Operator::Define): Fix a small bug for the case when we have 
5936         a unary operator.
5937
5938         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
5939         for the inbuilt operators. Only overloading works for now ;-)
5940
5941 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
5942
5943         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
5944         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
5945
5946         * expression.cs (This::Emit): Implement. 
5947         (This::Resolve): Implement.
5948         (TypeOf:Resolve): Implement.
5949         (Expression::ResolveSimpleName): Add an implicit this to instance
5950         field references. 
5951         (MemberAccess::Resolve): Deal with Parameters and Fields. 
5952         Bind instance variable to Field expressions.
5953         (FieldExpr::Instance): New field used to track the expression that
5954         represents the object instance.
5955         (FieldExpr::Resolve): Track potential errors from MemberLookup not
5956         binding 
5957         (FieldExpr::Emit): Implement.
5958
5959         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
5960         the last instruction contains a return opcode to avoid generating
5961         the last `ret' instruction (this generates correct code, and it is
5962         nice to pass the peverify output).
5963
5964         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
5965         initializer for static and instance variables.
5966         (Constructor::Emit): Allow initializer to be null in the case of
5967         static constructors.  Only emit initializer for instance
5968         constructors. 
5969
5970         (TypeContainer::FindMembers): Return a null array if there are no
5971         matches.
5972
5973         Also fix the code for the MemberTypes.Method branch, as it was not
5974         scanning that for operators (or tried to access null variables before).
5975
5976         * assign.cs (Assign::Emit): Handle instance and static fields. 
5977
5978         * TODO: Updated.
5979
5980         * driver.cs: Stop compilation if there are parse errors.
5981
5982         * cs-parser.jay (constructor_declaration): Provide default base
5983         initializer for non-static constructors.
5984         (constructor_declarator): Do not provide a default base
5985         initializers if none was specified.
5986         Catch the fact that constructors should not have parameters.
5987
5988         * class.cs: Do not emit parent class initializers for static
5989         constructors, that should be flagged as an error.
5990
5991 2001-09-18  Ravi Pratap  <ravi@ximian.com>
5992
5993         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
5994         Move back code into TypeContainer::Populate.
5995
5996 2001-09-18  Ravi Pratap  <ravi@ximian.com>
5997
5998         * class.cs (TypeContainer::AddConstructor): Fix the check to
5999         compare against Name, not Basename. 
6000         (Operator::OpType): Change Plus and Minus to Add and Subtract.
6001
6002         * cs-parser.jay : Update accordingly.
6003
6004         * class.cs (TypeContainer::FindMembers): For the case where we are searching
6005         for methods, don't forget to look into the operators too.
6006         (RegisterMethodBuilder): Helper method to take care of this for
6007         methods, constructors and operators.
6008         (Operator::Define): Completely revamp.
6009         (Operator.OperatorMethod, MethodName): New fields.
6010         (TypeContainer::Populate): Move the registering of builders into
6011         RegisterMethodBuilder.
6012         (Operator::Emit): Re-write.
6013
6014         * expression.cs (Binary::Emit): Comment out code path to emit method
6015         invocation stuff for the case when we have a user defined operator. I am
6016         just not able to get it right !
6017         
6018 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
6019
6020         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
6021         argument. 
6022
6023         (Expression::MemberLookup): Provide a version that allows to
6024         specify the MemberTypes and BindingFlags. 
6025
6026         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
6027         so it was not fetching variable information from outer blocks.
6028
6029         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
6030         Beforefieldinit as it was buggy.
6031
6032         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
6033         that Ravi put here.  
6034
6035         * class.cs (Constructor::Emit): Only emit if block is not null.
6036         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
6037         deal with this by semantically definining it as if the user had
6038         done it.
6039
6040         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
6041         constructors as we now "emit" them at a higher level.
6042
6043         (TypeContainer::DefineDefaultConstructor): Used to define the
6044         default constructors if none was provided.
6045
6046         (ConstructorInitializer): Add methods Resolve and Emit. 
6047         
6048         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
6049
6050 2001-09-17  Ravi Pratap  <ravi@ximian.com>
6051
6052         * class.cs (TypeContainer::EmitDefaultConstructor): Register
6053         the default constructor builder with our hashtable for methodbuilders
6054         to methodcores.
6055
6056         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
6057         and argument_count is 0 in which case we have a match.
6058         (Binary::ResolveOperator): More null checking and miscellaneous coding
6059         style cleanup.
6060
6061 2001-09-17  Ravi Pratap  <ravi@ximian.com>
6062
6063         * rootcontext.cs (IsNameSpace): Compare against null.
6064
6065         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
6066
6067         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
6068         and Unary::Operator.
6069
6070         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
6071         accordingly.
6072
6073         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
6074         we have overloaded operators.
6075         (Binary::ResolveOperator): Implement the part which does the operator overload
6076         resolution.
6077
6078         * class.cs (Operator::Emit): Implement.
6079         (TypeContainer::Emit): Emit the operators we have too.
6080
6081         * expression.cs (Binary::Emit): Update to emit the appropriate code for
6082         the case when we have a user-defined operator.
6083         
6084 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
6085
6086         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
6087
6088 2001-09-16  Ravi Pratap  <ravi@ximian.com>
6089
6090         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
6091         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
6092         (Constructor::Emit): Implement.
6093         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
6094         if we have no work to do. 
6095         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
6096         Emit method.
6097
6098         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
6099         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
6100
6101         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
6102         of parent.parent.
6103
6104 2001-09-15  Ravi Pratap  <ravi@ximian.com>
6105
6106         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
6107         in the source.
6108         (Tree::RecordNamespace): Method to do what the name says ;-)
6109         (Tree::Namespaces): Property to get at the namespaces hashtable.
6110
6111         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
6112         keep track.
6113
6114         * rootcontext.cs (IsNamespace): Fixed it :-)
6115
6116 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
6117
6118         * class.cs (TypeContainer::FindMembers): Add support for
6119         constructors. 
6120         (MethodCore): New class that encapsulates both the shared aspects
6121         of a Constructor and a Method.  
6122         (Method, Constructor): Factored pieces into MethodCore.
6123
6124         * driver.cs: Added --fatal which makes errors throw exceptions.
6125         Load System assembly as well as part of the standard library.
6126
6127         * report.cs: Allow throwing exceptions on errors for debugging.
6128
6129         * modifiers.cs: Do not use `parent', instead use the real type
6130         container to evaluate permission settings.
6131
6132         * class.cs: Put Ravi's patch back in.  He is right, and we will
6133         have to cope with the
6134
6135 2001-09-14  Ravi Pratap  <ravi@ximian.com>
6136
6137         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
6138         FamORAssem, not FamANDAssem.
6139         
6140 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
6141
6142         * driver.cs: Added --parse option that only parses its input files
6143         and terminates.
6144
6145         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
6146         incorrect.  IsTopLevel is not used to tell whether an object is
6147         root_types or not (that can be achieved by testing this ==
6148         root_types).  But to see if this is a top-level *class* (not
6149         necessarly our "toplevel" container). 
6150
6151 2001-09-14  Ravi Pratap  <ravi@ximian.com>
6152
6153         * enum.cs (Enum::Define): Modify to call the Lookup method on the
6154         parent instead of a direct call to GetType.
6155
6156 2001-09-14  Ravi Pratap  <ravi@ximian.com>
6157
6158         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
6159         Modifiers.TypeAttr. This should just be a call to that method.
6160
6161         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
6162         object so that we can determine if we are top-level or not.
6163
6164         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
6165         TypeContainer too.
6166
6167         * enum.cs (Enum::Define): Ditto.
6168
6169         * modifiers.cs (FieldAttr): Re-write.
6170
6171         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
6172         (TypeContainer::HaveStaticConstructor): New property to provide access
6173         to precisely that info.
6174
6175         * modifiers.cs (MethodAttr): Re-write.
6176         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
6177
6178         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
6179         of top-level types as claimed.
6180         
6181 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
6182
6183         * expression.cs (MemberLookup): Fruitless attempt to lookup
6184         constructors.  Maybe I need to emit default constructors?  That
6185         might be it (currently .NET emits this for me automatically).
6186         (Invocation::OverloadResolve): Cope with Arguments == null.
6187         (Invocation::EmitArguments): new function, shared by the new
6188         constructor and us.
6189         (Invocation::Emit): Handle static and instance methods.  Emit
6190         proper call instruction for virtual or non-virtual invocations.
6191         (New::Emit): Implement.
6192         (New::Resolve): Implement.
6193         (MemberAccess:Resolve): Implement.
6194         (MethodGroupExpr::InstanceExpression): used conforming to the spec
6195         to track instances.
6196         (FieldExpr::Resolve): Set type.
6197
6198         * support.cs: Handle empty arguments.
6199                 
6200         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
6201         SimpleLookup): Auxiliary routines to help parse a qualifier
6202         identifier.  
6203
6204         Update qualifier_identifier rule.
6205
6206         * codegen.cs: Removed debugging messages.
6207
6208         * class.cs: Make this a global thing, this acts just as a "key" to
6209         objects that we might have around.
6210
6211         (Populate): Only initialize method_builders_to_methods once.
6212
6213         * expression.cs (PropertyExpr): Initialize type from the
6214         PropertyType. 
6215
6216         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
6217         Resolve pattern.  Attempt to implicitly convert value to boolean.
6218         Emit code.
6219
6220         * expression.cs: Set the type for the int32/int32 argument case.
6221         (Binary::ResolveOperator): Set the return type to boolean for
6222         comparission operators
6223
6224         * typemanager.cs: Remove debugging print code.
6225
6226         (Invocation::Resolve): resolve type.
6227
6228         * class.cs: Allocate a MemberInfo of the correct size, as the code
6229         elsewhere depends on the test to reflect the correct contents.
6230
6231         (Method::) Keep track of parameters, due to System.Reflection holes
6232
6233         (TypeContainer::Populate): Keep track of MethodBuilders to Method
6234         mapping here.
6235
6236         (TypeContainer::FindMembers): Use ArrayList and then copy an array
6237         of the exact size and return that.
6238
6239         (Class::LookupMethodByBuilder): New function that maps
6240         MethodBuilders to its methods.  Required to locate the information
6241         on methods because System.Reflection bit us again.
6242
6243         * support.cs: New file, contains an interface ParameterData and
6244         two implementations: ReflectionParameters and InternalParameters
6245         used to access Parameter information.  We will need to grow this
6246         as required.
6247
6248         * expression.cs (Invocation::GetParameterData): implement a cache
6249         and a wrapper around the ParameterData creation for methods. 
6250         (Invocation::OverloadResolve): Use new code.
6251
6252 2001-09-13  Ravi Pratap  <ravi@ximian.com>
6253
6254         * class.cs (TypeContainer::EmitField): Remove and move into 
6255         (Field::Define): here and modify accordingly.
6256         (Field.FieldBuilder): New member.
6257         (TypeContainer::Populate): Update accordingly.
6258         (TypeContainer::FindMembers): Implement.
6259
6260 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
6261
6262         * statement.cs: (VariableInfo::VariableType): New field to be
6263         initialized with the full type once it is resolved. 
6264
6265 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
6266
6267         * parameter.cs (GetParameterInfo): Use a type cache to compute
6268         things only once, and to reuse this information
6269
6270         * expression.cs (LocalVariableReference::Emit): Implement.
6271         (OpcodeCast::Emit): fix.
6272
6273         (ParameterReference::Resolve): Implement.
6274         (ParameterReference::Emit): Implement.
6275
6276         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
6277         that are expressions need to stay as Expressions.
6278
6279         * typemanager.cs (CSharpName): Returns the C# name of a type if
6280         possible. 
6281
6282         * expression.cs (Expression::ConvertImplicit): New function that
6283         implements implicit type conversions.
6284
6285         (Expression::ImplicitReferenceConversion): Implements implicit
6286         reference conversions.
6287
6288         (EmptyCast): New type for transparent casts.
6289
6290         (OpcodeCast): New type for casts of types that are performed with
6291         a sequence of bytecodes.
6292         
6293         (BoxedCast): New type used for casting value types into reference
6294         types.  Emits a box opcode.
6295
6296         (Binary::DoNumericPromotions): Implements numeric promotions of
6297         and computation of the Binary::Type.
6298
6299         (Binary::EmitBranchable): Optimization.
6300
6301         (Binary::Emit): Implement code emission for expressions.
6302         
6303         * typemanager.cs (TypeManager): Added two new core types: sbyte
6304         and byte.
6305
6306 2001-09-12  Ravi Pratap  <ravi@ximian.com>
6307
6308         * class.cs (TypeContainer::FindMembers): Method which does exactly
6309         what Type.FindMembers does, only we don't have to use reflection. No
6310         implementation yet.
6311
6312         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
6313         typecontainer objects as we need to get at them.
6314         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
6315
6316         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
6317         typecontainer object.
6318
6319         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
6320         of just a Report object.
6321
6322 2001-09-11  Ravi Pratap  <ravi@ximian.com>
6323
6324         * class.cs (Event::Define): Go back to using the prefixes "add_" and
6325         "remove_"
6326         (TypeContainer::Populate): Now define the delegates of the type too.
6327         (TypeContainer.Delegates): Property to access the list of delegates defined
6328         in the type.
6329
6330         * delegates.cs (Delegate::Define): Implement partially.
6331
6332         * modifiers.cs (TypeAttr): Handle more flags.
6333
6334 2001-09-11  Ravi Pratap  <ravi@ximian.com>
6335
6336         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
6337         and not <=
6338         (Operator::Define): Re-write logic to get types by using the LookupType method
6339         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
6340         (Indexer::Define): Ditto.
6341         (Event::Define): Ditto.
6342         (Property::Define): Ditto.
6343         
6344 2001-09-10  Ravi Pratap  <ravi@ximian.com>
6345
6346         * class.cs (TypeContainer::Populate): Now define operators too. 
6347         (TypeContainer.Operators): New property to access the list of operators
6348         in a type.
6349         (Operator.OperatorMethodBuilder): New member to hold the method builder
6350         for the operator we are defining.
6351         (Operator::Define): Implement.
6352
6353 2001-09-10  Ravi Pratap  <ravi@ximian.com>
6354
6355         * class.cs (Event::Define): Make the prefixes of the accessor methods
6356         addOn_ and removeOn_ 
6357
6358         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
6359         of the location being passed in too. Ideally, this should go later since all
6360         error reporting should be done through the Report object.
6361
6362         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
6363         (Populate): Iterate thru the indexers we have and define them too.
6364         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
6365         for the get and set accessors.
6366         (Indexer::Define): Implement.
6367         
6368 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
6369
6370         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
6371         my previous implementation, did not work.
6372
6373         * typemanager.cs: Add a couple of missing types (the longs).
6374
6375         * literal.cs: Use TypeManager.bool_type instead of getting it.
6376
6377         * expression.cs (EventExpr): New kind of expressions.
6378         (Expressio::ExprClassFromMemberInfo): finish
6379
6380 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
6381
6382         * assign.cs: Emit stores to static fields differently.
6383
6384 2001-09-08  Ravi Pratap  <ravi@ximian.com>
6385
6386         * Merge in changes and adjust code to tackle conflicts. Backed out my
6387         code in Assign::Resolve ;-) 
6388
6389 2001-09-08  Ravi Pratap  <ravi@ximian.com>
6390
6391         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
6392         instead Report.Error and also pass in the location.
6393         (CSharpParser::Lexer): New readonly property to return the reference
6394         to the Tokenizer object.
6395         (declare_local_variables): Use Report.Error with location instead of plain 
6396         old error.
6397         (CheckDef): Ditto.
6398
6399         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
6400         (Operator.CheckBinaryOperator): Ditto.
6401
6402         * cs-parser.jay (operator_declarator): Update accordingly.
6403
6404         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
6405         (CheckBinaryOperator): Same here.
6406
6407         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
6408         on the name without any prefixes of namespace names etc. This is because we
6409         already might have something already fully qualified like 
6410         'System.Console.WriteLine'
6411
6412         * assign.cs (Resolve): Begin implementation. Stuck ;-)
6413
6414 2001-09-07  Ravi Pratap  <ravi@ximian.com>
6415
6416         * cs-tokenizer.cs (location): Return a string which also contains
6417         the file name.
6418
6419         * expression.cs (ElementAccess): New class for expressions of the
6420         type 'element access.'
6421         (BaseAccess): New class for expressions of the type 'base access.'
6422         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
6423         respectively.
6424         
6425         * cs-parser.jay (element_access): Implement action.
6426         (base_access): Implement actions.
6427         (checked_expression, unchecked_expression): Implement.
6428
6429         * cs-parser.jay (local_variable_type): Correct and implement.
6430         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
6431
6432         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
6433
6434         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
6435         name and the specifiers.
6436
6437         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
6438         
6439         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
6440         making them all public ;-)
6441
6442         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
6443         class anyways.
6444         
6445 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
6446
6447         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
6448         PropertyExprs.
6449         (FieldExpr, PropertyExprs): New resolved expressions.
6450         (SimpleName::MemberStaticCheck): Perform static checks for access
6451         to non-static fields on static methods. Maybe this should be
6452         generalized for MemberAccesses. 
6453         (SimpleName::ResolveSimpleName): More work on simple name
6454         resolution. 
6455
6456         * cs-parser.jay (primary_expression/qualified_identifier): track
6457         the parameter index.
6458
6459         * codegen.cs (CodeGen::Save): Catch save exception, report error.
6460         (EmitContext::EmitBoolExpression): Chain to expression generation
6461         instead of temporary hack.
6462         (::EmitStatementExpression): Put generic expression code generation.
6463
6464         * assign.cs (Assign::Emit): Implement variable assignments to
6465         local variables, parameters and fields.
6466
6467 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
6468
6469         * statement.cs (Block::GetVariableInfo): New method, returns the
6470         VariableInfo for a variable name in a block.
6471         (Block::GetVariableType): Implement in terms of GetVariableInfo
6472
6473         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
6474         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
6475
6476 2001-09-06  Ravi Pratap  <ravi@ximian.com>
6477
6478         * cs-parser.jay (operator_declaration): Continue on my quest : update
6479         to take attributes argument.
6480         (event_declaration): Ditto.
6481         (enum_declaration): Ditto.
6482         (indexer_declaration): Ditto.
6483         
6484         * class.cs (Operator::Operator): Update constructor accordingly.
6485         (Event::Event): Ditto.
6486
6487         * delegate.cs (Delegate::Delegate): Same here.
6488
6489         * enum.cs (Enum::Enum): Same here.
6490         
6491 2001-09-05  Ravi Pratap  <ravi@ximian.com>
6492
6493         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
6494
6495         * ../tests/cs0658.cs : New file to demonstrate error 0658.
6496
6497         * attribute.cs (Attributes): New class to encapsulate all attributes which were
6498         being passed around as an arraylist.
6499         (Attributes::AddAttribute): Method to add attribute sections.
6500
6501         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
6502         (struct_declaration): Update accordingly.
6503         (constant_declaration): Update.
6504         (field_declaration): Update.
6505         (method_header): Update.
6506         (fixed_parameter): Update.
6507         (parameter_array): Ditto.
6508         (property_declaration): Ditto.
6509         (destructor_declaration): Ditto.
6510         
6511         * class.cs (Struct::Struct): Update constructors accordingly.
6512         (Class::Class): Ditto.
6513         (Field::Field): Ditto.
6514         (Method::Method): Ditto.
6515         (Property::Property): Ditto.
6516         (TypeContainer::OptAttribute): update property's return type.
6517         
6518         * interface.cs (Interface.opt_attributes): New member.
6519         (Interface::Interface): Update to take the extra Attributes argument.
6520
6521         * parameter.cs (Parameter::Parameter): Ditto.
6522
6523         * constant.cs (Constant::Constant): Ditto.
6524
6525         * interface.cs (InterfaceMemberBase): New OptAttributes field.
6526         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
6527         the attributes as a parameter.
6528         (InterfaceProperty): Update constructor call.
6529         (InterfaceEvent): Ditto.
6530         (InterfaceMethod): Ditto.
6531         (InterfaceIndexer): Ditto.
6532
6533         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
6534         pass the attributes too.
6535         (interface_event_declaration): Ditto.
6536         (interface_property_declaration): Ditto.
6537         (interface_method_declaration): Ditto.
6538         (interface_declaration): Ditto.
6539
6540 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
6541
6542         * class.cs (Method::Define): Track the "static Main" definition to
6543         create an entry point. 
6544
6545         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
6546         EntryPoint if we find it. 
6547
6548         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
6549         (EmitContext::ig): Make this variable public.
6550
6551         * driver.cs: Make the default output file be the first file name
6552         with the .exe extension.  
6553
6554         Detect empty compilations
6555
6556         Handle various kinds of output targets.  Handle --target and
6557         rename -t to --dumper.
6558
6559         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
6560         methods inherited from Expression return now an Expression.  This
6561         will is used during the tree rewriting as we resolve them during
6562         semantic analysis.
6563
6564         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
6565         the spec.  Missing entirely is the information about
6566         accessability of elements of it.
6567
6568         (Expression::ExprClassFromMemberInfo): New constructor for
6569         Expressions that creates a fully initialized Expression based on
6570         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
6571         a Type.
6572
6573         (Invocation::Resolve): Begin implementing resolution of invocations.
6574         
6575         * literal.cs (StringLiteral):  Implement Emit.
6576
6577 2001-09-05  Ravi Pratap  <ravi@ximian.com>
6578
6579         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
6580         member.
6581         
6582 2001-09-04  Ravi Pratap  <ravi@ximian.com>
6583
6584         * cs-parser.jay (attribute_arguments): Implement actions.
6585         (attribute): Fix bug in production. Implement action.
6586         (attribute_list): Implement.
6587         (attribute_target): Implement.
6588         (attribute_target_specifier, opt_target_specifier): Implement
6589         (CheckAttributeTarget): New method to check if the attribute target
6590         is valid.
6591         (attribute_section): Implement.
6592         (opt_attributes): Implement.
6593
6594         * attribute.cs : New file to handle attributes.
6595         (Attribute): Class to hold attribute info.
6596
6597         * cs-parser.jay (opt_attribute_target_specifier): Remove production
6598         (attribute_section): Modify production to use 2 different rules to 
6599         achieve the same thing. 1 s/r conflict down !
6600         Clean out commented, useless, non-reducing dimension_separator rules.
6601         
6602         * class.cs (TypeContainer.attributes): New member to hold list
6603         of attributes for a type.
6604         (Struct::Struct): Modify to take one more argument, the attribute list.
6605         (Class::Class): Ditto.
6606         (Field::Field): Ditto.
6607         (Method::Method): Ditto.
6608         (Property::Property): Ditto.
6609         
6610         * cs-parser.jay (struct_declaration): Update constructor call to
6611         pass in the attributes too.
6612         (class_declaration): Ditto.
6613         (constant_declaration): Ditto.
6614         (field_declaration): Ditto.
6615         (method_header): Ditto.
6616         (fixed_parameter): Ditto.
6617         (parameter_array): Ditto.
6618         (property_declaration): Ditto.
6619
6620         * constant.cs (Constant::Constant): Update constructor similarly.
6621         Use System.Collections.
6622
6623         * parameter.cs (Parameter::Parameter): Update as above.
6624
6625 2001-09-02  Ravi Pratap  <ravi@ximian.com>
6626
6627         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
6628         (TypeContainer.delegates): New member to hold list of delegates.
6629
6630         * cs-parser.jay (delegate_declaration): Implement the action correctly 
6631         this time as I seem to be on crack ;-)
6632
6633 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
6634
6635         * rootcontext.cs (RootContext::IsNamespace): new function, used to
6636         tell whether an identifier represents a namespace.
6637
6638         * expression.cs (NamespaceExpr): A namespace expression, used only
6639         temporarly during expression resolution.
6640         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
6641         utility functions to resolve names on expressions.
6642
6643 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
6644
6645         * codegen.cs: Add hook for StatementExpressions. 
6646
6647         * class.cs: Fix inverted test for static flag in methods.
6648
6649 2001-09-02  Ravi Pratap  <ravi@ximian.com>
6650
6651         * class.cs (Operator::CheckUnaryOperator): Correct error number used
6652         to make it coincide with MS' number.
6653         (Operator::CheckBinaryOperator): Ditto.
6654
6655         * ../errors/errors.txt : Remove error numbers added earlier.
6656
6657         * ../errors/cs1019.cs : Test case for error # 1019
6658
6659         * ../errros/cs1020.cs : Test case for error # 1020
6660
6661         * cs-parser.jay : Clean out commented cruft.
6662         (dimension_separators, dimension_separator): Comment out. Ostensibly not
6663         used anywhere - non-reducing rule.
6664         (namespace_declarations): Non-reducing rule - comment out.
6665
6666         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
6667         with TypeContainer::AddEnum.
6668
6669         * delegate.cs : New file for delegate handling classes.
6670         (Delegate): Class for declaring delegates.
6671
6672         * makefile : Update.
6673
6674         * cs-parser.jay (delegate_declaration): Implement.
6675
6676 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
6677
6678         * class.cs (Event::Define): Implement.
6679         (Event.EventBuilder): New member.
6680
6681         * class.cs (TypeContainer::Populate): Update to define all enums and events
6682         we have.
6683         (Events): New property for the events arraylist we hold. Shouldn't we move to using
6684         readonly fields for all these cases ?
6685
6686 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
6687
6688         * class.cs (Property): Revamp to use the convention of making fields readonly.
6689         Accordingly modify code elsewhere.
6690
6691         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
6692         the Define method of the Property class.
6693
6694         * class.cs : Clean up applied patch and update references to variables etc. Fix 
6695         trivial bug.
6696         (TypeContainer::Populate): Update to define all the properties we have. Also
6697         define all enumerations.
6698
6699         * enum.cs (Define): Implement.
6700         
6701 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
6702
6703         * cs-parser.jay (overloadable_operator): The semantic value is an
6704         enum of the Operator class.
6705         (operator_declarator): Implement actions.
6706         (operator_declaration): Implement.
6707
6708         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
6709         validity of definitions.
6710         (Operator::CheckBinaryOperator): Static method to check for binary operators
6711         (TypeContainer::AddOperator): New method to add an operator to a type.
6712
6713         * cs-parser.jay (indexer_declaration): Added line to actually call the
6714         AddIndexer method so it gets added ;-)
6715
6716         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
6717         already taken care of by the MS compiler ?  
6718
6719 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
6720
6721         * class.cs (Operator): New class for operator declarations.
6722         (Operator::OpType): Enum for the various operators.
6723
6724 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
6725
6726         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
6727         ostensibly handle this in semantic analysis.
6728
6729         * cs-parser.jay (general_catch_clause): Comment out
6730         (specific_catch_clauses, specific_catch_clause): Ditto.
6731         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
6732         (catch_args, opt_catch_args): New productions.
6733         (catch_clause): Rewrite to use the new productions above
6734         (catch_clauses): Modify accordingly.
6735         (opt_catch_clauses): New production to use in try_statement
6736         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
6737         and re-write the code in the actions to extract the specific and
6738         general catch clauses by being a little smart ;-)
6739
6740         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
6741         Hooray, try and catch statements parse fine !
6742         
6743 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
6744
6745         * statement.cs (Block::GetVariableType): Fix logic to extract the type
6746         string from the hashtable of variables.
6747
6748         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
6749         I end up making that mistake ;-)
6750         (catch_clauses): Fixed gross error which made Key and Value of the 
6751         DictionaryEntry the same : $1 !!
6752
6753 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
6754
6755         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
6756
6757         * cs-parser.jay (event_declaration): Correct to remove the semicolon
6758         when the add and remove accessors are specified. 
6759
6760 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
6761
6762         * cs-parser.jay (IndexerDeclaration): New helper class to hold
6763         information about indexer_declarator.
6764         (indexer_declarator): Implement actions.
6765         (parsing_indexer): New local boolean used to keep track of whether
6766         we are parsing indexers or properties. This is necessary because 
6767         implicit_parameters come into picture even for the get accessor in the 
6768         case of an indexer.
6769         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
6770
6771         * class.cs (Indexer): New class for indexer declarations.
6772         (TypeContainer::AddIndexer): New method to add an indexer to a type.
6773         (TypeContainer::indexers): New member to hold list of indexers for the
6774         type.
6775
6776 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
6777
6778         * cs-parser.jay (add_accessor_declaration): Implement action.
6779         (remove_accessor_declaration): Implement action.
6780         (event_accessors_declaration): Implement
6781         (variable_declarators): swap statements for first rule - trivial.
6782
6783         * class.cs (Event): New class to hold information about event
6784         declarations.
6785         (TypeContainer::AddEvent): New method to add an event to a type
6786         (TypeContainer::events): New member to hold list of events.
6787
6788         * cs-parser.jay (event_declaration): Implement actions.
6789
6790 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
6791
6792         * cs-parser.jay (dim_separators): Implement. Make it a string
6793         concatenating all the commas together, just as they appear.
6794         (opt_dim_separators): Modify accordingly
6795         (rank_specifiers): Update accordingly. Basically do the same
6796         thing - instead, collect the brackets here.
6797         (opt_rank_sepcifiers): Modify accordingly.
6798         (array_type): Modify to actually return the complete type string
6799         instead of ignoring the rank_specifiers.
6800         (expression_list): Implement to collect the expressions
6801         (variable_initializer): Implement. We make it a list of expressions
6802         essentially so that we can handle the array_initializer case neatly too.
6803         (variable_initializer_list): Implement.
6804         (array_initializer): Make it a list of variable_initializers
6805         (opt_array_initializer): Modify accordingly.
6806
6807         * expression.cs (New::NType): Add enumeration to help us
6808         keep track of whether we have an object/delegate creation
6809         or an array creation.
6810         (New:NewType, New::Rank, New::Indices, New::Initializers): New
6811         members to hold data about array creation.
6812         (New:New): Modify to update NewType
6813         (New:New): New Overloaded contructor for the array creation
6814         case.
6815
6816         * cs-parser.jay (array_creation_expression): Implement to call
6817         the overloaded New constructor.
6818         
6819 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
6820
6821         * class.cs (TypeContainer::Constructors): Return member
6822         constructors instead of returning null.
6823
6824 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
6825
6826         * typemanager.cs (InitCoreTypes): Initialize the various core
6827         types after we have populated the type manager with the user
6828         defined types (this distinction will be important later while
6829         compiling corlib.dll)
6830
6831         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
6832         on Expression Classification.  Now all expressions have a method
6833         `Resolve' and a method `Emit'.
6834
6835         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
6836         generation from working.     Also add some temporary debugging
6837         code. 
6838         
6839 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
6840
6841         * codegen.cs: Lots of code generation pieces.  This is only the
6842         beginning, will continue tomorrow with more touches of polish.  We
6843         handle the fundamentals of if, while, do, for, return.  Others are
6844         trickier and I need to start working on invocations soon.
6845         
6846         * gen-treedump.cs: Bug fix, use s.Increment here instead of
6847         s.InitStatement. 
6848
6849         * codegen.cs (EmitContext): New struct, used during code
6850         emission to keep a context.   Most of the code generation will be
6851         here. 
6852
6853         * cs-parser.jay: Add embedded blocks to the list of statements of
6854         this block.  So code generation proceeds in a top down fashion.
6855
6856 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
6857
6858         * statement.cs: Add support for multiple child blocks.
6859
6860 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
6861
6862         * codegen.cs (EmitCode): New function, will emit the code for a
6863         Block of code given a TypeContainer and its ILGenerator. 
6864
6865         * statement.cs (Block): Standard public readonly optimization.
6866         (Block::Block constructors): Link children. 
6867         (Block::Child): Child Linker.
6868         (Block::EmitVariables): Emits IL variable declarations.
6869
6870         * class.cs: Drop support for MethodGroups here, delay until
6871         Semantic Analysis.
6872         (Method::): Applied the same simplification that I did before, and
6873         move from Properties to public readonly fields.
6874         (Method::ParameterTypes): Returns the parameter types for the
6875         function, and implements a cache that will be useful later when I
6876         do error checking and the semantic analysis on the methods is
6877         performed.
6878         (Constructor::GetCallingConvention): Renamed from CallingConvetion
6879         and made a method, optional argument tells whether this is a class
6880         or a structure to apply the `has-this' bit.
6881         (Method::GetCallingConvention): Implement, returns the calling
6882         convention. 
6883         (Method::Define): Defines the type, a second pass is performed
6884         later to populate the methods.
6885
6886         (Constructor::ParameterTypes): implement a cache similar to the
6887         one on Method::ParameterTypes, useful later when we do semantic
6888         analysis. 
6889
6890         (TypeContainer::EmitMethod):  New method.  Emits methods.
6891
6892         * expression.cs: Removed MethodGroup class from here.
6893         
6894         * parameter.cs (Parameters::GetCallingConvention): new method.
6895
6896 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
6897
6898         * class.cs (TypeContainer::Populate): Drop RootContext from the
6899         argument. 
6900
6901         (Constructor::CallingConvention): Returns the calling convention.
6902         (Constructor::ParameterTypes): Returns the constructor parameter
6903         types. 
6904         
6905         (TypeContainer::AddConstructor): Keep track of default constructor
6906         and the default static constructor.
6907
6908         (Constructor::) Another class that starts using `public readonly'
6909         instead of properties. 
6910
6911         (Constructor::IsDefault): Whether this is a default constructor. 
6912
6913         (Field::) use readonly public fields instead of properties also.
6914
6915         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
6916         track of static constructors;  If none is used, turn on
6917         BeforeFieldInit in the TypeAttributes. 
6918
6919         * cs-parser.jay (opt_argument_list): now the return can be null
6920         for the cases where there are no arguments. 
6921
6922         (constructor_declarator): If there is no implicit `base' or
6923         `this', then invoke the default parent constructor. 
6924         
6925         * modifiers.cs (MethodAttr): New static function maps a set of
6926         modifiers flags into a MethodAttributes enum
6927         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
6928         MethodAttr, TypeAttr to represent the various mappings where the
6929         modifiers are used.
6930         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
6931
6932 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
6933
6934         * parameter.cs (GetParameterInfo): Fix bug where there would be no
6935         method arguments.
6936
6937         * interface.cs (PopulateIndexer): Implemented the code generator
6938         for interface indexers.
6939
6940 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
6941
6942         * interface.cs (InterfaceMemberBase): Now we track the new status
6943         here.  
6944
6945         (PopulateProperty): Implement property population.  Woohoo!  Got
6946         Methods and Properties going today. 
6947
6948         Removed all the properties for interfaces, and replaced them with
6949         `public readonly' fields. 
6950
6951 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
6952
6953         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
6954         initialize their hashtables/arraylists only when they are needed
6955         instead of doing this always.
6956
6957         * parameter.cs: Handle refs and out parameters.
6958
6959         * cs-parser.jay: Use an ArrayList to construct the arguments
6960         instead of the ParameterCollection, and then cast that to a
6961         Parameter[] array.
6962
6963         * parameter.cs: Drop the use of ParameterCollection and use
6964         instead arrays of Parameters.
6965
6966         (GetParameterInfo): Use the Type, not the Name when resolving
6967         types. 
6968
6969 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
6970
6971         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
6972         and instead use public readonly fields.
6973
6974         * class.cs: Put back walking code for type containers.
6975
6976 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
6977
6978         * class.cs (MakeConstant): Code to define constants.
6979
6980         * rootcontext.cs (LookupType): New function.  Used to locate types 
6981
6982         
6983 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
6984
6985         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
6986         this System.Reflection code is.  Kudos to Microsoft
6987         
6988         * typemanager.cs: Implement a type cache and avoid loading all
6989         types at boot time.  Wrap in LookupType the internals.  This made
6990         the compiler so much faster.  Wow.  I rule!
6991         
6992         * driver.cs: Make sure we always load mscorlib first (for
6993         debugging purposes, nothing really important).
6994
6995         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
6996         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
6997
6998         * rootcontext.cs: Lookup types on their namespace;  Lookup types
6999         on namespaces that have been imported using the `using' keyword.
7000
7001         * class.cs (TypeContainer::TypeAttr): Virtualize.
7002         (Class::TypeAttr): Return attributes suitable for this bad boy.
7003         (Struct::TypeAttr): ditto.
7004         Handle nested classes.
7005         (TypeContainer::) Remove all the type visiting code, it is now
7006         replaced with the rootcontext.cs code
7007
7008         * rootcontext.cs (GetClassBases): Added support for structs. 
7009
7010 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
7011
7012         * interface.cs, statement.cs, class.cs, parameter.cs,
7013         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
7014         Drop use of TypeRefs, and use strings instead.
7015
7016 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
7017
7018         * rootcontext.cs: 
7019
7020         * class.cs (Struct::Struct): set the SEALED flags after
7021         checking the modifiers.
7022         (TypeContainer::TypeAttr): new property, returns the
7023         TypeAttributes for a class.  
7024
7025         * cs-parser.jay (type_list): Oops, list production was creating a
7026         new list of base types.
7027
7028         * rootcontext.cs (StdLib): New property.
7029         (GetInterfaceTypeByName): returns an interface by type name, and
7030         encapsulates error handling here.
7031         (GetInterfaces): simplified.
7032         (ResolveTree): Encapsulated all the tree resolution here.
7033         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
7034         types. 
7035         
7036         * driver.cs: Add support for --nostdlib, to avoid loading the
7037         default assemblies.
7038         (Main): Do not put tree resolution here. 
7039
7040         * rootcontext.cs: Beginning of the class resolution.
7041
7042 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
7043
7044         * rootcontext.cs: Provide better error reporting. 
7045
7046         * cs-parser.jay (interface_base): set our $$ to be interfaces.
7047
7048         * rootcontext.cs (CreateInterface): Handle the case where there
7049         are no parent interfaces.
7050         
7051         (CloseTypes): Routine to flush types at the end.
7052         (CreateInterface): Track types.
7053         (GetInterfaces): Returns an array of Types from the list of
7054         defined interfaces.
7055
7056         * typemanager.c (AddUserType): Mechanism to track user types (puts
7057         the type on the global type hash, and allows us to close it at the
7058         end). 
7059         
7060 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
7061
7062         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
7063         RecordInterface instead.
7064
7065         * cs-parser.jay: Updated to reflect changes above.
7066
7067         * decl.cs (Definition): Keep track of the TypeBuilder type that
7068         represents this type here.  Not sure we will use it in the long
7069         run, but wont hurt for now.
7070
7071         * driver.cs: Smaller changes to accomodate the new code.
7072
7073         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
7074         when done. 
7075
7076         * rootcontext.cs (CreateInterface):  New method, used to create
7077         the System.TypeBuilder type for interfaces.
7078         (ResolveInterfaces): new entry point to resolve the interface
7079         hierarchy. 
7080         (CodeGen): Property, used to keep track of the code generator.
7081
7082 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
7083
7084         * cs-parser.jay: Add a second production for delegate_declaration
7085         with `VOID'.
7086
7087         (enum_body): Put an opt_comma here instead of putting it on
7088         enum_body or enum_member_declarations so we can handle trailing
7089         commas on enumeration members.  Gets rid of a shift/reduce.
7090         
7091         (type_list): Need a COMMA in the middle.
7092
7093         (indexer_declaration): Tell tokenizer to recognize get/set
7094
7095         * Remove old targets.
7096
7097         * Re-add the parser target.
7098
7099 2001-07-13  Simon Cozens <simon@simon-cozens.org>
7100
7101         * cs-parser.jay: Add precendence rules for a number of operators
7102         ot reduce the number of shift/reduce conflicts in the grammar.
7103         
7104 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
7105
7106         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
7107         and put it here.
7108
7109         Get rid of old crufty code.
7110
7111         * rootcontext.cs: Use this to keep track of the parsed
7112         representation and the defined types available to the program. 
7113
7114         * gen-treedump.cs: adjust for new convention.
7115
7116         * type.cs: Split out the type manager, and the assembly builder
7117         from here. 
7118
7119         * typemanager.cs: the type manager will live here now.
7120
7121         * cil-codegen.cs: And the code generator here. 
7122
7123 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
7124
7125         * makefile: Fixed up for easy making.
7126
7127 2001-07-13  Simon Cozens <simon@simon-cozens.org>
7128
7129         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
7130         the 
7131
7132         (unary_expression): Expand pre_increment_expression and
7133         post_decrement_expression to reduce a shift/reduce.
7134
7135 2001-07-11  Simon Cozens
7136
7137         * cs-tokenizer.cs: Hex numbers should begin with a 0.
7138
7139         Improve allow_keyword_as_indent name.
7140
7141 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
7142
7143         * Adjustments for Beta2. 
7144
7145 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
7146
7147         * decl.cs: Added `Define' abstract method.
7148         (InTransit): new property, used to catch recursive definitions. 
7149
7150         * interface.cs: Implement `Define'. 
7151
7152         * modifiers.cs: Map Modifiers.constants to
7153         System.Reflection.TypeAttribute flags.
7154
7155         * class.cs: Keep track of types and user-defined types.
7156         (BuilderInit): New method for creating an assembly
7157         (ResolveType): New function to launch the resolution process, only
7158         used by interfaces for now.
7159
7160         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
7161         that are inserted into the name space. 
7162
7163 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
7164
7165         * ARGH.  I have screwed up my tree so many times due to the use of
7166         rsync rather than using CVS.  Going to fix this at once. 
7167
7168         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
7169         load types.
7170
7171 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
7172
7173         * Experiment successful: Use System.Type rather that our own
7174         version of Type.  
7175
7176 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
7177
7178         * cs-parser.jay: Removed nsAliases from here.
7179
7180         Use new namespaces, handle `using XXX;' 
7181
7182         * namespace.cs: Reimplemented namespace handling, use a recursive
7183         definition of the class.  Now we can keep track of using clauses
7184         and catch invalid using clauses.
7185
7186 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
7187
7188         * gen-treedump.cs: Adapted for all the renaming.
7189
7190         * expression.cs (Expression): this class now has a Type property
7191         which returns an expression Type.
7192
7193         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
7194         `Type', as this has a different meaning now in the base
7195
7196 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
7197
7198         * interface.cs, class.cs: Removed from all the sources the
7199         references to signature computation, as we can not do method
7200         signature computation during the parsing time, as we are not
7201         trying to solve at that point distinguishing:
7202
7203         class X {
7204                 void a (Blah x) {}
7205                 void a (NS.Blah x) {}
7206         }
7207
7208         Which depending on the context might be valid or not, as we do not
7209         know if Blah is the same thing as NS.Blah at that point.
7210
7211         * Redid everything so the code uses TypeRefs now instead of
7212         Types.  TypeRefs are just temporary type placeholders, that need
7213         to be resolved.  They initially have a pointer to a string and the
7214         current scope in which they are used.  This is used later by the
7215         compiler to resolve the reference to an actual Type. 
7216
7217         * DeclSpace is no longer a CIR.Type, and neither are
7218         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
7219         are all DeclSpaces, but no Types. 
7220
7221         * type.cs (TypeRefManager): This implements the TypeRef manager,
7222         which keeps track of all the types that need to be resolved after
7223         the parsing has finished. 
7224
7225 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
7226
7227         * ARGH.  We are going to have to store `foreach' as a class rather
7228         than resolving it, as we need to verify error 1579 after name
7229         resolution.   *OR* we could keep a flag that says `This request to
7230         IEnumerator comes from a foreach statement' which we can then use
7231         to generate the error.
7232
7233 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
7234
7235         * class.cs (TypeContainer.AddMethod): we now add methods to the
7236         MethodGroup instead of the method hashtable.  
7237
7238         * expression.cs: Add MethodGroup abstraction, which gets us one
7239         step closer to the specification in the way we handle method
7240         declarations.  
7241
7242         * cs-parser.jay (primary_expression): qualified_identifier now
7243         tried to match up an identifier to a local variable reference or
7244         to a parameter reference.
7245
7246         current_local_parameters is now a parser global variable that
7247         points to the current parameters for the block, used during name
7248         lookup.
7249
7250         (property_declaration): Now creates an implicit `value' argument to
7251         the set accessor.
7252
7253 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
7254
7255         * parameter.cs: Do not use `param' arguments as part of the
7256         signature, per the spec.
7257
7258 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
7259
7260         * decl.cs: Base class for classes, structs and interfaces.  This
7261         is the "Declaration Space" 
7262
7263         * cs-parser.jay: Use CheckDef for checking declaration errors
7264         instead of having one on each function.
7265
7266         * class.cs: Factor out some code for handling error handling in
7267         accordance to the "Declarations" section in the "Basic Concepts"
7268         chapter in the ECMA C# spec.
7269
7270         * interface.cs: Make all interface member classes derive from
7271         InterfaceMemberBase.
7272
7273 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
7274
7275         * Many things: all interfaces are parsed and generated in
7276         gen-treedump.  Support for member variables, constructors,
7277         destructors, properties, constants is there.
7278
7279         Beginning of the IL backend, but very little done, just there for
7280         testing purposes. 
7281
7282 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
7283
7284         * cs-parser.jay: Fix labeled statement.
7285
7286         * cs-tokenizer.cs (escape): Escape " and ' always.
7287         ref_line, ref_name: keep track of the line/filename as instructed
7288         by #line by the compiler.
7289         Parse #line.
7290
7291 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
7292
7293         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
7294         to match the values in System.CodeDOM.
7295
7296         Divid renamed to Divide.
7297
7298         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
7299         statements. 
7300         (Statements.set): remove.
7301
7302         * System.CodeDOM/CodeCatchClause.cs: always have a valid
7303         statements. 
7304
7305         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
7306         falseStatements always have valid values. 
7307
7308         * cs-parser.jay: Use System.CodeDOM now.
7309