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