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