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