2003-03-28 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / ChangeLog
1 2003-03-28  Miguel de Icaza  <miguel@ximian.com>
2
3         * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
4         implicit conversion to boolean.
5
6         * statement.cs (Statement.ResolveBoolean): A boolean expression is
7         also one where the type implements `operator true'. 
8
9         * ecore.cs (Expression.GetOperatorTrue): New helper routine to
10         get an expression that will invoke operator true based on an
11         expression.  
12
13         (GetConversionOperators): Removed the hack that called op_True
14         here.  
15
16         (Expression.ResolveBoolean): Move this from Statement.
17
18 2003-03-17  Miguel de Icaza  <miguel@ximian.com>
19
20         * ecore.cs (FieldExpr): do not allow initialization of initonly
21         fields on derived classes
22
23 2003-03-13  Martin Baulig  <martin@ximian.com>
24
25         * statement.cs (Block.Emit): Call ig.BeginScope() and
26         ig.EndScope() when compiling with debugging info; call
27         LocalBuilder.SetLocalSymInfo _after_ opening the scope.
28
29 2003-03-08  Miguel de Icaza  <miguel@ximian.com>
30
31         * expression.cs (Indexers): Do not construct immediately, allow
32         for new members to be appended as we go.  Fixes 38143
33
34 2003-03-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
35
36         * expression.cs: save/restore context when resolving an unchecked
37         expression.
38
39 2003-03-05  Miguel de Icaza  <miguel@ximian.com>
40
41         * cfold.cs: Catch division by zero in modulus operator during
42         constant folding.
43
44 2003-03-03  Miguel de Icaza  <miguel@ximian.com>
45
46         * interface.cs (Interface.DefineMembers): Avoid defining members
47         twice. 
48
49 2003-02-27  Miguel de Icaza  <miguel@ximian.com>
50
51         * driver.cs: handle the +/- options for -noconfig
52
53         * statement.cs (Unckeched.Resolve): Also track the state of
54         unchecked in the Resolve phase.
55
56 2003-02-27  Martin Baulig  <martin@ximian.com>
57
58         * ecore.cs (Expression.MemberLookup): Don't create a
59         MethodGroupExpr for something which is not a method.  Fixes #38291.
60
61 2003-02-25  Miguel de Icaza  <miguel@ximian.com>
62
63         * class.cs (MemberBase.CheckParameters): Also check that the type
64         is unmanaged if it is a pointer.
65
66         * expression.cs (SizeOf.Resolve): Add location information.
67
68         * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
69         a managed type is declared.
70
71         * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
72         parameter modifiers as well.  Fixes bug 38606
73
74         * class.cs: Very sad.  Am backing out the speed up changes
75         introduced by the ArrayList -> Array in the TypeContainer, as they
76         were not actually that much faster, and introduced a bug (no error
77         reports on duplicated methods).
78
79         * assign.cs (CompoundAssign.DoLResolve): Resolve the original
80         source first, this will guarantee that we have a valid expression
81         before calling in lower levels functions that will require a
82         resolved object.  Then use this original_source in the
83         target.ResolveLValue instead of the original source that was
84         passed to us.
85
86         Another change.  Use target.Resolve instead of LValueResolve.
87         Although we are resolving for LValues, we will let the Assign code
88         take care of that (it will be called again from Resolve).  This
89         basically allows code like this:
90
91         class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
92         class Y { void A (X x) { x [0] += o; }
93
94         The problem was that the indexer was trying to resolve for
95         set_Item (idx, object o) and never finding one.  The real set_Item
96         was set_Item (idx, X).  By delaying the process we get the right
97         semantics. 
98
99         Fixes bug 36505
100         
101 2003-02-23  Martin Baulig  <martin@ximian.com>
102
103         * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
104         while calling DoEmit ().
105
106         * codegen.cs (EmitContext.Mark): Don't mark locations in other
107         source files; if you use the #line directive inside a method, the
108         compiler stops emitting line numbers for the debugger until it
109         reaches the end of the method or another #line directive which
110         restores the original file.
111
112 2003-02-23  Martin Baulig  <martin@ximian.com>
113
114         * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
115
116 2003-02-23  Martin Baulig  <martin@ximian.com>
117
118         * statement.cs (Block.AddChildVariableNames): We need to call this
119         recursively, not just for our immediate children.
120
121 2003-02-23  Martin Baulig  <martin@ximian.com>
122
123         * class.cs (Event.Define): Always make the field private, like csc does.
124
125         * typemanager.cs (TypeManager.RealMemberLookup): Make events
126         actually work, fixes bug #37521.
127
128 2003-02-23  Miguel de Icaza  <miguel@ximian.com>
129
130         * delegate.cs: When creating the various temporary "Parameters"
131         classes, make sure that we call the ComputeAndDefineParameterTypes
132         on those new parameters (just like we do with the formal ones), to
133         allow them to be resolved in the context of the DeclSpace.
134
135         This fixes the bug that Dick observed in Bugzilla #38530.
136
137 2003-02-22  Miguel de Icaza  <miguel@ximian.com>
138
139         * expression.cs (ResolveMemberAccess): When resolving a constant,
140         do not attempt to pull a constant if the value was not able to
141         generate a valid constant.
142
143         * const.cs (LookupConstantValue): Do not report more errors than required.
144
145 2003-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
146
147         * expression.cs: fixes bug #38328.
148
149 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
150
151         * class.cs: Changed all the various members that can be part of a
152         class from being an ArrayList to be an Array of the right type.
153         During the DefineType type_list, interface_list, delegate_list and
154         enum_list are turned into types, interfaces, delegates and enums
155         arrays.  
156
157         And during the member population, indexer_list, event_list,
158         constant_list, field_list, instance_constructor_list, method_list,
159         operator_list and property_list are turned into their real arrays.
160
161         Although we could probably perform this operation earlier, for
162         good error reporting we need to keep the lists and remove the
163         lists for longer than required.
164
165         This optimization was triggered by Paolo profiling the compiler
166         speed on the output of `gen-sample-program.pl' perl script. 
167
168         * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
169         not crash in methods like MemberLookupFailed that use this field.  
170
171         This problem arises when the compiler fails to resolve a type
172         during interface type definition for example.
173
174 2003-02-18  Miguel de Icaza  <miguel@ximian.com>
175
176         * expression.cs (Indexers.GetIndexersForType): Interfaces do not
177         inherit from System.Object, so we have to stop at null, not only
178         when reaching System.Object.
179
180 2003-02-17  Miguel de Icaza  <miguel@ximian.com>
181
182         * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
183         DeclaredOnly because the parent indexer might have had a different
184         name, but did not loop until the top of the hierarchy was reached.
185
186         The problem this one fixes is 35492: when a class implemented an
187         indexer from an interface, we were getting the interface method
188         (which was abstract) and we were flagging an error (can not invoke
189         abstract method).
190
191         This also keeps bug 33089 functioning, and test-148 functioning.
192
193         * typemanager.cs (IsSpecialMethod): The correct way of figuring
194         out if a method is special is to see if it is declared in a
195         property or event, or whether it is one of the predefined operator
196         names.   This should fix correctly #36804.
197
198 2003-02-15  Miguel de Icaza  <miguel@ximian.com>
199
200         The goal here is to remove the dependency on EmptyCast.Peel ().
201         Killing it completely.
202         
203         The problem is that currently in a number of places where
204         constants are expected, we have to "probe" for an EmptyCast, and
205         Peel, which is not the correct thing to do, as this will be
206         repetitive and will likely lead to errors. 
207
208         The idea is to remove any EmptyCasts that are used in casts that
209         can be reduced to constants, so we only have to cope with
210         constants. 
211
212         This bug hunt was triggered by Bug 37363 and the desire to remove
213         the duplicate pattern where we were "peeling" emptycasts to check
214         whether they were constants.  Now constants will always be
215         constants.
216         
217         * ecore.cs: Use an enumconstant here instead of wrapping with
218         EmptyCast.  
219
220         * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
221         throwing me off.  By handling this we can get rid of a few hacks.
222         
223         * statement.cs (Switch): Removed Peel() code.
224
225 2003-02-14  Miguel de Icaza  <miguel@ximian.com>
226
227         * class.cs: Location information for error 508
228
229         * expression.cs (New.DoResolve): Add a guard against double
230         resolution of an expression.  
231
232         The New DoResolve might be called twice when initializing field
233         expressions (see EmitFieldInitializers, the call to
234         GetInitializerExpression will perform a resolve on the expression,
235         and later the assign will trigger another resolution
236
237         This leads to bugs (#37014)
238
239         * delegate.cs: The signature for EndInvoke should contain any ref
240         or out parameters as well.  We were not doing this in the past. 
241
242         * class.cs (Field.Define): Do not overwrite the type definition
243         inside the `volatile' group.  Turns out that volatile enumerations
244         were changing the type here to perform a validity test, which
245         broke conversions. 
246
247 2003-02-12  Miguel de Icaza  <miguel@ximian.com>
248
249         * ecore.cs (FieldExpr.AddressOf): In the particular case of This
250         and structs, we do not want to load the instance variable
251
252         (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
253         enum_type has to be handled like an object reference (implicit
254         conversions exists from this to object), but the regular IsClass
255         and IsValueType tests will never return true for this one.
256
257         Also we use TypeManager.IsValueType instead of type.IsValueType,
258         just for consistency with the rest of the code (this is only
259         needed if we ever use the construct exposed by test-180.cs inside
260         corlib, which we dont today).
261
262 2003-02-12  Zoltan Varga  <vargaz@freemail.hu>
263
264         * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
265         just InternalCall.
266
267 2003-02-09  Martin Baulig  <martin@ximian.com>
268
269         * namespace.cs (Namespace..ctor): Added SourceFile argument.
270         (Namespace.DefineNamespaces): New static public method; this is
271         called when we're compiling with debugging to add all namespaces
272         to the symbol file.
273
274         * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
275         pass it to the Namespace's .ctor.
276
277         * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
278         and MethodBase arguments; pass the namespace ID to the symwriter;
279         pass the MethodBase instead of the token to the symwriter.
280         (SymbolWriter.DefineNamespace): New method to add a namespace to
281         the symbol file.
282
283 2003-02-09  Martin Baulig  <martin@ximian.com>
284
285         * symbolwriter.cs: New file.  This is a wrapper around
286         ISymbolWriter with a cleaner API.  We'll dynamically Invoke()
287         methods here in near future.
288
289 2003-02-09  Martin Baulig  <martin@ximian.com>
290
291         * codegen.cs (EmitContext.Mark): Just pass the arguments to
292         ILGenerator.MarkSequencePoint() which are actually used by the
293         symbol writer.
294
295 2003-02-09  Martin Baulig  <martin@ximian.com>
296
297         * location.cs (SourceFile): New public sealed class.  This
298         contains the name and an index which is used in the location's token.
299         (Location): Reserve an appropriate number of bits in the token for
300         the source file instead of walking over that list, this gives us a
301         really huge performance improvement when compiling with debugging.
302
303         * driver.cs (Driver.parse, Driver.tokenize_file): Take a
304         `SourceFile' argument instead of a string.
305         (Driver.ProcessFile): Add all the files via Location.AddFile(),
306         but don't parse/tokenize here, we need to generate the list of all
307         source files before we do that.
308         (Driver.ProcessFiles): New static function.  Parses/tokenizes all
309         the files.
310
311         * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
312         instead of a string.
313
314         * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
315         of a string.
316
317 2003-02-09  Martin Baulig  <martin@ximian.com>
318
319         * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
320         filename on `#line default'.
321
322 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
323
324         * statement.cs: don't clear the pinned var when the fixed statement
325         returns from the method (fixes bug#37752).
326
327 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
328
329         * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban) 
330         to IsValueType.
331
332 2003-02-07  Martin Baulig  <martin@ximian.com>
333
334         * driver.cs: Removed the `--debug-args' command line argument.
335
336         * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
337         automatically by the AsssemblyBuilder.
338         (CodeGen.InitializeSymbolWriter): We don't need to call any
339         initialization function on the symbol writer anymore.  This method
340         doesn't take any arguments.
341
342 2003-02-03  Miguel de Icaza  <miguel@ximian.com>
343
344         * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
345         from referenced assemblies as well.
346
347 2003-02-02  Martin Baulig  <martin@ximian.com>
348
349         * class.cs (MethodData.Emit): Generate debugging info for external methods.
350
351 2003-02-02  Martin Baulig  <martin@ximian.com>
352
353         * class.cs (Constructor.Emit): Open the symbol writer before
354         emitting the constructor initializer.
355         (ConstructorInitializer.Emit): Call ec.Mark() to allow
356         single-stepping through constructor initializers.
357
358 2003-01-30  Miguel de Icaza  <miguel@ximian.com>
359
360         * class.cs: Handle error 549: do not allow virtual methods in
361         sealed classes. 
362
363 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
364
365         * decl.cs: Check access levels when resolving types
366         
367 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
368
369         * statement.cs: Add parameters and locals set in catch blocks that might 
370         return to set vector
371
372 2003-01-29  Miguel de Icaza  <miguel@ximian.com>
373
374         * class.cs (Operator): Set the SpecialName flags for operators.
375         
376         * expression.cs (Invocation.DoResolve): Only block calls to
377         accessors and operators on SpecialName methods.
378
379         (Cast.TryReduce): Handle conversions from char constants.
380
381
382 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
383
384         * statement.cs: small memory and time optimization in FlowBranching.
385         
386 2003-01-28  Pedro Mart  <yoros@wanadoo.es>
387
388         * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
389         problem that the last fix but in the other sid (Set).
390
391         * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
392         access when there is no indexer in the hierarchy.
393         
394 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
395
396         * class.cs: Combine some if statements.
397
398 2003-01-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
399
400         * driver.cs: fixed bug #37187.
401
402 2003-01-27  Pedro Martinez Juliá  <yoros@wanadoo.es>
403
404         * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
405         any indexer, it's needed to build a list with all the indexers in the
406         hierarchy (AllGetters), else we have problems. Fixes #35653.
407
408 2003-01-23  Miguel de Icaza  <miguel@ximian.com>
409
410         * class.cs (MethodData.Define): It is wrong for an interface
411         implementation to be static in both cases: explicit and implicit.
412         We were only handling this in one case.
413
414         Improve the if situation there to not have negations.
415         
416         * class.cs (Field.Define): Turns out that we do not need to check
417         the unsafe bit on field definition, only on usage.  Remove the test.
418
419 2003-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
420
421         * driver.cs: use assembly.Location instead of Codebase (the latest
422         patch made mcs fail when using MS assemblies).
423
424 2003-01-21  Tim Haynes <thaynes@openlinksw.com>
425
426         * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
427         get the path to *corlib.dll.
428
429 2003-01-21  Nick Drochak <ndrochak@gol.com>
430
431         * cs-tokenizer.cs:
432         * pending.cs:
433         * typemanager.cs: Remove compiler warnings
434
435 2003-01-20  Duncan Mak  <duncan@ximian.com>
436
437         * AssemblyInfo.cs: Bump the version number to 0.19.
438         
439 2003-01-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
440
441         * cs-tokenizer.cs: little fixes to line numbering when #line is used.
442
443 2003-01-18  Zoltan Varga  <vargaz@freemail.hu>
444
445         * class.cs (Constructor::Emit): Emit debugging info for constructors.
446
447 2003-01-17  Miguel de Icaza  <miguel@ximian.com>
448
449         * cs-parser.jay: Small fix: we were not comparing the constructor
450         name correctly.   Thanks to Zoltan for the initial pointer.
451
452 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
453
454         * cs-tokenizer.cs: Set file name when specified with #line
455
456 2003-01-15  Miguel de Icaza  <miguel@ximian.com>
457
458         * cs-parser.jay: Only perform the constructor checks here if we
459         are named like the class;  This will help provider a better
460         error.  The constructor path is taken when a type definition is
461         not found, but most likely the user forgot to add the type, so
462         report that rather than the constructor error.
463
464 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
465
466         * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
467         allocations.
468
469 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
470
471         * cs-parser.jay: Add cleanup call.
472
473 2003-01-13  Duncan Mak  <duncan@ximian.com>
474
475         * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
476         consistent with other methods.
477
478 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
479
480         * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
481         
482 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
483
484         * attribute.cs: only set GuidAttr to true when we have a
485         GuidAttribute.
486
487 2003-01-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
488
489         * ecore.cs:
490         * expression.cs:
491         * typemanager.cs: fixes to allow mcs compile corlib with the new
492         Type.IsSubclassOf fix.
493
494 2003-01-08  Miguel de Icaza  <miguel@ximian.com>
495
496         * expression.cs (LocalVariableReference.DoResolve): Classify a
497         constant as a value, not as a variable.   Also, set the type for
498         the variable.
499
500         * cs-parser.jay (fixed_statement): take a type instead of a
501         pointer_type, so we can produce a better error message later.
502         
503         * statement.cs (Fixed.Resolve): Flag types that are not pointers
504         as an error.  
505         
506         (For.DoEmit): Make inifinite loops have a
507         non-conditional branch back.
508
509         (Fixed.DoEmit): First populate the pinned variables, then emit the
510         statement, then clear the variables.  Before I was emitting the
511         code once for each fixed piece.
512
513
514 2003-01-08  Martin Baulig  <martin@ximian.com>
515
516         * statement.cs (FlowBranching.MergeChild): A break in a
517         SWITCH_SECTION does not leave a loop.  Fixes #36155.
518
519 2003-01-08  Martin Baulig  <martin@ximian.com>
520
521         * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
522         lives in the same number space than `param_map'.  Fixes #36154.
523
524 2003-01-07  Miguel de Icaza  <miguel@ximian.com>
525
526         * cs-parser.jay (constructor_declaration): Set the
527         Constructor.ModFlags before probing for it.  This makes the
528         compiler report 514, 515 and 132 (the code was there, but got
529         broken). 
530
531         * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
532         (GotoDefault.Resolve): Set `Returns' to ALWAYS.
533         (GotoCase.Resolve): Set `Returns' to ALWAYS.
534
535 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
536
537         * enum.cs: create the enum static fields using the enum type.
538
539 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
540
541         * class.cs: don't try to create the ParamBuilder for the return
542         type if it's not needed (and handle it breaking for the ms runtime
543         anyway).
544
545 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
546
547         * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
548
549 2002-12-29  Miguel de Icaza  <miguel@ximian.com>
550
551         * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
552         the command.   This showed up while compiling the JANET source
553         code, which used \r as its only newline separator.
554
555 2002-12-28  Miguel de Icaza  <miguel@ximian.com>
556
557         * class.cs (Method.Define): If we are an operator (because it
558         reuses our code), then set the SpecialName and HideBySig.  #36128
559
560 2002-12-22  Miguel de Icaza  <miguel@ximian.com>
561
562         * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
563         exception, report error 120 `object reference required'.
564
565         * driver.cs: Add --pause option, used during to measure the size
566         of the process as it goes with --timestamp.
567
568         * expression.cs (Invocation.DoResolve): Do not allow methods with
569         SpecialName to be invoked.
570
571 2002-12-21  Miguel de Icaza  <miguel@ximian.com>
572
573         * cs-tokenizer.cs: Small fix to the parser: compute the ascii
574         number before adding it.
575
576 2002-12-21  Ravi Pratap  <ravi@ximian.com>
577
578         * ecore.cs (StandardImplicitConversion): When in an unsafe
579         context, we allow conversion between void * to any other pointer
580         type. This fixes bug #35973.
581
582 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
583
584         * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
585         is not thrown when extensionless outputs are used 
586
587 2002-12-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
588
589         * rootcontext.cs: fixed compilation of corlib.
590
591 2002-12-19  Miguel de Icaza  <miguel@ximian.com>
592
593         * attribute.cs (Attributes.Contains): Add new method.
594
595         * class.cs (MethodCore.LabelParameters): if the parameter is an
596         `out' parameter, check that no attribute `[In]' has been passed.
597
598         * enum.cs: Handle the `value__' name in an enumeration.
599
600 2002-12-14  Jaroslaw Kowalski <jarek@atm.com.pl>
601
602         * decl.cs: Added special case to allow overrides on "protected
603         internal" methods
604         
605 2002-12-18  Ravi Pratap  <ravi@ximian.com>
606
607         * attribute.cs (Attributes.AddAttributeSection): Rename to this
608         since it makes much more sense.
609
610         (Attributes.ctor): Don't require a Location parameter.
611         
612         * rootcontext.cs (AddGlobalAttributeSection): Rename again.
613
614         * attribute.cs (ApplyAttributes): Remove extra Location parameters
615         since we already have that information per attribute.
616
617         * everywhere : make appropriate changes.
618
619         * class.cs (LabelParameters): Write the code which actually
620         applies attributes to the return type. We can't do this on the MS
621         .NET runtime so we flag a warning in the case an exception is
622         thrown.
623
624 2002-12-18  Miguel de Icaza  <miguel@ximian.com>
625
626         * const.cs: Handle implicit null conversions here too.
627
628 2002-12-17  Ravi Pratap  <ravi@ximian.com>
629
630         * class.cs (MethodCore.LabelParameters): Remove the extra
631         Type [] parameter since it is completely unnecessary. Instead
632         pass in the method's attributes so that we can extract
633         the "return" attribute.
634
635 2002-12-17  Miguel de Icaza  <miguel@ximian.com>
636
637         * cs-parser.jay (parse): Use Report.Error to flag errors instead
638         of ignoring it and letting the compile continue.
639
640         * typemanager.cs (ChangeType): use an extra argument to return an
641         error condition instead of throwing an exception.
642
643 2002-12-15  Miguel de Icaza  <miguel@ximian.com>
644
645         * expression.cs (Unary.TryReduce): mimic the code for the regular
646         code path.  Perform an implicit cast in the cases where we can
647         implicitly convert to one of the integral types, and then reduce
648         based on that constant.   This fixes bug #35483.
649
650 2002-12-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
651
652         * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
653
654 2002-12-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
655
656         * namespace.cs: fixed bug #35489.
657
658 2002-12-12  Miguel de Icaza  <miguel@ximian.com>
659
660         * class.cs: Remove some dead code.
661
662         * cs-parser.jay: Estimate the number of methods needed
663         (RootContext.MethodCount);
664
665         * cs-tokenizer.cs: Use char arrays for parsing identifiers and
666         numbers instead of StringBuilders.
667
668         * support.cs (PtrHashtable): Add constructor with initial size;
669         We can now reduce reallocations of the method table.
670
671 2002-12-10  Ravi Pratap  <ravi@ximian.com>
672
673         * attribute.cs (ApplyAttributes): Keep track of the emitted
674         attributes on a per-target basis. This fixes bug #35413.
675
676 2002-12-10  Miguel de Icaza  <miguel@ximian.com>
677
678         * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
679         default to the Windows 1252 encoding.
680
681         (UnixParseOption): Support version, thanks to Alp for the missing
682         pointer. 
683
684         * AssemblyInfo.cs: Add nice assembly information.
685
686         * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
687         (bug 35169).
688
689         * cs-parser.jay: Allow a trailing comma before the close bracked
690         in the attribute_section production.
691
692         * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
693         address of the instance was being taken, I will take this out,
694         because we take the address of the object immediately here.
695
696 2002-12-09  Ravi Pratap  <ravi@ximian.com>
697
698         * typemanager.cs (AreMultipleAllowed): Take care of the most
699         obvious case where attribute type is not in the current assembly -
700         stupid me ;-)
701
702 2002-12-08  Miguel de Icaza  <miguel@ximian.com>
703
704         * ecore.cs (SimpleName.DoResolve): First perform lookups on using
705         definitions, instead of doing that afterwards.  
706
707         Also we use a nice little hack, depending on the constructor, we
708         know if we are a "composed" name or a simple name.  Hence, we
709         avoid the IndexOf test, and we avoid 
710
711         * codegen.cs: Add code to assist in a bug reporter to track down
712         the source of a compiler crash. 
713
714 2002-12-07  Ravi Pratap  <ravi@ximian.com>
715
716         * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
717         types have been emitted for a given element and flag an error
718         if something which does not have AllowMultiple set is used more
719         than once.
720
721         * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
722         attribute types and their corresponding AllowMultiple properties
723
724         (AreMultipleAllowed): Check the property for a given type.
725
726         * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
727         property in the case we have a TypeContainer.
728
729         (Attributes.AddAttribute): Detect duplicates and just skip on
730         adding them. This trivial fix catches a pretty gross error in our
731         attribute emission - global attributes were being emitted twice!
732
733         Bugzilla bug #33187 is now fixed.
734
735 2002-12-06  Miguel de Icaza  <miguel@ximian.com>
736
737         * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
738         instead of pp_and).
739
740         * expression.cs (Binary.ResolveOperator): I can only use the
741         Concat (string, string, string) and Concat (string, string,
742         string, string) if the child is actually a concatenation of
743         strings. 
744
745 2002-12-04  Miguel de Icaza  <miguel@ximian.com>
746
747         * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
748         context where we need a 2-character lookahead.
749
750         * pending.cs (PendingImplementation): Rework so we can keep track
751         of interface types all the time, and flag those which were
752         implemented by parents as optional.
753
754 2002-12-03  Miguel de Icaza  <miguel@ximian.com>
755
756         * expression.cs (Binary.ResolveOperator): Use
757         String.Concat(string,string,string) or
758         String.Concat(string,string,string,string) when possible. 
759
760         * typemanager: More helper methods.
761
762
763 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
764
765         * pending.cs: remove the bogus return from GetMissingInterfaces()
766         (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
767
768 2002-12-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
769
770         * namespace.cs: avoid duplicated 'using xxx' being added to
771         using_clauses. This prevents mcs from issuing and 'ambiguous type' error
772         when we get more than one 'using' statement for the same namespace.
773         Report a CS0105 warning for it.
774
775 2002-11-30  Miguel de Icaza  <miguel@ximian.com>
776
777         * cs-tokenizer.cs (consume_identifier): use read directly, instead
778         of calling getChar/putback, uses internal knowledge of it.    
779
780         (xtoken): Reorder tokenizer so most common patterns are checked
781         first.  This reduces the compilation time in another 5% (from 8.11s
782         average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
783
784         The parsing time is 22% of the compilation in mcs, and from that
785         64% is spent on the tokenization process.  
786
787         I tried using a binary search for keywords, but this is slower
788         than the hashtable.  Another option would be to do a couple of
789         things:
790
791                 * Not use a StringBuilder, instead use an array of chars,
792                   with a set value.  Notice that this way we could catch
793                   the 645 error without having to do it *afterwards*.
794
795                 * We could write a hand-parser to avoid the hashtable
796                   compares altogether.
797
798         The identifier consumption process takes 37% of the tokenization
799         time.  Another 15% is spent on is_number.  56% of the time spent
800         on is_number is spent on Int64.Parse:
801
802                 * We could probably choose based on the string length to
803                   use Int32.Parse or Int64.Parse and avoid all the 64-bit
804                   computations. 
805
806         Another 3% is spend on wrapping `xtoken' in the `token' function.
807
808         Handle 0xa0 as whitespace (#34752)
809         
810 2002-11-26  Miguel de Icaza  <miguel@ximian.com>
811
812         * typemanager.cs (IsCLRType): New routine to tell whether a type
813         is one of the builtin types.  
814
815         Maybe it needs to use TypeCodes to be faster.  Maybe we could use
816         typecode in more places instead of doing pointer comparissions.
817         We could leverage some knowledge about the way the typecodes are
818         laid out.
819
820         New code to cache namespaces in assemblies, it is currently not
821         invoked, to be used soon.
822
823         * decl.cs (DeclSpace.MakeFQN): Simple optimization.
824
825         * expression.cs (Binary.ResolveOperator): specially handle
826         strings, and do not perform user-defined operator overloading for
827         built-in types.
828
829 2002-11-24  Miguel de Icaza  <miguel@ximian.com>
830
831         * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
832         internalcall as it is a pretty simple operation;  Avoid whenever
833         possible to call Char.IsLetter.
834
835         (consume_identifier): Cut by half the number of
836         hashtable calls by merging the is_keyword and GetKeyword behavior.
837
838         Do not short-circuit, because if we do, we
839         report errors (ie, #if false && true would produce an invalid
840         directive error);
841         
842
843 2002-11-24  Martin Baulig  <martin@ximian.com>
844
845         * expression.cs (Cast.TryReduce): If we're in checked syntax,
846         check constant ranges and report a CS0221.  Fixes #33186.
847
848 2002-11-24  Martin Baulig  <martin@ximian.com>
849
850         * cs-parser.jay: Make this work for uninitialized variable
851         declarations in the `for' initializer.  Fixes #32416.
852
853 2002-11-24  Martin Baulig  <martin@ximian.com>
854
855         * ecore.cs (Expression.ConvertExplicit): Make casting from/to
856         System.Enum actually work.  Fixes bug #32269, added verify-6.cs.
857
858 2002-11-24  Martin Baulig  <martin@ximian.com>
859
860         * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
861         argument; if true, we also check for user-defined conversions.
862         This is only needed if both arguments are of a user-defined type.
863         Fixes #30443, added test-175.cs.
864         (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
865
866         * ecore.cs (Expression.ImplicitUserConversionExists): New method.
867
868 2002-11-24  Martin Baulig  <martin@ximian.com>
869
870         * expression.cs (ArrayAccess.GetStoreOpcode): New public static
871         function to get the store opcode.
872         (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
873         only emit the Ldelema if the store opcode is Stobj.  You must run
874         both test-34 and test-167 to test this.  Fixes #34529.
875
876 2002-11-23  Martin Baulig  <martin@ximian.com>
877
878         * ecore.cs (Expression.MemberLookup): Added additional
879         `qualifier_type' argument which is used when we're being called
880         from MemberAccess.DoResolve() and null if we're called from a
881         SimpleName lookup.
882         (Expression.MemberLookupFailed): New method to report errors; this
883         does the CS1540 check and reports the correct error message.
884
885         * typemanager.cs (MemberLookup): Added additional `qualifier_type'
886         argument for the CS1540 check and redone the way how we're dealing
887         with private members.  See the comment in the source code for details.
888         (FilterWithClosure): Reverted this back to revision 1.197; renamed
889         `closure_start_type' to `closure_qualifier_type' and check whether
890         it's not null.  It was not this filter being broken, it was just
891         being called with the wrong arguments.
892
893         * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
894         and pass it the correct `qualifier_type'; this also does the error
895         handling for us.
896
897 2002-11-22  Miguel de Icaza  <miguel@ximian.com>
898
899         * expression.cs (Invocation.EmitParams): If the we are dealing
900         with a non-built-in value type, load its address as well.
901
902         (ArrayCreation): Use a a pretty constant instead
903         of the hardcoded value 2.   Use 6 instead of 2 for the number of
904         static initializers.  
905
906         (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
907         because they are not really value types, just glorified integers. 
908
909         * driver.cs: Do not append .exe, the CSC compiler does not do it.
910
911         * ecore.cs: Remove redundant code for enumerations, make them use
912         the same code path as everything else, fixes the casting issue
913         with enumerations in Windows.Forms.
914
915         * attribute.cs: Do only cast to string if it is a string, the
916         validation happens later.
917
918         * typemanager.cs: Temproary hack to avoid a bootstrap issue until
919         people upgrade their corlibs.
920
921         * ecore.cs: Oops, enumerations were not following the entire code path
922
923 2002-11-21  Miguel de Icaza  <miguel@ximian.com>
924
925         * typemanager.cs (FilterWithClosure): Commented out the test for
926         1540 in typemanager.cs, as it has problems when accessing
927         protected methods from a parent class (see test-174.cs). 
928
929         * attribute.cs (Attribute.ValidateGuid): new method.
930         (Attribute.Resolve): Use above.
931
932 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
933
934         * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
935
936         * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
937         handling for enumerations, as we only needed the TypeContainer
938         functionality to begin with (this is required for the fix below to
939         work for enums that reference constants in a container class for
940         example). 
941
942         * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
943
944         * enum.cs (Enum.Define): Use `this' instead of parent, so we have
945         a valid TypeBuilder to perform lookups on.o
946
947         * class.cs (InheritableMemberSignatureCompare): Use true in the
948         call to GetGetMethod and GetSetMethod, because we are comparing
949         the signature, and we need to get the methods *even* if they are
950         private. 
951
952         (PropertyBase.CheckBase): ditto.
953
954         * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
955         GotoCase.Resolve): Use Peel on EmpytCasts.
956
957         * ecore.cs (EmptyCast): drop child, add Peel method.
958
959 2002-11-17  Martin Baulig  <martin@ximian.com>
960
961         * ecore.cs (EmptyCast.Child): New public property.
962
963         * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
964         label resolved to an EmptyCast.  Fixes #34162.
965         (GotoCase.Resolve): Likewise.
966         (Block.EmitMeta): Likewise.
967
968 2002-11-17  Martin Baulig  <martin@ximian.com>
969
970         * expression.cs (Invocation.BetterConversion): Prefer int over
971         uint; short over ushort; long over ulong for integer literals.
972         Use ImplicitConversionExists instead of StandardConversionExists
973         since we also need to check for user-defined implicit conversions.
974         Fixes #34165.  Added test-173.cs.
975
976 2002-11-16  Martin Baulig  <martin@ximian.com>
977
978         * expression.cs (Binary.EmitBranchable): Eliminate comparisions
979         with the `true' and `false' literals.  Fixes #33151.
980
981 2002-11-16  Martin Baulig  <martin@ximian.com>
982
983         * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
984         October 22nd; don't do the cs1540 check for static members.
985
986         * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
987         now using our own filter here and doing the cs1540 check again.
988
989 2002-11-16  Martin Baulig  <martin@ximian.com>
990
991         * support.cs (InternalParameters): Don't crash if we don't have
992         any fixed parameters.  Fixes #33532.
993
994 2002-11-16  Martin Baulig  <martin@ximian.com>
995
996         * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
997         when looking up static methods to make this work on Windows.
998         Fixes #33773.
999
1000 2002-11-16  Martin Baulig  <martin@ximian.com>
1001
1002         * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
1003         a setter rather than using PropertyInfo.CanWrite.
1004
1005 2002-11-15  Nick Drochak  <ndrochak@gol.com>
1006
1007         * class.cs: Allow acces to block member by subclasses. Fixes build
1008         breaker.
1009
1010 2002-11-14  Martin Baulig  <martin@ximian.com>
1011
1012         * class.cs (Constructor.Emit): Added the extern/block check.
1013         Fixes bug #33678.
1014
1015 2002-11-14  Martin Baulig  <martin@ximian.com>
1016
1017         * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
1018         iteration while looking for indexers, this is needed because the
1019         indexer may have a different name in our base classes.  Fixed the
1020         error reporting (no indexers at all, not get accessor, no
1021         overloaded match).  Fixes bug #33089.
1022         (IndexerAccess.DoResolveLValue): Likewise.
1023
1024 2002-11-14  Martin Baulig  <martin@ximian.com>
1025
1026         * class.cs (PropertyBase.CheckBase): Make this work for multiple
1027         indexers.  Fixes the first part of bug #33089.
1028         (MethodSignature.InheritableMemberSignatureCompare): Added support
1029         for properties.
1030
1031 2002-11-13  Ravi Pratap  <ravi@ximian.com>
1032
1033         * attribute.cs (Attribute.Resolve): Catch the
1034         NullReferenceException and report it since it isn't supposed to
1035         happen. 
1036         
1037 2002-11-12  Miguel de Icaza  <miguel@ximian.com>
1038
1039         * expression.cs (Binary.EmitBranchable): Also handle the cases for
1040         LogicalOr and LogicalAnd that can benefit from recursively
1041         handling EmitBranchable.  The code now should be nice for Paolo.
1042
1043 2002-11-08  Miguel de Icaza  <miguel@ximian.com>
1044
1045         * typemanager.cs (LookupType): Added a negative-hit hashtable for
1046         the Type lookups, as we perform quite a number of lookups on
1047         non-Types.  This can be removed once we can deterministically tell
1048         whether we have a type or a namespace in advance.
1049
1050         But this might require special hacks from our corlib.
1051
1052         * TODO: updated.
1053
1054         * ecore.cs (TryImplicitIntConversion): Handle conversions to float
1055         and double which avoids a conversion from an integer to a double.
1056
1057         * expression.cs: tiny optimization, avoid calling IsConstant,
1058         because it effectively performs the lookup twice.
1059
1060 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
1061
1062         But a bogus return here to keep the semantics of the old code
1063         until the Mono runtime is fixed.
1064         
1065         * pending.cs (GetMissingInterfaces): New method used to remove all
1066         the interfaces that are already implemented by our parent
1067         classes from the list of pending methods. 
1068
1069         * interface.cs: Add checks for calls after ResolveTypeExpr.
1070
1071 2002-11-05  Miguel de Icaza  <miguel@ximian.com>
1072
1073         * class.cs (Class.Emit): Report warning 67: event not used if the
1074         warning level is beyond 3.
1075
1076         * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
1077         being a NullLiteral.
1078
1079         * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
1080         specifiers. 
1081
1082         * class.cs (TypeContainer.GetClassBases): Cover a missing code
1083         path that might fail if a type can not be resolved.
1084
1085         * expression.cs (Binary.Emit): Emit unsigned versions of the
1086         operators. 
1087
1088         * driver.cs: use error 5.
1089         
1090 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
1091
1092         * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
1093
1094 2002-11-01  Miguel de Icaza  <miguel@ximian.com>
1095
1096         * cs-parser.jay (switch_section): A beautiful patch from Martin
1097         Baulig that fixed 33094.
1098
1099 2002-10-31  Miguel de Icaza  <miguel@ximian.com>
1100
1101         * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
1102         Check whether the base is abstract and report an error if so.
1103
1104         * expression.cs (IndexerAccess.DoResolveLValue,
1105         IndexerAccess.DoResolve): ditto. 
1106
1107         (Invocation.DoResolve): ditto.
1108         
1109         (Invocation.FullMethodDesc): Improve the report string.
1110
1111         * statement.cs (Block): Eliminate IsVariableDefined as it is
1112         basically just a wrapper for GetVariableInfo.
1113
1114         * ecore.cs (SimpleName): Use new 
1115
1116         * support.cs (ReflectionParamter.ParameterType): We unwrap the
1117         type, as we return the actual parameter ref/unref state on a
1118         different call.
1119
1120 2002-10-30  Miguel de Icaza  <miguel@ximian.com>
1121
1122         * support.cs: Return proper flags REF/OUT fixing the previous
1123         commit.  
1124
1125         * expression.cs: Reverted last patch, that was wrong.  Is_ref is
1126         not used to mean `ref' but `ref or out' in ParameterReference
1127         
1128         * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
1129         full type signature instead of calling TypeManger.CSharpName
1130         ourselves. 
1131
1132         * support.cs (InternalParameters.ParameterDesc): Do not compare
1133         directly to the modflags, because REF/OUT will actually be bitsets
1134         if set. 
1135
1136         * delegate.cs (VerifyMethod): Check also the modifiers.
1137
1138         * cs-tokenizer.cs: Fix bug where floating point values with an
1139         exponent where a sign was missing was ignored.
1140
1141         * driver.cs: Allow multiple assemblies to be specified in a single
1142         /r: argument
1143
1144 2002-10-28  Miguel de Icaza  <miguel@ximian.com>
1145
1146         * cs-parser.jay: Ugly.  We had to add a multiplicative_expression,
1147         because identifiers after a parenthesis would end up in this kind
1148         of production, and we needed to desamiguate it for having casts
1149         like:
1150
1151                 (UserDefinedType *) xxx
1152
1153 2002-10-24  Miguel de Icaza  <miguel@ximian.com>
1154
1155         * typemanager.cs (RealMemberLookup): when we deal with a subclass,
1156         we should set on the Bindingflags.NonPublic, but not turn on
1157         private_ok.  private_ok controls whether a Private member is
1158         returned (this is chekced on the filter routine), while the
1159         BindingFlags.NonPublic just controls whether private/protected
1160         will be allowed.   This fixes the problem part of the problem of
1161         private properties being allowed to be used in derived classes.
1162
1163         * expression.cs (BaseAccess): Provide an DoResolveLValue method,
1164         so we can call the children DoResolveLValue method (this will
1165         properly signal errors on lvalue assignments to base properties)
1166         
1167         * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
1168         getter are null, and we have a property info, we know that this
1169         happened because the lookup failed, so we report an error 122 for
1170         protection level violation.
1171
1172         We also silently return if setter and getter are null in the
1173         resolve functions, this condition only happens if we have flagged
1174         the error before.  This is the other half of the problem. 
1175
1176         (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
1177         not have accessibility information, that is why we were returning
1178         true in the filter function in typemanager.cs.
1179
1180         To properly report 122 (property is inaccessible because of its
1181         protection level) correctly, we report this error in ResolveAccess
1182         by failing if both the setter and the getter are lacking (ie, the
1183         lookup failed). 
1184
1185         DoResolve and DoLResolve have been modified to check for both
1186         setter/getter being null and returning silently, the reason being
1187         that I did not want to put the knowledge about this error in upper
1188         layers, like:
1189
1190         int old = Report.Errors;
1191         x = new PropertyExpr (...);
1192         if (old != Report.Errors)
1193                 return null;
1194         else
1195                 return x;
1196
1197         So the property expr is returned, but it is invalid, so the error
1198         will be flagged during the resolve process. 
1199
1200         * class.cs: Remove InheritablePropertySignatureCompare from the
1201         class, as we no longer depend on the property signature to compute
1202         whether it is possible to implement a method or not.
1203
1204         The reason is that calling PropertyInfo.GetGetMethod will return
1205         null (in .NET, in Mono it works, and we should change this), in
1206         cases where the Get Method does not exist in that particular
1207         class.
1208
1209         So this code:
1210
1211         class X { public virtual int A { get { return 1; } } }
1212         class Y : X { }
1213         class Z : Y { public override int A { get { return 2; } } }
1214
1215         Would fail in Z because the parent (Y) would not have the property
1216         defined.  So we avoid this completely now (because the alternative
1217         fix was ugly and slow), and we now depend exclusively on the
1218         method names.
1219
1220         (PropertyBase.CheckBase): Use a method-base mechanism to find our
1221         reference method, instead of using the property.
1222
1223         * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
1224         routines are gone now.
1225
1226         * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
1227         names, they were incorrectly named.
1228
1229         * cs-tokenizer.cs: Return are more gentle token on failure. 
1230
1231         * pending.cs (PendingImplementation.InterfaceMethod): This routine
1232         had an out-of-sync index variable, which caused it to remove from
1233         the list of pending methods the wrong method sometimes.
1234
1235 2002-10-22  Miguel de Icaza  <miguel@ximian.com>
1236
1237         * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
1238         CanWrite, because those refer to this particular instance of the
1239         property, and do not take into account the fact that we can
1240         override single members of a property.
1241
1242         Constructor requires an EmitContext.  The resolution process does
1243         not happen here, but we need to compute the accessors before,
1244         because the resolution does not always happen for properties.
1245         
1246         * typemanager.cs (RealMemberLookup): Set private_ok if we are a
1247         subclass, before we did not update this flag, but we did update
1248         bindingflags. 
1249
1250         (GetAccessors): Drop this routine, as it did not work in the
1251         presence of partially overwritten set/get methods. 
1252
1253         Notice that this broke the cs1540 detection, but that will require
1254         more thinking. 
1255         
1256 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1257
1258         * class.cs:
1259         * codegen.cs:
1260         * driver.cs: issue a warning instead of an error if we don't support
1261         debugging for the platform. Also ignore a couple of errors that may
1262         arise when trying to write the symbols. Undo my previous patch.
1263
1264 2002-10-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1265
1266         * driver.cs: ignore /debug switch except for Unix platforms.
1267
1268 2002-10-23  Nick Drochak  <ndrochak@gol.com>
1269
1270         * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
1271
1272 2002-10-21  Miguel de Icaza  <miguel@ximian.com>
1273
1274         * driver.cs: Do not make mcs-debug conditional, so we do not break
1275         builds that use it.
1276
1277         * statement.cs (UsageVector.MergeChildren): I would like Martin to
1278         review this patch.  But basically after all the children variables
1279         have been merged, the value of "Breaks" was not being set to
1280         new_breaks for Switch blocks.  I think that it should be set after
1281         it has executed.  Currently I set this to the value of new_breaks,
1282         but only if new_breaks is FlowReturn.ALWAYS, which is a bit
1283         conservative, but I do not understand this code very well.
1284
1285         I did not break anything in the build, so that is good ;-)
1286
1287         * cs-tokenizer.cs: Also allow \r in comments as a line separator.
1288
1289 2002-10-20  Mark Crichton  <crichton@gimp.org>
1290
1291         * cfold.cs: Fixed compile blocker.  Really fixed it this time.
1292
1293 2002-10-20  Nick Drochak  <ndrochak@gol.com>
1294
1295         * cfold.cs: Fixed compile blocker.
1296
1297 2002-10-20  Miguel de Icaza  <miguel@ximian.com>
1298
1299         * driver.cs: I was chekcing the key, not the file.
1300
1301 2002-10-19  Ravi Pratap  <ravi@ximian.com>
1302
1303         * ecore.cs (UserDefinedConversion): Get rid of the bogus error
1304         message that we were generating - we just need to silently return
1305         a null.
1306
1307 2002-10-19  Miguel de Icaza  <miguel@ximian.com>
1308
1309         * class.cs (Event.Define): Change my previous commit, as this
1310         breaks the debugger.  This is a temporary hack, as it seems like
1311         the compiler is generating events incorrectly to begin with.
1312
1313         * expression.cs (Binary.ResolveOperator): Added support for 
1314         "U operator - (E x, E y)"
1315
1316         * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
1317         y)".
1318
1319         * ecore.cs (FieldExpr.AddressOf): We had a special code path for
1320         init-only variables, but this path did not take into account that
1321         there might be also instance readonly variables.  Correct this
1322         problem. 
1323
1324         This fixes bug 32253
1325
1326         * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
1327         delegates as well.
1328
1329         * driver.cs: Change the extension for modules to `netmodule'
1330
1331         * cs-parser.jay: Improved slightly the location tracking for
1332         the debugger symbols.
1333
1334         * class.cs (Event.Define): Use Modifiers.FieldAttr on the
1335         modifiers that were specified instead of the hardcoded value
1336         (FamAndAssem).  This was basically ignoring the static modifier,
1337         and others.  Fixes 32429.
1338
1339         * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
1340         fixed a bug in the process (32476)
1341
1342         * expression.cs (ArrayAccess.EmitAssign): Patch from
1343         hwang_rob@yahoo.ca that fixes bug 31834.3
1344
1345 2002-10-18  Miguel de Icaza  <miguel@ximian.com>
1346
1347         * driver.cs: Make the module extension .netmodule.
1348
1349 2002-10-16  Miguel de Icaza  <miguel@ximian.com>
1350
1351         * driver.cs: Report an error if the resource file is not found
1352         instead of crashing.
1353
1354         * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
1355         false, like Emit does.
1356
1357 2002-10-16  Nick Drochak  <ndrochak@gol.com>
1358
1359         * typemanager.cs: Remove unused private member.  Also reported mcs
1360         bug to report this as a warning like csc.
1361
1362 2002-10-15  Martin Baulig  <martin@gnome.org>
1363
1364         * statement.cs (Statement.Emit): Made this a virtual method; emits
1365         the line number info and calls DoEmit().
1366         (Statement.DoEmit): New protected abstract method, formerly knows
1367         as Statement.Emit().
1368
1369         * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
1370
1371 2002-10-11  Miguel de Icaza  <miguel@ximian.com>
1372
1373         * class.cs: Following the comment from 2002-09-26 to AddMethod, I
1374         have fixed a remaining problem: not every AddXXXX was adding a
1375         fully qualified name.  
1376
1377         Now everyone registers a fully qualified name in the DeclSpace as
1378         being defined instead of the partial name.  
1379
1380         Downsides: we are slower than we need to be due to the excess
1381         copies and the names being registered this way.  
1382
1383         The reason for this is that we currently depend (on the corlib
1384         bootstrap for instance) that types are fully qualified, because
1385         we dump all the types in the namespace, and we should really have
1386         types inserted into the proper namespace, so we can only store the
1387         basenames in the defined_names array.
1388
1389 2002-10-10  Martin Baulig  <martin@gnome.org>
1390
1391         * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
1392         from bug #31834, see the bug report for a testcase which is
1393         miscompiled.
1394
1395 2002-10-10  Martin Baulig  <martin@gnome.org>
1396
1397         * codegen.cs (EmitContext.Breaks): Removed, we're now using the
1398         flow analysis code for this.
1399
1400         * statement.cs (Do, While, For): Tell the flow analysis code about
1401         infinite loops.
1402         (FlowBranching.UsageVector): Added support for infinite loops.
1403         (Block.Resolve): Moved the dead code elimination here and use flow
1404         analysis to do it.
1405
1406 2002-10-09  Miguel de Icaza  <miguel@ximian.com>
1407
1408         * class.cs (Field.Define): Catch cycles on struct type
1409         definitions. 
1410
1411         * typemanager.cs (IsUnmanagedtype): Do not recursively check
1412         fields if the fields are static.  We only need to check instance
1413         fields. 
1414
1415         * expression.cs (As.DoResolve): Test for reference type.
1416
1417         * statement.cs (Using.ResolveExpression): Use
1418         ConvertImplicitRequired, not ConvertImplicit which reports an
1419         error on failture
1420         (Using.ResolveLocalVariableDecls): ditto.
1421
1422         * expression.cs (Binary.ResolveOperator): Report errors in a few
1423         places where we had to.
1424
1425         * typemanager.cs (IsUnmanagedtype): Finish implementation.
1426
1427 2002-10-08  Miguel de Icaza  <miguel@ximian.com>
1428
1429         * expression.cs: Use StoreFromPtr instead of extracting the type
1430         and then trying to use Stelem.  Patch is from hwang_rob@yahoo.ca
1431
1432         * ecore.cs (ImplicitReferenceConversion): It is possible to assign
1433         an enumeration value to a System.Enum, but System.Enum is not a
1434         value type, but an class type, so we need to box.
1435
1436         (Expression.ConvertExplicit): One codepath could return
1437         errors but not flag them.  Fix this.  Fixes #31853
1438
1439         * parameter.cs (Resolve): Do not allow void as a parameter type.
1440
1441 2002-10-06  Martin Baulig  <martin@gnome.org>
1442
1443         * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
1444         if it's a class type and not a struct.  Fixes #31815.
1445
1446 2002-10-06  Martin Baulig  <martin@gnome.org>
1447
1448         * statement.cs: Reworked the flow analysis code a bit to make it
1449         usable for dead code elimination.
1450
1451 2002-10-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1452
1453         * cs-parser.jay: allow empty source files. Fixes bug #31781.
1454
1455 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
1456
1457         * expression.cs (ComposedCast.DoResolveType): A quick workaround
1458         to fix the test 165, will investigate deeper.
1459
1460 2002-10-04  Martin Baulig  <martin@gnome.org>
1461
1462         * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
1463         finally blocks actually work.
1464         (Try.Resolve): We don't need to create a sibling for `finally' if
1465         there is no finally block.
1466
1467 2002-10-04  Martin Baulig  <martin@gnome.org>
1468
1469         * class.cs (Constructor.Define): The default accessibility for a
1470         non-default constructor is private, not public.
1471
1472 2002-10-04  Miguel de Icaza  <miguel@ximian.com>
1473
1474         * class.cs (Constructor): Make AllowedModifiers public, add
1475         EXTERN.
1476
1477         * cs-parser.jay: Perform the modifiers test here, as the
1478         constructor for the Constructor class usually receives a zero
1479         because of the way we create it (first we create, later we
1480         customize, and we were never checking the modifiers).
1481
1482         * typemanager.cs (Typemanager.LookupTypeDirect): This new function
1483         is a version of LookupTypeReflection that includes the type-name
1484         cache.  This can be used as a fast path for functions that know
1485         the fully qualified name and are only calling into *.GetType() to
1486         obtain a composed type.
1487
1488         This is also used by TypeManager.LookupType during its type
1489         composition.
1490
1491         (LookupType): We now also track the real type name, as sometimes
1492         we can get a quey for the real type name from things like
1493         ComposedCast.  This fixes bug 31422.
1494         
1495         * expression.cs (ComposedCast.Resolve): Since we are obtaining a
1496         complete type fullname, it does not have to go through the type
1497         resolution system to obtain the composed version of the type (for
1498         obtaining arrays or pointers).
1499         
1500         (Conditional.Emit): Use the EmitBoolExpression to
1501         generate nicer code, as requested by Paolo.
1502
1503         (ArrayCreation.CheckIndices): Use the patch from
1504         hwang_rob@yahoo.ca to validate the array initializers. 
1505
1506 2002-10-03  Miguel de Icaza  <miguel@ximian.com>
1507
1508         * class.cs (ConstructorInitializer.Emit): simplify code by using
1509         Invocation.EmitCall, and at the same time, fix the bugs in calling
1510         parent constructors that took variable arguments. 
1511
1512         * ecore.cs (Expression.ConvertNumericExplicit,
1513         Expression.ImplicitNumericConversion): Remove the code that
1514         manually wrapped decimal (InternalTypeConstructor call is now gone
1515         as well).
1516
1517         * expression.cs (Cast.TryReduce): Also handle decimal types when
1518         trying to perform a constant fold on the type.
1519
1520         * typemanager.cs (IsUnmanagedtype): Partially implemented.
1521
1522         * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
1523         that only turned off an error report, and did nothing else. 
1524
1525 2002-10-02  Miguel de Icaza  <miguel@ximian.com>
1526
1527         * driver.cs: Handle and ignore /fullpaths
1528
1529 2002-10-01  Miguel de Icaza  <miguel@ximian.com>
1530
1531         * expression.cs (Binary.ResolveOperator): Catch the case where
1532         DoNumericPromotions returns true, 
1533
1534         (Binary.DoNumericPromotions): Simplify the code, and the tests.
1535
1536 2002-09-27  Miguel de Icaza  <miguel@ximian.com>
1537
1538         * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
1539         report error 70.
1540
1541 2002-09-26  Miguel de Icaza  <miguel@ximian.com>
1542
1543         * ecore.cs (ConvertNumericExplicit): It is not enough that the
1544         conversion exists, but it is also required that the conversion be
1545         performed.  This manifested in "(Type64Enum) 2".  
1546
1547         * class.cs (TypeManager.AddMethod): The fix is not to change
1548         AddEnum, because that one was using a fully qualified name (every
1549         DeclSpace derivative does), but to change the AddMethod routine
1550         that was using an un-namespaced name.  This now correctly reports
1551         the duplicated name.
1552
1553         Revert patch until I can properly fix it.  The issue
1554         is that we have a shared Type space across all namespaces
1555         currently, which is wrong.
1556
1557         Options include making the Namespace a DeclSpace, and merge
1558         current_namespace/current_container in the parser.
1559
1560 2002-09-25  Miguel de Icaza  <miguel@ximian.com>
1561
1562         * cs-parser.jay: Improve error reporting when we get a different
1563         kind of expression in local_variable_type and
1564         local_variable_pointer_type. 
1565
1566         Propagate this to avoid missleading errors being reported.
1567
1568         * ecore.cs (ImplicitReferenceConversion): treat
1569         TypeManager.value_type as a target just like object_type.   As
1570         code like this:
1571
1572         ValueType v = 1;
1573
1574         Is valid, and needs to result in the int 1 being boxed before it
1575         is assigned to the value type v.
1576
1577         * class.cs (TypeContainer.AddEnum): Use the basename, not the name
1578         to validate the enumeration name.
1579
1580         * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
1581         EmitDynamicInitializers for the criteria to use Ldelema.  Thanks
1582         to hwang_rob@yahoo.ca for finding the bug and providing a patch.
1583
1584         * ecore.cs (TryImplicitIntConversion): When doing an
1585         implicit-enumeration-conversion, check if the type is 64-bits and
1586         perform a conversion before passing to EnumConstant.
1587
1588 2002-09-23  Miguel de Icaza  <miguel@ximian.com>
1589
1590         * decl.cs (Error_AmbiguousTypeReference); New routine used to
1591         report ambiguous type references.  Unlike the MS version, we
1592         report what the ambiguity is.   Innovation at work ;-)
1593
1594         (DeclSpace.FindType): Require a location argument to
1595         display when we display an ambiguous error.
1596
1597         * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
1598
1599         * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
1600
1601         * expression.cs (EmitDynamicInitializers): Apply patch from
1602         hwang_rob@yahoo.ca that fixes the order in which we emit our
1603         initializers. 
1604
1605 2002-09-21  Martin Baulig  <martin@gnome.org>
1606
1607         * delegate.cs (Delegate.VerifyApplicability): Make this work if the
1608         delegate takes no arguments.
1609
1610 2002-09-20  Miguel de Icaza  <miguel@ximian.com>
1611
1612         * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
1613         from integers.
1614
1615         * expression.cs: Extract the underlying type.
1616
1617         * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
1618
1619         * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
1620
1621 2002-09-19  Miguel de Icaza  <miguel@ximian.com>
1622
1623         * class.cs (TypeContainer.DefineType): We can not use the nice
1624         PackingSize with the size set to 1 DefineType method, because it
1625         will not allow us to define the interfaces that the struct
1626         implements.
1627
1628         This completes the fixing of bug 27287
1629
1630         * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
1631         means also structs.  This fixes part of the problem. 
1632         (Expresion.ImplicitReferenceConversionExists): ditto.
1633
1634         * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
1635         error if there were no errors reported during the type lookup
1636         process, to avoid duplicates or redundant errors.  Without this
1637         you would get an ambiguous errors plus a type not found.  We have
1638         beaten the user enough with the first error.  
1639
1640         (DeclSparce.FindType): Emit a warning if we have an ambiguous
1641         reference. 
1642
1643         * ecore.cs (SimpleName.DoResolveType): If an error is emitted
1644         during the resolution process, stop the lookup, this avoids
1645         repeated error reports (same error twice).
1646
1647         * rootcontext.cs: Emit a warning if we have an ambiguous reference.
1648
1649         * typemanager.cs (LookupType): Redo the type lookup code to match
1650         the needs of System.Reflection.  
1651
1652         The issue is that System.Reflection requires references to nested
1653         types to begin with a "+" sign instead of a dot.  So toplevel
1654         types look like: "NameSpace.TopLevelClass", and nested ones look
1655         like "Namespace.TopLevelClass+Nested", with arbitrary nesting
1656         levels. 
1657
1658 2002-09-19  Martin Baulig  <martin@gnome.org>
1659
1660         * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
1661         says that a method always returns or always throws an exception,
1662         don't report the CS0161.
1663
1664         * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
1665         set `Returns = new_returns'.
1666
1667 2002-09-19  Martin Baulig  <martin@gnome.org>
1668
1669         * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
1670         to an enum constant, check for a CS0176.
1671
1672 2002-09-18  Miguel de Icaza  <miguel@ximian.com>
1673
1674         * class.cs (TypeContainer.CheckPairedOperators): Now we check
1675         for operators that must be in pairs and report errors.
1676
1677         * ecore.cs (SimpleName.DoResolveType): During the initial type
1678         resolution process, when we define types recursively, we must
1679         check first for types in our current scope before we perform
1680         lookups in the enclosing scopes.
1681
1682         * expression.cs (MakeByteBlob): Handle Decimal blobs.
1683
1684         (Invocation.VerifyArgumentsCompat): Call
1685         TypeManager.TypeToCoreType on the parameter_type.GetElementType.
1686         I thought we were supposed to always call this, but there are a
1687         few places in the code where we dont do it.
1688
1689 2002-09-17  Miguel de Icaza  <miguel@ximian.com>
1690
1691         * driver.cs: Add support in -linkres and -resource to specify the
1692         name of the identifier.
1693
1694 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
1695
1696         * ecore.cs (StandardConversionExists): Sync with the conversion
1697         code: allow anything-* to void* conversions.
1698
1699         (FindMostSpecificSource): Use an Expression argument
1700         instead of a Type, because we might be handed over a Literal which
1701         gets a few more implicit conversions that plain types do not.  So
1702         this information was being lost.
1703
1704         Also, we drop the temporary type-holder expression when not
1705         required.
1706
1707 2002-09-17  Martin Baulig  <martin@gnome.org>
1708
1709         * class.cs (PropertyBase.CheckBase): Don't check the base class if
1710         this is an explicit interface implementation.
1711
1712 2002-09-17  Martin Baulig  <martin@gnome.org>
1713
1714         * class.cs (PropertyBase.CheckBase): Make this work for indexers with
1715         different `IndexerName' attributes.
1716
1717         * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
1718         (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
1719         virtual CommonResolve().
1720
1721 2002-09-16  Miguel de Icaza  <miguel@ximian.com>
1722
1723         * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
1724         and convert that to the UnderlyingType.
1725
1726         * statement.cs (Foreach.Resolve): Indexers are just like variables
1727         or PropertyAccesses.
1728
1729         * cs-tokenizer.cs (consume_string): Track line numbers and columns
1730         inside quoted strings, we were not doing this before.
1731
1732 2002-09-16  Martin Baulig  <martin@gnome.org>
1733
1734         * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
1735         resolve it.  This is needed for the definite assignment check of the
1736         instance expression, fixes bug #29846.
1737         (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
1738
1739 2002-09-16  Nick Drochak  <ndrochak@gol.com>
1740
1741         * parameter.cs: Fix compile error.  Cannot reference static member
1742         from an instance object.  Is this an mcs bug?
1743
1744 2002-09-14  Martin Baulig  <martin@gnome.org>
1745
1746         * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
1747         multiple times.  Fixes bug #30295, added test-166.cs.
1748
1749 2002-09-14  Martin Baulig  <martin@gnome.org>
1750
1751         * statement.cs (Block.Emit): Don't emit unreachable code.
1752         (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
1753         `break' statements.
1754         (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
1755
1756 2002-09-14  Martin Baulig  <martin@gnome.org>
1757
1758         * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
1759         is set.
1760
1761 2002-09-14  Martin Baulig  <martin@gnome.org>
1762
1763         * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
1764         if `type == parent' since in this case `type.IsSubclassOf (parent)' will
1765         be false on the ms runtime.
1766
1767 2002-09-13  Martin Baulig  <martin@gnome.org>
1768
1769         * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
1770         the CS0038 error message.
1771
1772 2002-09-12  Miguel de Icaza  <miguel@ximian.com>
1773
1774         * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
1775         constant inside, return it.
1776
1777 2002-09-12  Martin Baulig  <martin@gnome.org>
1778
1779         * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
1780         implicit conversion can be done between enum types.
1781
1782         * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
1783         check whether an implicit conversion to the current enum's UnderlyingType
1784         exists and report an error if not.
1785
1786         * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
1787         without debugging support.
1788
1789         * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
1790         Fixes bug #30235.  Thanks to Ricardo Fernández Pascual.
1791
1792 2002-09-12  Martin Baulig  <martin@gnome.org>
1793
1794         * typemanager.cs (TypeManager.IsNestedChildOf): New method.
1795
1796         * ecore.cs (IMemberExpr.DeclaringType): New property.
1797         (SimpleName.SimpleNameResolve): Check whether we're accessing a
1798         nonstatic member of an outer type (CS0038).
1799
1800 2002-09-11  Miguel de Icaza  <miguel@ximian.com>
1801
1802         * driver.cs: Activate the using-error detector at warning level
1803         4 (at least for MS-compatible APIs).
1804
1805         * namespace.cs (VerifyUsing): Small buglett fix.
1806
1807         * pending.cs (PendingImplementation): pass the container pointer. 
1808
1809         * interface.cs (GetMethods): Allow for recursive definition.  Long
1810         term, I would like to move every type to support recursive
1811         definitions, not the current ordering mechanism that we have right
1812         now.
1813
1814         The situation is this: Attributes are handled before interfaces,
1815         so we can apply attributes to interfaces.  But some attributes
1816         implement interfaces, we will now handle the simple cases
1817         (recursive definitions will just get an error).  
1818
1819         * parameter.cs: Only invalidate types at the end if we fail to
1820         lookup all types.  
1821
1822 2002-09-09  Martin Baulig  <martin@gnome.org>
1823
1824         * ecore.cs (PropertyExpr.Emit): Also check for
1825         TypeManager.system_int_array_get_length so this'll also work when
1826         compiling corlib.  Fixes #30003.
1827
1828 2002-09-09  Martin Baulig  <martin@gnome.org>
1829
1830         * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
1831         and throw an exception if we can't get the type's size.  Fixed #30040,
1832         added test-165.cs.
1833
1834 2002-09-09  Martin Baulig  <martin@gnome.org>
1835
1836         * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
1837
1838         * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
1839         context.  Fixes bug #30027.
1840
1841         * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
1842         virtual functions.  Fixes bug #30043, added test-164.cs.
1843
1844 2002-09-08  Ravi Pratap  <ravi@ximian.com>
1845
1846         * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
1847
1848 2002-09-08  Nick Drochak  <ndrochak@gol.com>
1849
1850         * driver.cs: Use an object to get the windows codepage since it's not a
1851         static property.
1852
1853 2002-09-08  Miguel de Icaza  <miguel@ximian.com>
1854
1855         * statement.cs (For.Emit): for infinite loops (test == null)
1856         return whether there is a break inside, not always "true".
1857
1858         * namespace.cs (UsingEntry): New struct to hold the name of the
1859         using definition, the location where it is defined, and whether it
1860         has been used in a successful type lookup.
1861         
1862         * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
1863         strings.
1864
1865         * decl.cs: ditto.
1866
1867 2002-09-06  Ravi Pratap  <ravi@ximian.com>
1868
1869         * attribute.cs : Fix incorrect code which relied on catching
1870         a NullReferenceException to detect a null being passed in
1871         where an object was expected.
1872
1873 2002-09-06  Miguel de Icaza  <miguel@ximian.com>
1874
1875         * statement.cs (Try): flag the catch variable as assigned
1876
1877         * expression.cs (Cast): Simplified by using ResolveType instead of
1878         manually resolving.
1879
1880         * statement.cs (Catch): Fix bug by using ResolveType.
1881
1882 2002-09-06  Ravi Pratap  <ravi@ximian.com>
1883
1884         * expression.cs (BetterConversion): Special case for when we have
1885         a NullLiteral as the argument and we have to choose between string
1886         and object types - we choose string the way csc does.
1887
1888         * attribute.cs (Attribute.Resolve): Catch the
1889         NullReferenceException and report error #182 since the Mono
1890         runtime no more has the bug and having this exception raised means
1891         we tried to select a constructor which takes an object and is
1892         passed a null.
1893
1894 2002-09-05  Ravi Pratap  <ravi@ximian.com>
1895
1896         * expression.cs (Invocation.OverloadResolve): Flag a nicer error
1897         message (1502, 1503) when we can't locate a method after overload
1898         resolution. This is much more informative and closes the bug
1899         Miguel reported.
1900
1901         * interface.cs (PopulateMethod): Return if there are no argument
1902         types. Fixes a NullReferenceException bug.
1903
1904         * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
1905         expressions too. Previously we were checking only in one place for
1906         positional arguments leaving out named arguments.
1907
1908         * ecore.cs (ImplicitNumericConversion): Conversion from underlying
1909         type to the enum type is not allowed. Remove code corresponding to
1910         that.
1911
1912         (ConvertNumericExplicit): Allow explicit conversions from
1913         the underlying type to enum type. This precisely follows the spec
1914         and closes a bug filed by Gonzalo.
1915         
1916 2002-09-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1917
1918         * compiler.csproj:
1919         * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
1920
1921 2002-09-03  Miguel de Icaza  <miguel@ximian.com>
1922
1923         * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
1924         it was important that we stored the right value after the
1925         reduction in `converted'.
1926
1927 2002-09-04  Martin Baulig  <martin@gnome.org>
1928
1929         * location.cs (Location.SymbolDocument): Use full pathnames for the
1930         source files.
1931
1932 2002-08-30  Miguel de Icaza  <miguel@ximian.com>
1933
1934         * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
1935         of the expression resolve mechanism, because that will catch the
1936         SimpleName error failures.
1937
1938         (Conditional): If we can not resolve the
1939         expression, return, do not crash.
1940
1941 2002-08-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1942
1943         * cs-tokenizer.cs:
1944         (location): display token name instead of its number.
1945
1946 2002-08-28  Martin Baulig  <martin@gnome.org>
1947
1948         * expression.cs (Binary.ResolveOperator): Don't silently return
1949         but return an error if an operator cannot be applied between two
1950         enum types.
1951
1952 2002-08-28  Martin Baulig  <martin@gnome.org>
1953
1954         * class.cs (Constructor.Define): Set the permission attributes
1955         correctly instead of making all constructors public.
1956
1957 2002-08-28  Martin Baulig  <martin@gnome.org>
1958
1959         * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
1960         for private members before reporting a CS0103; if we find anything,
1961         it's a CS0122.
1962
1963 2002-08-28  Martin Baulig  <martin@gnome.org>
1964
1965         * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
1966         to check whether `closure_start_type == closure_invocation_type',
1967         we also need to check whether `m.DeclaringType == closure_invocation_type'
1968         before bypassing the permission checks.  We might be accessing
1969         protected/private members from the base class.
1970         (TypeManager.RealMemberLookup): Only set private_ok if private
1971         members were requested via BindingFlags.NonPublic.
1972
1973         * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
1974
1975         * expression.cs (MemberAccess.ResolveMemberAccess): Set
1976         MethodGroupExpr.IsExplicitImpl if appropriate.
1977         (Invocation.DoResolve): Don't report the CS0120 for explicit
1978         interface implementations.
1979
1980 2002-08-27  Martin Baulig  <martin@gnome.org>
1981
1982         * expression.cs (Invocation.DoResolve): If this is a static
1983         method and we don't have an InstanceExpression, we must report
1984         a CS0120.
1985
1986 2002-08-25  Martin Baulig  <martin@gnome.org>
1987
1988         * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
1989         `==' between a valuetype and an object.
1990
1991 2002-08-25  Miguel de Icaza  <miguel@ximian.com>
1992
1993         * ecore.cs (TypeExpr): Provide a ToString method.
1994
1995 2002-08-24  Martin Baulig  <martin@gnome.org>
1996
1997         * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
1998         now called proggie.dbg and it's a binary file.
1999
2000 2002-08-23  Martin Baulig  <martin@gnome.org>
2001
2002         * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
2003
2004 2002-08-23  Martin Baulig  <martin@gnome.org>
2005
2006         * struct.cs (MyStructInfo.ctor): Make this work with empty
2007         structs; it's not allowed to use foreach() on null.
2008
2009 2002-08-23  Martin Baulig  <martin@gnome.org>
2010
2011         * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
2012         writer the full pathname of the generated assembly.
2013
2014 2002-08-23  Martin Baulig  <martin@gnome.org>
2015
2016         * statements.cs (FlowBranching.UsageVector.MergeChildren):
2017         A `finally' block never returns or breaks; improved handling of
2018         unreachable code.
2019
2020 2002-08-23  Martin Baulig  <martin@gnome.org>
2021
2022         * statement.cs (Throw.Resolve): Allow `throw null'.
2023
2024 2002-08-23  Martin Baulig  <martin@gnome.org>
2025
2026         * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
2027         EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
2028         `ee.EventInfo.DeclaringType == ec.ContainerType'.  The
2029         MemberLookup would return a wrong event if this is an explicit
2030         interface implementation and the class has an event with the same
2031         name.
2032
2033 2002-08-23  Martin Baulig  <martin@gnome.org>
2034
2035         * statement.cs (Block.AddChildVariableNames): New public method.
2036         (Block.AddChildVariableName): Likewise.
2037         (Block.IsVariableNameUsedInChildBlock): Likewise.
2038         (Block.AddVariable): Check whether a variable name has already
2039         been used in a child block.
2040
2041         * cs-parser.jay (declare_local_variables): Mark all variable names
2042         from the current block as being used in a child block in the
2043         implicit block.
2044
2045 2002-08-23  Martin Baulig  <martin@gnome.org>
2046
2047         * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
2048         find the symbol writer.
2049
2050         * driver.cs: csc also allows the arguments to /define being
2051         separated by commas, not only by semicolons.
2052
2053 2002-08-23  Martin Baulig  <martin@gnome.org>
2054
2055         * interface.cs (Interface.GetMembers): Added static check for events.
2056
2057 2002-08-15  Martin Baulig  <martin@gnome.org>
2058
2059         * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
2060         call, use ec.ContainerType.BaseType as queried_type and invocation_type.
2061
2062         * ecore.cs (Expression.MemberLookup): Added documentation and explained
2063         why the MethodData.EmitDestructor() change was necessary.
2064
2065 2002-08-20  Martin Baulig  <martin@gnome.org>
2066
2067         * class.cs (TypeContainer.FindMembers): Added static check for events.
2068
2069         * decl.cs (MemberCache.AddMembers): Handle events like normal members.
2070
2071         * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
2072         use Type.GetEvents(), not Type.FindMembers().
2073
2074 2002-08-20  Martin Baulig  <martin@gnome.org>
2075
2076         * decl.cs (MemberCache): Added a special method cache which will
2077         be used for method-only searched.  This ensures that a method
2078         search will return a MethodInfo with the correct ReflectedType for
2079         inherited methods.      
2080
2081 2002-08-20  Martin Baulig  <martin@gnome.org>
2082
2083         * decl.cs (DeclSpace.FindMembers): Made this public.
2084
2085 2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2086
2087         * delegate.cs: fixed build on windows.
2088         [FIXME:  Filed as bug #29150: MCS must report these errors.]
2089
2090 2002-08-19  Ravi Pratap  <ravi@ximian.com>
2091
2092         * ecore.cs (StandardConversionExists): Return a false
2093         if we are trying to convert the void type to anything else
2094         since that is not allowed.
2095
2096         * delegate.cs (DelegateInvocation.DoResolve): Ensure that
2097         we flag error 70 in the event an event is trying to be accessed
2098         directly from outside the declaring type.
2099
2100 2002-08-20  Martin Baulig  <martin@gnome.org>
2101
2102         * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
2103         MemberCache from typemanager.cs to decl.cs.
2104
2105 2002-08-19  Martin Baulig  <martin@gnome.org>
2106
2107         * class.cs (TypeContainer): Implement IMemberContainer.
2108         (TypeContainer.DefineMembers): Create the MemberCache.
2109         (TypeContainer.FindMembers): Do better BindingFlags checking; only
2110         return public members if BindingFlags.Public was given, check
2111         whether members are static.
2112
2113 2002-08-16  Martin Baulig  <martin@gnome.org>
2114
2115         * decl.cs (DeclSpace.Define): Splitted this in Define and
2116         DefineMembers.  DefineMembers is called first and initializes the
2117         MemberCache.
2118
2119         * rootcontext.cs (RootContext.DefineMembers): New function.  Calls
2120         DefineMembers() on all our DeclSpaces.
2121
2122         * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
2123         but call DefineMembers() on all nested interfaces.  We call their
2124         Define() in our new Define() function.
2125
2126         * interface.cs (Interface): Implement IMemberContainer.
2127         (Interface.Define): Moved all code except the attribute stuf to
2128         DefineMembers().
2129         (Interface.DefineMembers): Initialize the member cache.
2130
2131         * typemanager.cs (IMemberFinder): Removed this interface, we don't
2132         need this anymore since we can use MemberCache.FindMembers directly.
2133
2134 2002-08-19  Martin Baulig  <martin@gnome.org>
2135
2136         * typemanager.cs (MemberCache): When creating the cache for an
2137         interface type, add all inherited members.
2138         (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
2139         to `out bool used_cache' and documented it.
2140         (TypeManager.MemberLookup): If we already used the cache in the first
2141         iteration, we don't need to do the interfaces check.
2142
2143 2002-08-19  Martin Baulig  <martin@gnome.org>
2144
2145         * decl.cs (DeclSpace.FindMembers): New abstract method.  Moved this
2146         here from IMemberFinder and don't implement this interface anymore.
2147         (DeclSpace.MemberCache): Moved here from IMemberFinder.
2148
2149         * typemanager.cs (IMemberFinder): This interface is now only used by
2150         classes which actually support the member cache.
2151         (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
2152         since we only put DeclSpaces into this Hashtable.
2153         (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
2154         a dynamic type and TypeHandle.GetTypeHandle() otherwise.
2155
2156 2002-08-16  Martin Baulig  <martin@gnome.org>
2157
2158         * typemanager.cs (ICachingMemberFinder): Removed.
2159         (IMemberFinder.MemberCache): New property.
2160         (TypeManager.FindMembers): Merged this with RealFindMembers().
2161         This function will never be called from TypeManager.MemberLookup()
2162         so we can't use the cache here, just the IMemberFinder.
2163         (TypeManager.MemberLookup_FindMembers): Check whether the
2164         IMemberFinder has a MemberCache and call the cache's FindMembers
2165         function.
2166         (MemberCache): Rewrote larger parts of this yet another time and
2167         cleaned it up a bit.
2168
2169 2002-08-15  Miguel de Icaza  <miguel@ximian.com>
2170
2171         * driver.cs (LoadArgs): Support quoting.
2172
2173         (Usage): Show the CSC-like command line arguments.
2174
2175         Improved a few error messages.
2176
2177 2002-08-15  Martin Baulig  <martin@gnome.org>
2178
2179         * typemanager.cs (IMemberContainer.Type): New property.
2180         (IMemberContainer.IsInterface): New property.
2181
2182         The following changes are conditional to BROKEN_RUNTIME, which is
2183         defined at the top of the file.
2184
2185         * typemanager.cs (MemberCache.MemberCache): Don't add the base
2186         class'es members, but add all members from TypeHandle.ObjectType
2187         if we're an interface.
2188         (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
2189         is the current type.
2190         (MemberCache.CacheEntry.Container): Removed this field.
2191         (TypeHandle.GetMembers): Include inherited members.
2192
2193 2002-08-14  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2194
2195         * typemanager.cs: fixed compilation and added a comment on a field that
2196         is never used.
2197
2198 2002-08-15  Martin Baulig  <martin@gnome.org>
2199
2200         * class.cs (ConstructorInitializer.Resolve): In the
2201         Expression.MemberLookup call, use the queried_type as
2202         invocation_type.
2203
2204         * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
2205         declared' attribute, it's always true.
2206         (IMemberContainer.Parent, IMemberContainer.Name): New properties.
2207         (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
2208         temporary wrapper for FindMembers which tells MemberLookup whether
2209         members from the base classes are included in the return value.
2210         This will go away soon.
2211         (TypeManager.MemberLookup): Use this temporary hack here; once the
2212         new MemberCache is completed, we don't need to do the DeclaredOnly
2213         looping here anymore since the MemberCache will take care of this.
2214         (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
2215         (MemberCache): When creating the MemberCache for a class, get
2216         members from the current class and all its base classes.
2217         (MemberCache.CacheEntry.Container): New field.  This is a
2218         temporary hack until the Mono runtime is fixed to distinguish
2219         between ReflectedType and DeclaringType.  It allows us to use MCS
2220         with both the MS runtime and the unfixed Mono runtime without
2221         problems and without accecting performance.
2222         (MemberCache.SearchMembers): The DeclaredOnly looping from
2223         TypeManager.MemberLookup is now done here.      
2224
2225 2002-08-14  Martin Baulig  <martin@gnome.org>
2226
2227         * statement.cs (MyStructInfo.MyStructInfo): Don't call
2228         Type.GetFields on dynamic types but get the fields from the
2229         corresponding TypeContainer.
2230         (MyStructInfo.GetStructInfo): Added check for enum types.
2231
2232         * typemanager.cs (MemberList.IsSynchronized): Implemented.
2233         (MemberList.SyncRoot): Implemented.
2234         (TypeManager.FilterWithClosure): No need to check permissions if
2235         closure_start_type == closure_invocation_type, don't crash if
2236         closure_invocation_type is null.
2237
2238 2002-08-13  Martin Baulig  <martin@gnome.org>
2239
2240         Rewrote TypeContainer.FindMembers to use a member cache.  This
2241         gives us a speed increase of about 35% for the self-hosting MCS
2242         build and of about 15-20% for the class libs (both on GNU/Linux).
2243
2244         * report.cs (Timer): New class to get enhanced profiling.  This
2245         whole class is "TIMER" conditional since it remarkably slows down
2246         compilation speed.
2247
2248         * class.cs (MemberList): New class.  This is an IList wrapper
2249         which we're now using instead of passing MemberInfo[]'s around to
2250         avoid copying this array unnecessarily.
2251         (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
2252         (ICachingMemberFinder, IMemberContainer): New interface.
2253         (TypeManager.FilterWithClosure): If `criteria' is null, the name
2254         has already been checked, otherwise use it for the name comparision.
2255         (TypeManager.FindMembers): Renamed to RealMemberFinder and
2256         provided wrapper which tries to use ICachingMemberFinder.FindMembers
2257         if possible.  Returns a MemberList, not a MemberInfo [].
2258         (TypeHandle): New class, implements IMemberContainer.  We create
2259         one instance of this class per type, it contains a MemberCache
2260         which is used to do the member lookups.
2261         (MemberCache): New class.  Each instance of this class contains
2262         all members of a type and a name-based hash table.
2263         (MemberCache.FindMembers): This is our new member lookup
2264         function.  First, it looks up all members of the requested name in
2265         the hash table.  Then, it walks this list and sorts out all
2266         applicable members and returns them.
2267
2268 2002-08-13  Martin Baulig  <martin@gnome.org>
2269
2270         In addition to a nice code cleanup, this gives us a performance
2271         increase of about 1.4% on GNU/Linux - not much, but it's already
2272         half a second for the self-hosting MCS compilation.
2273
2274         * typemanager.cs (IMemberFinder): New interface.  It is used by
2275         TypeManager.FindMembers to call FindMembers on a TypeContainer,
2276         Enum, Delegate or Interface.
2277         (TypeManager.finder_to_member_finder): New PtrHashtable.
2278         (TypeManager.finder_to_container): Removed.
2279         (TypeManager.finder_to_delegate): Removed.
2280         (TypeManager.finder_to_interface): Removed.
2281         (TypeManager.finder_to_enum): Removed.
2282
2283         * interface.cs (Interface): Implement IMemberFinder.
2284
2285         * delegate.cs (Delegate): Implement IMemberFinder.
2286
2287         * enum.cs (Enum): Implement IMemberFinder.
2288
2289         * class.cs (TypeContainer): Implement IMemberFinder.
2290
2291 2002-08-12  Martin Baulig  <martin@gnome.org>
2292
2293         * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
2294
2295 2002-08-12  Martin Baulig  <martin@gnome.org>
2296
2297         * ecore.cs (ITypeExpression): New interface for expressions which
2298         resolve to a type.
2299         (TypeExpression): Renamed to TypeLookupExpression.
2300         (Expression.DoResolve): If we're doing a types-only lookup, the
2301         expression must implement the ITypeExpression interface and we
2302         call DoResolveType() on it.
2303         (SimpleName): Implement the new ITypeExpression interface.
2304         (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
2305         hack, the situation that we're only looking up types can't happen
2306         anymore when this method is called.  Moved the type lookup code to
2307         DoResolveType() and call it.
2308         (SimpleName.DoResolveType): This ITypeExpression interface method
2309         is now doing the types-only lookup.
2310         (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
2311         (ResolveFlags): Added MaskExprClass.
2312
2313         * expression.cs (MemberAccess): Implement the ITypeExpression
2314         interface.
2315         (MemberAccess.DoResolve): Added support for a types-only lookup
2316         when we're called via ITypeExpression.DoResolveType().
2317         (ComposedCast): Implement the ITypeExpression interface.
2318
2319         * codegen.cs (EmitContext.OnlyLookupTypes): Removed.  Call
2320         Expression.Resolve() with ResolveFlags.Type instead.
2321
2322 2002-08-12  Martin Baulig  <martin@gnome.org>
2323
2324         * interface.cs (Interface.Define): Apply attributes.
2325
2326         * attribute.cs (Attribute.ApplyAttributes): Added support for
2327         interface attributes.
2328
2329 2002-08-11  Martin Baulig  <martin@gnome.org>
2330
2331         * statement.cs (Block.Emit): Only check the "this" variable if we
2332         do not always throw an exception.
2333
2334         * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
2335         whether the property has a set accessor.
2336
2337 2002-08-11  Martin Baulig  <martin@gnome.org>
2338
2339         Added control flow analysis support for structs.
2340
2341         * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
2342         with control flow analysis turned off.
2343         (IVariable): New interface.
2344         (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
2345         returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
2346         (FieldExpr.DoResolve): Resolve the instance expression with flow
2347         analysis turned off and do the definite assignment check after the
2348         resolving when we know what the expression will resolve to.
2349
2350         * expression.cs (LocalVariableReference, ParameterReference):
2351         Implement the new IVariable interface, only call the flow analysis
2352         code if ec.DoFlowAnalysis is true.
2353         (This): Added constructor which takes a Block argument.  Implement
2354         the new IVariable interface.
2355         (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
2356         DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
2357         This does the definite assignment checks for struct members.
2358
2359         * class.cs (Constructor.Emit): If this is a non-static `struct'
2360         constructor which doesn't have any initializer, call
2361         Block.AddThisVariable() to tell the flow analysis code that all
2362         struct elements must be initialized before control returns from
2363         the constructor.
2364
2365         * statement.cs (MyStructInfo): New public class.
2366         (UsageVector.this [VariableInfo vi]): Added `int field_idx'
2367         argument to this indexer.  If non-zero, check an individual struct
2368         member, not the whole struct.
2369         (FlowBranching.CheckOutParameters): Check struct members.
2370         (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
2371         overloaded versions of these methods which take an additional
2372         `int field_idx' argument to check struct members.
2373         (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
2374         overloaded versions of these methods which take an additional
2375         `string field_name' argument to check struct member.s
2376         (VariableInfo): Implement the IVariable interface.
2377         (VariableInfo.StructInfo): New public property.  Returns the
2378         MyStructInfo instance of the variable if it's a struct or null.
2379         (Block.AddThisVariable): New public method.  This is called from
2380         Constructor.Emit() for non-static `struct' constructor which do
2381         not have any initializer.  It creates a special variable for the
2382         "this" instance variable which will be checked by the flow
2383         analysis code to ensure that all of the struct's fields are
2384         initialized before control returns from the constructor.
2385         (UsageVector): Added support for struct members.  If a
2386         variable/parameter is a struct with N members, we reserve a slot
2387         in the usage vector for each member.  A struct is considered fully
2388         initialized if either the struct itself (slot 0) or all its
2389         members are initialized.
2390
2391 2002-08-08  Martin Baulig  <martin@gnome.org>
2392
2393         * driver.cs (Driver.MainDriver): Only report an error CS5001
2394         if there were no compilation errors.
2395
2396         * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
2397         `UnsafeContext' property to determine whether the parent is in
2398         unsafe context rather than checking the parent's ModFlags:
2399         classes nested in an unsafe class are unsafe as well.
2400
2401 2002-08-08  Martin Baulig  <martin@gnome.org>
2402
2403         * statement.cs (UsageVector.MergeChildren): Distinguish between
2404         `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
2405         we return.  Added test17() and test18() to test-154.cs.
2406
2407 2002-08-08  Martin Baulig  <martin@gnome.org>
2408
2409         * typemanager.cs (TypeManager.FilterWithClosure): If we have
2410         Family access, make sure the invoking type isn't a subclass of the
2411         queried type (that'd be a CS1540).
2412
2413         * ecore.cs (Expression.MemberLookup): Added overloaded version of
2414         this method which takes an additional `Type invocation_type'.
2415
2416         * expression.cs (BaseAccess.DoResolve): Use the base type as
2417         invocation and query type.
2418         (MemberAccess.DoResolve): If the lookup failed and we're about to
2419         report a CS0122, try a lookup with the ec.ContainerType - if this
2420         succeeds, we must report a CS1540.
2421
2422 2002-08-08  Martin Baulig  <martin@gnome.org>
2423
2424         * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
2425         (MethodGroupExpr): Implement the IMemberExpr interface.
2426
2427         * expression (MemberAccess.ResolveMemberAccess): No need to have
2428         any special code for MethodGroupExprs anymore, they're now
2429         IMemberExprs.   
2430
2431 2002-08-08  Martin Baulig  <martin@gnome.org>
2432
2433         * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
2434         Family, FamANDAssem and FamORAssem permissions.
2435         (TypeManager.IsSubclassOrNestedChildOf): New public method.
2436
2437 2002-08-08  Martin Baulig  <martin@gnome.org>
2438
2439         * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
2440         (UsageVector.MergeChildren): `break' breaks unless we're in a switch
2441         or loop block.
2442
2443 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
2444
2445         * driver.cs: implemented /resource option to embed managed resources.
2446
2447 2002-08-07  Martin Baulig  <martin@gnome.org>
2448
2449         * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
2450         (FieldBase.HasFieldInitializer): New public property.
2451         (FieldBase.GetInitializerExpression): New public method.  Resolves and
2452         returns the field initializer and makes sure it is only resolved once.
2453         (TypeContainer.EmitFieldInitializers): Call
2454         FieldBase.GetInitializerExpression to get the initializer, this ensures
2455         that it isn't resolved multiple times.
2456
2457         * codegen.cs (EmitContext): Added `bool IsFieldInitialier'.  This tells
2458         the resolving process (SimpleName/MemberLookup) that we're currently
2459         emitting a field initializer (which must not access any instance members,
2460         this is an error CS0236).
2461
2462         * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
2463         argument, if the `IsFieldInitializer' flag is set, we must report and
2464         error CS0236 and not an error CS0120.   
2465
2466 2002-08-07  Martin Baulig  <martin@gnome.org>
2467
2468         * ecore.cs (IMemberExpr): New public interface.
2469         (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
2470         (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
2471         if the expression is an IMemberExpr.
2472
2473         * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
2474         to be null, implicitly default to `this' if we're non-static in
2475         this case.  Simplified the code a lot by using the new IMemberExpr
2476         interface.  Also fixed bug #28176 here.
2477
2478 2002-08-06  Martin Baulig  <martin@gnome.org>
2479
2480         * cs-parser.jay (SimpleLookup): Removed.  We need to create
2481         ParameterReferences during semantic analysis so that we can do a
2482         type-only search when resolving Cast, TypeOf and SizeOf.
2483         (block): Pass the `current_local_parameters' to the Block's
2484         constructor.
2485
2486         * class.cs (ConstructorInitializer): Added `Parameters parameters'
2487         argument to the constructor.
2488         (ConstructorInitializer.Resolve): Create a temporary implicit
2489         block with the parameters.
2490
2491         * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
2492         references here if we aren't doing a type-only search.
2493
2494         * statement.cs (Block): Added constructor which takes a
2495         `Parameters parameters' argument.
2496         (Block.Parameters): New public property.
2497
2498         * support.cs (InternalParameters.Parameters): Renamed `parameters'
2499         to `Parameters' and made it public readonly.
2500
2501 2002-08-06  Martin Baulig  <martin@gnome.org>
2502
2503         * ecore.cs (Expression.Warning): Made this public as well.
2504
2505         * report.cs (Report.Debug): Print the contents of collections.
2506
2507 2002-08-06  Martin Baulig  <martin@gnome.org>
2508
2509         * ecore.cs (Expression.ResolveFlags): New [Flags] enum.  This is
2510         used to tell Resolve() which kinds of expressions it may return.
2511         (Expression.Resolve): Added overloaded version of this method which
2512         takes a `ResolveFlags flags' argument.  This can be used to tell
2513         Resolve() which kinds of expressions it may return.  Reports a
2514         CS0118 on error.
2515         (Expression.ResolveWithSimpleName): Removed, use Resolve() with
2516         ResolveFlags.SimpleName.
2517         (Expression.Error118): Added overloaded version of this method which
2518         takes a `ResolveFlags flags' argument.  It uses the flags to determine
2519         which kinds of expressions are allowed.
2520
2521         * expression.cs (Argument.ResolveMethodGroup): New public method.
2522         Resolves an argument, but allows a MethodGroup to be returned.
2523         This is used when invoking a delegate.
2524
2525         * TODO: Updated a bit.
2526
2527 2002-08-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2528
2529         Fixed compilation with csc.
2530
2531         * ecore.cs: Expression.Error made public. Is this correct? Should
2532         Warning be made public too?
2533
2534         * expression.cs: use ea.Location instead of ea.loc.
2535         [FIXME:  Filed as bug #28607: MCS must report these errors.]
2536
2537 2002-08-06  Martin Baulig  <martin@gnome.org>
2538
2539         * ecore.cs (Expression.loc): Moved the location here instead of
2540         duplicating it in all derived classes.
2541         (Expression.Location): New public property.
2542         (Expression.Error, Expression.Warning): Made them non-static and
2543         removed the location argument.
2544         (Expression.Warning): Added overloaded version which takes an
2545         `int level' argument.
2546         (Expression.Error118): Make this non-static and removed the
2547         expression and location arguments.
2548         (TypeExpr): Added location argument to the constructor.
2549
2550         * expression.cs (StaticCallExpr): Added location argument to
2551         the constructor.
2552         (Indirection, PointerArithmetic): Likewise.
2553         (CheckedExpr, UnCheckedExpr): Likewise.
2554         (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
2555         (StringPtr): Likewise.
2556
2557
2558 2002-08-05  Martin Baulig  <martin@gnome.org>
2559
2560         * expression.cs (BaseAccess.DoResolve): Actually report errors.
2561
2562         * assign.cs (Assign.DoResolve): Check whether the source
2563         expression is a value or variable.
2564
2565         * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
2566         while resolving the corresponding blocks.
2567
2568         * interface.cs (Interface.GetInterfaceTypeByName): Actually report
2569         an error, don't silently return null.
2570
2571         * statement.cs (Block.AddVariable): Do the error reporting here
2572         and distinguish between CS0128 and CS0136.
2573         (Block.DoResolve): Report all unused labels (warning CS0164).
2574         (LabeledStatement): Pass the location to the constructor.
2575         (LabeledStatement.HasBeenReferenced): New property.
2576         (LabeledStatement.Resolve): Set it to true here.
2577
2578         * statement.cs (Return.Emit): Return success even after reporting
2579         a type mismatch error (CS0126 or CS0127), this is what csc does and
2580         it avoids confusing the users with any consecutive errors.
2581
2582 2002-08-05  Martin Baulig  <martin@gnome.org>
2583
2584         * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
2585
2586         * const.cs (Const.LookupConstantValue): Catch circular definitions.
2587
2588         * expression.cs (MemberAccess.DoResolve): Silently return if an
2589         error has already been reported.
2590
2591         * ecore.cs (Expression.MemberLookupFinal): Silently return if an
2592         error has already been reported.
2593
2594 2002-08-05  Martin Baulig  <martin@gnome.org>
2595
2596         * statement.cs (UsageVector): Only initialize the `parameters'
2597         vector if we actually have any "out" parameters.
2598
2599 2002-08-05  Martin Baulig  <martin@gnome.org>
2600
2601         * expression.cs (Binary.ResolveOperator): When combining delegates,
2602         they must have the same type.
2603
2604 2002-08-05  Martin Baulig  <martin@gnome.org>
2605
2606         * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
2607         PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
2608         work with the ms runtime and we also don't need it: if we're a
2609         PropertyBuilder and not in the `indexer_arguments' hash, then we
2610         are a property and not an indexer.
2611
2612         * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
2613         Type.IsPointer and Type.IsByRef instead of Type.HasElementType
2614         since the latter one doesn't work with the ms runtime.
2615
2616 2002-08-03  Martin Baulig  <martin@gnome.org>
2617
2618         Fixed bugs #27998 and #22735.
2619
2620         * class.cs (Method.IsOperator): New public field.
2621         (Method.CheckBase): Report CS0111 if there's already a method
2622         with the same parameters in the current class.  Report CS0508 when
2623         attempting to change the return type of an inherited method.
2624         (MethodData.Emit): Report CS0179 if a method doesn't have a body
2625         and it's not marked abstract or extern.
2626         (PropertyBase): New abstract base class for Property and Indexer.
2627         (PropertyBase.CheckBase): Moved here from Property and made it work
2628         for indexers.
2629         (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
2630         the same so we can reuse it there.
2631         (Property, Indexer): Derive from PropertyBase.
2632         (MethodSignature.inheritable_property_signature_filter): New delegate
2633         to find properties and indexers.
2634
2635         * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
2636         argument and improved error reporting.
2637
2638         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
2639         EmptyReadOnlyParameters and made it a property.
2640
2641         * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
2642         version of this method which takes a `PropertyInfo indexer'.
2643         (TypeManager.RegisterIndexer): New method.
2644
2645         * class.cs: Added myself as author of this file :-)
2646
2647 2002-08-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2648
2649         * class.cs: fixed compilation on windoze.
2650
2651 2002-08-03  Martin Baulig  <martin@gnome.org>
2652
2653         * interface.cs (Interface.GetInterfaceBases): Check whether all
2654         base interfaces are at least as accessible than the current one.
2655
2656         * class.cs (TypeContainer.GetClassBases): Check whether base types
2657         are at least as accessible than the current type.
2658         (TypeContainer.AsAccessible): Implemented and made non-static.
2659         (MemberBase.CheckParameters): Report errors if the accessibility
2660         checks fail.
2661
2662         * delegate.cs (Delegate.Delegate): The default visibility is
2663         internal for top-level types and private for nested types.
2664         (Delegate.Define): Report errors if the accessibility checks fail.
2665
2666         * enum.cs (Enum.Enum): The default visibility is internal for
2667         top-level types and private for nested types.
2668         (Enum.DefineType): Compute the correct visibility.
2669
2670         * modifiers.cs (Modifiers.TypeAttr): Added a version of this
2671         function which takes a `bool is_toplevel' instead of a TypeContainer.
2672
2673         * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
2674         builtin type.
2675
2676 2002-08-02  Martin Baulig  <martin@gnome.org>
2677
2678         * expression.cs (LocalVariableReferenc): Added constructor which
2679         takes additional `VariableInfo vi' and `bool is_readonly' arguments.
2680         (LocalVariableReference.IsReadOnly): New property.
2681         (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
2682         variable is readonly, use our own readonly flag to do this; you can
2683         use the new constructor to get a writable reference to a read-only
2684         variable.
2685
2686         * cs-parser.jay (foreach_statement, using_statement): Get a writable
2687         reference to the local variable.
2688
2689 2002-08-01  Miguel de Icaza  <miguel@ximian.com>
2690
2691         * rootcontext.cs (ResolveCore): Also include System.Exception
2692
2693         * statement.cs (Block.Emit): Do not emit the dead-code warnings if
2694         we reach an EmptyStatement.
2695
2696         (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
2697         is also fine.
2698
2699         * expression.cs (Binary.ResolveOperator): Check error result in
2700         two places.
2701
2702         use brtrue/brfalse directly and avoid compares to null.
2703
2704 2002-08-02  Martin Baulig  <martin@gnome.org>
2705
2706         * class.cs (TypeContainer.Define): Define all nested interfaces here.
2707         Fixes bug #28407, added test-155.cs.
2708
2709 2002-08-01  Martin Baulig  <martin@gnome.org>
2710
2711         * class.cs (Event.EmitDefaultMethod): Make this work with static
2712         events.  Fixes #28311, added verify-3.cs.
2713
2714 2002-08-01  Martin Baulig  <martin@gnome.org>
2715
2716         * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
2717         `is_disposable' fields.
2718         (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
2719         `hm.is_disposable' if we're using the collection pattern.
2720         (Foreach.EmitCollectionForeach): Use the correct type for the
2721         enumerator's local variable, only emit the try/finally block if
2722         necessary (fixes #27713).
2723
2724 2002-08-01  Martin Baulig  <martin@gnome.org>
2725
2726         * ecore.cs (Expression.report118): Renamed to Error118 and made
2727         it public static.
2728
2729         * statement.cs (Throw.Resolve): Check whether the expression is of
2730         the correct type (CS0118) and whether the type derives from
2731         System.Exception (CS0155).
2732         (Catch.Resolve): New method.  Do the type lookup here and check
2733         whether it derives from System.Exception (CS0155).
2734         (Catch.CatchType, Catch.IsGeneral): New public properties.
2735
2736         * typemanager.cs (TypeManager.exception_type): Added.
2737
2738 2002-07-31  Miguel de Icaza  <miguel@ximian.com>
2739
2740         * driver.cs: Updated About function.
2741
2742 2002-07-31  Martin Baulig  <martin@gnome.org>
2743
2744         Implemented Control Flow Analysis.
2745
2746         * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
2747         (EmitContext.CurrentBranching): Added.
2748         (EmitContext.StartFlowBranching): Added.
2749         (EmitContext.EndFlowBranching): Added.
2750         (EmitContext.KillFlowBranching): Added.
2751         (EmitContext.IsVariableAssigned): Added.
2752         (EmitContext.SetVariableAssigned): Added.
2753         (EmitContext.IsParameterAssigned): Added.
2754         (EmitContext.SetParameterAssigned): Added.
2755         (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
2756         Added control flow analysis stuff here.
2757
2758         * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
2759         resolve the expression as lvalue.
2760         (LocalVariableReference.DoResolve): Check whether the variable has
2761         already been assigned.
2762         (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
2763         the parameter as assigned here.
2764         (ParameterReference.DoResolve): Check whether the parameter has already
2765         been assigned.
2766         (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
2767         expression as lvalue.
2768
2769         * statement.cs (FlowBranching): New class for the flow analysis code.
2770         (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
2771         (LabeledStatement.IsDefined): New public property.
2772         (LabeledStatement.AddUsageVector): New public method to tell flow
2773         analyis that the label may be reached via a forward jump.
2774         (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
2775         flow analysis.
2776         (VariableInfo.Number): New public field.  This is used by flow analysis
2777         to number all locals of a block.
2778         (Block.CountVariables): New public property.  This is the number of
2779         local variables in this block (including the locals from all parent
2780         blocks).
2781         (Block.EmitMeta): Number all the variables.
2782
2783         * statement.cs: Added flow analysis support to all classes.
2784
2785 2002-07-31  Martin Baulig  <martin@gnome.org>
2786
2787         * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
2788         To get debugging messages, compile mcs with /define:MCS_DEBUG and
2789         then use this argument.
2790
2791         * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
2792
2793         * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
2794         use this to specify /define options.
2795
2796 2002-07-29  Martin Baulig  <martin@gnome.org>
2797
2798         * statement.cs (Fixed): Moved all code that does variable lookups
2799         and resolvings from Emit to Resolve.
2800
2801         * statement.cs (For): Moved all code that does variable lookups
2802         and resolvings from Emit to Resolve.
2803
2804         * statement.cs (Using): Moved all code that does variable lookups
2805         and resolvings from Emit to Resolve.
2806
2807 2002-07-29  Martin Baulig  <martin@gnome.org>
2808
2809         * attribute.cs (Attribute.Resolve): Explicitly catch a
2810         System.NullReferenceException when creating the
2811         CustromAttributeBuilder and report a different warning message.
2812
2813 2002-07-29  Martin Baulig  <martin@gnome.org>
2814
2815         * support.cs (ParameterData.ParameterName): Added method to
2816         get the name of a parameter.
2817
2818         * typemanager.cs (TypeManager.IsValueType): New public method.
2819
2820 2002-07-29  Martin Baulig  <martin@gnome.org>
2821
2822         * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'.  This
2823         is a flag which specifies that it's either ref or out.
2824         (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
2825         the out parameter to `out Parameter.Modifier mod', also set the
2826         Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
2827
2828         * support.cs (InternalParameters.ParameterModifier): Distinguish
2829         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
2830         Parameter.Modifier.ISBYREF flag if it's either ref or out.
2831
2832         * expression.cs (Argument.GetParameterModifier): Distinguish
2833         between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
2834         Parameter.Modifier.ISBYREF flag if it's either ref or out.
2835
2836 2002-07-29  Martin Baulig  <martin@gnome.org>
2837
2838         * expression.cs (ParameterReference.ParameterReference): Added
2839         `Location loc' argument to the constructor.
2840
2841         * cs-parser.jay: Pass location to ParameterReference.
2842
2843 2002-07-28  Miguel de Icaza  <miguel@ximian.com>
2844
2845         * statement.cs (Try): Initialize the location.
2846
2847         * cs-parser.jay: pass location to Try.
2848
2849         * expression.cs (Unary.Reduce): Change the prototype to return
2850         whether a constant fold could be performed or not.  The result is
2851         returned in an out parameters.  In the case of Indirection and
2852         AddressOf, we want to perform the full tests.
2853
2854 2002-07-26  Miguel de Icaza  <miguel@ximian.com>
2855
2856         * statement.cs (Statement.Emit): Flag dead code.
2857
2858 2002-07-27  Andrew Birkett  <andy@nobugs.org>
2859
2860         * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
2861
2862 2002-07-27  Martin Baulig  <martin@gnome.org>
2863
2864         * class.cs (MethodData.Define): Put back call to
2865         TypeManager.AddMethod(), accidentally commented this out.
2866
2867         * report.cs (Debug): New public method to print debugging information,
2868         this is `[Conditional ("DEBUG")]'.
2869
2870 2002-07-26  Martin Baulig  <martin@gnome.org>
2871
2872         * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
2873         (switch_statement): Push the current_block to the switch_stack and
2874         pop it again when we're done with the switch.
2875         (switch_section): The new block is a child of the current_block.
2876         Fixes bug #24007, added test-152.cs.
2877
2878 2002-07-27  Martin Baulig  <martin@gnome.org>
2879
2880         * expression.cs (Invocation.EmitArguments): When calling a varargs
2881         function with only its fixed arguments, we need to pass an empty
2882         array.
2883
2884 2002-07-27  Martin Baulig  <martin@gnome.org>
2885
2886         Mono 0.13 has been released.
2887
2888 2002-07-25  Miguel de Icaza  <miguel@ximian.com>
2889
2890         * driver.cs: Rename --resource to --linkres, because that is what
2891         we do currently, we dont support --resource yet.
2892
2893         * cs-tokenizer.cs: Fix test for reporting endif mismatches.
2894
2895 2002-07-25  Martin Baulig  <martin@gnome.org>
2896
2897         * class.cs (MethodData): New public class.  This is a `method builder'
2898         class for a method or one accessor of a Property/Indexer/Event.
2899         (MethodData.GetMethodFlags): Moved here from MemberBase.
2900         (MethodData.ApplyAttributes): Likewise.
2901         (MethodData.ApplyObsoleteAttribute): Likewise.
2902         (MethodData.ApplyConditionalAttribute): Likewise.
2903         (MethodData.ApplyDllImportAttribute): Likewise.
2904         (MethodData.CheckAbstractAndExternal): Likewise.
2905         (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
2906         (MethodData.Emit): Formerly known as Method.Emit().
2907         (MemberBase): Moved everything which was specific to a single
2908         accessor/method to MethodData.
2909         (Method): Create a new MethodData and call Define() and Emit() on it.
2910         (Property, Indexer, Event): Create a new MethodData objects for each
2911         accessor and call Define() and Emit() on them.
2912
2913 2002-07-25  Martin Baulig  <martin@gnome.org>
2914
2915         Made MethodCore derive from MemberBase to reuse the code from there.
2916         MemberBase now also checks for attributes.
2917
2918         * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
2919         (MemberBase.GetMethodFlags): Moved here from class Method and marked
2920         as virtual.
2921         (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
2922         `CallingConventions cc' and `Attributes opt_attrs' arguments.
2923         (MemberBase.ApplyAttributes): New virtual method; applies the
2924         attributes to a method or accessor.
2925         (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
2926         (MemberBase.ApplyConditionalAttribute): Likewise.
2927         (MemberBase.ApplyDllImportAttribute): Likewise.
2928         (MemberBase.CheckAbstractAndExternal): Likewise.
2929         (MethodCore.ParameterTypes): This is now a property instead of a
2930         method, it's initialized from DoDefineParameters().
2931         (MethodCore.ParameterInfo): Removed the set accessor.
2932         (MethodCore.DoDefineParameters): New protected virtual method to
2933         initialize ParameterTypes and ParameterInfo.
2934         (Method.GetReturnType): We can now simply return the MemberType.
2935         (Method.GetMethodFlags): Override the MemberBase version and add
2936         the conditional flags.
2937         (Method.CheckBase): Moved some code from Define() here, call
2938         DoDefineParameters() here.
2939         (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
2940         here to avoid some larger code duplication.
2941         (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
2942         ensure that abstract and external accessors don't declare a body.
2943
2944         * attribute.cs (Attribute.GetValidPieces): Make this actually work:
2945         `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
2946         lookup in the attribute's parent classes, so we need to abort as soon
2947         as we found the first match.
2948         (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
2949         the attribute has no arguments.
2950
2951         * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
2952         of a Method.
2953
2954 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2955
2956         * cs-parser.jay: reverted previous patch.
2957
2958 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2959
2960         * cs-parser.jay: fixed bug #22119.
2961
2962 2002-07-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2963
2964         * attribute.cs: fixed compilation. The error was:
2965         "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must 
2966         be assigned to before control leaves the current method."
2967         [FIXME:  Filed as bug #28186: MCS must report this error.]
2968
2969 2002-07-25  Martin Baulig  <martin@gnome.org>
2970
2971         * attribute.cs (Attribute.Conditional_GetConditionName): New static
2972         method to pull the condition name ouf of a Conditional attribute.
2973         (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
2974         the obsolete message and error flag out of an Obsolete attribute.
2975
2976         * class.cs (Method.GetMethodFlags): New public method to get the
2977         TypeManager.MethodFlags for this method.
2978         (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
2979         private methods.
2980         (Method.Define): Get and apply the Obsolete and Conditional attributes;
2981         if we're overriding a virtual function, set the new private variable
2982         `parent_method'; call the new TypeManager.AddMethod().
2983
2984         * typemanager.cs (TypeManager.AddMethod): New static method.  Stores
2985         the MethodBuilder and the Method in a PtrHashtable.
2986         (TypeManager.builder_to_method): Added for this purpose.
2987         (TypeManager.MethodFlags): Added IsObsoleteError.
2988         (TypeManager.GetMethodFlags): Added `Location loc' argument.  Lookup
2989         Obsolete and Conditional arguments in MethodBuilders.  If we discover
2990         an Obsolete attribute, emit an appropriate warning 618 / error 619 with
2991         the message from the attribute.
2992
2993 2002-07-24  Martin Baulig  <martin@gnome.org>
2994
2995         * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
2996         preprocessor directives, ensure that the argument to #define/#undef is
2997         exactly one identifier and that it's actually an identifier.
2998
2999         Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
3000         did not work ....
3001
3002 2002-07-24  Martin Baulig  <martin@gnome.org>
3003
3004         * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
3005         initialize it to TypeManager.object_type in the constructor.
3006         (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
3007         of the `hm.get_current' method if we're using the collection pattern.
3008         (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
3009         for the explicit conversion to make it work when we're using the collection
3010         pattern and the `Current' property has a different return type than `object'.
3011         Fixes #27713.
3012
3013 2002-07-24  Martin Baulig  <martin@gnome.org>
3014
3015         * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
3016         does not match, but don't report any errors.  This method is called in
3017         order for all methods in a MethodGroupExpr until a matching method is
3018         found, so we don't want to bail out if the first method doesn't match.
3019         (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
3020         matches, report the 123.  Fixes #28070.
3021
3022 2002-07-24  Martin Baulig  <martin@gnome.org>
3023
3024         * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
3025         TypeManager.TypeToCoreType() to the top of the method so the
3026         following equality checks will work.  Fixes #28107.
3027
3028 2002-07-24  Martin Baulig  <martin@gnome.org>
3029
3030         * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
3031         operand is of type uint, and the other operand is of type sbyte,
3032         short or int, the operands are converted to type long." -
3033         Actually do what this comment already told us.  Fixes bug #28106,
3034         added test-150.cs.
3035
3036 2002-07-24  Martin Baulig  <martin@gnome.org>
3037
3038         * class.cs (MethodBase): New abstract class.  This is now a base
3039         class for Property, Indexer and Event to avoid some code duplication
3040         in their Define() and DefineMethods() methods.
3041         (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
3042         generic methods for Define() and DefineMethods().
3043         (FieldBase): Derive from MemberBase, not MemberCore.
3044         (Property): Derive from MemberBase, not MemberCore.
3045         (Property.DefineMethod): Moved all the code from this method to the
3046         new MethodBase.DefineAccessor(), just call it with appropriate
3047         argumetnts.
3048         (Property.Define): Call the new Property.DoDefine(), this does some
3049         sanity checks and we don't need to duplicate the code everywhere.
3050         (Event): Derive from MemberBase, not MemberCore.
3051         (Event.Define): Use the new MethodBase.DefineAccessor() to define the
3052         accessors, this will also make them work with interface events.
3053         (Indexer): Derive from MemberBase, not MemberCore.
3054         (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
3055         (Indexer.Define): Use the new MethodBase functions.
3056
3057         * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
3058         argument to the constructor.
3059         (Interface.FindMembers): Added support for interface events.
3060         (Interface.PopluateEvent): Implemented.
3061
3062         Added test-149.cs for this.  This also fixes bugs #26067 and #24256.
3063
3064 2002-07-22  Miguel de Icaza  <miguel@ximian.com>
3065
3066         * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
3067         but this is required to check for a method name being the same as
3068         the containing class.  
3069
3070         Handle this now.
3071
3072 2002-07-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3073
3074         * interface.cs: initialize variable.
3075
3076 2002-07-23  Martin Baulig  <martin@gnome.org>
3077
3078         Implemented the IndexerName attribute in interfaces.
3079
3080         * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
3081         name if this is an explicit interface implementation.
3082         (Indexer.InterfaceIndexerName): New public variable.  If we're
3083         implementing an interface indexer, this is the IndexerName in that
3084         interface.  Otherwise, it's the IndexerName.
3085         (Indexer.DefineMethod): If we're implementing interface indexer,
3086         set InterfaceIndexerName.  Use the new Pending.IsInterfaceIndexer
3087         and Pending.ImplementIndexer methods.
3088         (Indexer.Define): Also define the PropertyBuilder if we're
3089         implementing an interface indexer and this is neither an explicit
3090         interface implementation nor do the IndexerName match the one in
3091         the interface.
3092
3093         * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
3094         If a method is defined here, then we always need to create a proxy
3095         for it.  This is used when implementing interface indexers.
3096         (Pending.IsInterfaceIndexer): New public method.
3097         (Pending.ImplementIndexer): New public method.
3098         (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
3099         This is used when implementing interface indexers to define a proxy
3100         if necessary.
3101         (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
3102         define a proxy if necessary.
3103
3104         * interface.cs (Interface.IndexerName): New public variable.
3105         (Interface.PopulateIndexer): Set the IndexerName.
3106         (Interface.DefineIndexers): New private method.  Populate all the
3107         indexers and make sure their IndexerNames match.
3108
3109         * typemanager.cs (IndexerPropertyName): Added support for interface
3110         indexers.
3111
3112 2002-07-22  Martin Baulig  <martin@gnome.org>
3113
3114         * codegen.cs (EmitContext.HasReturnLabel): New public variable.
3115         (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
3116         ret if HasReturnLabel.
3117         (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
3118         variables.
3119
3120         * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
3121         and set the ec.LoopBeginTryCatchLevel.
3122         (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
3123         (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
3124         the current ec.TryCatchLevel, the branch goes out of an exception
3125         block.  In this case, we need to use Leave and not Br.
3126
3127 2002-07-22  Martin Baulig  <martin@gnome.org>
3128
3129         * statement.cs (Try.Emit): Emit an explicit ret after the end of the
3130         block unless the block does not always return or it is contained in
3131         another try { ... } catch { ... } block.  Fixes bug #26506.
3132         Added verify-1.cs to the test suite.
3133
3134 2002-07-22  Martin Baulig  <martin@gnome.org>
3135
3136         * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
3137         then we do not always return.  Fixes bug #24985.
3138
3139 2002-07-22  Martin Baulig  <martin@gnome.org>
3140
3141         * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
3142         lookup on a per-class level; ie. walk up the class hierarchy until we
3143         found at least one applicable method, then choose the best among them.
3144         Fixes bug #24463 and test-29.cs.
3145
3146 2002-07-22  Martin Baulig  <martin@gnome.org>
3147
3148         * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
3149         return types of the methods.  The return type is not part of the
3150         signature and we must not check it to make the `new' modifier work.
3151         Fixes bug #27999, also added test-147.cs.
3152         (TypeManager.TypeToCoreType): Added TypeManager.type_type.
3153
3154         * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
3155         on the method's return type.
3156
3157 2002-07-21  Martin Baulig  <martin@gnome.org>
3158
3159         * assign.cs: Make this work if the rightmost source is a constant and
3160         we need to do an implicit type conversion.  Also adding a few more tests
3161         to test-38.cs which should have caught this.
3162
3163         * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
3164         target in the makefile for this.  The makefile.gnu is primarily intended
3165         for end-users who don't want to debug the compiler.
3166
3167 2002-07-21  Martin Baulig  <martin@gnome.org>
3168
3169         * assign.cs: Improved the Assign class so it can now handle embedded
3170         assignments (X = Y = Z = something).  As a side-effect this'll now also
3171         consume less local variables.  test-38.cs now passes with MCS, added
3172         a few new test cases to that test.
3173
3174 2002-07-20  Martin Baulig  <martin@gnome.org>
3175
3176         * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
3177         instructions.  Fixes bug #27977, also added test-146.cs.
3178
3179 2002-07-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3180
3181         * cs-tokenizer.cs: fixed getHex ().
3182
3183 2002-07-19  Martin Baulig  <martin@gnome.org>
3184
3185         * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
3186         not Type.GetType() to lookup the array type.  This is needed when
3187         we're constructing an array of a user-defined type.
3188         (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
3189         single-dimensional arrays, but also for single-dimensial arrays of
3190         type decimal.
3191
3192 2002-07-19  Martin Baulig  <martin@gnome.org>
3193
3194         * expression.cs (New.DoEmit): Create a new LocalTemporary each time
3195         this function is called, it's not allowed to share LocalBuilders
3196         among ILGenerators.
3197
3198 2002-07-19  Martin Baulig  <martin@gnome.org>
3199
3200         * expression.cs (Argument.Resolve): Report an error 118 when trying
3201         to pass a type as argument.
3202
3203 2002-07-18  Martin Baulig  <martin@gnome.org>
3204
3205         * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
3206         Conv_R_Un for the signed `long' type.
3207
3208 2002-07-15  Miguel de Icaza  <miguel@ximian.com>
3209
3210         * expression.cs (MemberAccess.DoResolve): Do not reuse the field
3211         `expr' for the temporary result, as that will fail if we do
3212         multiple resolves on the same expression.
3213
3214 2002-07-05  Miguel de Icaza  <miguel@ximian.com>
3215
3216         * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
3217         ec.TypeContainer for looking up aliases. 
3218
3219         * class.cs (TypeContainer): Remove LookupAlias from here.
3220
3221         * decl.cs (DeclSpace); Move here.
3222
3223 2002-07-01  Miguel de Icaza  <miguel@ximian.com>
3224
3225         * class.cs (FindMembers): Only call filter if the constructor
3226         bulider is not null.
3227
3228         Also handle delegates in `NestedTypes' now.  Now we will perform
3229         type lookups using the standard resolution process.  This also
3230         fixes a bug.
3231
3232         * decl.cs (DeclSpace.ResolveType): New type resolution routine.
3233         This uses Expressions (the limited kind that can be parsed by the
3234         tree) instead of strings.
3235
3236         * expression.cs (ComposedCast.ToString): Implement, used to flag
3237         errors since now we have to render expressions.
3238
3239         (ArrayCreation): Kill FormElementType.  Use ComposedCasts in
3240         FormArrayType. 
3241
3242         * ecore.cs (SimpleName.ToString): ditto.
3243
3244         * cs-parser.jay: Instead of using strings to assemble types, use
3245         Expressions to assemble the type (using SimpleName, ComposedCast,
3246         MemberAccess).  This should fix the type lookups in declarations,
3247         because we were using a different code path for this.
3248
3249         * statement.cs (Block.Resolve): Continue processing statements
3250         even when there is an error.
3251
3252 2002-07-17  Miguel de Icaza  <miguel@ximian.com>
3253
3254         * class.cs (Event.Define): Also remove the `remove' method from
3255         the list of pending items.
3256
3257         * expression.cs (ParameterReference): Use ldarg.N (0..3) to
3258         generate more compact code. 
3259
3260 2002-07-17  Martin Baulig  <martin@gnome.org>
3261
3262         * const.cs (Const.LookupConstantValue): Add support for constant
3263         `unchecked' and `checked' expressions.
3264         Also adding test case test-140.cs for this.
3265
3266 2002-07-17  Martin Baulig  <martin@gnome.org>
3267
3268         * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
3269         check whether mi.ReturnType implements the IEnumerator interface; the
3270         `==' and the IsAssignableFrom() will fail in this situation.
3271
3272 2002-07-16  Ravi Pratap  <ravi@ximian.com>
3273
3274         * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix 
3275         here too.
3276
3277 2002-07-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3278
3279         * expression.cs: fixed bug #27811.
3280
3281 2002-07-14  Miguel de Icaza  <miguel@ximian.com>
3282
3283         * expression.cs (ParameterReference.AddressOf): Patch from Paolo
3284         Molaro: when we are a ref, the value already contains a pointer
3285         value, do not take the address of it.
3286
3287 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
3288         * removed mb-parser.jay and mb-tokenizer.cs
3289
3290 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
3291
3292         * expression.cs: check against the building corlib void type.
3293
3294 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
3295
3296         * ecore.cs: fix for valuetype static readonly fields: when 
3297         initializing them, we need their address, not the address of a copy.
3298
3299 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
3300
3301         * typemanager.cs: register also enum_type in corlib.
3302
3303 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
3304
3305         * class.cs: allow calling this (but not base) initializers in structs.
3306
3307 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
3308
3309         * ecore.cs: make sure we compare against the building base types
3310         in GetTypeSize ().
3311
3312 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
3313
3314         * typemanager.cs: fix TypeToCoreType() to handle void and object
3315         (corlib gets no more typerefs after this change).
3316
3317 2002-07-12  Miguel de Icaza  <miguel@ximian.com>
3318
3319         * expression.cs (ArrayCreation.EmitArrayArguments): use
3320         Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
3321
3322         (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
3323         Conv_Ovf_I_Un for the array arguments.  Even if C# allows longs as
3324         array indexes, the runtime actually forbids them.
3325
3326         * ecore.cs (ExpressionToArrayArgument): Move the conversion code
3327         for array arguments here.
3328
3329         * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
3330         instead of the default for ValueTypes.
3331
3332         (New.DoEmit): Use IsValueType instead of
3333         IsSubclassOf (value_type)
3334         (New.DoResolve): ditto.
3335         (Invocation.EmitCall): ditto.
3336
3337         * assign.cs (Assign): ditto.
3338
3339         * statement.cs (Unsafe): Ok, so I got the semantics wrong.
3340         Statements *are* currently doing part of their resolution during
3341         Emit.  
3342
3343         Expressions do always resolve during resolve, but statements are
3344         only required to propagate resolution to their children.
3345
3346 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
3347
3348         * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
3349
3350         (LoadAssembly): Do not add the dll if it is already specified
3351         
3352         (MainDriver): Add the System directory to the link path at the end,
3353         after all the other -L arguments. 
3354
3355         * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
3356         wrong opcode for loading bytes and bools (ldelem.i1 instead of
3357         ldelem.u1) and using the opposite for sbytes.
3358
3359         This fixes Digger, and we can finally run it.
3360
3361         * driver.cs (UnixParseOption): Move the option parsing here.  
3362         (CSCParseOption): Implement CSC-like parsing of options.
3363
3364         We now support both modes of operation, the old Unix way, and the
3365         new CSC-like way.  This should help those who wanted to make cross
3366         platform makefiles.
3367
3368         The only thing broken is that /r:, /reference: and /lib: are not
3369         implemented, because I want to make those have the same semantics
3370         as the CSC compiler has, and kill once and for all the confussion
3371         around this.   Will be doing this tomorrow.
3372
3373         * statement.cs (Unsafe.Resolve): The state is checked during
3374         resolve, not emit, so we have to set the flags for IsUnsfe here.
3375
3376 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
3377
3378         * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
3379         not catch the Error_ObjectRefRequired in SimpleName (as it is
3380         possible to have a class/instance variable name that later gets
3381         deambiguated), we have to check this here.      
3382
3383 2002-07-10  Ravi Pratap  <ravi@ximian.com>
3384
3385         * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
3386         make static and put into Expression.
3387
3388         (Event.Define): Register the private field of the event with the 
3389         TypeManager so that GetFieldFromEvent can get at it.
3390
3391         (TypeManager.RegisterPrivateFieldOfEvent): Implement to
3392         keep track of the private field associated with an event which
3393         has no accessors.
3394
3395         (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
3396         private field.
3397
3398         * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
3399         
3400 2002-07-10  Miguel de Icaza  <miguel@ximian.com>
3401
3402         * expression.cs (Binary.EmitBranchable): this routine emits the
3403         Binary expression in a branchable context.  This basically means:
3404         we need to branch somewhere, not just get the value on the stack.
3405
3406         This works together with Statement.EmitBoolExpression.
3407
3408         * statement.cs (Statement.EmitBoolExpression): Use
3409         EmitBranchable. 
3410
3411 2002-07-09  Miguel de Icaza  <miguel@ximian.com>
3412
3413         * statement.cs (For): Reduce the number of jumps in loops.
3414
3415         (For): Implement loop inversion for the For statement.
3416
3417         (Break): We can be breaking out of a Try/Catch controlled section
3418         (foreach might have an implicit try/catch clause), so we need to
3419         use Leave instead of Br.
3420
3421         * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
3422         now).  If the instace expression supports IMemoryLocation, we use
3423         the AddressOf method from the IMemoryLocation to extract the
3424         address instead of emitting the instance.
3425
3426         This showed up with `This', as we were emitting the instance
3427         always (Emit) instead of the Address of This.  Particularly
3428         interesting when This is a value type, as we dont want the Emit
3429         effect (which was to load the object).
3430         
3431 2002-07-08  Miguel de Icaza  <miguel@ximian.com>
3432
3433         * attribute.cs: Pass the entry point to the DefinePInvokeMethod
3434
3435         * statement.cs (Checked): Set the CheckedState during the resolve
3436         process too, as the ConvCast operations track the checked state on
3437         the resolve process, and not emit.
3438
3439         * cs-parser.jay (namespace_member_declaration): Flag that we have
3440         found a declaration when we do.  This is used to flag error 1529
3441
3442         * driver.cs: Report ok when we display the help only.
3443
3444 2002-07-06  Andrew Birkett  <adb@tardis.ed.ac.uk>
3445
3446         * cs-tokenizer.cs (xtoken): Improve handling of string literals.
3447
3448 2002-07-04  Miguel de Icaza  <miguel@ximian.com>
3449
3450         * cs-tokenizer.cs (define): We also have to track locally the
3451         defines.  AllDefines is just used for the Conditional Attribute,
3452         but we also need the local defines for the current source code. 
3453
3454 2002-07-03  Miguel de Icaza  <miguel@ximian.com>
3455
3456         * statement.cs (While, For, Do): These loops can exit through a
3457         Break statement, use this information to tell whether the
3458         statement is the last piece of code.
3459
3460         (Break): Flag that we break.
3461
3462         * codegen.cs (EmitContexts): New `Breaks' state variable.
3463
3464 2002-07-03  Martin Baulig  <martin@gnome.org>
3465
3466         * class.cs (TypeContainer.MethodModifiersValid): Allow override
3467         modifiers in method declarations in structs.  Otherwise, you won't
3468         be able to override things like Object.Equals().
3469
3470 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
3471
3472         * class.cs (Method, Property, Indexer): Do not allow the public
3473         modifier to be used in explicit interface implementations.
3474
3475         (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
3476         override modifiers in method declarations in structs
3477
3478 2002-07-02   Andrew Birkett <adb@tardis.ed.ac.uk>
3479
3480         * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
3481         integer or real overflow, report an error
3482
3483 2002-07-02  Martin Baulig  <martin@gnome.org>
3484
3485         * typemanager.cs (TypeManager.InitCoreTypes): When compiling
3486         corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
3487         to tell the runtime about our newly created System.Object and
3488         System.ValueType types.
3489
3490 2002-07-02  Miguel de Icaza  <miguel@ximian.com>
3491
3492         * expression.cs (This): Use Stobj/Ldobj when we are a member of a
3493         struct instead of Ldarg/Starg.
3494
3495 2002-07-02  Martin Baulig  <martin@gnome.org>
3496
3497         * expression.cs (Indirection.Indirection): Call
3498         TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
3499
3500 2002-07-02  Martin Baulig  <martin@gnome.org>
3501
3502         * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
3503         ValueType, call TypeManager.TypeToCoreType() on it.
3504         (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
3505         the OpCodes.Newarr argument.
3506
3507 2002-07-02  Martin Baulig  <martin@gnome.org>
3508
3509         * expression.cs (Invocation.EmitCall): When compiling corlib,
3510         replace all calls to the system's System.Array type to calls to
3511         the newly created one.
3512
3513         * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
3514         System.Array methods.
3515         (TypeManager.InitCoreTypes): When compiling corlib, get the methods
3516         from the system's System.Array type which must be replaced.
3517
3518 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
3519
3520         * typemanager.cs: load unverifiable_code_ctor so we can build
3521         corlib using the correct type. Avoid using GetTypeCode() with
3522         TypeBuilders.
3523         * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
3524         TypeManager.object_type to allow building corlib.
3525
3526 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
3527
3528         * ecore.cs: handle System.Enum separately in LoadFromPtr().
3529
3530 2002-07-01  Martin Baulig  <martin@gnome.org>
3531
3532         * class.cs: Make the last change actually work, we need to check
3533         whether `ifaces != null' to avoid a crash.
3534
3535 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
3536
3537         * class.cs: when we build structs without fields that implement
3538         interfaces, we need to add the interfaces separately, since there is
3539         no API to both set the size and add the interfaces at type creation
3540         time.
3541
3542 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
3543
3544         * expression.cs: the dimension arguments to the array constructors
3545         need to be converted if they are a long.
3546
3547 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
3548
3549         * class.cs: don't emit ldarg.0 if there is no parent constructor
3550         (fixes showstopper for corlib).
3551
3552 2002-06-29  Martin Baulig  <martin@gnome.org>
3553
3554         MCS now compiles corlib on GNU/Linux :-)
3555
3556         * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
3557         ie. check for MethodImplOptions.InternalCall.
3558
3559         * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
3560         and TypeManager.attribute_type are null, so we must explicitly check
3561         whether parent is not null to find out whether it's an attribute type.
3562         (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
3563         and SetBuilder, not only if the property is neither abstract nor external.
3564         This is necessary to set the MethodImplOptions on the accessor methods.
3565         (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
3566         SetBuilder, see Property.Emit().
3567
3568         * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
3569         populate "System.Object", "System.ValueType" and "System.Attribute" since
3570         they've already been populated from BootCorlib_PopulateCoreTypes().
3571
3572 2002-06-29  Martin Baulig  <martin@gnome.org>
3573
3574         * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
3575         is the NullLiteral, we also need to make sure that target_type is not
3576         an enum type.   
3577
3578 2002-06-29  Martin Baulig  <martin@gnome.org>
3579
3580         * rootcontext.cs (RootContext.ResolveCore): We must initialize
3581         `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
3582         before calling BootstrapCorlib_ResolveDelegate ().
3583
3584 2002-06-27  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3585
3586         * statement.cs: fixed build-breaker. All tests passed ok.
3587
3588 2002-06-27  Martin Baulig  <martin@gnome.org>
3589
3590         * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
3591         for System.Decimal when compiling corlib.
3592
3593 2002-06-27  Martin Baulig  <martin@gnome.org>
3594
3595         * statement.cs (Switch.TableSwitchEmit): Make this work with empty
3596         switch blocks which contain nothing but a default clause.
3597
3598 2002-06-26  Andrew  <adb@tardis.ed.ac.uk>
3599
3600        * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
3601
3602 2002-06-27  Martin Baulig  <martin@gnome.org>
3603
3604         * ecore.cs (PropertyExpr.PropertyExpr): Call
3605         TypeManager.TypeToCoreType() on the `pi.PropertyType'.
3606
3607         * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
3608         is already a TypeBuilder.
3609
3610 2002-06-27  Martin Baulig  <martin@gnome.org>
3611
3612         * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
3613         `target_type == TypeManager.array_type', not IsAssignableFrom() in
3614         the "from an array-type to System.Array" case.  This makes it work
3615         when compiling corlib.
3616
3617 2002-06-27  Martin Baulig  <martin@gnome.org>
3618
3619         * ecore.cs (Expression.SimpleNameResolve): If the expression is a
3620         non-static PropertyExpr, set its InstanceExpression.  This makes
3621         the `ICollection.Count' property work in System/Array.cs.
3622
3623 2002-06-25  Andrew Birkett  <adb@tardis.ed.ac.uk>
3624
3625         * driver.cs: Made error handling more consistent.  Errors now
3626         tracked by Report class, so many methods which used to return int
3627         now return void.  Main() now prints success/failure and 
3628         errors/warnings message.
3629
3630         Renamed '--probe' compiler argument to '--expect-error'.  Removed
3631         the magic number return values (123 and 124).  Now, if the
3632         expected error occurs, the compiler exits with success (exit value
3633         0).  If the compilation completes without seeing that particular
3634         error, the compiler exits with failure (exit value 1).  The
3635         makefile in mcs/errors has been changed to handle the new behaviour.
3636
3637         * report.cs: Made 'expected error' number a property and renamed
3638         it from 'Probe' to 'ExpectedError'.
3639
3640         * genericparser.cs: Removed error handling support, since it is
3641         now all done by Report class.
3642
3643         * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
3644         class, so parse() no longer returns an int.
3645
3646         * namespace.cs: Use Report.Error instead of GenericParser.error
3647
3648 2002-06-22  Miguel de Icaza  <miguel@ximian.com>
3649
3650         * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
3651         TypeContainer.AddOperator): At the front of the list put the
3652         explicit implementations, so they get resolved/defined first. 
3653
3654 2002-06-21  Miguel de Icaza  <miguel@ximian.com>
3655
3656         * class.cs (TypeContainer.VerifyImplements): Verifies that a given
3657         interface type is implemented by this TypeContainer.  Used during
3658         explicit interface implementation.
3659
3660         (Property.Define, Indexer.Define, Method.Define): Validate that
3661         the given interface in the explicit implementation is one of the
3662         base classes for the containing type.
3663
3664         Also if we are explicitly implementing an interface, but there is
3665         no match in the pending implementation table, report an error.
3666
3667         (Property.Define): Only define the property if we are
3668         not explicitly implementing a property from an interface.  Use the
3669         correct name also for those properties (the same CSC uses,
3670         although that is really not needed).
3671         
3672         (Property.Emit): Do not emit attributes for explicitly implemented
3673         properties, as there is no TypeBuilder.
3674
3675         (Indexer.Emit): ditto.
3676
3677         Hiding then means that we do not really *implement* a pending
3678         implementation, which makes code fail.
3679
3680 2002-06-22  Martin Baulig  <martin@gnome.org>
3681
3682         * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
3683         the return value of Object.GetType().  [FIXME: we need to do this whenever
3684         we get a type back from the reflection library].
3685
3686 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
3687
3688         * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
3689
3690 2002-06-20  Miguel de Icaza  <miguel@ximian.com>
3691
3692         * attribute.cs: Return null if we can not look up the type.
3693
3694         * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
3695         the interface types found.
3696
3697         * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
3698         interface types found.
3699
3700         * typemanager.cs (GetInterfaces): Make this routine returns alll
3701         the interfaces and work around the lame differences between
3702         System.Type and System.Reflection.Emit.TypeBuilder in the results
3703         result for GetInterfaces.
3704         
3705         (ExpandInterfaces): Given an array of interface types, expand and
3706         eliminate repeated ocurrences of an interface.  This expands in
3707         context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
3708         be IA, IB, IC.
3709         
3710 2002-06-21  Martin Baulig  <martin@gnome.org>
3711
3712         * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
3713         on System.Enum.
3714
3715 2002-06-21  Martin Baulig  <martin@gnome.org>
3716
3717         * typemanager.cs (TypeManager.TypeToCoreType): New function.  When compiling corlib
3718         and called with one of the core types, return the corresponding typebuilder for
3719         that type.
3720
3721         * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
3722         element type.
3723
3724 2002-06-21  Martin Baulig  <martin@gnome.org>
3725
3726         * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
3727         `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
3728         (Expression.ConvertReferenceExplicit): Likewise.
3729
3730         * expression.cs (ElementAccess.DoResolve): Likewise.
3731         (ElementAccess.DoResolveLValue): Likewise.
3732
3733 2002-06-10  Martin Baulig  <martin@gnome.org>
3734
3735         * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
3736         add the "value" parameter to the parameter list.
3737
3738         * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
3739         to our caller.
3740
3741 2002-06-19  Miguel de Icaza  <miguel@ximian.com>
3742
3743         * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
3744         the argument to an int, uint, long or ulong, per the spec.  Also
3745         catch negative constants in array creation.
3746
3747 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
3748
3749         * class.cs: do not allow the same interface to appear twice in
3750         the definition list.
3751
3752 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
3753
3754         * ecore.cs: don't use ldlen with System.Array.
3755
3756 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
3757
3758         * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
3759
3760 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
3761
3762         * modifiers.cs: produce correct field attributes for protected
3763         internal. Easy fix so miguel can work on ther harder stuff:-)
3764
3765 2002-06-18  Miguel de Icaza  <miguel@ximian.com>
3766
3767         * pending.cs: New file.  Move the code from class.cs here.
3768         Support clearning the pending flag for all methods (when not doing
3769         explicit interface implementation).
3770
3771 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
3772
3773         * rootcontext.cs: added a couple more types needed to bootstrap.
3774
3775 2002-06-17  Miguel de Icaza  <miguel@ximian.com>
3776
3777         * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
3778         constructor in the type, instead of any constructor in the type
3779         hierarchy.  Thanks to Paolo for finding this bug (it showed up as
3780         a bug in the Mono runtime when applying the params attribute). 
3781
3782 2002-06-16  Rafael Teixeira  <rafaelteixeirabr@hotmail.com>
3783         * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
3784
3785 2002-06-14  Rachel Hestilow  <hestilow@ximian.com>
3786
3787         * expression.cs (Unary.ResolveOperator): Use TypeManager
3788         to resolve the type.
3789         
3790 2002-06-13  Ravi Pratap  <ravi@ximian.com>
3791
3792         * cs-parser.jay (enum_member_declaration): Pass in the attributes
3793         attached.
3794
3795         * enum.cs (AddEnumMember): Add support to store the attributes associated 
3796         with each member too.
3797
3798         * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
3799         field builders too - this takes care of the enum member case.
3800
3801 2002-06-10  Rachel Hestilow  <hestilow@ximian.com>
3802
3803         * typemanager.cs (TypeManager.VerifyUnManaged): Allow
3804         address-of operator on both value types and pointers.
3805         
3806 2002-06-10  Martin Baulig  <martin@gnome.org>
3807
3808         * interface.cs (Interface.PopulateIndexer): Add the indexer's
3809         PropertyBuilder to the `property_builders' list.
3810
3811         * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
3812         (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
3813         `lookup_type' and all its interfaces.  Unfortunately, Type.FindMembers() won't
3814         find any indexers which are inherited from an interface.
3815
3816 2002-06-09  Martin Baulig  <martin@gnome.org>
3817
3818         * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
3819         the same type as the constant if necessary.  There's also a test-130.cs
3820         for this.
3821
3822         * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
3823
3824         * typemanager.cs (TypeManager.ChangeType): Previously known as
3825         Enum.ChangeEnumType().
3826
3827 2002-06-09  Martin Baulig  <martin@gnome.org>
3828
3829         * expression.cs (Cast.TryReduce): Added support for consts.
3830
3831 2002-06-08  Ravi Pratap  <ravi@ximian.com>
3832
3833         * class.cs (Accessor): Hold attributes information so we can pass
3834         it along.
3835
3836         * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
3837         Modify to pass in attributes attached to the methods.
3838
3839         (add_accessor_declaration, remove_accessor_declaration): Ditto.
3840
3841         * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
3842         to handle the Accessor kind :-)
3843
3844         * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
3845         
3846 2002-06-08  Martin Baulig  <martin@gnome.org>
3847
3848         * expression.cs (Unary.TryReduceNegative): Added support for
3849         ULongConstants.
3850
3851 2002-06-08  Martin Baulig  <martin@gnome.org>
3852
3853         * enum.cs (Enum.LookupEnumValue): Don't report an error if the
3854         name can't be found in the `defined_names' - the caller will do a
3855         MemberLookup in this case and thus find methods in System.Enum
3856         such as Enum.IsDefined().
3857
3858 2002-06-08  Martin Baulig  <martin@gnome.org>
3859
3860         * enum.cs (Enum.ChangeEnumType): This is a custom version of
3861         Convert.ChangeType() which works with TypeBuilder created types.
3862         (Enum.LookupEnumValue, Enum.Define): Use it here.
3863
3864         * class.cs (TypeContainer.RegisterRequiredImplementations): Added
3865         `TypeBuilder.BaseType != null' check.
3866         (TypeContainer.FindMembers): Only lookup parent members if we
3867         actually have a parent.
3868         (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
3869         (ConstructorInitializer.Resolve): Likewise.
3870
3871         * interface.cs (Interface.FindMembers): Added
3872         `TypeBuilder.BaseType != null' check.
3873
3874         * rootcontext.cs (RootContext.ResolveCore): Added
3875         "System.Runtime.CompilerServices.IndexerNameAttribute" to
3876         classes_second_stage.
3877
3878         * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
3879         debug_type and trace_type when compiling with --nostdlib.       
3880
3881 2002-06-07  Martin Baulig  <martin@gnome.org>
3882
3883         * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
3884         (AddField): Set it to true when adding a non-static field.
3885         (DefineType): Use `have_nonstatic_fields' to find out whether we
3886         have non-static fields, not `Fields != null'.
3887
3888 2002-06-02  Miguel de Icaza  <miguel@ximian.com>
3889
3890         * ecore.cs (SimpleNameResolve): Removed simple bug (we were
3891         dereferencing a null on the static-field code path)
3892
3893 2002-05-30  Martin Baulig  <martin@gnome.org>
3894
3895         * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
3896         to take command line arguments.  Use reflection to call the new
3897         custom `Initialize' function on the symbol writer and pass it the
3898         command line arguments.
3899
3900         * driver.cs (--debug-args): New command line argument to pass command
3901         line arguments to the symbol writer.
3902
3903 2002-05-28  Miguel de Icaza  <miguel@ximian.com>
3904
3905         * assign.cs (DoResolve): Forgot to do the implicit conversion to
3906         the target type for indexers and properties.  Thanks to Joe for
3907         catching this.
3908
3909 2002-05-27  Miguel de Icaza  <miguel@ximian.com>
3910
3911         * typemanager.cs (MethodFlags): returns the method flags
3912         (Obsolete/ShouldIgnore) that control warning emission and whether
3913         the invocation should be made, or ignored. 
3914
3915         * expression.cs (Invocation.Emit): Remove previous hack, we should
3916         not do this on matching a base type, we should do this based on an attribute
3917
3918         Only emit calls to System.Diagnostics.Debug and
3919         System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
3920         on the command line.
3921
3922         * rootcontext.cs: Global settings for tracing and debugging.
3923
3924         * cs-tokenizer.cs (define): New utility function to track
3925         defines.   Set the global settings for TRACE and DEBUG if found.
3926
3927 2002-05-25  Ravi Pratap  <ravi@ximian.com>
3928
3929         * interface.cs (Populate*): Pass in the TypeContainer as well as
3930         the DeclSpace as parameters so that we can create EmitContexts and
3931         then use that to apply attributes etc.
3932
3933         (PopulateMethod, PopulateEvent, PopulateProperty)
3934         (PopulateIndexer): Apply attributes everywhere.
3935
3936         * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
3937         etc.
3938
3939         (ApplyAttributes): Update accordingly.
3940
3941         We now apply interface attributes for all members too.
3942
3943 2002-05-26  Miguel de Icaza  <miguel@ximian.com>
3944
3945         * class.cs (Indexer.Define); Correctly check if we are explicit
3946         implementation (instead of checking the Name for a ".", we
3947         directly look up if the InterfaceType was specified).
3948
3949         Delay the creation of the PropertyBuilder.
3950
3951         Only create the PropertyBuilder if we are not an explicit
3952         interface implementation.   This means that explicit interface
3953         implementation members do not participate in regular function
3954         lookups, and hence fixes another major ambiguity problem in
3955         overload resolution (that was the visible effect).
3956
3957         (DefineMethod): Return whether we are doing an interface
3958         implementation. 
3959         
3960         * typemanager.cs: Temporary hack until we get attributes in
3961         interfaces (Ravi is working on that) and we get IndexerName
3962         support in interfaces.
3963
3964         * interface.cs: Register the indexers as properties.
3965
3966         * attribute.cs (Attribute.Resolve): Catch the error, and emit a
3967         warning, I have verified that this is a bug in the .NET runtime
3968         (JavaScript suffers of the same problem).
3969
3970         * typemanager.cs (MemberLookup): When looking up members for
3971         interfaces, the parent of an interface is the implicit
3972         System.Object (so we succeed in searches of Object methods in an
3973         interface method invocation.  Example:  IEnumerable x;  x.ToString
3974         ()) 
3975
3976 2002-05-25  Miguel de Icaza  <miguel@ximian.com>
3977
3978         * class.cs (Event): Events should also register if they do
3979         implement the methods that an interface requires.
3980
3981         * typemanager.cs (MemberLookup); use the new GetInterfaces
3982         method. 
3983
3984         (GetInterfaces): The code used to lookup interfaces for a type is
3985         used in more than one place, factor it here. 
3986
3987         * driver.cs: Track the errors at the bottom of the file, we kept
3988         on going.
3989
3990         * delegate.cs (NewDelegate.Emit): We have to emit a null as the
3991         instance if the method we are calling is static!
3992
3993 2002-05-24  Miguel de Icaza  <miguel@ximian.com>
3994
3995         * attribute.cs (ApplyAttributes): Make this function filter out
3996         the IndexerName attribute (as that attribute in reality is never
3997         applied) and return the string constant for the IndexerName
3998         attribute. 
3999
4000         * class.cs (TypeContainer.Emit): Validate that all the indexers
4001         have the same IndexerName attribute, and if so, set the
4002         DefaultName attribute on the class. 
4003
4004         * typemanager.cs: The return value might contain other stuff (not
4005         only methods).  For instance, consider a method with an "Item"
4006         property and an Item method.
4007
4008         * class.cs: If there is a problem with the parameter types,
4009         return. 
4010
4011 2002-05-24  Ravi Pratap  <ravi@ximian.com>
4012
4013         * ecore.cs (ImplicitConversionExists): Wrapper function which also
4014         looks at user defined conversion after making a call to 
4015         StandardConversionExists - we need this for overload resolution.
4016
4017         * expression.cs : Update accordingly the various method calls.
4018
4019         This fixes 2 bugs filed against implicit user defined conversions 
4020
4021 2002-05-22  Miguel de Icaza  <miguel@ximian.com>
4022
4023         * statement.cs: Track the result of the assignment.
4024
4025 2002-05-21  Miguel de Icaza  <miguel@ximian.com>
4026
4027         * expression.cs (MemberAccess): Improved error reporting for
4028         inaccessible members.
4029
4030 2002-05-22  Martin Baulig  <martin@gnome.org>
4031
4032         * makefile (mcs-mono2.exe): New target.  This is mcs compiled with
4033         itself with debugging support.
4034
4035 2002-05-22  Martin Baulig  <martin@gnome.org>
4036
4037         * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
4038         Removed, this isn't needed anymore.
4039
4040 2002-05-20  Martin Baulig  <martin@gnome.org>
4041
4042         * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
4043         be underlying type for an enum.
4044
4045 2002-05-20  Miguel de Icaza  <miguel@ximian.com>
4046
4047         * typemanager.cs (InitEnumUnderlyingTypes): New helper function
4048         that splits out the loading of just the core types.
4049
4050         * rootcontext.cs (ResolveCore): Split the struct resolution in
4051         two, so we can load the enumeration underlying types before any
4052         enums are used.
4053
4054         * expression.cs (Is): Bandaid until we fix properly Switch (see
4055         bug #24985 for details).
4056
4057         * typemanager.cs (ImplementsInterface): The hashtable will contain
4058         a null if there are no interfaces implemented.
4059
4060 2002-05-18  Miguel de Icaza  <miguel@ximian.com>
4061
4062         * cs-parser.jay (indexer_declarator): It is fine to have array
4063         parameters
4064
4065 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
4066
4067         * typemanager.cs: (RegisterBuilder): New function used to register
4068         TypeBuilders that implement interfaces.  Since
4069         TypeBuilder.GetInterfaces (as usual) does not work with lame
4070         Reflection.Emit. 
4071         (AddUserType): register interfaces.
4072
4073         (ImplementsInterface): Use the builder_to_ifaces hash if we are
4074         dealing with TypeBuilder.  Also, arrays are showing up as
4075         SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
4076         methods can not be invoked on them!
4077
4078         * ecore.cs (ExplicitReferenceConversionExists): Made public.
4079         (ImplicitReferenceConversionExists): Split out from
4080         StandardConversionExists. 
4081
4082         * expression.cs (As): We were only implementing one of the three
4083         cases for the as operator.  We now implement them all.
4084         (Is): Implement the various other cases for Is as well.
4085
4086         * typemanager.cs (CACHE): New define used to control if we want or
4087         not the FindMembers cache.  Seems to have a negative impact on
4088         performance currently
4089
4090         (MemberLookup): Nested types have full acess to
4091         enclosing type members
4092
4093         Remove code that coped with instance/static returns for events, we
4094         now catch this in RealFindMembers.
4095
4096         (RealFindMembers): only perform static lookup if the instance
4097         lookup did not return a type or an event.  
4098
4099 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
4100
4101         * assign.cs (CompoundAssign): We pass more semantic information
4102         now to Compound Assignments than we did before: now we have all
4103         the information at hand, and now we resolve the target *before* we
4104         do the expression expansion, which allows the "CacheValue" method
4105         to have the effect we intended (before, a [x] += 1 would generate
4106         two differen ArrayAccess expressions from the ElementAccess,
4107         during the resolution process).
4108
4109         (CompoundAssign.DoResolve): Resolve target and original_source here.
4110
4111 2002-05-16  Miguel de Icaza  <miguel@ximian.com>
4112
4113         * expression.cs (ArrayAccess): dropped debugging information. 
4114
4115         * typemanager.cs: Small bug fix: I was always returning i_members,
4116         instead of one of i_members or s_members (depending on which had
4117         the content).
4118
4119         * assign.cs (IAssignMethod.CacheTemporaries): New method.  This
4120         method is invoked before any code generation takes place, and it
4121         is a mechanism to inform that the expression will be invoked more
4122         than once, and that the method should use temporary values to
4123         avoid having side effects
4124
4125         (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
4126         
4127         * ecore.cs (Expression.CacheTemporaries): Provide empty default
4128         implementation.
4129
4130         * expression.cs (Indirection, ArrayAccess): Add support for
4131         CacheTemporaries in these two bad boys. 
4132
4133         * ecore.cs (LoadFromPtr): figure out on our own if we need to use
4134         ldobj or ldind_ref.  
4135         (StoreFromPtr): Handle stobj as well.
4136
4137         * expression.cs (UnaryMutator): Share more code.
4138         
4139         * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
4140         down: I was not tracking the Filter function as well, which
4141         was affecting the results of the cache.
4142
4143 2002-05-15  Miguel de Icaza  <miguel@ximian.com>
4144
4145         * attribute.cs: Remove the hack to handle the CharSet property on
4146         StructLayouts. 
4147
4148 2002-05-14  Miguel de Icaza  <miguel@ximian.com>
4149
4150         * attribute.cs (DoResolve): More uglyness, we now only try to
4151         resolve the attribute partially, to extract the CharSet
4152         information (only if we are a StructLayout attribute).  Otherwise 
4153
4154         (GetExtraTypeInfo): Add some code to conditionally kill in the
4155         future this.   I am more and more convinced that the .NET
4156         framework has special code to handle the attribute setting on
4157         certain elements.
4158
4159         * expression.cs (IsParamsMethodApplicable): Revert my previous
4160         foreach change here, it was wrong.
4161
4162 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
4163
4164         * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
4165         (pp_expr): do not abort on unknown input, just return.
4166         (eval): abort if there are pending chars.
4167
4168         * attribute.cs (Attribute.Resolve): Positional parameters are
4169         optional.  Deal with that case.
4170
4171         * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
4172         the Ansi/Unicode/Auto information for the type.
4173
4174         (TypeContainer.DefineType): instantiate the EmitContext here, as
4175         we will be using it during the type definition (to resolve
4176         attributes) and during the emit phase.
4177
4178         * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
4179         to pull type information out of the attributes
4180
4181         (Attribute.Resolve): track the constructor builder, and allow for
4182         multiple invocations (structs and classes will use this).
4183
4184         * ecore.cs (MemberLookupFinal): new version with all the
4185         parameters customizable.
4186
4187         * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
4188         constructors.  Return if the result value is null (as the error
4189         would have been flagged already by MemberLookupFinal)
4190
4191         Do not allow instances of abstract classes or interfaces to be
4192         created.
4193         
4194         * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
4195         We have to compare the assembly property here when dealing with
4196         FamANDAssem and Assembly access modifiers, because we might be
4197         creating an assembly from *modules* (that means that we are not
4198         getting TypeBuilders for types defined in other modules that are
4199         part of this assembly).
4200
4201         (Method.Emit): If the method is marked abstract and has a body,
4202         emit an error. 
4203
4204         (TypeContainer.DefineMembers): If both the defined member and the
4205         parent name match are methods, then do not emit any warnings: let
4206         the Method.Define routine take care of flagging warnings.  But if
4207         there is a mismatch (method overrides something else, or method is
4208         overriwritten by something, then emit warning).
4209
4210         (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
4211         set to null, this means `do not check for the return type on the
4212         signature'. 
4213
4214         (Method.Define): set the return type for the method signature to
4215         null, so that we get methods with the same name and parameters and
4216         different return types.  This is used to flag warning 114 (you are
4217         hiding a method, and you probably want to use the new/override
4218         keywords instead).
4219
4220         * typemanager.cs (MemberLookup): Implemented proper access
4221         control, closing a long standing set of bug reports.  The problem
4222         was that the Framework only has two bits: Public and NonPublic,
4223         and NonPublic includes private and protected methods, but we need
4224         to enforce the FamANDAssem, FamOrAssem and Family. 
4225
4226 2002-05-11  Miguel de Icaza  <miguel@ximian.com>
4227
4228         * statement.cs (GotoCase): Return true: Ammounts to giving up
4229         knowledge on whether we return or not, and letting the other case
4230         be responsible for it.
4231
4232 2002-05-10  Miguel de Icaza  <miguel@ximian.com>
4233
4234         * driver.cs: Do not load directories for each file processed, only
4235         do it if there is a pattern.
4236
4237         * ecore.cs: Report readonly assigns here as well, as we might have
4238         been resolved only by MemberAccess.
4239
4240         (SimpleName.SimpleNameResolve): Also be useful for LValue
4241         resolution.   We need this to propagate assign to local readonly variables
4242
4243         * typemanager.cs: Use a ptrhashtable for the criteria, because we
4244         do not want to reuse potential criteria memory.
4245
4246         * class.cs (MyEventBuilder): Set reflected_type;
4247
4248         * ecore.cs (Constantify): Added support for constifying bools.
4249
4250         (RootContext.LookupType): Added a cache for values looked up in
4251         the declaration space.
4252
4253         * typemanager.cs (FindMembers): Now is a front-end to
4254         RealFindMembers, and provides a two-level hashtable-based cache to
4255         the request.  
4256
4257         15% performance improvement: from 22.5 to 19.2 seconds.
4258
4259         * expression.cs (IsParamsMethodApplicable): use foreach.
4260         (Invocation.DoResolve): ditto.
4261         (New.DoResolve): ditto.
4262         (ArrayCreation.DoResolve): ditto.
4263
4264         * ecore.cs (FindMostEncompassingType): use foreach.
4265
4266         * delegate.cs (NewDelegate.DoResolve): Use foreach
4267
4268         * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
4269         (RemoveMethods): use foreach.
4270
4271         * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
4272         nested foreach statements instead of for, and also break out of
4273         the inner loop once a match is found.
4274         
4275         (Invocation.OverloadResolve): Use foreach, simplify the code. 
4276
4277 2002-05-08  Miguel de Icaza  <miguel@ximian.com>
4278
4279         * cfold.cs (BinaryFold): During an enumeration evaluation context,
4280         we actually unwrap the expression to allow for extra information
4281         to be extracted. 
4282
4283         * expression.cs: Use Shr_Un on unsigned operations. 
4284
4285 2002-05-08  Ravi Pratap  <ravi@ximian.com>
4286
4287         * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of 
4288         applicable operators was not being considered correctly. This closes
4289         the bug Miguel reported.
4290
4291 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
4292
4293         * attribute.cs: check that the type derives from System.Attribute
4294         and report the correct error in that case (moved the duplicate code to
4295         its own method, too).
4296
4297 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
4298
4299         * attribute.cs: lookup attribute type name as the spec says: first the
4300         bare attribute name and then name + "Attribute" (nant compiles with
4301         mcs after this fix).
4302
4303 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
4304
4305         * expression.cs (Unary.TryReduceNegative): Ah!  Tricky!  Tricky!
4306         Because of the way we parse things, we should try to see if a
4307         UIntConstant can fit in an integer.
4308
4309 2002-05-07  Ravi Pratap  <ravi@ximian.com>
4310
4311         * ecore.cs (GetConversionOperators): Do not pick up op_True operators
4312         when we are in an explicit context.
4313
4314         (ConvertReferenceExplicit): When converting from Iface type S to Class
4315         T make sure the rules are implemented as an OR.
4316
4317         * parameter.cs (ParameterType): Make it a property for now although the
4318         purpose really isn't anything immediate.
4319         
4320         * expression.cs (Is*Applicable): Do better checking on the parameter type
4321         of a ref/out parameter. The ones from the system assemblies are already 
4322         marked with the correct type so we don't need to do any correction.
4323
4324         * ecore.cs (StandardConversionExists): Conversion from Interface types to 
4325         the object type is standard too so include that.
4326
4327 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
4328
4329         * ecore.cs (StandardConversionExists): Augment with missing code:
4330         deal with IntConstant, LongConstants and Enumerations.
4331
4332         * assign.cs: Report the error, instead of failing silently
4333
4334         * rootcontext.cs (AddGlobalAttributes): Track attributes on the
4335         typecontainer that they are declared, because the
4336         typecontainer/namespace will have the list of using clauses that
4337         need to be applied.
4338
4339         Assembly Attributes were escaping the normal registration
4340         mechanism. 
4341
4342         (EmitCode): Apply attributes within an EmitContext that represents
4343         the container they were declared on.
4344         
4345         * cs-parser.jay: Track bases for structs.  How did I get this wrong?
4346
4347 2002-05-06  Ravi Pratap  <ravi@ximian.com>
4348
4349         * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
4350         Revamp completely - make much cleaner as we now operate only
4351         on a set of Types.
4352
4353         (FindMostSpecificSource, FindMostSpecificTarget): New methods
4354         to implement the logic detailed in the spec more correctly.
4355
4356         (UserDefinedConversion): Update accordingly.
4357
4358 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
4359
4360         * statement.cs: Return flow analysis information up.
4361
4362         * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
4363         and the default.
4364
4365         (token): Do not consume an extra character before calling
4366         decimal_digits.
4367
4368 2002-05-06  Piers Haken <piersh@friskit.com>
4369
4370         * cs-parser.jay: add 'override' attribute to System.Object.Finalize
4371
4372 2002-05-06  Miguel de Icaza  <miguel@ximian.com>
4373
4374         * class.cs (Constructor.Emit): Set the IsStatic flag in the
4375         EmitContext during the instance constructor initializer
4376         resolution, to stop access to instance variables.
4377
4378         This is mandated by the spec, last paragraph of the `constructor
4379         initializers' section. 
4380
4381 2002-05-05  Miguel de Icaza  <miguel@ximian.com>
4382
4383         * cs-parser.jay, class.cs (Accessor): new class used to represent
4384         an accessor (get or set).  In the past we used `null' to represent
4385         a missing accessor.  But this is ambiguous because there was no
4386         way to tell in abstract indexers/properties if one of them was
4387         specified.
4388
4389         Now there is a way of addressing that.
4390
4391         * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
4392         instead of FindMembers.
4393
4394         * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
4395         the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
4396
4397         * attribute.cs: Treat indexers and properties as the same in terms
4398         of applying attributes
4399
4400         * ecore.cs (FindMostEncompassedType): Use statically initialized
4401         EmptyExpressions()s like we do elsewhere to avoid creating useless
4402         objects (and we take this out of the tight loop).
4403
4404         (GetConversionOperators): Move the code to extract the actual
4405         operators to a separate routine to clean things up.
4406
4407 2002-05-04  Miguel de Icaza  <miguel@ximian.com>
4408
4409         * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
4410         events are always registered FieldBuilders.
4411         
4412         * class.cs (FieldBase): New class shared by Fields 
4413
4414         * delegate.cs: If we are a toplevel delegate, use our full name.
4415         If we are a nested delegate, then only use our tail name.
4416
4417 2002-05-02  Ravi Pratap  <ravi@ximian.com>
4418
4419         * expression.cs (IsApplicable): Ensure that we add the "&" to
4420         ref/out types before comparing it with the type of the argument.
4421
4422         (IsParamsMethodApplicable): Ditto.
4423
4424         (Argument.Type): Use TypeManager.LookupType instead of Type.GetType - 
4425         silly me ;-)
4426
4427         * delegate.cs : Handle the case when we have more than one applicable
4428         method. Flag an error only when we finish checking all.
4429
4430 2002-05-02  Miguel de Icaza  <miguel@ximian.com>
4431
4432         * expression.cs: Add support for boolean static initializers.
4433
4434 2002-05-01  Miguel de Icaza  <miguel@ximian.com>
4435
4436         * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
4437
4438         * parameter.cs (ComputeParameterTypes,
4439         ComputeAndDefineParameterTypes): Better error handling: now we
4440         clear the `types' cache if we fail during any of the type lookups.
4441         We also return the status code correctly to our caller
4442
4443         * delegate.cs: If we fail to define a delegate, abort the extra
4444         steps. 
4445
4446         * expression.cs (Binary.ResolveOperator): for
4447         operator==(object,object) and operator !=(object, object) we also
4448         have to verify that there is an implicit conversion from one to
4449         the other.
4450
4451         (ArrayAccess.DoResolve): Array Access can operate on
4452         non-variables. 
4453
4454 2002-04-30  Miguel de Icaza  <miguel@ximian.com>
4455
4456         * assign.cs (CompoundAssign): A new class used as a "flag" that
4457         the assignment actually is happening as part of a compound
4458         assignment operator.
4459
4460         During compound assignment, a few new rules exist to enable things
4461         like:
4462
4463         byte b |= 1 + 2
4464
4465         From the spec:
4466         
4467         x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
4468         to the type of x) if y is implicitly convertible to the type of x,
4469         and the operator is a builtin operator and the return type of the
4470         operator is explicitly convertible to the type of x. 
4471
4472         * rootcontext.cs: Reset warning level to 2.  4 catches various
4473         "interesting" features in mcs, we must clean this up at some
4474         point, but currently am trying to kill other bugs ;-)
4475
4476         * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
4477         in container classes as well.  
4478
4479         * expression.cs (Binary.ResolveOperator): Handle string case
4480         before anything else (as operator overloading does emit an error
4481         before doing anything else).
4482
4483         This code could go away when we move to a table driven model, but
4484         i could not come up with a good plan last night.
4485         
4486 2002-04-30  Lawrence Pit <loz@cable.a2000.nl>
4487
4488         * typemanager.cs (CSharpName): reimplementation using regex.
4489         * class.cs: added null check for fields in Emit
4490         * rootcontext.cs: set warninglevel to 4
4491
4492 2002-04-29  Miguel de Icaza  <miguel@ximian.com>
4493
4494         * typemanager.cs (CSharpName): reimplemented with Lupus
4495         suggestion.
4496
4497 2002-04-28  Miguel de Icaza  <miguel@ximian.com>
4498
4499         * statement.cs (If): correclty implement Resolve, because we were
4500         not catching sem errors in there.  The same process is needed
4501         everywhere else. 
4502         (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
4503         
4504
4505         (Statement.Warning_DeadCodeFound): Factorize code.
4506         (While): Report dead code here too.
4507
4508         (Statement): Added Resolve virtual method to allow
4509         for resolution split from the emit code.
4510
4511 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
4512
4513         * statement.cs (EmitBoolExpression): No longer try to resolve the
4514         expression here.    
4515         (MakeBoolean): New utility function that resolve, implicitly
4516         converts to boolean and tags the expression. 
4517         
4518
4519         (If, Do): Implement dead code elimination.
4520         (While): Implement loop inversion
4521
4522         (Do, While, For, If): Resolve the expression prior to calling our
4523         code generation.
4524
4525 2002-04-22  Lawrence Pit <loz@cable.a2000.nl>
4526
4527         * class.cs:
4528           - added method Report28 (warning: program has more than one entry point)
4529           - added method IsEntryPoint, implements paragraph 10.1 of the spec
4530           - modified method Method.Define, the part at the end of the method
4531
4532         * rootcontext.cs: added static public Location EntryPointLocation;
4533           
4534         * ../errors/cs0028.cs : Add test case for the above warning.              
4535
4536         * typemanager.cs:
4537           - modified method CSharpName to allow arrays of primitive type to
4538             be printed nicely (e.g. instead of System.Int32[][] it now prints
4539             int[][])
4540           - added method CSharpSignature: returns the signature of a method
4541             in string format to be used in reporting errors, warnings, etc.
4542
4543         * support.cs: InternalParameters.ParameterDesc variable tmp initialized
4544         with String.Empty.
4545         
4546 2002-04-26  Ravi Pratap  <ravi@ximian.com>
4547
4548         * delegate.cs (Define): Fix extremely silly bug where I was
4549         setting the type of the 'object' parameter of the BeginInvoke
4550         method to System.IAsyncResult instead of System.Object ;-)
4551
4552 2002-04-26  Miguel de Icaza  <miguel@ximian.com>
4553
4554         * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
4555         here. 
4556
4557         (Constructor.Emit): return if we fail to initialize the
4558         constructor.  Another door closed!  
4559
4560         * expression.cs (New.DoResolve): Improve error message (from -6 to
4561         1501).  Use DeclaredOnly lookup to find the exact constructor.
4562
4563         * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
4564         loop.  This is useful.
4565
4566         * cs-parser.jay: Adjust the default parameters so that destructors
4567         have the proper signature.
4568
4569 2002-04-26  Martin Baulig  <martin@gnome.org>
4570
4571         * driver.cs (LoadAssembly): If `assembly' contains any characters
4572         which are only valid in path names and not in assembly names
4573         (currently slash, backslash and point), use Assembly.LoadFrom ()
4574         instead of Assembly.Load () on the `assembly' (before iteration
4575         over the link_paths).
4576
4577 2002-04-26  Martin Baulig  <martin@gnome.org>
4578
4579         * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
4580
4581 2002-04-25  Miguel de Icaza  <miguel@ximian.com>
4582
4583         * class.cs (Property): use the new typemanager.MemberLookup
4584
4585         (TypeContainer.MemberLookup): Implement using the
4586         TypeManager.MemberLookup now. 
4587         
4588         * typemanager.cs: Make MemberLookup a function of the TypeManager,
4589         and return MemberInfos, so that these can be used without an
4590         EmitContext (what we had before).
4591
4592 2002-04-24  Miguel de Icaza  <miguel@ximian.com>
4593
4594         * expression.cs: Fix the case where the argument to params if the
4595         type of the params.  I omitted handling this before.   Fixed
4596
4597 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
4598
4599         * driver.cs: Call BootCorlib_PopulateCoreType
4600
4601         * class.cs (Property.CheckBase): Check for properties only, not
4602         for all members. 
4603
4604         * interface.cs: Temporary hack: try/catch around the
4605         CustomAttributeBuilder, because I am getting an exception that I
4606         do not understand.
4607
4608         * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
4609         types whose definitions are required to be there (attributes are
4610         defined before standard types).
4611
4612         Compute definitions as we boot the various types, as they are used
4613         immediately (value_type class will need object_type, but if we do
4614         not initialize object_type, we will pass a null, which will let
4615         the runtime pick the System.Object from the existing corlib, which
4616         is not what we want).
4617
4618 2002-04-22  Patrik Torstensson <totte@labs2.com>
4619
4620         * cs-tokenizer.cs: fixed a number of trim() issues.
4621
4622 2002-04-22  Ravi Pratap  <ravi@ximian.com>
4623
4624         * expression.cs (Argument.Type): Ensure that we return the correct
4625         type when we have out or ref parameters [in which case we 
4626         append a "&"].
4627         
4628 2002-04-22  Miguel de Icaza  <miguel@ximian.com>
4629
4630         * class.cs (Property, Indexer): Allow extern modifier in there. 
4631
4632         * typemanager.cs (InitBaseTypes): Initializes object_type and
4633         value_type, since those will be used early on during the bootstrap
4634         process to compile corlib.
4635
4636         (InitCoreTypes): Move code from here to InitBaseTypes.
4637
4638 2002-04-21  Miguel de Icaza  <miguel@ximian.com>
4639
4640         * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
4641         single-dimension arrays as using the ldlen opcode.  
4642
4643         Daniel Lewis discovered this optimization.  
4644
4645         * typemanager.cs: Add signature for System.Array::get_Length
4646
4647 2002-04-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4648
4649         * statement.cs: report the error when the foreach does not apply to an
4650         array nor a collection.
4651
4652 2002-04-19  Miguel de Icaza  <miguel@ximian.com>
4653
4654         * expression.cs: Add implicit conversions to the operator ~.
4655
4656         * constant.cs (DecimalConstant.Emit): Emit decimal value.
4657
4658         * typemanager.cs: Locate the decimal constructor.
4659
4660 2002-04-17  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4661
4662         * attribute.cs: use the new property of TypeOf.
4663         * expression.cs: added 'get' property around typearg.
4664
4665         These changes fix a build breaker reported by NickD. Is this the
4666         correct way to fix?  If not, please, revert my changes and make it
4667         work :-).
4668
4669 2002-04-17  Miguel de Icaza  <miguel@ximian.com>
4670
4671         * attribute.cs: Add support for typeof in attribute invocations.
4672         I am not sure that this is right though.
4673
4674 2002-04-14  Duncan Mak  <duncan@ximian.com>
4675
4676         * cfold.cs (BinaryFold): Catch DivideByZeroException in the
4677         Binary.Operator.Division case.
4678
4679 2002-04-13  Ravi Pratap  <ravi@ximian.com>
4680
4681         * class.cs (DefineType): Ensure that we do a proper check on
4682         attribute types and also register it with the TypeManager.
4683
4684         (TypeContainer.Targets): The default for attribute types is
4685         AttributeTargets.All.
4686         
4687         * attribute.cs (ApplyAttributes): Registering the attribute type
4688         is done elsewhere, not when we discover we have a Usage attribute.
4689
4690 2002-04-12  Ravi Pratap  <ravi@ximian.com>
4691
4692         * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
4693         and get rid of is_delegate parameter.
4694
4695         * everywhere : update.
4696         
4697 2002-04-12  Ravi Pratap  <ravi@ximian.com>
4698
4699         * cs-parser.jay (compilation_unit): Revamp completely to use
4700         some new ideas that I got from Rhys' grammar to solve the problems
4701         with assembly level attributes.
4702
4703         (outer_declaration): New grammar production.
4704
4705         (attribute_sections): Add.
4706
4707         (opt_attributes): Base on attribute_sections
4708
4709         (namespace_declaration): Allow opt_attributes to tackle the case
4710         when we have assembly level attributes - we are clever in this
4711         regard now ;-)
4712
4713         * attribute.cs (ApplyAttributes): Do not worry about assembly 
4714         attributes in the non-global context.
4715
4716         * rootcontext.cs (AddGlobalAttributes): Go back to using this
4717         instead of SetGlobalAttributes.
4718
4719         * class.cs, rootcontext.cs : Ensure we define and generate 
4720         attribute types before anything else.
4721
4722         * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
4723         and flag the new error -20 for the case when the attribute type
4724         does not have valid targets specified. csc does not catch this.
4725
4726         * ../errors/errors.txt : update for error # -20
4727
4728 2002-04-11  Ravi Pratap  <ravi@ximian.com>
4729
4730         * support.cs (InternalParameters.ParameterModifier): Do some null
4731         checking and return sane values.
4732
4733         * class.cs (Method.Define): If we are a PInvoke method, ensure
4734         that we are static and extern. Report error # 601
4735
4736         * ../errors/cs0601.cs : Add test case for the above error.
4737
4738 2002-04-07  Ravi Pratap  <ravi@ximian.com>
4739
4740         * rootcontext.cs (attribute_types): We need to keep type of
4741         all attribute types separately and emit code for them first.
4742
4743         (RegisterAttribute) : Implement.
4744
4745         * class.cs (DefineType): Check if the current Type is a custom
4746         attribute type and register it accordingly.
4747
4748         * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
4749         adding the first attribute twice and rename to
4750
4751         (SetGlobalAttributes): this.
4752
4753         * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
4754         lookups.
4755
4756         * attribute.cs (ApplyAttributes): Take an additional argument telling us
4757         if we are processing global arguments. Hmm, I am unsure of this.
4758
4759 2002-04-12  Gonzalo Paniagua Javier <gonzalo@ximian.com>
4760
4761         * expression.cs: added static array of strings to avoid calling
4762         Enum.ToString () for Operator in Binary. Significant recover of
4763         performance.
4764
4765 2002-04-10  Miguel de Icaza  <miguel@ximian.com>
4766
4767         * class.cs (FindMembers): Allow the Builders of the various
4768         members to be null.  If they are skip them.  This only happens
4769         during the PInvoke declaration.
4770
4771 2002-04-09  Miguel de Icaza  <miguel@ximian.com>
4772
4773         * parameter.cs (Parameters.ComputeParameterTypes): Flag the
4774         failure, so we do not keep going afterwards.
4775
4776         * expression.cs: (Invocation.OverloadResolve): I believe Ravi
4777         wanted to pass `false' as the `is_delegate' argument.  If this is
4778         the case, why not use delegate_type == null to mean `is_delegate =
4779         false' and anything else as is_delegate = true.
4780
4781 Tue Apr  9 05:40:12  2002 Piers Haken <piersh@friskit.com>
4782
4783         * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
4784         code for the section, not the beginning of the tests.
4785
4786 2002-04-08  Miguel de Icaza  <miguel@ximian.com>
4787
4788         * cfold.cs: Handle operator + (Enum x, Underlying x) 
4789
4790         * expression.cs (Binary): same.  Warn about errors where we have
4791         Enum/Enum in operator + as well.
4792
4793 Mon Apr  8 06:29:03  2002 Piers Haken <piersh@friskit.com>
4794
4795         * statement.cs:
4796                 - added support for switch(bool)
4797                 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
4798                 - add TableSwitchEmit() to handle table-based switch statements
4799
4800 2002-04-05  Ravi Pratap  <ravi@ximian.com>
4801
4802         * expression.cs (Invocation.OverloadResolve): Factor out code which
4803         does parameter compatibility checking with arguments so that we can 
4804         re-use the code even from Delegate.VerifyApplicability
4805
4806         (VerifyArgumentsCompat): Move above code here.
4807
4808         * delegate.cs (VerifyApplicability): Get rid of duplicate code
4809         and instead make a call to the above method.
4810
4811 2002-03-31  Ravi Pratap  <ravi@ximian.com>
4812
4813         * typemanager.cs (attribute_type): Corresponds to System.Attribute.
4814         We use it to keep track of classes which are attribute types.
4815
4816 2002-04-02  Miguel de Icaza  <miguel@ximian.com>
4817
4818         * delegate.cs (Delegate.Define): Correctly define the types in the
4819         presence of fixed and array parameters.
4820
4821         * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
4822         doing FindMembers.
4823
4824         * ecore.cs (Expression.MemberLookup): Reset binding flags to not
4825         include NonPublic after the first iteration.
4826
4827         * class.cs (Indexer.CheckBase): Only check if both parents are
4828         non-null. 
4829         
4830         * cs-parser.jay (accessor_body): If empty, set to null.
4831
4832         * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
4833         same code path here to resolve constants names that we did have in
4834         MemberAccess.DoResolve.  There is too much code duplicated here.
4835
4836 2002-04-01  Miguel de Icaza  <miguel@ximian.com>
4837
4838         * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
4839
4840         * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
4841         to MakeUnionSet.
4842
4843         * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
4844         tokens, numbers and strings.
4845
4846         * ecore.cs (MethodGroupExpr): Make Emit warn about missing
4847         parenthesis.
4848
4849         * delegate.cs: Use ComputeAndDefineParameterTypes for both the
4850         asyncronous parameters and the regular parameters.  
4851
4852         * codegen.cs (CodeGen.Init): Use the constructor that allows us to
4853         specify the target directory.
4854
4855         * expression.cs: (This.DoResolve): Simplify
4856         (As.Emit): Optimize, do not generate IsInst if the expression is
4857         always of the given type.
4858
4859         (Is.DoResolve): Bug fix, we were reporting both always/never for
4860         the is expression.
4861
4862         * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
4863         creating too many unnecessary arrays.
4864
4865 2002-03-31  Miguel de Icaza  <miguel@ximian.com>
4866
4867         * class.cs (EmitFieldInitializer): Use Assign expression to assign
4868         fields instead of rolling our own initializer.   Takes care of all
4869         implicit conversions, and drops unnecessary static checks/argument.
4870
4871 2002-03-31  Dick Porter  <dick@ximian.com>
4872
4873         * driver.cs: use the GetDirectories() return values properly, and
4874         use "/" as path separator.
4875
4876 2002-03-30  Miguel de Icaza  <miguel@ximian.com>
4877
4878         * expression.cs (Unary): Optimize - - expr into expr.
4879         (Binary): Optimize a + (-b) into a -b.
4880
4881         * codegen.cs (CodeGen): Made all methods static.
4882
4883 2002-03-29  Miguel de Icaza  <miguel@ximian.com>
4884
4885         * rootcontext.cs: 
4886
4887         * decl.cs: Rename `definition' into `TypeBuilder' and drop the
4888         TypeBuilder property.
4889
4890         * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
4891         instead. 
4892
4893         * tree.cs: Removed the various RecordXXXX, and replaced with a
4894         single RecordDecl.  Removed all the accessor methods, and just
4895         left a single access point Type 
4896
4897         * enum.cs: Rename DefineEnum to DefineType.
4898
4899         * decl.cs: New abstract method `DefineType' used to unify the
4900         Defines for Enumerations, Interfaces, TypeContainers and
4901         Delegates.
4902
4903         (FindType): Moved LookupInterfaceOrClass here.  Moved the
4904         LookupBaseClasses method that used to live in class.cs and
4905         interface.cs here, and renamed to FindType.
4906         
4907         * delegate.cs: Implement DefineType.  Take advantage of the
4908         refactored pattern for locating the parent builder without taking
4909         the parent_builder argument (which we know does not work if we are
4910         nested, and triggering a toplevel definition).
4911
4912 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
4913
4914         * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
4915         accessibility of a member has changed during override and report
4916         an error if so.
4917
4918         * class.cs (Method.Define, Property.Define): Only complain on
4919         overrides if the method is private, any other accessibility is
4920         fine (and since we just checked the permission is the same, we are
4921         good to go).
4922
4923         * cs-tokenizer.cs: only line, region, endregion, if, endif, else
4924         and elif are processed always.  The other pre-processing
4925         directives are only processed if we are "taking" the path
4926
4927 2002-03-29  Martin Baulig  <martin@gnome.org>
4928
4929         * class.cs (Method.Emit): Only emit symbolic debugging info if the
4930         current location is not Null.
4931
4932         * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
4933         a separate method so we can profile it.
4934
4935         * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
4936         `span.Seconds' are just seconds, but no minutes or hours.
4937         (MainDriver): Profile the CodeGen.SaveSymbols calls.
4938
4939 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
4940
4941         * class.cs (Method.Define), (Property.Define), (Indexer.Define):
4942         Remove the gratuitous set of Final:
4943
4944                                 // If an interface implementation, then we can set Final.
4945                                 if (((flags & MethodAttributes.Abstract) == 0) &&
4946                                     implementing.DeclaringType.IsInterface)
4947                                         flags |= MethodAttributes.Final;
4948
4949         I do not know what I was smoking when I used that.
4950         
4951
4952         * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
4953         step into fixing the name resolution issues for delegates and
4954         unifying the toplevel name resolution.
4955
4956 2002-03-28  Martin Baulig  <martin@gnome.org>
4957
4958         * class.cs (Method.Emit): If we have a symbol writer, call its
4959         OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
4960         tell it about the current method.
4961
4962         * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
4963         writer that we're going to emit the first byte of IL code for a new
4964         statement (a new source line).
4965         (EmitContext.EmitTopBlock): If we have a symbol writer, call
4966         EmitContext.Mark() before emitting any code.
4967
4968         * location.cs (SymbolDocument): Return null when we're Null.
4969
4970         * statement.cs (Statement): Moved the `Location loc' variable here.
4971         (Statement.EmitBoolExpression): If we have a symbol writer, call
4972         ec.Mark() before emitting any code to tell it that we're at the
4973         beginning of a new statement.
4974         (StatementExpression): Added `Location' argument to the constructor.
4975         (Block): Added public readonly variable `StartLocation' and public
4976         variable `EndLocation'.  The latter is to be set using SetEndLocation().
4977         (Block): Added constructor which takes a start and end location.
4978         (Block.SetEndLocation): New method. This sets the end location.
4979         (Block.EmitMeta): If we have a symbol writer, tell it the names of the
4980         local variables we create.
4981         (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
4982         each statement and do also mark the begin and end of the block.
4983
4984         * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
4985         tell it the current lexer.Location, use Location.Null for the end of the
4986         block.
4987         (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
4988         current block, set its end location using SetEndLocation().
4989         (statement_expression): StatementExpression constructor now takes the
4990         lexer.Location as additional argument.
4991         (for_statement, declare_local_variables): Likewise.
4992         (declare_local_variables): When creating a new implicit block, use the
4993         new Block constructor and pass it the lexer.Location.
4994
4995 2002-03-28  Miguel de Icaza  <miguel@ximian.com>
4996
4997         * ecore.cs (Expression.MemberLookup): On interfaces, lookup
4998         members also on the parent interfaces recursively.
4999
5000 2002-03-27  Miguel de Icaza  <miguel@ximian.com>
5001
5002         * report.cs: Use new formats, since Gonzalo finished the missing
5003         bits. 
5004
5005         * expression.cs (Binary.ResolveOperator): added missing operator|
5006         operator& and operator^ for bool/bool.
5007
5008         * cs-parser.jay: CheckDef now takes a Location argument that is
5009         used to report errors more precisly (instead of reporting the end
5010         of a definition, we try to track something which is a lot closer
5011         to the source of the problem).
5012
5013         * cs-tokenizer.cs: Track global token use, so we can properly flag
5014         the use of #define/#undef after the first token has been seen.
5015
5016         Also, rename the reportXXXX to Error_DescriptiveName
5017
5018         * decl.cs (DeclSpace.IsTopLevel): Move property here from
5019         TypeContainer, so that Enum and Interface can use this too.
5020
5021         * class.cs (TypeContainer.LookupInterfaceOrClass,
5022         GetInterfaceOrClass, GetClassBases, DefineType): Drop the
5023         `builder' argument.  Typically this was used to pass the parent
5024         builder (a ModuleBuilder or a TypeBuilder from whoever triggered
5025         the definition).  
5026
5027         The problem is that a nested class could trigger the definition of
5028         a toplevel class, and the builder would be obviously wrong in that
5029         case. 
5030
5031         So we drop this argument, and we compute dynamically the
5032         TypeBuilder/ModuleBuilder (the correct information was available
5033         to us anyways from DeclSpace.Parent)
5034
5035         * interface.cs (Interface.DefineInterface): Drop builder
5036         parameter cleanup like class.cs
5037
5038         * enum.cs (Enum.DefineEnum): Drop builder parameter.  Clean up
5039         like class.cs
5040
5041         * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
5042         values. 
5043
5044         (Try.Emit): Propagate the returns value from the statement.
5045
5046         (Return.Emit): Even if we are leavning 
5047
5048         * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
5049
5050         * modifiers.cs: Fix the computation of MethodAttributes flags.
5051
5052 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
5053
5054         * driver.cs: allow compilation of files that start with '/'.
5055         Add a default case when checking the argument of --target.
5056
5057 2002-03-25  Miguel de Icaza  <miguel@ximian.com>
5058
5059         * interface.cs: Implement the same search algorithm for types in
5060         the interface code.
5061
5062         * delegate.cs: Do not allow multiple definition.
5063
5064         * Recovered ChangeLog that got accidentally amputated
5065
5066         * interface.cs (Interface.DefineInterface): Prevent from double definitions.
5067
5068         * rootcontext.cs: Load manually enum to allow core classes to
5069         contain enumerations.
5070
5071         * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
5072         Update to new static methods in TypeManager.
5073
5074         * typemanager.cs (GetMethod, GetConstructor): Use our
5075         implementation of FindMembers to find the members, since during
5076         corlib compilation, the types are TypeBuilders and GetMethod and
5077         GetConstructor do not work.
5078
5079         Make all methods in TypeManager static.
5080
5081         (InitCodeHelpers): Split the functionality from
5082         the InitCodeTypes function.
5083
5084         * driver.cs: Call InitCodeHelpers after we have populated the
5085         types. 
5086
5087         * cs-parser.jay (delegate_declaration): we did not used to compute
5088         the delegate name correctly for void delegates.
5089
5090 2002-03-24  Miguel de Icaza  <miguel@ximian.com>
5091
5092         * rootcontext.cs (RootContext): Init the interface_resolve_order
5093         and type_container_resolve_order always.
5094
5095         (ResolveCore, BootstrapCorlib_ResolveClass,
5096         BootstrapCorlib_ResolveStruct): New functions to bootstrap the
5097         compiler when compiling with --nostdlib
5098
5099         * class.cs (TypeContainer.DefineType): Check that our parent is
5100         not null.  This test is most important when we are bootstraping
5101         the core types.
5102
5103         * codegen.cs: Split out the symbol writing code.
5104
5105 2002-03-25  Martin Baulig  <martin@gnome.org>
5106
5107         * driver.cs (-g): Made -g an alias for --debug.
5108
5109 2002-03-24  Martin Baulig  <martin@gnome.org>
5110
5111         * codegen.cs (SymbolWriter): New public variable. Returns the
5112         current symbol writer.
5113         (CodeGen): Added `bool want_debugging_support' argument to the
5114          constructor. If true, tell the ModuleBuild that we want debugging
5115         support and ask it for the ISymbolWriter.
5116         (Save): If we have a symbol writer, call it's Close() method after
5117         saving the assembly.
5118
5119         * driver.c (--debug): New command line argument to create a
5120         debugger information file.
5121
5122         * location.cs (SymbolDocument): New public property. Returns an
5123         ISymbolDocumentWriter object for the current source file or null
5124         if we don't have a symbol writer.
5125
5126 2002-03-21  Miguel de Icaza  <miguel@ximian.com>
5127
5128         * driver.cs (LoadAssembly): Correctly return when all the paths
5129         have been tried and not before.
5130
5131         * statement.cs (Switch.Emit): return the actual coverage for this
5132         statement (returns/not-returns)
5133
5134         (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
5135         switch of the statement if we are the last switch section.  That
5136         kills two problems: try/catch problems (we used to emit an empty
5137         nop at the end) and switch statements where all branches would
5138         return. 
5139
5140 2002-03-19  Miguel de Icaza  <miguel@ximian.com>
5141
5142         * driver.cs: Add default assemblies (the equivalent to the
5143         Microsoft CSC.RSP file)
5144
5145         * cs-tokenizer.cs: When updating `cols and setting it to zero,
5146         also update tokens_seen and set it to false.
5147
5148         * driver.cs: Implement --recurse for Mike.
5149
5150         * driver.cs (SplitPathAndPattern): Small bug fix, I was not
5151         correctly splitting out the paths.
5152
5153 2002-03-18  Miguel de Icaza  <miguel@ximian.com>
5154
5155         * interface.cs (Interface.PopulateProperty): Instead of using
5156         `parent' as the declaration space for the set parameters, use
5157         `this' 
5158
5159         * support.cs (InternalParameters): InternalParameters constructor
5160         takes a DeclSpace instead of a TypeContainer.
5161
5162         * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
5163         types are being initialized, load the address of it before calling
5164         the function.  
5165
5166         (New): Provide a mechanism to disable the generation of local
5167         value type temporaries when the caller will be providing us with
5168         an address to store it.
5169
5170         (ArrayCreation.EmitDynamicInitializers): Use it.
5171
5172 2002-03-17  Miguel de Icaza  <miguel@ximian.com>
5173
5174         * expression.cs (Invocation.EmitArguments): Only probe for array
5175         property if there is more than one argument.  Sorry about that.
5176
5177         * class.cs (Invocation.EmitArguments): Fix to emit arguments for
5178         empty param arrays.
5179         
5180         * class.cs (Method.LabelParameters): Fix incorrect code path that
5181         prevented the `ParamArrayAttribute' from being applied to the
5182         params attribute.
5183
5184 2002-03-16  Miguel de Icaza  <miguel@ximian.com>
5185
5186         * support.cs (ReflectionParameters): Correctly compute whether the
5187         last argument is a params array.  Fixes the problem with
5188         string.Split ('a')
5189
5190         * typemanager.cs: Make the assemblies array always be non-null
5191         (empty, but non-null)
5192
5193         * tree.cs (RecordDecl): New function that abstracts the recording
5194         of names.  This reports error 101, and provides a pointer to the
5195         previous declaration.  Fixes a crash in the compiler.
5196
5197         * cs-parser.jay (constructor_declaration): Update to new grammar,
5198         and provide a constructor_body that can be empty.
5199
5200 2002-03-15  Miguel de Icaza  <miguel@ximian.com>
5201
5202         * driver.cs: Add support for --resources.
5203
5204         * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
5205         Make all types for the various array helper methods be integer.
5206
5207         * ecore.cs (Expression.ConvertNumericExplicit): Pass the
5208         CheckState to ConvCast.
5209
5210         (ConvCast): Now it takes a `checked' state argument, to avoid
5211         depending on the emit context for the conversion, and just using
5212         the resolve time setting.
5213
5214         * expression.cs (ArrayCreation.EmitArrayArguments): New function,
5215         instead of Invocation.EmitArguments.  We do not emit the original
5216         arguments, instead we emit those which have been converted to
5217         unsigned int expressions.
5218
5219         * statement.cs (Block.EmitMeta): Drop tracking of indexes.
5220
5221         * codegen.cs: ditto.
5222
5223         * expression.cs (LocalVariableReference): Drop the use of the
5224         Store function that depended on the variable index.
5225
5226         * statement.cs (VariableInfo): Drop the `Idx' property from this
5227         class, as this is not taking into account the indexes for
5228         temporaries tat we generate during the execution, getting the
5229         indexes wrong.
5230
5231         * class.cs: First emit class initializers, then call the parent
5232         constructor. 
5233
5234         * expression.cs (Binary): Fix opcode emision.
5235         (UnaryMutator.EmitCode): Support checked code generation
5236
5237         * ecore.cs (MemberLookup): TypeManager.FindMembers will return
5238         matches for events for both the Static and Instance scans,
5239         pointing to the same element.   Fix that.
5240
5241 2002-03-14  Miguel de Icaza  <miguel@ximian.com>
5242
5243         * rootcontext.cs (ResolveTree): Always set the
5244         interface_resolve_order, because nested interfaces will be calling
5245         into us.
5246
5247         * class.cs (GetInterfaceOrClass): Track the same resolution
5248         process used by TypeManager.LookupType.  This fixes the nested
5249         type lookups in class declarations (separate path from
5250         LookupType). 
5251
5252         (TypeContainer.DefineType): Also define nested interfaces.
5253         (TypeContainer.RegisterOrder): New public function used to
5254         register the order in which child interfaces need to be closed.
5255
5256         Nested interfaces need to be closed after their parents have been
5257         created. 
5258         
5259         * interface.cs (InterfaceAttr): Put all the logic for computing
5260         the interface attribute here. 
5261
5262         (DefineInterface): Register our interface order with the
5263         RootContext or with the TypeContainer depending on the case.
5264
5265 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
5266
5267         * cs-parser.jay: rework foreach statement to work with the new
5268         changes to the policy on SimpleNames.
5269         
5270         * report.cs: support Stacktrace on warnings as well.
5271
5272         * makefile: drop --unsafe and /unsafe from the compile.
5273
5274 2002-03-13  Ravi Pratap  <ravi@ximian.com>
5275
5276         * ecore.cs (StandardConversionExists): Modify to take an Expression
5277         as the first parameter. Ensure we do null -> reference type conversion
5278         checking.
5279
5280         * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
5281         temporary Expression objects.
5282
5283 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
5284
5285         * interface.cs: workaround bug in method overloading resolution
5286         (there is already a bugzilla bug for it).
5287
5288 2002-03-12  Miguel de Icaza  <miguel@ximian.com>
5289
5290         We could also solve this problem by having a separate path for
5291         performing type lookups, instead of DoResolve, we could have a
5292         ResolveType entry point, and only participating pieces of the
5293         production (simplename, deref, array) would implement this. 
5294         
5295         * codegen.cs (EmitContext): New field OnlyLookupTypes used to
5296         signal SimpleName to only resolve type names and not attempt to
5297         resolve anything else.
5298
5299         * expression.cs (Cast): Set the flag.
5300
5301         * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
5302
5303         * class.cs: Only report 108 if there is no `new' modifier.
5304
5305         * cs-parser.jay: rework foreach statement to work with the new
5306         changes to the policy on SimpleNames.
5307         
5308         * report.cs: support Stacktrace on warnings as well.
5309
5310         * makefile: drop --unsafe and /unsafe from the compile.
5311
5312 2002-03-11  Miguel de Icaza  <miguel@ximian.com>
5313
5314         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
5315         lookups here, instead of doing that at parse time.  This means
5316         that our grammar will not introduce `LocalVariableReferences' as
5317         expressions at this point.  That solves the problem of code like
5318         this:
5319
5320         class X {
5321            static void Main ()
5322            { int X = 1;
5323             { X x = null }}}
5324
5325         This is only half the fix.  The full fix requires parameters to
5326         also be handled in this way.
5327
5328         * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
5329         makes the use more obvious of the DeclSpace.  The
5330         ec.TypeContainer.TypeBuilder is now only used to pull the
5331         TypeBuilder for it.
5332
5333         My theory is that I can get rid of the TypeBuilder completely from
5334         the EmitContext, and have typecasts where it is used (from
5335         DeclSpace to where it matters).  
5336
5337         The only pending problem is that the code that implements Aliases
5338         is on TypeContainer, and probably should go in DeclSpace.
5339
5340         * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
5341         lookups here, instead of doing that at parse time.  This means
5342         that our grammar will not introduce `LocalVariableReferences' as
5343         expressions at this point.  That solves the problem of code like
5344         this:
5345
5346         class X {
5347            static void Main ()
5348            { int X = 1;
5349             { X x = null }}}
5350
5351         This is only half the fix.  The full fix requires parameters to
5352         also be handled in this way.
5353
5354         * class.cs (Property.DefineMethod): When implementing an interface
5355         method, set newslot, when implementing an abstract method, do not
5356         set the flag (before we tried never setting it, or always setting
5357         it, which is the difference).
5358         (Indexer.DefineMethod): same.
5359         (Method.DefineMethod): same.
5360
5361         * ecore.cs: Only set the status used flag if we get back a Field.
5362
5363         * attribute.cs: Temporary hack, so Paolo can keep working.
5364
5365 2002-03-08  Ravi Pratap  <ravi@ximian.com>
5366
5367         * attribute.cs (Attribute.UnmanagedType): This is to keep track of
5368         the unmanaged type in the case we have a MarshalAs attribute.
5369
5370         (Resolve): Handle the case when we are parsing the special MarshalAs
5371         attribute [we need to store the unmanaged type to use later]
5372         
5373         * typemanager.cs (marshal_as_attr_type): Built in type for the 
5374         MarshalAs Attribute.
5375
5376         * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute 
5377         on parameters and accordingly set the marshalling info.
5378         
5379 2002-03-09  Miguel de Icaza  <miguel@ximian.com>
5380
5381         * class.cs: Optimizing slightly by removing redundant code after
5382         we switched to the `NoTypes' return value.
5383         (Property.DefineMethod): use NoTypes here too.
5384
5385         This fixes the bug I introduced in my last batch of changes.
5386
5387 2002-03-05  Ravi Pratap  <ravi@ximian.com>
5388
5389         * tree.cs (RecordEnum): Add. We now keep track of enums too.
5390
5391         * class.cs (LookupInterfaceOrClass): Check against the list of recorded
5392         Enums since those are types too. 
5393
5394         * cs-parser.jay (enum_declaration): Record enums as we parse them.
5395         
5396         * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined 
5397         thanks to a call during the lookup process.
5398
5399 2002-03-07  Miguel de Icaza  <miguel@ximian.com>
5400
5401         * statement.cs (Foreach): Lots of work to accomodate a particular
5402         kind of foreach statement that I had not kept in mind.  It is
5403         possible to have foreachs on classes that provide a GetEnumerator
5404         method that return objects that implement the "pattern" for using
5405         a foreach, there is no need to support GetEnumerator
5406         specifically. 
5407
5408         This is needed to compile nant.
5409
5410         * decl.cs: Only report 114 if the member is not `Finalize' and if
5411         the warning level is at least 2.
5412
5413         * class.cs: Moved the compare function from Method to
5414         MethodSignature. 
5415
5416         (MethodSignature.InheritableMemberSignatureCompare): Add new
5417         filter function that is used to extract inheritable methods from a
5418         class. 
5419
5420         (Method.Define): Use the new `inheritable_method_signature_filter'
5421         delegate
5422
5423         * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
5424         command. 
5425
5426 2002-03-06  Miguel de Icaza  <miguel@ximian.com>
5427
5428         * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
5429
5430         * cs-parser.jay: Add opt_semicolon to the interface declaration.
5431
5432         * expression.cs: Pass location information to
5433         ConvertImplicitStandard. 
5434
5435         * class.cs: Added debugging code to track return values from
5436         interfaces. 
5437
5438 2002-03-05  Miguel de Icaza  <miguel@ximian.com>
5439
5440         * expression.cs (Is.DoResolve): If either side of the `is' is an
5441         interface, do not flag the warning.
5442
5443         * ecore.cs (ImplicitReferenceConversion): We need a separate test
5444         for interfaces
5445
5446         * report.cs: Allow for --fatal to be used with --probe.
5447         
5448         * typemanager.cs (NoTypes): Move the definition for the empty Type
5449         array here. 
5450
5451         * class.cs (TypeContainer.FindMembers): Also look for methods defined by
5452         properties. 
5453         (TypeContainer.DefineProxy): New function used to proxy to parent
5454         implementations when implementing interfaces.
5455         (TypeContainer.ParentImplements): used to lookup if our parent
5456         implements a public function that is required by an interface.
5457         (TypeContainer.VerifyPendingMethods): Hook this up.
5458
5459         * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
5460         `modules' and `assemblies' arraylists into arrays.  We only grow
5461         these are the very early start up of the program, so this improves
5462         the speedof LookupType (nicely measured).
5463
5464         * expression.cs (MakeByteBlob): Replaced unsafe code with
5465         BitConverter, as suggested by Paolo.
5466
5467         * cfold.cs (ConstantFold.Binary): Special case: perform constant
5468         folding of string concatenation, but if either side is a string,
5469         and the other is not, then return null, and let the runtime use
5470         the concatenation on the string plus the object (using
5471         `Object.ToString'). 
5472
5473 2002-03-04  Miguel de Icaza  <miguel@ximian.com>
5474
5475         Constant Folding has been implemented now.
5476         
5477         * expression.cs (Unary.Reduce): Do not throw an exception, catch
5478         the error instead on types that are not supported in one's
5479         complement. 
5480
5481         * constant.cs (Constant and all children): New set of functions to
5482         perform implict and explicit conversions.
5483         
5484         * ecore.cs (EnumConstant): Implement the new functions to perform
5485         conversion by proxying to the child expression.
5486
5487         * codegen.cs: (ConstantCheckState): Constant evaluation has its
5488         own separate setting that can not be turned off from the command
5489         line using --unchecked or --checked and is only controlled using
5490         the checked/unchecked statements and expressions.  This setting is
5491         used by the constant folder to flag errors.
5492
5493         * expression.cs (CheckedExpr, UncheckedExpr): Set the
5494         ConstantCheckState as well.   
5495
5496         During Resolve, they also have to flag the state, because the
5497         constant folder runs completely in the Resolve phase.
5498
5499         * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
5500         well.
5501
5502 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
5503
5504         * cfold.cs: New file, this file contains the constant folder.
5505         
5506         * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
5507         argument to track whether we are using the resulting address to
5508         load or store a value and provide better error messages. 
5509
5510         (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
5511         new AddressOf arguments.
5512
5513         * statement.cs (Foreach.EmitCollectionForeach): Update
5514
5515         * expression.cs (Argument.Emit): Call AddressOf with proper
5516         arguments to track usage.
5517
5518         (New.DoEmit): Call AddressOf with new arguments.
5519
5520         (Unary.Emit): Adjust AddressOf call.
5521
5522 2002-03-01  Ravi Pratap  <ravi@ximian.com>
5523
5524         * cs-parser.jay (member_access): Change the case for pre-defined types
5525         to use a MemberAccess instead of a SimpleName. Thanks to Felix again for 
5526         this suggestion.
5527
5528         * class.cs (Operator::Emit): If we are abstract or extern, we don't have
5529         a method body.
5530
5531         * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
5532         essentially like methods and apply attributes like MethodImplOptions to them too.
5533
5534         * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
5535         not being null.
5536
5537         * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
5538         DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
5539         is the DeclSpace.
5540
5541         * Update code everywhere accordingly.
5542
5543         * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
5544
5545         * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
5546
5547 2002-02-28  Ravi Pratap  <ravi@ximian.com>
5548
5549         * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
5550         try performing lookups against those instead of jumping straight into using
5551         the 'using' clauses.
5552
5553         (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
5554
5555         (LookupType): Perform lookups in implicit parents too.
5556
5557         * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
5558         sequence as RootContext.LookupType. 
5559
5560         * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries 
5561         the various cases of namespace lookups into this method.
5562
5563 2002-03-01  Miguel de Icaza  <miguel@ximian.com>
5564
5565         * cs-parser.jay: Add support for [Attribute ()] (empty arguments
5566         in positional arguments)
5567
5568         * class.cs (Operator): Update the AllowedModifiers to contain
5569         extern. 
5570
5571         * cs-parser.jay: Update operator declaration to allow for the
5572         operator body to be empty.
5573
5574         * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
5575         values. 
5576
5577 2002-02-27  Miguel de Icaza  <miguel@ximian.com>
5578
5579         * class.cs (Method.Emit): Label parameters.
5580
5581         * driver.cs: Return 1 or 0 as the program exit code.
5582
5583 2002-02-26  Miguel de Icaza  <miguel@ximian.com>
5584
5585         * expression.cs: Special case the `null' object when trying to
5586         auto-compute the type, as anything can be explicitly converted to
5587         that. 
5588
5589         * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
5590         spotting this Paolo.
5591
5592         (Expression.ImplicitNumericConversion): Perform comparissions of
5593         the type using the underlying type in the case of an enumeration
5594         rather than using the enumeration type for the compare.
5595
5596         Cope with the underlying == type case, which is not possible to
5597         catch before. 
5598
5599         (Expression.ConvertNumericExplicit): Perform comparissions of
5600         the type using the underlying type in the case of an enumeration
5601         rather than using the enumeration type for the compare.
5602
5603         * driver.cs: If the user does not supply an extension, assume .exe
5604
5605         * cs-parser.jay (if_statement): Rewrote so that we can track the
5606         location for the if statement.
5607
5608         * expression.cs (Binary.ConstantFold): Only concat strings when
5609         the operation is "+", not everything ;-)
5610
5611         * statement.cs (Statement.EmitBoolExpression): Take a location
5612         argument. 
5613         (If, While, Do): Track location.
5614
5615         * expression.cs (Binary.ResolveOperator): In the object + string
5616         case, I was missing a call to ConvertImplicit
5617
5618 2002-02-25  Ravi Pratap  <ravi@ximian.com>
5619
5620         * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
5621         Location arguments. Ensure we use RootContext.LookupType to do our work
5622         and not try to do a direct Type.GetType and ModuleBuilder.GetType
5623
5624         * interface.cs (PopulateMethod): Handle the type of the parameter being
5625         null gracefully.
5626
5627         * expression.cs (Invocation.BetterFunction): Handle the case when we 
5628         have a params method with no fixed arguments and a call is made with no
5629         arguments.
5630
5631 2002-02-25  Miguel de Icaza  <miguel@ximian.com>
5632
5633         * cs-tokenizer.cs: Add support for the quote-escape-sequence in
5634         the verbatim-string-literal
5635
5636         * support.cs (InternalParameters.ParameterModifier): handle null
5637         fixed parameters.
5638         (InternalParameters.ParameterType): ditto.
5639
5640         * parameter.cs (VerifyArgs): Also check if the fixed parameter is
5641         duplicating the name of the variable parameter.
5642         (GetParameterByName): Fix bug where we were not looking up array
5643         paramters if they were the only present (thanks Paolo!).
5644         (GetParameterInfo): We only have an empty set of types if both
5645         fixed and array are set to null.
5646         (GetParameterInfo-idx): Handle FixedParameter == null
5647
5648         * cs-parser.jay: Handle the case where there is no catch
5649         statements (missing null test).
5650
5651 2002-02-22  Miguel de Icaza  <miguel@ximian.com>
5652
5653         * driver.cs (MainDriver): Be conservative on our command line
5654         handling.
5655
5656         Catch DirectoryNotFoundException when calling GetFiles.
5657         
5658         (SplitPathAndPattern): Used to split the input specification into
5659         a path and a pattern that we can feed to Directory.GetFiles.
5660
5661 2002-02-21  Miguel de Icaza  <miguel@ximian.com>
5662
5663         * statement.cs (Fixed): Implement the last case of the Fixed
5664         statement (string handling).
5665
5666         * expression.cs (StringPtr): New class used to return a char * to
5667         a string;  Used by the Fixed statement.
5668
5669         * typemanager.cs: Add char_ptr_type.  Add get_OffsetToStringData method.
5670
5671         * expression.cs (Binary.ResolveOperator): Remove redundant
5672         MemberLookup pn parent type.
5673         Optimize union call, we do not need a union if the types are the same.
5674         (Unary.ResolveOperator): REmove redundant MemberLookup on parent
5675         type.
5676
5677         Specialize the use of MemberLookup everywhere, instead of using
5678         the default settings. 
5679
5680         (StackAlloc): Implement stackalloc keyword.
5681
5682         * cs-parser.jay: Add rule to parse stackalloc.
5683         
5684         * driver.cs: Handle /h, /help, /?
5685
5686         * expression.cs (MakeByteBlob): Removed the hacks we had in place
5687         before we supported unsafe code.
5688         
5689         * makefile: add --unsafe to the self compilation of mcs.
5690
5691 2002-02-20  Miguel de Icaza  <miguel@ximian.com>
5692
5693         * expression.cs (PointerArithmetic): New class that is used to
5694         perform pointer arithmetic.
5695         (Binary.Resolve): Handle pointer arithmetic
5696         Handle pointer comparission.
5697         (ArrayPtr): Utility expression class that is used to take the
5698         address of an array.
5699
5700         (ElementAccess): Implement array access for pointers
5701         
5702         * statement.cs (Fixed): Implement fixed statement for arrays, we
5703         are missing one more case before we are done.
5704
5705         * expression.cs (Indirection): Implement EmitAssign and set the
5706         ExprClass to Variable.  This allows pointer dereferences to be
5707         treated as variables, and to have values assigned to them.
5708         
5709         * ecore.cs (Expression.StoreFromPtr): New utility function to
5710         store values dereferencing.
5711
5712 2002-02-20  Ravi Pratap  <ravi@ximian.com>
5713
5714         * expression.cs (Binary.ResolveOperator): Ensure that we are
5715         not trying to operate on a void type - this fixes the reported
5716         bug.
5717
5718         * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
5719         the parent implementation is sealed.
5720
5721         * ../errors/cs0239.cs : Add.
5722
5723         * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
5724
5725         * typemanager.cs (unverifiable_code_type): Corresponds to 
5726         System.Security.UnverifiableCodeAttribute. We need to emit this for modules
5727         which have unsafe code in them.
5728
5729         * rootcontext.cs (EmitCode): Emit the above attribute when we are in an 
5730         unsafe context.
5731
5732 2002-02-19  Miguel de Icaza  <miguel@ximian.com>
5733
5734         * cs-tokenizer.cs: Add support for @"litreal strings"
5735
5736         Make tokenizer accept pre-processor directives
5737         on any column (remove the old C-like limitation). 
5738
5739         * rootcontext.cs (EmitCode): Emit any global attributes.
5740         (AddGlobalAttributes): Used to keep track of assembly attributes. 
5741
5742         * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
5743
5744         * cs-parser.jay: Add support for global attributes.  
5745
5746 2002-02-17  Miguel de Icaza  <miguel@ximian.com>
5747
5748         * expression.cs (Indirection): New helper class.  Unary will
5749         create Indirection classes to be able to implement the
5750         IMemoryLocation interface on it.
5751
5752 2002-02-16  Miguel de Icaza  <miguel@ximian.com>
5753
5754         * cs-parser.jay (fixed_statement): reference the right statement.
5755
5756         * statement.cs (Fixed.Emit): Finish implementing the fixed
5757         statement for the &x case.
5758
5759 2002-02-14  Miguel de Icaza  <miguel@ximian.com>
5760
5761         * class.cs (Property.Define, Method.Define): Remove newslot when
5762         `implementing'.  
5763
5764         * modifiers.cs: My use of NewSlot when `Abstract' was set was
5765         wrong.  NewSlot should only be used if the `new' keyword is present.
5766
5767         * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
5768         locating our system dir.  Sorry about this.
5769
5770 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
5771
5772         * driver.cs (GetSystemDir): Compute correctly the location of our
5773         system assemblies.  I was using the compiler directory instead of
5774         the library directory.
5775
5776 2002-02-13  Ravi Pratap  <ravi@ximian.com>
5777
5778         * expression.cs (BetterFunction): Put back in what Miguel commented out
5779         since it is the correct fix. The problem is elsewhere ;-)
5780
5781         (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
5782         parameters of the parms method are themselves compatible or not !
5783
5784         (StandardConversionExists): Fix very dangerous bug where we were forgetting
5785         to check that a class implements an interface before saying that an implicit
5786         conversion was allowed. Use ImplementsInterface to do the checking.
5787
5788 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
5789
5790         * class.cs (Method.Define): Track whether we are an explicit
5791         implementation or not.  And only call DefineMethodOverride if we
5792         are an explicit implementation.
5793
5794         (Property.DefineMethod): Ditto.
5795
5796 2002-02-11  Ravi Pratap  <ravi@ximian.com>
5797
5798         * expression.cs (BetterFunction): Catch hideous bug which was
5799          preventing us from detecting ambiguous calls due to implicit casts i.e
5800         cs0121.
5801
5802 2002-01-29  Miguel de Icaza  <miguel@ximian.com>
5803
5804         * support.cs (Pair): Remove un-needed method.  I figured why I was
5805         getting the error in cs-parser.jay, the variable in a foreach loop
5806         is readonly, and the compiler does not really treat this as a variable.
5807
5808         * cs-parser.jay (fixed_statement): Fix grammar.  Use ASSIGN
5809         instead of EQUALS in grammar.  
5810
5811         * typemanager.cs (VerifyUnmanaged): Report correct error (208)
5812
5813         * expression.cs (Unary.DoResolve): Check whether the argument is
5814         managed or not.
5815
5816 2002-01-28  Miguel de Icaza  <miguel@ximian.com>
5817
5818         * support.cs: Api for Pair to set a value.  Despite the fact that
5819         the variables are public the MS C# compiler refuses to compile
5820         code that accesses the field if the variable is part of a foreach
5821         statement. 
5822
5823         * statement.cs (Fixed): Begin implementation of the fixed
5824         statement.
5825
5826         (Block.AddVariable): Return the VariableInfo on success and null
5827         on failure instead of true/false. 
5828
5829         * cs-parser.jay (foreach): Catch errors on variables already
5830         defined (we were ignoring this value before) and properly unwind
5831         the block hierarchy
5832
5833         (fixed_statement): grammar for the fixed statement.
5834
5835 2002-01-25  Miguel de Icaza  <miguel@ximian.com>
5836
5837         * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
5838         pointer types to be incretemented.
5839
5840         (SizeOf): Implement.
5841
5842         * cs-parser.jay (pointer_member_access): Implement
5843         expr->IDENTIFIER production.
5844
5845         * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
5846         MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
5847         on safe contexts.
5848
5849         (Unary): Implement indirection.
5850
5851         * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
5852         use in non-unsafe context).
5853
5854         (SimpleName.DoResolve): Check for pointers in field access on safe
5855         contexts. 
5856
5857         (Expression.LoadFromPtr): Factor the load-indirect code in this
5858         function.  This was duplicated in UnboxCast and ParameterReference
5859
5860 2002-01-24  Miguel de Icaza  <miguel@ximian.com>
5861
5862         * expression.cs (ComposedCast): report an error if a pointer cast
5863         is used in a safe region.
5864
5865         * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
5866         pointer type casts in unsafe context.
5867
5868         * codegen.cs (EmitContext): Set up IsUnsafe.
5869
5870         * cs-parser.jay (non_expression_type): Add productions for pointer
5871         casts. 
5872
5873         * expression.cs (Invocation.EmitCall): Remove chunk of buggy
5874         code.  We should not use force into static mode if the method is
5875         not virtual.  Fixes bug in MIS
5876
5877         * statement.cs (Do.Emit, While.Emit, For.Emit,
5878         Statement.EmitBoolExpression): Add support to Do and While to
5879         propagate infinite loop as `I do return' semantics.
5880
5881         Improve the For case to also test for boolean constants.
5882
5883         * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
5884         to the list of attributes we can add.
5885
5886         Remove `EmitContext' argument.
5887
5888         * class.cs (Method.Define): Apply parameter attributes.
5889         (Constructor.Define): Apply parameter attributes.
5890         (MethodCore.LabelParameters): Move here the core of labeling
5891         parameters. 
5892
5893         * support.cs (ReflectionParameters.ParameterModifier,
5894         InternalParameters.ParameterModifier): Use IsByRef on the type and
5895         only return the OUT bit for these parameters instead of in/out/ref
5896         flags.
5897
5898         This is because I miss-understood things.  The ParameterInfo.IsIn
5899         and IsOut represent whether the parameter has the [In] and [Out]
5900         attributes set.  
5901
5902 2002-01-22  Miguel de Icaza  <miguel@ximian.com>
5903
5904         * ecore.cs (FieldExpr.Emit): Release temporaries.
5905
5906         * assign.cs (LocalTemporary.Release): new function.
5907
5908         * codegen.cs (EmitContext.GetTemporaryStorage,
5909         EmitContext.FreeTemporaryStorage): Rework the way we deal with
5910         temporary storage.  Now we can "put back" localbuilders when we
5911         are done with them
5912
5913 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
5914
5915         * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
5916         need to make a copy of the variable to generate verifiable code.
5917
5918 2002-01-19  Miguel de Icaza  <miguel@ximian.com>
5919
5920         * driver.cs: Compute dynamically the system directory.
5921
5922         * ecore.cs (CopyNewMethods): reworked, exposed, made public.
5923         Slower, but more generally useful.  Used by the abstract
5924         registering implementation. 
5925
5926         * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
5927         the rules for the special rule on Type/instances.  First check if
5928         we have the same name, and if so, try that special static path
5929         rather than the instance path.
5930         
5931 2002-01-18  Miguel de Icaza  <miguel@ximian.com>
5932
5933         * cs-parser.jay: Emit 642 (warning: possible empty statement) for
5934         for, while and if.
5935
5936         * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
5937         Enum, ValueType, Delegate or Array for non-corlib compiles.
5938
5939         * cs-tokenizer.cs: Catch long identifiers (645)
5940
5941         * typemanager.cs (IndexerPropetyName): Ravi never tested this
5942         piece of code.
5943
5944         * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
5945         fix, we were returning too early, so we were not registering
5946         pending methods from abstract classes.
5947
5948         Do not register pending methods if the class is abstract.
5949
5950         * expression.cs (Conditional.DoResolve): Report circular implicit
5951         conversions when we neecd to compute it for conditional
5952         expressions. 
5953
5954         (Is.DoResolve): If the expression is always of the provided type,
5955         flag warning 183.  If the expression can not ever be of the
5956         provided type flag warning 184.
5957
5958         * class.cs: Catch 169 as well.
5959
5960         * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
5961         read. 
5962
5963 2002-01-18  Nick Drochak  <ndrochak@gol.com>
5964
5965         * makefile: remove path to beta2 csc.exe.  path to csc.exe must be in PATH instead.
5966
5967 2002-01-17  Miguel de Icaza  <miguel@ximian.com>
5968
5969         * interface.cs: (PopulateMethod): Check for pointers being defined
5970         only if the unsafe context is active.
5971         (PopulateProperty): ditto.
5972         (PopulateIndexer): ditto.
5973
5974         * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
5975         specified.  If pointers are present, make sure that they are
5976         present in an unsafe context.
5977         (Constructor, Constructor.Define): ditto.
5978         (Field, Field.Define): ditto.
5979         (Property, Property.Define): ditto.
5980         (Event, Event.Define): ditto.
5981
5982         * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
5983         hashtable if there are classes or structs defined.
5984
5985         * expression.cs (LocalVariableReference.DoResolve): Simplify this
5986         code, as the constant resolution moved.
5987
5988         * statement.cs (Block.EmitMeta): Resolve all constants as we emit
5989         the metadata, so we can flag error 133. 
5990
5991         * decl.cs (MemberCore.UnsafeOK): New function to test that a
5992         pointer is being declared in an unsafe context.
5993
5994 2002-01-16  Miguel de Icaza  <miguel@ximian.com>
5995
5996         * modifiers.cs (Modifiers.Check): Require a Location argument.
5997         Report error 227 for Unsafe use.
5998
5999         * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
6000
6001         * statement.cs (For.Emit): If the test is null, then report that
6002         we do `return', as we wont reach anything afterwards.
6003
6004         (Switch.SwitchGoverningType): Track the expression that matched
6005         the conversion.
6006
6007         * driver.cs: Allow negative numbers as an error code to flag.
6008
6009         * cs-parser.jay: Handle 1551.
6010
6011         * namespace.cs: Add 1537 checking (repeated using alias namespaces).
6012
6013 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
6014
6015         * cs-parser.jay: Report 1518 (type declaration can only contain
6016         class, struct, interface, enum or delegate)
6017
6018         (switch_label): Report 1523 (keywords `case' or `default' must
6019         preced code)
6020
6021         (opt_switch_sections): Report 1522 (empty switch)
6022
6023         * driver.cs: Report 1515 (response file specified multiple times)
6024         Report 1516 (Source file specified multiple times).
6025
6026         * expression.cs (Argument.Resolve): Signal 1510
6027
6028         (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
6029         access not allowed in static code)
6030
6031 2002-01-11  Ravi Pratap  <ravi@ximian.com>
6032
6033         * typemanager.cs (IsPointerType): Utility method which we are going
6034         to need a lot.
6035
6036         * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
6037         the object type, so we take care of that.
6038
6039         * expression.cs (FullMethodDesc): Also include the return type in descriptions.
6040         
6041         * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
6042         added to non-params parameters :-)
6043
6044         * typemanager.cs (CSharpName): Include 'void' type too. 
6045
6046         (void_ptr_type): Include in the set of core types.
6047
6048         * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of 
6049         duplicating code.
6050
6051         (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have 
6052         an unsafe context.
6053
6054         * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had 
6055         completely forgotten about it.
6056
6057 2002-01-10  Ravi Pratap  <ravi@ximian.com>
6058
6059         * cs-parser.jay (pointer_type): Add. This begins our implementation
6060         of parsing rules for unsafe code.
6061
6062         (unsafe_statement): Implement.
6063
6064         (embedded_statement): Modify to include the above.
6065
6066         * statement.cs (Unsafe): Implement new class for unsafe blocks.
6067
6068         * codegen.cs (EmitContext.InUnsafe): Add. This determines
6069         if the current context is an unsafe one.
6070
6071         * cs-parser.jay (local_variable_pointer_type): Since local variable types
6072         are handled differently, we need separate rules for them.
6073
6074         (local_variable_declaration): Update to use local_variable_pointer_type
6075         to allow variable declarations of unmanaged pointer types.
6076
6077         * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
6078         in unsafe contexts.
6079
6080         * ../errors/cs0214.cs : Add.
6081
6082 2002-01-16  Nick Drochak  <ndrochak@gol.com>
6083
6084         * makefile: remove 'response' file when cleaning.
6085
6086 2002-01-15  Miguel de Icaza  <miguel@ximian.com>
6087
6088         * cs-parser.jay: Report 1524.
6089
6090 2002-01-14  Miguel de Icaza  <miguel@ximian.com>
6091
6092         * typemanager.cs (RegisterMethod): drop checking if we have
6093         registered this from here
6094
6095 2002-01-12  Miguel de Icaza  <miguel@ximian.com>
6096
6097         * class.cs (Method.EmitDestructor): Implement calling our base
6098         destructor. 
6099
6100         * statement.cs (Try.Emit): Fix to reset the InFinally to the old
6101         value of InFinally.
6102
6103         * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
6104         this routine and will wrap the call in a try/catch block.  Deal
6105         with the case.
6106
6107 2002-01-11  Miguel de Icaza  <miguel@ximian.com>
6108
6109         * ecore.cs (Expression.MemberLookup): instead of taking a
6110         parameter `same_type' that was used to tell whether we could
6111         access private members we compute our containing type from the
6112         EmitContext.
6113
6114         (FieldExpr): Added partial support for volatile fields.  This does
6115         not work for volatile fields exposed from assemblies, as I can not
6116         figure out how to extract the modreq from it.
6117
6118         Updated all the source files to use this.
6119
6120         * codegen.cs (EmitContext): Compute ContainerType ahead of time,
6121         because it is referenced by MemberLookup very often. 
6122
6123 2002-01-09  Ravi Pratap  <ravi@ximian.com>
6124
6125         * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
6126         TypeBuilder.GetCustomAttributes to retrieve what we need.
6127
6128         Get rid of redundant default_member_attr_type as this is the same as
6129         default_member_type which already exists.
6130
6131         * interface.cs, attribute.cs : Update accordingly.
6132         
6133 2002-01-08  Miguel de Icaza  <miguel@ximian.com>
6134
6135         * typemanager.cs: Enable IndexerPropertyName again.  It does not
6136         work for TYpeBuilders though.  Ravi, can you please fix this?
6137
6138         * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
6139
6140         * expression.cs (Argument.Emit): Handle the case of ref objects
6141         being passed to ref functions;  
6142
6143         (ParameterReference.EmitLoad): Loads the content of the pointer
6144         without dereferencing.
6145
6146 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
6147
6148         * cs-tokenizer.cs: Implemented the pre-processing expressions.
6149
6150 2002-01-08  Ravi Pratap  <ravi@ximian.com>
6151
6152         * class.cs (Indexer.DefineMethod): Incorporate the interface
6153         type in the name of the method if we are doing explicit interface
6154         implementation.
6155
6156         * expression.cs (ConversionExists): Remove as it is completely obsolete.
6157
6158         (BetterConversion): Fix extremely trivial bug where we were referring to
6159         ConversionExists instead of StandardConversionExists ! Hooray, things are fine
6160         again !
6161
6162         * ../errors/bug16.cs : Add although we have fixed it.
6163
6164 2002-01-07  Miguel de Icaza  <miguel@ximian.com>
6165
6166         * expression.cs (BaseIndexer): Begin implementation.
6167
6168         * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
6169
6170         * cs-parser.jay (indexer_declarator): Use qualified_identifier
6171         production directly to remove a shift/reduce, and implement
6172         explicit interface implementation.
6173
6174         * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
6175         after a floating point suffix.
6176
6177         * expression.cs (DoNumericPromotions): Improved the conversion for
6178         uint/uint.  If we have a constant, we avoid doing a typecast to a
6179         larger type.
6180
6181         * class.cs (Indexer): Implement explicit interface implementation
6182         for indexers.
6183         
6184 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
6185
6186         * class.cs: make the default instance constructor public and hidebysig.
6187
6188 2001-01-03  Ravi Pratap  <ravi@ximian.com>
6189
6190         * interface.cs (EmitDefaultMemberAttr): Make this helper method static
6191         so we can call it from elsewhere.
6192
6193         * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
6194         we emit it internally if the class has a defined indexer; otherwise the user
6195         emits it by decorating the class definition with the DefaultMemberAttribute.
6196
6197         * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
6198         attribute is not used on a type which defines an indexer.
6199
6200         * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
6201         character when we skip whitespace.
6202
6203         * ../errors/cs0646.cs : Add.
6204
6205 2002-01-03  Miguel de Icaza  <miguel@ximian.com>
6206
6207         * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
6208         again. 
6209
6210         * makefile: Add practical target `mcs3.exe' which builds the third
6211         generation compiler. 
6212
6213         * expression.cs (New): Fix structures constructor calling.
6214
6215         * class.cs (Property, Method, Indexer): Emit Final flag on the
6216         method if we are an interface implementation and we are not
6217         abstract. 
6218
6219         * ecore.cs (PropertyExpr): New public field `IsBase', tells
6220         whether this property is referencing a `base' method.
6221
6222         * expression.cs (Invocation.EmitCall): take an extra argument:
6223         is_base, this is used to determine whether the `call' or
6224         `callvirt' opcode should be used.
6225
6226         
6227         * delegate.cs: update EmitCall.
6228
6229         * class.cs (Method.Define): Set NewSlot for the cases where we are
6230         not implementing an interface method.
6231
6232         (Property.Define): ditto.
6233
6234 2002-01-02  Miguel de Icaza  <miguel@ximian.com>
6235
6236         * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
6237         'r'.  Allows mcs to parse itself fully.
6238
6239 2002-01-02  Ravi Pratap  <ravi@ximian.com>
6240
6241         * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
6242         of the number of initializers that require the InitializeArray method.
6243
6244         (CheckIndices): Store the Expression in all cases - not the plain value. Also
6245         update the above field where necessary.
6246
6247         (MakeByteBlob): Update accordingly.
6248
6249         (DoEmit): Call EmitStaticInitializers only if the number of initializers is 
6250         greater than 2.
6251
6252         (EmitDynamicInitializers): Update in accordance with the new optimization.
6253
6254         (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
6255         same OpCode applies.
6256
6257         * cs-parser.jay : Fix some glaring errors I introduced.
6258
6259 2002-01-01  Ravi Pratap  <ravi@ximian.com> 
6260
6261         * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
6262         so that we can check for name clashes there too.
6263
6264         * typemanager.cs (default_member_attr_type): The attribute that we need to emit
6265         for interface indexers.
6266
6267         * interfaces.cs (Define): Emit the default member attribute.
6268
6269         * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
6270         variable was being referred to while setting the value ;-)
6271
6272 2002-01-01  Miguel de Icaza  <miguel@ximian.com>
6273
6274         * expression.cs (MakeByteBlob): Optimize: we do not need to fill
6275         byte-by-byte information when we know the data is zero.
6276
6277         Make the block always a multiple of 4, because
6278         DefineInitializedData has a bug.
6279
6280         * assign.cs: Fix, we should assign from the temporary, not from
6281         the source. 
6282
6283         * expression.cs (MakeByteBlob): Fix my incorrect code.
6284
6285 2001-12-31  Miguel de Icaza  <miguel@ximian.com>
6286
6287         * typemanager.cs (EnumToUnderlying): This function is used to get
6288         the underlying type from an enumeration, because it does not
6289         always work. 
6290
6291         * constant.cs: Use the I4_S form for values between -128 and 127.
6292
6293         * statement.cs (Block.LookupLabel): Looks up a label.
6294         (Block): Drop support for labeled blocks.
6295
6296         (LabeledStatement): New kind of statement that represents a label
6297         only.
6298
6299         (Goto): Finally implement this bad boy.
6300         
6301         * cs-parser.jay: Update to reflect new mechanism to implement
6302         labels.
6303
6304 2001-12-30  Miguel de Icaza  <miguel@ximian.com>
6305
6306         * codegen.cs (EmitContext.This): a codegen property that keeps the
6307         a single instance of this instead of creating many different this
6308         instances. 
6309
6310         * delegate.cs (Delegate.DoResolve): Update to use the property;
6311
6312         * ecore.cs (SimpleName.SimpleNameResolve): Ditto
6313
6314         * expression.cs (BaseAccess.DoResolve): Ditto.
6315
6316 2001-12-29  Ravi Pratap  <ravi@ximian.com>
6317
6318         * typemanager.cs (methodimpl_attr_type): Add to hold the type
6319         corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
6320
6321         (InitCoreTypes): Update accordingly.
6322
6323         * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
6324         so we can quickly store the state.
6325
6326         (ApplyAttributes): Set the correct implementation flags
6327         for InternalCall methods.
6328
6329 2001-12-29  Miguel de Icaza  <miguel@ximian.com>
6330
6331         * expression.cs (EmitCall): if a method is not virtual, then do
6332         not use callvirt on it.
6333
6334         (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
6335         user defined stuff) requires the use of stobj, which takes an
6336         address on the stack instead of an array and an index.  So emit
6337         the Ldelema operation for it.
6338
6339         (EmitStoreOpcode): Use stobj for valuetypes.
6340
6341         (UnaryMutator.EmitCode): Use the right 1 value depending on
6342         whether we are dealing with int64/uint64, float or doubles.
6343
6344         * class.cs (TypeContainer.AddConstructor): Fix the logic to define
6345         constructors that I implemented last night.
6346
6347         (Constructor.IsDefault): Fix to work properly for static
6348         constructors.
6349
6350         * cs-parser.jay (CheckDef): report method signature errors.
6351         Update error number 103 to be 132.
6352
6353         * decl.cs: New AdditionResult enumeration value: MethodExists.
6354         Although we do this check for methods later on in the semantic
6355         analysis, catching repeated default constructors is so easy that
6356         we catch these here. 
6357         
6358         * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
6359         promotions code.
6360
6361         (ParameterReference.EmitAssign, Emit): handle
6362         bools as bytes.
6363
6364         (ArrayAccess.EmitLoadOpcode): Handle bool type here.
6365         (ArrayAccess.EmitStoreOpcode): ditto.
6366
6367         * cs-tokenizer.cs (is_punct): Eliminated empty computation.
6368
6369         * expression.cs (MakeByteBlob): Complete all the missing types
6370         (uint, short, ushort, byte, sbyte)
6371
6372         * class.cs: Only init instance field initializers on instance
6373         constructors. 
6374
6375         Rename `constructors' to instance_constructors. 
6376
6377         (TypeContainer.AddConstructor): Only add constructors to the list
6378         if it is not static.
6379
6380         Make sure that we handle default_static_constructor independently
6381         everywhere where we handle instance_constructors
6382
6383 2001-12-28  Miguel de Icaza  <miguel@ximian.com>
6384
6385         * class.cs: Do not lookup or create a base initializer for a
6386         static constructor.
6387
6388         (ConstructorInitializer.Resolve): use the proper type to lookup
6389         for constructors.
6390
6391         * cs-parser.jay: Report error 1585 (modifiers between type and name).
6392
6393         * enum.cs, interface.cs: Remove CloseType, this is taken care by
6394         in DeclSpace. 
6395
6396         * decl.cs: CloseType is now an virtual method, the default
6397         implementation just closes this type.
6398         
6399 2001-12-28  Ravi Pratap  <ravi@ximian.com>
6400
6401         * attribute.cs (DefinePInvokeMethod): Set the implementation flags
6402         to PreserveSig by default. Also emit HideBySig on such methods.
6403
6404         Basically, set the defaults to standard values.
6405
6406         * expression.cs (Invocation.BetterFunction): We need to make sure that for each
6407         argument, if candidate is better, it can't be worse than the best !
6408
6409         (Invocation): Re-write bits to differentiate between methods being
6410         applicable in their expanded form and their normal form - for params
6411         methods of course.
6412
6413         Get rid of use_standard everywhere as only standard conversions are allowed
6414         in overload resolution. 
6415
6416         More spec conformance.
6417         
6418 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
6419
6420         * driver.cs: Add --timestamp, to see where the compiler spends
6421         most of its time.
6422
6423         * ecore.cs (SimpleName.DoResolve): Do not create an implicit
6424         `this' in static code.
6425
6426         (SimpleName.DoResolve): Implement in terms of a helper function
6427         that allows static-references to be passed upstream to
6428         MemberAccess.
6429
6430         (Expression.ResolveWithSimpleName): Resolve specially simple
6431         names when called by MemberAccess to implement the special
6432         semantics. 
6433
6434         (Expression.ImplicitReferenceConversion): Handle conversions from
6435         Null to reference types before others, as Null's type is
6436         System.Object. 
6437
6438         * expression.cs (Invocation.EmitCall): Handle the special case of
6439         calling methods declared on a reference type from a ValueType
6440         (Base classes System.Object and System.Enum)
6441
6442         (MemberAccess.Resolve): Only perform lookups on Enumerations if
6443         the left hand side is a TypeExpr, not on every enumeration. 
6444
6445         (Binary.Resolve): If types are reference types, then do a cast to
6446         object on operators != and == of both arguments.
6447         
6448         * typemanager.cs (FindMembers): Extract instance and static
6449         members if requested.
6450
6451         * interface.cs (PopulateProperty): Use void_type instead of null
6452         as the return type for the setter method.
6453
6454         (PopulateIndexer): ditto.
6455
6456 2001-12-27  Ravi Pratap  <ravi@ximian.com>
6457
6458         * support.cs (ReflectionParameters): Fix minor bug where we
6459         were examining the wrong parameter for the ParamArray attribute.
6460
6461         Cope with requests for the type of the parameter at position
6462         greater than the params parameter's. We now return the element
6463         type of the params array as that makes more sense.
6464
6465         * expression.cs (Invocation.IsParamsMethodApplicable): Update 
6466         accordingly as we no longer have to extract the element type
6467         ourselves.
6468
6469         (Invocation.OverloadResolve): Update.
6470
6471 2001-12-27  Miguel de Icaza  <miguel@ximian.com>
6472
6473         * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
6474         against IEnumerator, test whether the return value is a descendant
6475         of the IEnumerator interface.
6476
6477         * class.cs (Indexer.Define): Use an auxiliary method to implement
6478         the other bits of the method definition.  Begin support for
6479         explicit interface implementation.
6480
6481         (Property.DefineMethod): Use TypeManager.void_type instead of null
6482         for an empty return value.
6483
6484 2001-12-26  Miguel de Icaza  <miguel@ximian.com>
6485
6486         * expression.cs (MemberAccess.ResolveMemberAccess): if we are
6487         dealing with a FieldExpr which is composed of a FieldBuilder, in
6488         the code path we did extract the constant, but we should have
6489         obtained the underlying value to be able to cast it (otherwise we
6490         end up in an infinite loop, this is what Ravi was running into).
6491
6492         (ArrayCreation.UpdateIndices): Arrays might be empty.
6493
6494         (MemberAccess.ResolveMemberAccess): Add support for section
6495         14.5.4.1 that deals with the special case of E.I when E is a type
6496         and something else, that I can be a reference to a static member.
6497
6498         (ArrayCreation.MakeByteBlob): It is not an error to not be able to
6499         handle a particular array type to create byte blobs, it is just
6500         something we dont generate byteblobs for.
6501
6502         * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
6503         arguments. 
6504
6505         * location.cs (Push): remove the key from the hashtable that we
6506         are about to add.   This happens for empty files.
6507
6508         * driver.cs: Dispose files after we have parsed them.
6509
6510         (tokenize): new function that only runs the tokenizer on its
6511         input, for speed testing.
6512
6513 2001-12-26  Ravi Pratap  <ravi@ximian.com>
6514
6515         * class.cs (Event.Define): Define the private field only if there
6516         are no accessors defined.
6517
6518         * expression.cs (ResolveMemberAccess): If there is no associated
6519         field with the event, that means we have an event defined with its
6520         own accessors and we should flag error cs0070 since transforming
6521         ourselves into a field is not valid in that case.
6522
6523         * ecore.cs (SimpleName.DoResolve): Same as above.
6524
6525         * attribute.cs (DefinePInvokeMethod): Set the default calling convention
6526         and charset to sane values.
6527
6528 2001-12-25  Ravi Pratap  <ravi@ximian.com>
6529
6530         * assign.cs (DoResolve): Perform check on events only if they 
6531         are being accessed outside the declaring type.
6532
6533         * cs-parser.jay (event_declarations): Update rules to correctly
6534         set the type of the implicit parameter etc.
6535
6536         (add_accessor, remove_accessor): Set current local parameters.
6537
6538         * expression.cs (Binary): For delegate addition and subtraction,
6539         cast the return value from the method into the appropriate delegate
6540         type.
6541
6542 2001-12-24  Ravi Pratap  <ravi@ximian.com>
6543
6544         * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
6545         of these as the workaround is unnecessary.
6546
6547         * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
6548         delegate data - none of that is needed at all.
6549
6550         Re-write bits to extract the instance expression and the delegate method
6551         correctly.
6552
6553         * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator 
6554         on delegates too.
6555
6556         * attribute.cs (ApplyAttributes): New method to take care of common tasks
6557         of attaching attributes instead of duplicating code everywhere.
6558
6559         * everywhere : Update code to do attribute emission using the above method.
6560
6561 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
6562
6563         * expression.cs (IsParamsMethodApplicable): if there are not
6564         parameters, return immediately.
6565
6566         * ecore.cs: The 0 literal can be implicity converted to an enum
6567         type. 
6568
6569         (SimpleName.DoResolve): First lookup the type, then lookup the
6570         members. 
6571
6572         (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
6573         want to get its address.  If the InstanceExpression is not
6574         addressable, store the result in a temporary variable, then get
6575         the address of it.
6576
6577         * codegen.cs: Only display 219 errors on warning level or above. 
6578
6579         * expression.cs (ArrayAccess): Make it implement the
6580         IMemoryLocation interface.
6581
6582         (Binary.DoResolve): handle the operator == (object a, object b)
6583         and operator != (object a, object b) without incurring into a
6584         BoxedCast (because 5 != o should never be performed).
6585
6586         Handle binary enumerator operators.
6587
6588         (EmitLoadOpcode): Use Ldelema if the object we are loading is a
6589         value type, otherwise use Ldelem_ref.
6590
6591         Use precomputed names;
6592
6593         (AddressOf): Implement address of
6594
6595         * cs-parser.jay (labeled_statement): Fix recursive block
6596         addition by reworking the production.
6597
6598         * expression.cs (New.DoEmit): New has a special case:
6599                 
6600                  If we are dealing with a ValueType, we have a few
6601                  situations to deal with:
6602                 
6603                     * The target of New is a ValueType variable, that is
6604                       easy, we just pass this as the variable reference
6605                 
6606                     * The target of New is being passed as an argument,
6607                       to a boxing operation or a function that takes a
6608                       ValueType.
6609                 
6610                       In this case, we need to create a temporary variable
6611                       that is the argument of New.
6612
6613
6614 2001-12-23  Ravi Pratap  <ravi@ximian.com>
6615
6616         * rootcontext.cs (LookupType): Check that current_type is not null before
6617         going about looking at nested types.
6618
6619         * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
6620         not implement the IAssignMethod interface any more.
6621
6622         * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
6623         where we tranform them into FieldExprs if they are being resolved from within
6624         the declaring type.
6625
6626         * ecore.cs (SimpleName.DoResolve): Do the same here.
6627
6628         * assign.cs (DoResolve, Emit): Clean up code considerably. 
6629
6630         * ../errors/bug10.cs : Add.
6631
6632         * ../errors/cs0070.cs : Add.
6633
6634         * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
6635
6636         * assign.cs : Get rid of EventIsLocal everywhere.
6637         
6638 2001-12-23  Miguel de Icaza  <miguel@ximian.com>
6639
6640         * ecore.cs (ConvertIntLiteral): finished the implementation.
6641
6642         * statement.cs (SwitchLabel): Convert the value we are using as a
6643         key before looking up the table.
6644
6645 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
6646
6647         * codegen.cs (EmitTopBlock): Require a Location argument now.
6648
6649         * cs-parser.jay (constructor_declarator): We need to setup
6650         current_local_parameters before we parse the
6651         opt_constructor_initializer, to allow the variables to be bound
6652         to the constructor arguments.
6653
6654         * rootcontext.cs (LookupType): First lookup nested classes in our
6655         class and our parents before we go looking outside our class.
6656
6657         * expression.cs (ConstantFold): Extract/debox the values at the
6658         beginnning. 
6659
6660         * rootcontext.cs (EmitCode): Resolve the constants first before we
6661         resolve the types.  This is not really needed, but it helps debugging.
6662
6663         * statement.cs: report location.
6664         
6665         * cs-parser.jay: pass location to throw statement.
6666
6667         * driver.cs: Small bug fix.
6668
6669         * report.cs: Updated format to be 4-zero filled digits.
6670
6671 2001-12-22  Ravi Pratap  <ravi@ximian.com>
6672
6673         * expression.cs (CheckIndices): Fix minor bug where the wrong
6674         variable was being referred to ;-)
6675
6676         (DoEmit): Do not call EmitStaticInitializers when the 
6677         underlying type is System.Object.
6678
6679 2001-12-21  Ravi Pratap  <ravi@ximian.com>
6680
6681         * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
6682         and do the usual workaround for SRE.
6683
6684         * class.cs (MyEventBuilder.EventType): New member to get at the type
6685         of the event, quickly.
6686
6687         * expression.cs (Binary.ResolveOperator): Handle delegate addition.
6688
6689         * assign.cs (Assign.DoResolve): Handle the case when the target
6690         is an EventExpr and perform the necessary checks.
6691
6692         * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
6693         interface.
6694
6695         (SimpleName.MemberStaticCheck): Include check for EventExpr.
6696
6697         (EventExpr): Set the type in the constructor itself since we 
6698         are meant to be born fully resolved.
6699
6700         (EventExpr.Define): Revert code I wrote earlier.
6701                 
6702         * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
6703         instance expression is null. The instance expression is a This in that case
6704         or a null, depending on whether it is a static method or not.
6705
6706         Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
6707         refers to more than one method.
6708
6709         * assign.cs (DoResolve): Check whether the event belongs to the same Type container
6710         and accordingly flag errors.
6711
6712 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
6713
6714         * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
6715
6716 2001-12-22  Miguel de Icaza  <miguel@ximian.com>
6717
6718         * location.cs (ToString): Provide useful rutine.
6719
6720 2001-12-21  Miguel de Icaza  <miguel@ximian.com>
6721
6722         * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
6723         objects, return the actual integral boxed.
6724
6725         * statement.cs (SwitchLabel): define an ILLabel for each
6726         SwitchLabel. 
6727         
6728         (Switch.CheckSwitch): If the value is a Literal, extract
6729         the underlying literal.
6730         
6731         Also in the unused hashtable we had, add the SwitchLabel so we can
6732         quickly look this value up.
6733
6734         * constant.cs: Implement a bunch of new constants.  Rewrite
6735         Literal based on this.  Made changes everywhere to adapt to this.
6736         
6737         * expression.cs (Expression.MakeByteBlob): Optimize routine by
6738         dereferencing array only once, and also copes with enumrations.
6739
6740         bytes are two bytes wide, not one.
6741
6742         (Cast): Perform constant conversions.
6743         
6744         * ecore.cs (TryImplicitIntConversion): Return literals instead of
6745         wrappers to the literals here.
6746
6747         * expression.cs (DoNumericPromotions): long literals can converted
6748         to ulong implicity (this is taken care of elsewhere, but I was
6749         missing this spot).
6750
6751         * ecore.cs (Expression.Literalize): Make the return type Literal,
6752         to improve type checking.
6753
6754         * rootcontext.cs: Lookup for nested classes in our class hierarchy.
6755
6756 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
6757
6758         * literal.cs: Revert code from ravi that checked the bounds.  The
6759         bounds are sane by the definition of the type itself. 
6760
6761         * typemanager.cs: Fix implementation of ImplementsInterface.  We
6762         need to actually look up in our parent hierarchy for interfaces
6763         implemented. 
6764
6765         * const.cs: Use the underlying type for enumerations
6766
6767         * delegate.cs: Compute the basename for the delegate creation,
6768         that should fix the delegate test case, and restore the correct
6769         Type Lookup semantics in rootcontext
6770
6771         * rootcontext.cs: Revert Ravi's last patch.  The correct way of
6772         referencing a nested type with the Reflection API is using the "+"
6773         sign. 
6774
6775         * cs-parser.jay: Do not require EOF token at the end.
6776
6777 2001-12-20  Ravi Pratap  <ravi@ximian.com>
6778
6779         * rootcontext.cs (LookupType): Concatenate type names with
6780         a '.' instead of a '+' The test suite passes again.
6781
6782         * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
6783         field of the enumeration.
6784
6785         * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
6786         the case when the member is an EventExpr.
6787
6788         * ecore.cs (EventExpr.InstanceExpression): Every event which is not
6789         static has an associated instance expression.
6790
6791         * typemanager.cs (RegisterEvent): The usual workaround, now for events.
6792
6793         (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
6794
6795         * class.cs (Event.Define): Register event and perform appropriate checks
6796         for error #111.
6797
6798         We define the Add and Remove methods even if the use provides none because
6799         in that case, we provide default implementations ourselves.
6800
6801         Define a private field of the type of the event. This is done by the CSC compiler
6802         and we should be doing it too ;-)
6803
6804         * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
6805         More methods we use in code we generate.
6806
6807         (multicast_delegate_type, delegate_type): Two separate types since the distinction
6808         is important.
6809
6810         (InitCoreTypes): Update accordingly for the above.
6811
6812         * class.cs (Event.Emit): Generate code for default accessors that we provide
6813
6814         (EmitDefaultMethod): Do the job in the above.
6815
6816         * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the 
6817         appropriate place.
6818
6819 2001-12-20  Miguel de Icaza  <miguel@ximian.com>
6820
6821         * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
6822         builders even if we were missing one.
6823
6824         * interface.cs, class.cs, enum.cs: When calling DefineNestedType
6825         pass the Basename as our class name instead of the Name.  The
6826         basename will be correctly composed for us.
6827
6828         * parameter.cs (Paramters): Now takes a Location argument.
6829
6830         * decl.cs (DeclSpace.LookupType): Removed convenience function and
6831         make all the code call directly LookupType in RootContext and take
6832         this chance to pass the Location information everywhere.
6833
6834         * Everywhere: pass Location information.
6835
6836 2001-12-19  Miguel de Icaza  <miguel@ximian.com>
6837
6838         * class.cs (Constructor.Define): Updated way of detecting the
6839         length of the parameters.
6840
6841         (TypeContainer.DefineType): Use basename as the type name for
6842         nested types.
6843
6844         (TypeContainer.Define): Do not recursively define types here, as
6845         definition is taken care in order by the RootContext.
6846
6847         * tree.cs: Keep track of namespaces in a per-file basis.
6848
6849         * parameter.cs (Parameter.ComputeSignature): Update to use
6850         DeclSpace. 
6851
6852         (Parameters.GetSignature): ditto.
6853
6854         * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
6855         instead of a TypeContainer.
6856
6857         (Interface.SemanticAnalysis): Use `this' instead of our parent to
6858         resolve names.  Because we need to be resolve in our context, not
6859         our parents.
6860         
6861         * driver.cs: Implement response files.
6862
6863         * class.cs (TypeContainer.DefineType): If we are defined, do not
6864         redefine ourselves.
6865         
6866         (Event.Emit): Emit the code for add/remove handlers.
6867         (Event.Define): Save the MethodBuilders for add/remove.
6868
6869         * typemanager.cs: Use pair here too.
6870
6871         * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
6872         DictionaryEntry requires the first argument to be non-null.  
6873         
6874         (enum_declaration): Compute full name for registering the
6875         enumeration.
6876         
6877         (delegate_declaration): Instead of using
6878         formal_parameter_list, use opt_formal_parameter_list as the list
6879         can be empty.
6880
6881         * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
6882         (EventParsing): New property that controls whether `add' and
6883         `remove' are returned as tokens or identifiers (for events);
6884
6885 2001-12-19  Ravi Pratap  <ravi@ximian.com>
6886
6887         * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
6888         use MyEventBuilder only and let it wrap the real builder for us.
6889
6890         (MyEventBuilder): Revamp constructor etc.
6891
6892         Implement all operations that we perform on EventBuilder in precisely the same
6893         way here too.
6894
6895         (FindMembers): Update to use the EventBuilder member.
6896
6897         (Event.Emit): Update accordingly.
6898
6899 2001-12-18  Ravi Pratap  <ravi@ximian.com>
6900
6901         * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
6902         by calling the appropriate methods.
6903
6904         (GetCustomAttributes): Make stubs as they cannot possibly do anything
6905         useful.
6906
6907         (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
6908
6909 2001-12-17  Ravi Pratap  <ravi@ximian.com>
6910
6911         * delegate.cs (Delegate.Populate): Check that the return type
6912         and various parameters types are indeed accessible.
6913
6914         * class.cs (Constructor.Define): Same here.
6915
6916         (Field.Define): Ditto.
6917
6918         (Event.Define): Ditto.
6919
6920         (Operator.Define): Check that the underlying Method defined itself
6921         correctly - so it's MethodBuilder should not be null.
6922
6923         * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
6924         expression happens to be null.
6925
6926         * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
6927         members but as of now we don't seem to be able to do anything really useful with it.
6928
6929         (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
6930         not the EventBuilder.
6931
6932 2001-12-18  Miguel de Icaza  <miguel@ximian.com>
6933
6934         * cs-tokenizer.cs: Add support for defines.
6935         Add support for #if, #elif, #else, #endif
6936         
6937         (eval_var): evaluates a variable.
6938         (eval): stubbed for evaluating functions.
6939
6940         * cs-parser.jay: Pass the defines information
6941
6942         * driver.cs: Add --define command line option.
6943
6944         * decl.cs: Move MemberCore here.
6945
6946         Make it the base class for DeclSpace.  This allows us to catch and
6947         report 108 and 109 for everything now.
6948
6949         * class.cs (TypeContainer.Define): Extract all the members
6950         before populating and emit the warning 108 (new keyword required
6951         to override) instead of having each member implement this.
6952
6953         (MemberCore.Define): New abstract method, we will be using this in
6954         the warning reporting engine in Populate.
6955         
6956         (Operator.Define): Adjust to new MemberCore protocol. 
6957
6958         * const.cs (Const): This does not derive from Expression, it is a
6959         temporary object we use to create fields, it is a MemberCore. 
6960
6961         * class.cs (Method.Define): Allow the entry point to be in a
6962         specific class.
6963
6964         * driver.cs: Rewrite the argument handler to clean it up a bit.
6965
6966         * rootcontext.cs: Made it just an auxiliary namespace feature by
6967         making everything static.
6968
6969         * driver.cs: Adapt code to use RootContext type name instead of
6970         instance variable.
6971
6972         * delegate.cs: Remove RootContext argument.
6973
6974         * class.cs: (Struct, TypeContainer, Class): Remove RootContext
6975         argument. 
6976
6977         * class.cs (Event.Define): The lookup can fail.
6978         
6979         * cs-tokenizer.cs: Begin implementation of pre-procesor. 
6980
6981         * expression.cs: Resolve the this instance before invoking the code.
6982
6983 2001-12-17  Miguel de Icaza  <miguel@ximian.com>
6984
6985         * cs-parser.jay: Add a production in element_access that allows
6986         the thing to become a "type" reference.  This way we can parse
6987         things like "(string [])" as a type.
6988
6989         Note that this still does not handle the more complex rules of
6990         casts. 
6991         
6992
6993         * delegate.cs (Delegate.Populate): Register the delegage constructor builder here. 
6994
6995         * ecore.cs: (CopyNewMethods): new utility function used to
6996         assemble the list of methods from running FindMembers.
6997
6998         (MemberLookup): Rework FindMembers so that 
6999
7000 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
7001
7002         * class.cs (TypeContainer): Remove Delegates who fail to be
7003         defined.
7004
7005         * delegate.cs (Populate): Verify that we dont get null return
7006         values.   TODO: Check for AsAccessible.
7007
7008         * cs-parser.jay: Use basename to emit error 574 (destructor should
7009         have the same name as container class), not the full name.
7010
7011         * cs-tokenizer.cs (adjust_int): Fit the integer in the best
7012         possible representation.  
7013
7014         Also implements integer type suffixes U and L.
7015
7016 2001-12-15  Miguel de Icaza  <miguel@ximian.com>
7017
7018         * expression.cs (ArrayCreation.DoResolve): We need to do the
7019         argument resolution *always*.
7020
7021         * decl.cs: Make this hold the namespace.  Hold the root context as
7022         well.
7023         (LookupType): Move here.
7024
7025         * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
7026
7027         * location.cs (Row, Name): Fixed the code, it was always returning
7028         references to the first file.
7029
7030         * interface.cs: Register properties defined through interfaces.
7031
7032         * driver.cs: Add support for globbing on the command line
7033
7034         * class.cs (Field): Make it derive from MemberCore as well.
7035         (Event): ditto.
7036
7037 2001-12-15  Ravi Pratap  <ravi@ximian.com>
7038
7039         * class.cs (Event::Define): Check that the type of the event is a delegate
7040         type else flag error #66.
7041
7042         Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
7043         same.
7044
7045         * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
7046         values of EntryPoint, CharSet etc etc.
7047
7048         Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
7049
7050         * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
7051         be null and we should ignore this. I am not sure if this is really clean. Apparently,
7052         there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
7053         which needs this to do its work.
7054
7055         * ../errors/cs0066.cs : Add.
7056
7057 2001-12-14  Miguel de Icaza  <miguel@ximian.com>
7058
7059         * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
7060         helper functions.
7061
7062         * class.cs: (MethodSignature.MethodSignature): Removed hack that
7063         clears out the parameters field.
7064         (MemberSignatureCompare): Cleanup
7065
7066         (MemberCore): New base class used to share code between MethodCore
7067         and Property.
7068
7069         (RegisterRequiredImplementations) BindingFlags.Public requires
7070         either BindingFlags.Instace or Static.  Use instance here.
7071
7072         (Property): Refactored code to cope better with the full spec.
7073
7074         * parameter.cs (GetParameterInfo): Return an empty array instead
7075         of null on error.
7076
7077         * class.cs (Property): Abstract or extern properties have no bodies.
7078
7079         * parameter.cs (GetParameterInfo): return a zero-sized array.
7080
7081         * class.cs (TypeContainer.MethodModifiersValid): Move all the
7082         method modifier validation to the typecontainer so we can reuse
7083         this on properties.
7084
7085         (MethodCore.ParameterTypes): return an empty sized array of types.
7086
7087         (Property.Define): Test property modifier validity.
7088
7089         Add tests for sealed/override too.
7090
7091         (Method.Emit): abstract or extern methods have no bodies.
7092
7093 2001-12-14  Ravi Pratap  <ravi@ximian.com>
7094
7095         * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
7096         thing.
7097
7098         (Method::Define, ::Emit): Modify accordingly.
7099
7100         * expression.cs (Invocation::OverloadResolve): Handle error # 121.
7101
7102         (ArrayCreation::MakeByteBlob): Handle floats and doubles.
7103
7104         * makefile: Pass in /unsafe.
7105
7106 2001-12-13  Miguel de Icaza  <miguel@ximian.com>
7107
7108         * class.cs (MakeKey): Kill routine.
7109         
7110         * class.cs (TypeContainer.Define): Correctly define explicit
7111         method implementations (they require the full interface name plus
7112         the method name).
7113
7114         * typemanager.cs: Deply the PtrHashtable here and stop using the
7115         lame keys.  Things work so much better.
7116
7117         This of course broke everyone who depended on `RegisterMethod' to
7118         do the `test for existance' test.  This has to be done elsewhere.
7119
7120         * support.cs (PtrHashtable): A hashtable that avoid comparing with
7121         the object stupid Equals method (because, that like fails all over
7122         the place).  We still do not use it.
7123
7124         * class.cs (TypeContainer.SetRequiredInterface,
7125         TypeContainer.RequireMethods): Killed these two routines and moved
7126         all the functionality to RegisterRequiredImplementations.
7127
7128         (TypeContainer.RegisterRequiredImplementations): This routine now
7129         registers all the implementations required in an array for the
7130         interfaces and abstract methods.  We use an array of structures
7131         which can be computed ahead of time to reduce memory usage and we
7132         also assume that lookups are cheap as most classes will not
7133         implement too many interfaces.
7134
7135         We also avoid creating too many MethodSignatures.
7136
7137         (TypeContainer.IsInterfaceMethod): Update and optionally does not
7138         clear the "pending" bit if we find that there are problems with
7139         the declaration.
7140
7141         (TypeContainer.VerifyPendingMethods): Update to report errors of
7142         methods that look like implementations but are not.
7143
7144         (TypeContainer.Define): Add support for explicit interface method
7145         implementation. 
7146         
7147 2001-12-12  Miguel de Icaza  <miguel@ximian.com>
7148
7149         * typemanager.cs: Keep track of the parameters here instead of
7150         being a feature of the TypeContainer.
7151
7152         * class.cs: Drop the registration of parameters here, as
7153         InterfaceMethods are also interface declarations.
7154
7155         * delegate.cs: Register methods with the TypeManager not only with
7156         the TypeContainer.  This code was buggy.
7157
7158         * interface.cs: Full registation here.
7159
7160 2001-12-11  Miguel de Icaza  <miguel@ximian.com>
7161
7162         * expression.cs: Remove reducer for binary expressions, it can not
7163         be done this way.
7164
7165         * const.cs: Put here the code that used to go into constant.cs
7166
7167         * constant.cs: Put here the code for constants, this is a new base
7168         class for Literals.
7169
7170         * literal.cs: Make Literal derive from Constant.
7171
7172 2001-12-09  Miguel de Icaza  <miguel@ximian.com>
7173
7174         * statement.cs (Return.Emit): Report error 157 if the user
7175         attempts to return from a finally block.
7176
7177         (Return.Emit): Instead of emitting a return, jump to the end of
7178         the function.
7179
7180         * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
7181         LocalBuilder to store the result of the function.  ReturnLabel is
7182         the target where we jump.
7183         
7184
7185 2001-12-09  Radek Doulik  <rodo@ximian.com>
7186
7187         * cs-parser.jay: remember alias in current namespace
7188
7189         * ecore.cs (SimpleName::DoResolve): use aliases for types or
7190         namespaces
7191
7192         * class.cs (LookupAlias): lookup alias in my_namespace
7193
7194         * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
7195         aliases hashtable
7196         (LookupAlias): lookup alias in this and if needed in parent
7197         namespaces
7198
7199 2001-12-08  Miguel de Icaza  <miguel@ximian.com>
7200
7201         * support.cs: 
7202
7203         * rootcontext.cs: (ModuleBuilder) Made static, first step into
7204         making things static.  I need this to avoid passing the
7205         TypeContainer when calling ParameterType.
7206
7207         * support.cs (InternalParameters.ParameterType): Remove ugly hack
7208         that did string manipulation to compute the type and then call
7209         GetType.  Use Parameter.ParameterType instead.
7210
7211         * cs-tokenizer.cs: Consume the suffix for floating values.
7212
7213         * expression.cs (ParameterReference): figure out whether this is a
7214         reference parameter or not.  Kill an extra variable by computing
7215         the arg_idx during emission.
7216
7217         * parameter.cs (Parameters.GetParameterInfo): New overloaded
7218         function that returns whether a parameter is an out/ref value or not.
7219
7220         (Parameter.ParameterType): The type of the parameter (base,
7221         without ref/out applied).
7222         
7223         (Parameter.Resolve): Perform resolution here.
7224         (Parameter.ExternalType): The full type (with ref/out applied).
7225
7226         * statement.cs (Using.Emit, Using.EmitExpression): Implement
7227         support for expressions on the using statement.
7228
7229 2001-12-07  Miguel de Icaza  <miguel@ximian.com>
7230
7231         * statement.cs (Using.EmitLocalVariableDecls): Split the
7232         localvariable handling of the using statement.
7233
7234         (Block.EmitMeta): Keep track of variable count across blocks.  We
7235         were reusing slots on separate branches of blocks.
7236
7237         (Try.Emit): Emit the general code block, we were not emitting it. 
7238
7239         Check the type of the declaration to be an IDisposable or
7240         something that can be implicity converted to it. 
7241
7242         Emit conversions if required.
7243
7244         * ecore.cs (EmptyExpression): New utility class.
7245         (Expression.ImplicitConversionExists): New utility function.
7246
7247 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
7248
7249         * statement.cs (Using): Implement.
7250
7251         * expression.cs (LocalVariableReference): Support read only variables.
7252
7253         * statement.cs: Remove the explicit emit for the Leave opcode.
7254         (VariableInfo): Add a readonly field.
7255
7256 2001-12-05  Miguel de Icaza  <miguel@ximian.com>
7257
7258         * ecore.cs (ConvCast): new class used to encapsulate the various
7259         explicit integer conversions that works in both checked and
7260         unchecked contexts.
7261
7262         (Expression.ConvertNumericExplicit): Use new ConvCast class to
7263         properly generate the overflow opcodes.
7264
7265 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
7266
7267         * statement.cs: The correct type for the EmptyExpression is the
7268         element_type, not the variable type.  Ravi pointed this out.
7269
7270 2001-12-04  Ravi Pratap  <ravi@ximian.com>
7271
7272         * class.cs (Method::Define): Handle PInvoke methods specially
7273         by using DefinePInvokeMethod instead of the usual one.
7274
7275         * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
7276         above to do the task of extracting information and defining the method.
7277         
7278 2001-12-04  Ravi Pratap  <ravi@ximian.com>
7279
7280         * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
7281         of the condition for string type.
7282
7283         (Emit): Move that here. 
7284
7285         (ArrayCreation::CheckIndices): Keep string literals in their expression
7286         form.
7287
7288         (EmitDynamicInitializers): Handle strings appropriately.
7289
7290 2001-12-04  Miguel de Icaza  <miguel@ximian.com>
7291
7292         * codegen.cs (EmitContext): Replace multiple variables with a
7293         single pointer to the current Switch statement.
7294
7295         * statement.cs (GotoDefault, Switch): Adjust to cleaned up
7296         EmitContext.
7297
7298 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
7299
7300         * statement.cs 
7301
7302         * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
7303         default'.
7304         
7305         (Foreach.Emit): Foreach on arrays was not setting
7306         up the loop variables (for break/continue).
7307
7308         (GotoCase): Semi-implented.
7309         
7310 2001-12-03  Ravi Pratap  <ravi@ximian.com>
7311
7312         * attribute.cs (CheckAttribute): Handle system attributes by using
7313         Attribute.GetAttributes to examine information we need.
7314
7315         (GetValidPlaces): Same here.
7316
7317         * class.cs (Method::Define): Catch invalid use of extern and abstract together.
7318
7319         * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
7320
7321         * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
7322
7323         (Method::Define): Set appropriate flags if we have a DllImport attribute.
7324
7325         (Method::Emit): Handle the case when we are a PInvoke method.
7326
7327 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
7328
7329         * expression.cs: Use ResolveWithSimpleName on compound names.
7330
7331 2001-12-02  Ravi Pratap  <ravi@ximian.com>
7332
7333         * constant.cs (EmitConstant): Make sure we resolve the associated expression
7334         before trying to reduce it.
7335
7336         * typemanager.cs (RegisterConstant, LookupConstant): Implement.
7337
7338         * constant.cs (LookupConstantValue): Implement.
7339
7340         (EmitConstant): Use the above in emitting the constant.
7341
7342         * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
7343         that are user-defined by doing a LookupConstantValue on them.
7344
7345         (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
7346         too, like above.
7347
7348 2001-11-29  Miguel de Icaza  <miguel@ximian.com>
7349
7350         * expression.cs (BaseAccess, BaseIndexer): Also split this out.
7351
7352         (BaseAccess.DoResolve): Implement.
7353
7354         (MemberAccess.DoResolve): Split this routine into a
7355         ResolveMemberAccess routine that can be used independently
7356
7357 2001-11-28  Miguel de Icaza  <miguel@ximian.com>
7358
7359         * expression.cs (Probe, Is, As): Split Probe in two classes Is and
7360         As that share bits of the implementation.  Is returns a boolean,
7361         while As returns the Type that is being probed.
7362
7363 2001-12-01  Ravi Pratap  <ravi@ximian.com>
7364
7365         * enum.cs (LookupEnumValue): Re-write various bits, return an object value
7366         instead of a Literal - much easier.
7367
7368         (EnumInTransit): Remove - utterly useless :-)
7369
7370         (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
7371
7372         * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
7373
7374         * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
7375         chain when we have no associated expression.
7376
7377 2001-11-30  Ravi Pratap  <ravi@ximian.com>
7378
7379         * constant.cs (Define): Use Location while reporting the errror.
7380
7381         Also emit a warning when 'new' is used and there is no inherited
7382         member to hide.
7383
7384         * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being 
7385         populated.
7386
7387         (LookupEnumValue): Implement to lookup an enum member's value and define it
7388         if necessary.
7389
7390         (Populate): Re-write accordingly to use the above routine.
7391
7392 2001-11-27  Miguel de Icaza  <miguel@ximian.com>
7393
7394         * expression.cs (This): Fix prototype for DoResolveLValue to
7395         override the base class DoResolveLValue.
7396
7397         * cs-parser.cs: Report errors cs574 and cs575 (destructor
7398         declarations) 
7399
7400         * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
7401         (we need to load the address of the field here).  This fixes
7402         test-22. 
7403         
7404         (FieldExpr.DoResolveLValue): Call the DoResolve
7405         function to initialize the Instance expression.
7406         
7407         * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
7408         correctly the GetEnumerator operation on a value type.
7409
7410         * cs-parser.jay: Add more simple parsing error catches.
7411
7412         * statement.cs (Switch): Add support for string switches.
7413         Handle null specially.
7414
7415         * literal.cs (NullLiteral): Make NullLiteral objects singletons. 
7416
7417 2001-11-28  Ravi Pratap  <ravi@ximian.com>
7418
7419         * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
7420
7421         (declare_local_constant): New helper function.
7422
7423         * statement.cs (AddConstant): Keep a separate record of constants
7424
7425         (IsConstant): Implement to determine if a variable is a constant.
7426
7427         (GetConstantExpression): Implement.
7428
7429         * expression.cs (LocalVariableReference): Handle the case when it is a constant.
7430
7431         * statement.cs (IsVariableDefined): Re-write.
7432
7433 2001-11-27  Ravi Pratap  <ravi@ximian.com>
7434
7435         * class.cs (TypeContainer::FindMembers): Look for constants
7436         in the case when we are looking for MemberTypes.Field
7437
7438         * expression.cs (MemberAccess::DoResolve): Check that in the
7439         case we are a FieldExpr and a Literal, we are not being accessed
7440         by an instance reference.
7441
7442         * cs-parser.jay (local_constant_declaration): Implement.
7443
7444         (declaration_statement): Implement for constant declarations.
7445
7446 2001-11-26  Miguel de Icaza  <miguel@ximian.com>
7447
7448         * statement.cs (Switch): Catch double defaults.
7449
7450         (Switch): More work on the switch() statement
7451         implementation.  It works for integral values now, need to finish
7452         string support.
7453
7454
7455 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
7456
7457         * ecore.cs (Expression.ConvertIntLiteral): New function to convert
7458         integer literals into other integer literals.  To be used by
7459         switch. 
7460
7461 2001-11-24  Ravi Pratap  <ravi@ximian.com>
7462
7463         * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
7464         some memory.
7465
7466         (EmitDynamicInitializers): Cope with the above since we extract data
7467         directly from ArrayData now.
7468
7469         (ExpectInitializers): Keep track of whether initializers are mandatory
7470         or not.
7471
7472         (Bounds): Make it a hashtable to prevent the same dimension being 
7473         recorded for every element in that dimension.
7474
7475         (EmitDynamicInitializers): Fix bug which prevented the Set array method
7476         from being found.
7477
7478         Also fix bug which was causing the indices to be emitted in the reverse
7479         order.
7480
7481 2001-11-24  Miguel de Icaza  <miguel@ximian.com>
7482
7483         * expression.cs (ArrayCreation): Implement the bits that Ravi left
7484         unfinished.  They do not work, because the underlying code is
7485         sloppy.
7486
7487 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
7488
7489         * cs-parser.jay: Remove bogus fixme.
7490
7491         * statement.cs (Switch, SwitchSection, SwithLabel): Started work
7492         on Switch statement.
7493         
7494 2001-11-23  Ravi Pratap  <ravi@ximian.com>
7495
7496         * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
7497         the same. 
7498         
7499         * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
7500         parameter. Apparently, any expression is allowed. 
7501
7502         (ValidateInitializers): Update accordingly.
7503
7504         (CheckIndices): Fix some tricky bugs thanks to recursion.
7505
7506         * delegate.cs (NewDelegate::DoResolve): Re-write large portions as 
7507         I was being completely brain-dead.
7508
7509         (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
7510         and re-write acordingly.
7511
7512         (DelegateInvocation): Re-write accordingly.
7513
7514         * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
7515
7516         (MakeByteBlob): Handle types more correctly.
7517
7518         * expression.cs (ArrayCreation:Emit): Write preliminary code to do
7519         initialization from expressions but it is incomplete because I am a complete
7520         Dodo :-|
7521
7522 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
7523
7524         * statement.cs (If.Emit): Fix a bug that generated incorrect code
7525         on If.  Basically, we have to return `true' (ie, we do return to
7526         our caller) only if both branches of the if return.
7527
7528         * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
7529         short-circuit operators, handle them as short circuit operators. 
7530
7531         (Cast.DoResolve): Resolve type.
7532         (Cast.Cast): Take an expression as the target type.
7533
7534         * cs-parser.jay (cast_expression): Remove old hack that only
7535         allowed a limited set of types to be handled.  Now we take a
7536         unary_expression and we resolve to a type during semantic
7537         analysis.
7538
7539         Use the grammar productions from Rhys to handle casts (this is
7540         not complete like Rhys syntax yet, we fail to handle that corner
7541         case that C# has regarding (-x), but we will get there.
7542         
7543 2001-11-22  Ravi Pratap  <ravi@ximian.com>
7544
7545         * class.cs (EmitFieldInitializer): Take care of the case when we have a
7546         field which is an array type.
7547
7548         * cs-parser.jay (declare_local_variables): Support array initialization too.
7549
7550         * typemanager.cs (MakeKey): Implement.
7551
7552         (everywhere): Use the above appropriately.
7553
7554         * cs-parser.jay (for_statement): Update for array initialization while
7555         declaring variables.
7556
7557         * ecore.cs : The error message was correct, it's the variable's names that
7558         were misleading ;-) Make the code more readable.
7559
7560         (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
7561         the correct type etc.
7562
7563         (ConvertExplicit): Handle Enum types by examining the underlying type.
7564
7565 2001-11-21  Ravi Pratap  <ravi@ximian.com>
7566
7567         * parameter.cs (GetCallingConvention): Always return
7568         CallingConventions.Standard for now.
7569
7570 2001-11-22  Miguel de Icaza  <miguel@ximian.com>
7571
7572         * expression.cs (Binary.ResolveOperator): Update the values of `l'
7573         and `r' after calling DoNumericPromotions.
7574
7575         * ecore.cs: Fix error message (the types were in the wrong order).
7576
7577         * statement.cs (Foreach.ProbeCollectionType): Need to pass
7578         BindingFlags.Instance as well 
7579
7580         * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
7581         implicit int literal conversion in an empty cast so that we
7582         propagate the right type upstream.
7583
7584         (UnboxCast): new class used to unbox value types.
7585         (Expression.ConvertExplicit): Add explicit type conversions done
7586         by unboxing.
7587
7588         (Expression.ImplicitNumericConversion): Oops, forgot to test for
7589         the target type before applying the implicit LongLiterals to ULong
7590         literal cast.
7591
7592 2001-11-21  Miguel de Icaza  <miguel@ximian.com>
7593
7594         * cs-parser.jay (for_statement): Reworked the way For works: now
7595         we declare manually any variables that are introduced in
7596         for_initializer to solve the problem of having out-of-band code
7597         emition (that is what got for broken).
7598
7599         (declaration_statement): Perform the actual variable declaration
7600         that used to be done in local_variable_declaration here.
7601
7602         (local_variable_declaration): Do not declare anything, just pass
7603         the information on a DictionaryEntry
7604
7605 2001-11-20  Ravi Pratap  <ravi@ximian.com>
7606
7607         * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
7608         re-write of the logic to now make it recursive.
7609
7610         (UpdateIndices): Re-write accordingly.
7611
7612         Store element data in a separate ArrayData list in the above methods.
7613
7614         (MakeByteBlob): Implement to dump the array data into a byte array.
7615
7616 2001-11-19  Ravi Pratap  <ravi@ximian.com>
7617
7618         * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
7619         into CheckIndices.
7620
7621         * constant.cs (Define): Implement.
7622
7623         (EmitConstant): Re-write fully.
7624
7625         Pass in location info.
7626
7627         * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
7628         respectively.
7629
7630         * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
7631         DictionaryEntry since we need location info too.
7632
7633         (constant_declaration): Update accordingly.
7634
7635         * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
7636         code into another method : UpdateIndices.
7637
7638 2001-11-18  Ravi Pratap  <ravi@ximian.com>
7639
7640         * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
7641         some type checking etc.
7642
7643 2001-11-17  Ravi Pratap  <ravi@ximian.com>
7644
7645         * expression.cs (ArrayCreation::ValidateInitializers): Implement
7646         bits to provide dimension info if the user skips doing that.
7647
7648         Update second constructor to store the rank correctly.
7649
7650 2001-11-16  Ravi Pratap  <ravi@ximian.com>
7651
7652         * expression.cs (ArrayCreation::ValidateInitializers): Poke around
7653         and try to implement.
7654
7655         * ../errors/cs0150.cs : Add.
7656
7657         * ../errors/cs0178.cs : Add.
7658
7659 2001-11-16  Miguel de Icaza  <miguel@ximian.com>
7660
7661         * statement.cs: Implement foreach on multi-dimensional arrays. 
7662
7663         * parameter.cs (Parameters.GetParameterByName): Also lookup the
7664         name of the params argument.
7665
7666         * expression.cs: Use EmitStoreOpcode to get the right opcode while
7667         initializing the array.
7668
7669         (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
7670         we can use this elsewhere.
7671
7672         * statement.cs: Finish implementation of foreach for single
7673         dimension arrays.
7674
7675         * cs-parser.jay: Use an out-of-band stack to pass information
7676         around, I wonder why I need this.
7677
7678         foreach_block: Make the new foreach_block the current_block.
7679
7680         * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
7681         function used to return a static Parameters structure.  Used for
7682         empty parameters, as those are created very frequently.
7683
7684         * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
7685
7686 2001-11-15  Ravi Pratap  <ravi@ximian.com>
7687
7688         * interface.cs : Default modifier is private, not public. The
7689         make verify test passes again.
7690
7691 2001-11-15  Ravi Pratap  <ravi@ximian.com>
7692
7693         * support.cs (ReflectionParameters): Fix logic to determine
7694         whether the last parameter is a params one. Test 9 passes again.
7695
7696         * delegate.cs (Populate): Register the builders we define with
7697         RegisterParameterForBuilder. Test 19 passes again.
7698
7699         * cs-parser.jay (property_declaration): Reference $6 instead
7700         of $$ to get at the location.
7701
7702         (indexer_declaration): Similar stuff.
7703
7704         (attribute): Ditto.
7705
7706         * class.cs (Property): Register parameters for the Get and Set methods
7707         if they exist. Test 23 passes again.
7708
7709         * expression.cs (ArrayCreation::Emit): Pass null for the method in the
7710         call to EmitArguments as we are sure there aren't any params arguments. 
7711         Test 32 passes again.
7712
7713         * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
7714         IndexOutOfRangeException. 
7715
7716         * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
7717         Test 33 now passes again.
7718         
7719 2001-11-15  Miguel de Icaza  <miguel@ximian.com>
7720
7721         * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
7722         broke a bunch of things.  Will have to come up with a better way
7723         of tracking locations.
7724
7725         * statement.cs: Implemented foreach for single dimension arrays.
7726
7727 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
7728
7729         * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
7730         an error.  This removes the lookup from the critical path.
7731
7732         * cs-parser.jay: Removed use of temporary_loc, which is completely
7733         broken. 
7734
7735 2001-11-14  Miguel de Icaza  <miguel@ximian.com>
7736
7737         * support.cs (ReflectionParameters.ParameterModifier): Report
7738         whether the argument is a PARAMS argument or not.
7739
7740         * class.cs: Set the attribute `ParamArrayAttribute' on the
7741         parameter argument.
7742
7743         * typemanager.cs: Define param_array_type (ParamArrayAttribute)
7744         and cons_param_array_attribute (ConstructorInfo for
7745         ParamArrayAttribute)., 
7746
7747         * codegen.cs: Emit the return using the `Return' statement, that
7748         way we can report the error correctly for missing return values. 
7749
7750         * class.cs (Method.Emit): Clean up.
7751
7752         * expression.cs (Argument.Resolve): Take another argument: the
7753         location where this argument is used.  Notice that this is not
7754         part of the "Argument" class as to reduce the size of the
7755         structure (we know the approximate location anyways).
7756
7757         Test if the argument is a variable-reference, if not, then
7758         complain with a 206.
7759
7760         (Argument.Emit): Emit addresses of variables.
7761
7762         (Argument.FullDesc): Simplify.
7763
7764         (Invocation.DoResolve): Update for Argument.Resolve.
7765
7766         (ElementAccess.DoResolve): ditto.
7767
7768         * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
7769         method should be virtual, as this method is always virtual.
7770
7771         (NewDelegate.DoResolve): Update for Argument.Resolve.
7772
7773         * class.cs (ConstructorInitializer.DoResolve): ditto.
7774         
7775         * attribute.cs (Attribute.Resolve): ditto.
7776
7777 2001-11-13  Miguel de Icaza  <miguel@ximian.com>
7778
7779         * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
7780
7781         * expression.cs (ParameterReference): Drop IStackStorage and implement
7782         IAssignMethod instead. 
7783
7784         (LocalVariableReference): ditto.
7785         
7786         * ecore.cs (FieldExpr): Drop IStackStorage and implement
7787         IAssignMethod instead. 
7788
7789 2001-11-13  Miguel de Icaza <miguel@ximian.com>
7790
7791         * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
7792         enumerations that are used in heavily used structures derive from
7793         byte in a laughable and pathetic attempt to reduce memory usage.
7794         This is the kind of pre-optimzations that you should not do at
7795         home without adult supervision.
7796
7797         * expression.cs (UnaryMutator): New class, used to handle ++ and
7798         -- separatedly from the other unary operators.  Cleans up the
7799         code, and kills the ExpressionStatement dependency in Unary.
7800
7801         (Unary): Removed `method' and `Arguments' from this class, making
7802         it smaller, and moving it all to SimpleCall, so I can reuse this
7803         code in other locations and avoid creating a lot of transient data
7804         strucutres when not required.
7805
7806         * cs-parser.jay: Adjust for new changes.
7807
7808 2001-11-11  Miguel de Icaza  <miguel@ximian.com>
7809
7810         * enum.cs (Enum.Populate): If there is a failure during
7811         definition, return
7812
7813         * cs-parser.jay (opt_enum_base): we used to catch type errors
7814         here, but this is really incorrect.  The type error should be
7815         catched during semantic analysis.
7816
7817 2001-12-11  Ravi Pratap  <ravi@ximian.com>
7818
7819         * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
7820         current_local_parameters as expected since I, in my stupidity, had forgotten
7821         to do this :-)
7822
7823         * attribute.cs (GetValidPlaces): Fix stupid bug.
7824
7825         * class.cs (Method::Emit): Perform check on applicability of attributes.
7826
7827         (Constructor::Emit): Ditto.
7828
7829         (Field::Emit): Ditto.
7830
7831         (Field.Location): Store location information.
7832
7833         (Property, Event, Indexer, Operator): Ditto.
7834
7835         * cs-parser.jay (field_declaration): Pass in location for each field.
7836
7837         * ../errors/cs0592.cs : Add.
7838
7839 2001-11-12  Ravi Pratap  <ravi@ximian.com>
7840
7841         * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
7842
7843         (InitCoreTypes): Update accordingly.
7844
7845         (RegisterAttrType, LookupAttr): Implement.
7846
7847         * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
7848         info about the same.
7849
7850         (Resolve): Update to populate the above as necessary.
7851
7852         (Error592): Helper.
7853
7854         (GetValidPlaces): Helper to the above.
7855
7856         (CheckAttribute): Implement to perform validity of attributes on declarative elements.
7857
7858         * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
7859
7860 2001-11-12  Ravi Pratap  <ravi@ximian.com>
7861
7862         * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
7863
7864         * ../errors/cs0617.cs : Add.
7865
7866 2001-11-11  Ravi Pratap  <ravi@ximian.com>
7867
7868         * enum.cs (Emit): Rename to Populate to be more consistent with what
7869         we expect it to do and when exactly it is called.
7870
7871         * class.cs, rootcontext.cs : Update accordingly.
7872
7873         * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
7874         FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
7875
7876         * enum.cs (Populate): Register fields with TypeManager.RegisterField.
7877
7878         * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
7879         of a fieldinfo using the above, when dealing with a FieldBuilder.
7880
7881 2001-11-10  Ravi Pratap  <ravi@ximian.com>
7882
7883         * ../errors/cs0031.cs : Add.
7884
7885         * ../errors/cs1008.cs : Add.
7886
7887         * ../errrors/cs0543.cs : Add.
7888
7889         * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
7890         enum type.
7891
7892         (FindMembers): Implement.
7893
7894         * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
7895         enums and delegates too.
7896
7897         (enum_types): Rename to builder_to_enum.
7898
7899         (delegate_types): Rename to builder_to_delegate.
7900
7901         * delegate.cs (FindMembers): Implement.
7902
7903 2001-11-09  Ravi Pratap  <ravi@ximian.com>
7904
7905         * typemanager.cs (IsEnumType): Implement.
7906
7907         * enum.cs (Emit): Re-write parts to account for the underlying type
7908         better and perform checking etc.
7909
7910         (GetNextDefaultValue): Helper to ensure we don't overshoot max value
7911         of the underlying type.
7912
7913         * literal.cs (GetValue methods everywhere): Perform bounds checking and return
7914         value
7915
7916         * enum.cs (error31): Helper to report error #31.
7917
7918         * cs-parser.jay (enum_declaration): Store location of each member too.
7919
7920         * enum.cs (member_to_location): New hashtable. 
7921
7922         (AddEnumMember): Update location hashtable.
7923
7924         (Emit): Use the location of each member while reporting errors.
7925
7926 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
7927
7928         * cs-parser.jay: A for_initializer if is a
7929         local_variable_declaration really ammount to have an implicit
7930         block with the variable declaration and no initializer for for.
7931
7932         * statement.cs (For.Emit): Cope with null initializers.
7933
7934         This fixes the infinite loop on for initializers.
7935
7936 2001-11-08  Miguel de Icaza  <miguel@ximian.com>
7937
7938         * enum.cs: More cleanup.
7939
7940         * ecore.cs: Remove dead code.
7941
7942         * class.cs (Property.Emit): More simplification.
7943         (Event.Emit): ditto.
7944
7945         Reworked to have less levels of indentation.
7946         
7947 2001-11-08  Ravi Pratap  <ravi@ximian.com>
7948
7949         * class.cs (Property): Emit attributes.
7950
7951         (Field): Ditto.
7952         
7953         (Event): Ditto.
7954
7955         (Indexer): Ditto.
7956
7957         (Operator): Ditto.
7958
7959         * enum.cs (Emit): Ditto.
7960
7961         * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
7962         Enums too.
7963
7964         * class.cs (Field, Event, etc.): Move attribute generation into the
7965         Emit method everywhere.
7966
7967         * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
7968         we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
7969         as we had no way of defining nested enums !
7970
7971         * rootcontext.cs : Adjust code accordingly.
7972
7973         * typemanager.cs (AddEnumType): To keep track of enum types separately.
7974
7975 2001-11-07  Ravi Pratap  <ravi@ximian.com>
7976
7977         * expression.cs (EvalConstantExpression): Move into ecore.cs
7978         
7979         * enum.cs (Enum): Rename some members and make them public and readonly
7980         according to our convention.
7981
7982         * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
7983         nothing else.
7984
7985         * enum.cs (Enum::Define): Use the above instead of TypeAttr.
7986
7987         (Enum::Emit): Write a simple version for now which doesn't try to compute
7988         expressions. I shall modify this to be more robust in just a while.
7989
7990         * class.cs (TypeContainer::Emit): Make sure we include Enums too.
7991
7992         (TypeContainer::CloseType): Create the Enum types too.
7993
7994         * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
7995
7996         * expression.cs (EvalConstantExpression): Get rid of completely.
7997
7998         * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
7999         user-defined values and other cases.
8000
8001         (IsValidEnumLiteral): Helper function.
8002
8003         * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing 
8004         out there in the case we had a literal FieldExpr.
8005
8006         (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
8007
8008         (Literalize): Revamp a bit to take two arguments.
8009         
8010         (EnumLiteral): New class which derives from Literal to wrap enum literals.
8011         
8012 2001-11-06  Ravi Pratap  <ravi@ximian.com>
8013
8014         * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
8015
8016         * expression.cs (ArrayCreation::ValidateInitializers): Implement.
8017
8018         (Resolve): Use the above to ensure we have proper initializers.
8019
8020 2001-11-05  Ravi Pratap  <ravi@ximian.com>
8021
8022         * expression.cs (Expression::EvalConstantExpression): New method to 
8023         evaluate constant expressions.
8024
8025         * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
8026
8027 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
8028
8029         * expression.cs (ArrayCreation.Emit): Some bits to initialize data
8030         in an array.
8031
8032         (Binary.ResolveOperator): Handle operator != (object a, object b)
8033         and operator == (object a, object b);
8034
8035         (Binary.DoNumericPromotions): Indicate whether the numeric
8036         promotion was possible.
8037
8038         (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
8039         Implement.  
8040
8041         Made the ArrayAccess implement interface IAssignMethod instead of
8042         IStackStore as the order in which arguments are passed reflects
8043         this.
8044
8045         * assign.cs: Instead of using expr.ExprClass to select the way of
8046         assinging, probe for the IStackStore/IAssignMethod interfaces.
8047
8048         * typemanager.cs: Load InitializeArray definition.
8049
8050         * rootcontext.cs (RootContext.MakeStaticData): Used to define
8051         static data that can be used to initialize arrays. 
8052
8053 2001-11-05  Miguel de Icaza  <miguel@ximian.com>
8054
8055         * expression.cs: Handle operator== and operator!= for booleans.
8056
8057         (Conditioal.Reduce): Implement reducer for the ?: operator.
8058
8059         (Conditional.Resolve): Implement dead code elimination.
8060
8061         (Binary.Resolve): Catch string literals and return a new
8062         concatenated string.
8063
8064         (Unary.Reduce): Implement reduction of unary expressions.
8065
8066         * ecore.cs: Split out the expression core handling here.
8067
8068         (Expression.Reduce): New method used to perform constant folding
8069         and CSE.  This is needed to support constant-expressions. 
8070         
8071         * statement.cs (Statement.EmitBoolExpression): Pass true and false
8072         targets, and optimize for !x.
8073
8074 2001-11-04  Ravi Pratap  <ravi@ximian.com>
8075
8076         * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
8077         of an attribute gives us a CustomAttributeBuilder which we use accordingly to
8078         set custom atttributes.
8079
8080         * literal.cs (Literal::GetValue): New abstract method to return the actual
8081         value of the literal, cast as an object.
8082
8083         (*Literal): Implement GetValue method.
8084
8085         * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
8086         expressions to the arraylist but objects of type Argument.
8087
8088         * class.cs (TypeContainer::Emit): Emit our attributes too.
8089
8090         (Method::Emit, Constructor::Emit): Ditto.
8091
8092         * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
8093         to be ignoring earlier.
8094
8095 2001-11-03  Ravi Pratap  <ravi@ximian.com>
8096
8097         * attribute.cs (AttributeSection::Define): Implement to do the business
8098         of constructing a CustomAttributeBuilder.
8099
8100         (Attribute): New trivial class. Increases readability of code.  
8101
8102         * cs-parser.jay : Update accordingly.
8103
8104         (positional_argument_list, named_argument_list, named_argument): New rules
8105
8106         (attribute_arguments): Use the above so that we are more correct.
8107         
8108 2001-11-02  Ravi Pratap  <ravi@ximian.com>
8109         
8110         * expression.cs (Invocation::IsParamsMethodApplicable): Implement
8111         to perform all checks for a method with a params parameter.
8112
8113         (Invocation::OverloadResolve): Update to use the above method and therefore
8114         cope correctly with params method invocations.
8115
8116         * support.cs (InternalParameters::ParameterDesc): Provide a desc for 
8117         params too.
8118
8119         * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
8120         constructors in our parent too because we can't afford to miss out on 
8121         protected ones ;-)
8122
8123         * attribute.cs (AttributeSection): New name for the class Attribute
8124
8125         Other trivial changes to improve readability.
8126
8127         * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
8128         use the new class names.
8129         
8130 2001-11-01  Ravi Pratap  <ravi@ximian.com>
8131
8132         * class.cs (Method::Define): Complete definition for params types too
8133
8134         (Indexer::Define): Ditto.
8135
8136         * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
8137         Cope everywhere with a request for info about the array parameter.
8138
8139 2001-11-01  Ravi Pratap  <ravi@ximian.com>
8140
8141         * tree.cs (RecordNamespace): Fix up to check for the correct key.
8142
8143         * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in 
8144         local_variable_type to extract the string corresponding to the type.
8145
8146         (local_variable_type): Fixup the action to use the new helper method.
8147
8148         * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to 
8149         go.
8150
8151         * expression.cs : Clean out code which uses the above.
8152
8153 2001-10-31  Ravi Pratap  <ravi@ximian.com>
8154         
8155         * typemanager.cs (RegisterMethod): Check if we already have an existing key
8156         and bale out if necessary by returning a false.
8157
8158         (RegisterProperty): Ditto.
8159
8160         * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
8161         and print out appropriate error messages.
8162
8163         * interface.cs (everywhere): Ditto.
8164
8165         * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
8166         location to constructor.
8167
8168         * class.cs (Property, Event, Indexer): Update accordingly.
8169
8170         * ../errors/cs111.cs : Added.
8171
8172         * expression.cs (Invocation::IsApplicable): New static method to determine applicability
8173         of a method, as laid down by the spec.
8174
8175         (Invocation::OverloadResolve): Use the above method.
8176
8177 2001-10-31  Ravi Pratap  <ravi@ximian.com>
8178
8179         * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
8180         now take a TypeContainer and a Parameters object.
8181
8182         (ParameterData): Modify return type of ParameterModifier method to be 
8183         Parameter.Modifier and not a string.
8184
8185         (ReflectionParameters, InternalParameters): Update accordingly.
8186
8187         * expression.cs (Argument::GetParameterModifier): Same here.
8188
8189         * support.cs (InternalParameters::ParameterType): Find a better way of determining
8190         if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
8191         symbol in it at all so maybe this is only for now.
8192
8193 2001-10-30  Ravi Pratap  <ravi@ximian.com>
8194
8195         * support.cs (InternalParameters): Constructor now takes an extra argument 
8196         which is the actual Parameters class.
8197
8198         (ParameterDesc): Update to provide info on ref/out modifiers.
8199
8200         * class.cs (everywhere): Update call to InternalParameters to pass in
8201         the second argument too.
8202
8203         * support.cs (ParameterData): Add ParameterModifier, which is a method 
8204         to return the modifier info [ref/out etc]
8205
8206         (InternalParameters, ReflectionParameters): Implement the above.
8207
8208         * expression.cs (Argument::ParameterModifier): Similar function to return
8209         info about the argument's modifiers.
8210
8211         (Invocation::OverloadResolve): Update to take into account matching modifiers 
8212         too.
8213
8214         * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
8215         a new SetFormalParameters object which we pass to InternalParameters.
8216
8217 2001-10-30  Ravi Pratap  <ravi@ximian.com>
8218
8219         * expression.cs (NewArray): Merge into the ArrayCreation class.
8220
8221 2001-10-29  Ravi Pratap  <ravi@ximian.com>
8222
8223         * expression.cs (NewArray): Merge classes NewBuiltinArray and 
8224         NewUserdefinedArray into one as there wasn't much of a use in having
8225         two separate ones.
8226
8227         * expression.cs (Argument): Change field's name to ArgType from Type.
8228
8229         (Type): New readonly property which returns the proper type, taking into 
8230         account ref/out modifiers.
8231
8232         (everywhere): Adjust code accordingly for the above.
8233
8234         * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
8235         whether we are emitting for a ref or out parameter.
8236
8237         * expression.cs (Argument::Emit): Use the above field to set the state.
8238
8239         (LocalVariableReference::Emit): Update to honour the flag and emit the
8240         right stuff.
8241
8242         * parameter.cs (Attributes): Set the correct flags for ref parameters.
8243
8244         * expression.cs (Argument::FullDesc): New function to provide a full desc.
8245
8246         * support.cs (ParameterData): Add method ParameterDesc to the interface.
8247
8248         (ReflectionParameters, InternalParameters): Implement the above method.
8249
8250         * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
8251         reporting errors.
8252
8253         (Invocation::FullMethodDesc): Ditto. 
8254
8255 2001-10-29  Miguel de Icaza  <miguel@ximian.com>
8256
8257         * cs-parser.jay: Add extra production for the second form of array
8258         creation. 
8259
8260         * expression.cs (ArrayCreation): Update to reflect the above
8261         change. 
8262
8263         * Small changes to prepare for Array initialization.
8264
8265 2001-10-28  Miguel de Icaza  <miguel@ximian.com>
8266
8267         * typemanager.cs (ImplementsInterface): interface might be null;
8268         Deal with this problem;
8269
8270         Also, we do store negative hits on the cache (null values), so use
8271         this instead of calling t.GetInterfaces on the type everytime.
8272
8273 2001-10-28  Ravi Pratap  <ravi@ximian.com>
8274
8275         * typemanager.cs (IsBuiltinType): New method to help determine the same.
8276
8277         * expression.cs (New::DoResolve): Get rid of array creation code and instead
8278         split functionality out into different classes.
8279
8280         (New::FormArrayType): Move into NewBuiltinArray.
8281
8282         (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
8283         quite useless.
8284
8285         (NewBuiltinArray): New class to handle creation of built-in arrays.
8286
8287         (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
8288         account creation of one-dimensional arrays.
8289
8290         (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
8291
8292         (NewUserdefinedArray::DoResolve): Implement.
8293
8294         * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
8295
8296         * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
8297         we maintain inside the TypeManager. This is necessary to perform lookups on the
8298         module builder.
8299
8300         (LookupType): Update to perform GetType on the module builders too.     
8301
8302         * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
8303
8304         * exprssion.cs (NewUserdefinedArray::Emit): Implement.
8305
8306 2001-10-23  Ravi Pratap  <ravi@ximian.com>
8307
8308         * expression.cs (New::DoResolve): Implement guts of array creation.
8309
8310         (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
8311         
8312 2001-10-27  Miguel de Icaza  <miguel@ximian.com>
8313
8314         * expression.cs: Fix bug I introduced lsat night that broke
8315         Delegates. 
8316
8317         (Expression.Resolve): Report a 246 error (can not resolve name)
8318         if we find a SimpleName in the stream.
8319         
8320         (Expression.ResolveLValue): Ditto.
8321         
8322         (Expression.ResolveWithSimpleName): This function is a variant of
8323         ResolveName, this one allows SimpleNames to be returned without a
8324         warning.  The only consumer of SimpleNames is MemberAccess
8325
8326 2001-10-26  Miguel de Icaza  <miguel@ximian.com>
8327
8328         * expression.cs (Invocation::DoResolve): Catch SimpleNames that
8329         might arrive here.  I have my doubts that this is correct.
8330
8331         * statement.cs (Lock): Implement lock statement.
8332
8333         * cs-parser.jay: Small fixes to support `lock' and `using'
8334
8335         * cs-tokenizer.cs: Remove extra space
8336
8337         * driver.cs: New flag --checked, allows to turn on integer math
8338         checking. 
8339
8340         * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
8341         Threading.Monitor.Exit 
8342         
8343 2001-10-23  Miguel de Icaza  <miguel@ximian.com>
8344
8345         * expression.cs (IndexerAccess::DoResolveLValue): Set the
8346         Expression Class to be IndexerAccess.
8347
8348         Notice that Indexer::DoResolve sets the eclass to Value.
8349
8350 2001-10-22  Miguel de Icaza  <miguel@ximian.com>
8351
8352         * class.cs (TypeContainer::Emit): Emit code for indexers.
8353
8354         * assign.cs (IAssignMethod): New interface implemented by Indexers
8355         and Properties for handling assignment.
8356
8357         (Assign::Emit): Simplify and reuse code. 
8358         
8359         * expression.cs (IndexerAccess, PropertyExpr): Implement
8360         IAssignMethod, clean up old code. 
8361
8362 2001-10-22  Ravi Pratap  <ravi@ximian.com>
8363
8364         * typemanager.cs (ImplementsInterface): New method to determine if a type
8365         implements a given interface. Provides a nice cache too.
8366
8367         * expression.cs (ImplicitReferenceConversion): Update checks to use the above
8368         method.
8369
8370         (ConvertReferenceExplicit): Ditto.
8371
8372         * delegate.cs (Delegate::Populate): Update to define the parameters on the 
8373         various methods, with correct names etc.
8374
8375         * class.cs (Operator::OpType): New members Operator.UnaryPlus and 
8376         Operator.UnaryNegation.
8377
8378         * cs-parser.jay (operator_declarator): Be a little clever in the case where
8379         we have a unary plus or minus operator.
8380
8381         * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and 
8382         UnaryMinus.
8383
8384         * everywhere : update accordingly.
8385
8386         * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
8387         respectively.
8388
8389         * class.cs (Method::Define): For the case where we are implementing a method
8390         inherited from an interface, we need to set the MethodAttributes.Final flag too. 
8391         Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
8392         
8393 2001-10-21  Ravi Pratap  <ravi@ximian.com>
8394
8395         * interface.cs (FindMembers): Implement to work around S.R.E
8396         lameness.
8397
8398         * typemanager.cs (IsInterfaceType): Implement.
8399
8400         (FindMembers): Update to handle interface types too.
8401
8402         * expression.cs (ImplicitReferenceConversion): Re-write bits which
8403         use IsAssignableFrom as that is not correct - it doesn't work.
8404
8405         * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
8406         and accordingly override EmitStatement.
8407
8408         * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
8409         using the correct logic :-)
8410
8411 2001-10-19  Ravi Pratap  <ravi@ximian.com>
8412
8413         * ../errors/cs-11.cs : Add to demonstrate error -11 
8414
8415 2001-10-17  Miguel de Icaza  <miguel@ximian.com>
8416
8417         * assign.cs (Assign::Resolve): Resolve right hand side first, and
8418         then pass this as a hint to ResolveLValue.
8419         
8420         * expression.cs (FieldExpr): Add Location information
8421
8422         (FieldExpr::LValueResolve): Report assignment to readonly
8423         variable. 
8424         
8425         (Expression::ExprClassFromMemberInfo): Pass location information.
8426
8427         (Expression::ResolveLValue): Add new method that resolves an
8428         LValue. 
8429
8430         (Expression::DoResolveLValue): Default invocation calls
8431         DoResolve. 
8432
8433         (Indexers): New class used to keep track of indexers in a given
8434         Type. 
8435
8436         (IStackStore): Renamed from LValue, as it did not really describe
8437         what this did.  Also ResolveLValue is gone from this interface and
8438         now is part of Expression.
8439
8440         (ElementAccess): Depending on the element access type
8441         
8442         * typemanager.cs: Add `indexer_name_type' as a Core type
8443         (System.Runtime.CompilerServices.IndexerNameAttribute)
8444
8445         * statement.cs (Goto): Take a location.
8446         
8447 2001-10-18  Ravi Pratap  <ravi@ximian.com>
8448
8449         * delegate.cs (Delegate::VerifyDelegate): New method to verify
8450         if two delegates are compatible.
8451
8452         (NewDelegate::DoResolve): Update to take care of the case when
8453         we instantiate a delegate from another delegate.
8454
8455         * typemanager.cs (FindMembers): Don't even try to look up members
8456         of Delegate types for now.
8457
8458 2001-10-18  Ravi Pratap  <ravi@ximian.com>
8459
8460         * delegate.cs (NewDelegate): New class to take care of delegate
8461         instantiation.
8462
8463         * expression.cs (New): Split the delegate related code out into 
8464         the NewDelegate class.
8465
8466         * delegate.cs (DelegateInvocation): New class to handle delegate 
8467         invocation.
8468
8469         * expression.cs (Invocation): Split out delegate related code into
8470         the DelegateInvocation class.
8471
8472 2001-10-17  Ravi Pratap  <ravi@ximian.com>
8473
8474         * expression.cs (New::DoResolve): Implement delegate creation fully
8475         and according to the spec.
8476
8477         (New::DoEmit): Update to handle delegates differently.
8478
8479         (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
8480         because of which we were printing out arguments in reverse order !
8481
8482         * delegate.cs (VerifyMethod): Implement to check if the given method
8483         matches the delegate.
8484
8485         (FullDelegateDesc): Implement.
8486
8487         (VerifyApplicability): Implement.
8488
8489         * expression.cs (Invocation::DoResolve): Update to accordingly handle
8490         delegate invocations too.
8491
8492         (Invocation::Emit): Ditto.
8493
8494         * ../errors/cs1593.cs : Added.
8495
8496         * ../errors/cs1594.cs : Added.
8497
8498         * delegate.cs (InstanceExpression, TargetMethod): New properties.
8499
8500 2001-10-16  Ravi Pratap  <ravi@ximian.com>
8501
8502         * typemanager.cs (intptr_type): Core type for System.IntPtr
8503
8504         (InitCoreTypes): Update for the same.
8505
8506         (iasyncresult_type, asynccallback_type): Ditto.
8507
8508         * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
8509         correct.
8510
8511         * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
8512         too.
8513
8514         * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
8515         the builders for the 4 members of a delegate type :-)
8516
8517         (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
8518         type.
8519
8520         * expression.cs (New::DoResolve): Implement guts for delegate creation.
8521
8522         * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
8523
8524 2001-10-15  Miguel de Icaza  <miguel@ximian.com>
8525
8526         * statement.cs (Break::Emit): Implement.   
8527         (Continue::Emit): Implement.
8528
8529         (For::Emit): Track old being/end loops;  Set Begin loop, ack end loop
8530         (While::Emit): Track old being/end loops;  Set Begin loop, ack end loop
8531         (Do::Emit): Track old being/end loops;  Set Begin loop, ack end loop
8532         (Foreach::Emit): Track old being/end loops;  Set Begin loop, ack
8533         end loop
8534         
8535         * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
8536         properties that track the label for the current loop (begin of the
8537         loop and end of the loop).
8538
8539 2001-10-15  Ravi Pratap  <ravi@ximian.com>
8540
8541         * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
8542         use of emitting anything at all.
8543
8544         * class.cs, rootcontext.cs : Get rid of calls to the same.
8545
8546         * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
8547
8548         (Populate): Define the constructor correctly and set the implementation
8549         attributes.
8550
8551         * typemanager.cs (delegate_types): New hashtable to hold delegates that
8552         have been defined.
8553
8554         (AddDelegateType): Implement.
8555
8556         (IsDelegateType): Implement helper method.
8557
8558         * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
8559
8560         * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
8561         and accordingly handle it.
8562
8563         * delegate.cs (Populate): Take TypeContainer argument.
8564         Implement bits to define the Invoke method. However, I still haven't figured out
8565         how to take care of the native int bit :-(
8566
8567         * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-) 
8568         Qualify the name of the delegate, not its return type !
8569
8570         * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
8571         conversion.
8572
8573         (StandardConversionExists): Checking for array types turns out to be recursive.
8574
8575         (ConvertReferenceExplicit): Implement array conversion.
8576
8577         (ExplicitReferenceConversionExists): New method to determine precisely that :-)
8578         
8579 2001-10-12  Ravi Pratap  <ravi@ximian.com>
8580
8581         * cs-parser.jay (delegate_declaration): Store the fully qualified
8582         name as it is a type declaration.
8583
8584         * delegate.cs (ReturnType, Name): Rename members to these. Make them 
8585         readonly.
8586
8587         (DefineDelegate): Renamed from Define. Does the same thing essentially,
8588         as TypeContainer::DefineType.
8589
8590         (Populate): Method in which all the definition of the various methods (Invoke)
8591         etc is done.
8592
8593         (Emit): Emit any code, if necessary. I am not sure about this really, but let's
8594         see.
8595         
8596         (CloseDelegate): Finally creates the delegate.
8597
8598         * class.cs (TypeContainer::DefineType): Update to define delegates.
8599         (Populate, Emit and CloseType): Do the same thing here too.
8600
8601         * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
8602         delegates in all these operations.
8603
8604 2001-10-14  Miguel de Icaza  <miguel@ximian.com>
8605
8606         * expression.cs: LocalTemporary: a new expression used to
8607         reference a temporary that has been created.
8608
8609         * assign.cs: Handle PropertyAccess back here, so that we can
8610         provide the proper semantic access to properties.
8611
8612         * expression.cs (Expression::ConvertReferenceExplicit): Implement
8613         a few more explicit conversions. 
8614
8615         * modifiers.cs: `NEW' modifier maps to HideBySig.
8616
8617         * expression.cs (PropertyExpr): Make this into an
8618         ExpressionStatement, and support the EmitStatement code path. 
8619
8620         Perform get/set error checking, clean up the interface.
8621
8622         * assign.cs: recognize PropertyExprs as targets, and if so, turn
8623         them into toplevel access objects.
8624
8625 2001-10-12  Miguel de Icaza  <miguel@ximian.com>
8626
8627         * expression.cs: PropertyExpr::PropertyExpr: use work around the
8628         SRE.
8629
8630         * typemanager.cs: Keep track here of our PropertyBuilders again to
8631         work around lameness in SRE.
8632
8633 2001-10-11  Miguel de Icaza  <miguel@ximian.com>
8634
8635         * expression.cs (LValue::LValueResolve): New method in the
8636         interface, used to perform a second resolution pass for LValues. 
8637         
8638         (This::DoResolve): Catch the use of this in static methods.
8639
8640         (This::LValueResolve): Implement.
8641
8642         (This::Store): Remove warning, assigning to `this' in structures
8643         is 
8644
8645         (Invocation::Emit): Deal with invocation of
8646         methods on value types.  We need to pass the address to structure
8647         methods rather than the object itself.  (The equivalent code to
8648         emit "this" for structures leaves the entire structure on the
8649         stack instead of a pointer to it). 
8650
8651         (ParameterReference::DoResolve): Compute the real index for the
8652         argument based on whether the method takes or not a `this' pointer
8653         (ie, the method is static).
8654
8655         * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
8656         value types returned from functions when we need to invoke a
8657         method on the sturcture.
8658         
8659
8660 2001-10-11  Ravi Pratap  <ravi@ximian.com>
8661
8662         * class.cs (TypeContainer::DefineType): Method to actually do the business of
8663         defining the type in the Modulebuilder or Typebuilder. This is to take
8664         care of nested types which need to be defined on the TypeBuilder using
8665         DefineNestedMethod.
8666
8667         (TypeContainer::GetClassBases): Implement. Essentially the code from the 
8668         methods in RootContext, only ported to be part of TypeContainer.
8669
8670         (TypeContainer::GetInterfaceOrClass): Ditto.
8671
8672         (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
8673
8674         * interface.cs (Interface::DefineInterface): New method. Does exactly
8675         what RootContext.CreateInterface did earlier, only it takes care of nested types 
8676         too.
8677
8678         (Interface::GetInterfaces): Move from RootContext here and port.
8679
8680         (Interface::GetInterfaceByName): Same here.
8681
8682         * rootcontext.cs (ResolveTree): Re-write.
8683
8684         (PopulateTypes): Re-write.
8685
8686         * class.cs (TypeContainer::Populate): Populate nested types too.
8687         (TypeContainer::Emit): Emit nested members too.
8688
8689         * typemanager.cs (AddUserType): Do not make use of the FullName property,
8690         instead just use the name argument passed in as it is already fully
8691         qualified.
8692
8693         (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
8694         to TypeContainer mapping to see if a type is user-defined.
8695
8696         * class.cs (TypeContainer::CloseType): Implement. 
8697
8698         (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
8699         the default constructor.
8700         
8701         (TypeContainer::Populate): Fix minor bug which led to creating default constructors
8702         twice.
8703
8704         (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
8705
8706         * interface.cs (CloseType): Create the type here.
8707         
8708         * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
8709         the hierarchy.
8710
8711         Remove all the methods which are now in TypeContainer.
8712
8713 2001-10-10  Ravi Pratap  <ravi@ximian.com>
8714
8715         * delegate.cs (Define): Re-write bits to define the delegate
8716         correctly.
8717
8718 2001-10-10  Miguel de Icaza  <miguel@ximian.com>
8719
8720         * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
8721
8722         * expression.cs (ImplicitReferenceConversion): handle null as well
8723         as a source to convert to any reference type.
8724
8725         * statement.cs (Return): Perform any implicit conversions to
8726         expected return type.  
8727
8728         Validate use of return statement.  
8729
8730         * codegen.cs (EmitContext): Pass the expected return type here.
8731
8732         * class.cs (Method, Constructor, Property): Pass expected return
8733         type to EmitContext.
8734
8735 2001-10-09  Miguel de Icaza  <miguel@ximian.com>
8736
8737         * expression.cs: Make DoResolve take an EmitContext instead of a
8738         TypeContainer.
8739
8740         Replaced `l' and `location' for `loc', for consistency.
8741         
8742         (Error, Warning): Remove unneeded Tc argument.
8743
8744         * assign.cs, literal.cs, constant.cs: Update to new calling
8745         convention. 
8746         
8747         * codegen.cs: EmitContext now contains a flag indicating whether
8748         code is being generated in a static method or not.
8749
8750         * cs-parser.jay: DecomposeQI, new function that replaces the old
8751         QualifiedIdentifier.  Now we always decompose the assembled
8752         strings from qualified_identifier productions into a group of
8753         memberaccesses.
8754
8755 2001-10-08  Miguel de Icaza  <miguel@ximian.com>
8756
8757         * rootcontext.cs: Deal with field-less struct types correctly now
8758         by passing the size option to Define Type.
8759
8760         * class.cs: Removed hack that created one static field. 
8761
8762 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
8763
8764         * statement.cs: Moved most of the code generation here. 
8765
8766 2001-10-09  Ravi Pratap  <ravi@ximian.com>
8767
8768         * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
8769         seem very right.
8770
8771         (ElementAccess): Remove useless bits for now - keep checks as the spec
8772         says.
8773
8774 2001-10-08  Ravi Pratap  <ravi@ximian.com>
8775
8776         * expression.cs (ElementAccess::DoResolve): Remove my crap code
8777         and start performing checks according to the spec.
8778
8779 2001-10-07  Ravi Pratap  <ravi@ximian.com>
8780
8781         * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
8782         rank_specifiers instead.
8783
8784         (rank_specifiers): Change the order in which the rank specifiers are stored
8785
8786         (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
8787
8788         * expression.cs (ElementAccess): Implement the LValue interface too.
8789         
8790 2001-10-06  Ravi Pratap  <ravi@ximian.com>
8791         
8792         * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
8793         except that user defined conversions are not included.
8794
8795         (UserDefinedConversion): Update to use the ConvertExplicitStandard to 
8796         perform the conversion of the return type, if necessary.
8797
8798         (New::DoResolve): Check whether we are creating an array or an object
8799         and accordingly do the needful.
8800
8801         (New::Emit): Same here.
8802
8803         (New::DoResolve): Implement guts of array creation.
8804
8805         (New::FormLookupType): Helper function.
8806
8807 2001-10-07  Miguel de Icaza  <miguel@ximian.com>
8808
8809         * codegen.cs: Removed most of the code generation here, and move the
8810         corresponding code generation bits to the statement classes. 
8811
8812         Added support for try/catch/finalize and throw.
8813         
8814         * cs-parser.jay: Added support for try/catch/finalize.
8815
8816         * class.cs: Catch static methods having the flags override,
8817         virtual or abstract.
8818
8819         * expression.cs (UserCast): This user cast was not really doing
8820         what it was supposed to do.  Which is to be born in fully resolved
8821         state.  Parts of the resolution were being performed at Emit time! 
8822
8823         Fixed this code.
8824
8825 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
8826
8827         * expression.cs: Implicity convert the result from UserCast.
8828
8829 2001-10-05  Ravi Pratap  <ravi@ximian.com>
8830
8831         * expression.cs (Expression::FindMostEncompassingType): Fix bug which
8832         prevented it from working correctly. 
8833
8834         (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
8835         merely ConvertImplicit.
8836
8837 2001-10-05  Miguel de Icaza  <miguel@ximian.com>
8838
8839         * typemanager.cs: Make the LookupTypeContainer function static,
8840         and not per-instance.  
8841
8842         * class.cs: Make static FindMembers (the one that takes a Type
8843         argument). 
8844
8845         * codegen.cs: Add EmitForeach here.
8846
8847         * cs-parser.jay: Make foreach a toplevel object instead of the
8848         inline expansion, as we need to perform semantic analysis on it. 
8849
8850 2001-10-05  Ravi Pratap  <ravi@ximian.com>
8851
8852         * expression.cs (Expression::ImplicitUserConversion): Rename to
8853         UserDefinedConversion.
8854
8855         (Expression::UserDefinedConversion): Take an extra argument specifying 
8856         whether we look for explicit user conversions too.
8857
8858         (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
8859
8860         (UserDefinedConversion): Incorporate support for user defined explicit conversions.
8861
8862         (ExplicitUserConversion): Make it a call to UserDefinedConversion
8863         with the appropriate arguments.
8864
8865         * cs-parser.jay (cast_expression): Record location too.
8866
8867         * expression.cs (Cast): Record location info.
8868
8869         (Expression::ConvertExplicit): Take location argument.
8870
8871         (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
8872         to determine if we are doing explicit conversions.
8873
8874         (UserCast::Emit): Update accordingly.
8875
8876         (Expression::ConvertExplicit): Report an error if everything fails.
8877
8878         * ../errors/cs0030.cs : Add.
8879
8880 2001-10-04  Miguel de Icaza  <miguel@ximian.com>
8881
8882         * modifiers.cs: If the ABSTRACT keyword is present, also set the
8883         virtual and newslot bits. 
8884
8885         * class.cs (TypeContainer::RegisterRequiredImplementations):
8886         Record methods we need.
8887
8888         (TypeContainer::MakeKey): Helper function to make keys for
8889         MethodBases, since the Methodbase key is useless.
8890
8891         (TypeContainer::Populate): Call RegisterRequiredImplementations
8892         before defining the methods.   
8893
8894         Create a mapping for method_builders_to_methods ahead of time
8895         instead of inside a tight loop.
8896
8897         (::RequireMethods):  Accept an object as the data to set into the
8898         hashtable so we can report interface vs abstract method mismatch.
8899
8900 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
8901
8902         * report.cs: Make all of it static.
8903
8904         * rootcontext.cs: Drop object_type and value_type computations, as
8905         we have those in the TypeManager anyways.
8906
8907         Drop report instance variable too, now it is a global.
8908
8909         * driver.cs: Use try/catch on command line handling.
8910
8911         Add --probe option to debug the error reporting system with a test
8912         suite. 
8913
8914         * report.cs: Add support for exiting program when a probe
8915         condition is reached.
8916
8917 2001-10-03  Ravi Pratap  <ravi@ximian.com>
8918
8919         * expression.cs (Binary::DoNumericPromotions): Fix the case when
8920         we do a forcible conversion regardless of type, to check if 
8921         ForceConversion returns a null.
8922
8923         (Binary::error19): Use location to report error.
8924
8925         (Unary::error23): Use location here too.
8926
8927         * ../errors/cs0019.cs : Check in.
8928
8929         * ../errors/cs0023.cs : Check in.
8930
8931         * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
8932         case of a non-null MethodInfo object with a length of 0 !
8933
8934         (Binary::ResolveOperator): Flag error if overload resolution fails to find
8935         an applicable member - according to the spec :-)
8936         Also fix logic to find members in base types.
8937
8938         (Unary::ResolveOperator): Same here.
8939
8940         (Unary::report23): Change name to error23 and make first argument a TypeContainer
8941         as I was getting thoroughly confused between this and error19 :-)
8942         
8943         * expression.cs (Expression::ImplicitUserConversion): Re-write fully
8944         (::FindMostEncompassedType): Implement.
8945         (::FindMostEncompassingType): Implement.
8946         (::StandardConversionExists): Implement.
8947
8948         (UserImplicitCast): Re-vamp. We now need info about most specific
8949         source and target types so that we can do the necessary conversions.
8950
8951         (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
8952         mathematical union with no duplicates.
8953
8954 2001-10-03  Miguel de Icaza  <miguel@ximian.com>
8955
8956         * rootcontext.cs (RootContext::PopulateTypes): Populate containers
8957         in order from base classes to child classes, so that we can in
8958         child classes look up in our parent for method names and
8959         attributes (required for handling abstract, virtual, new, override
8960         constructs: we need to instrospect our base class, and if we dont
8961         populate the classes in order, the introspection might be
8962         incorrect.  For example, a method could query its parent before
8963         the parent has any methods and would determine that the parent has
8964         no abstract methods (while it could have had them)).
8965
8966         (RootContext::CreateType): Record the order in which we define the
8967         classes.
8968
8969 2001-10-02  Miguel de Icaza  <miguel@ximian.com>
8970
8971         * class.cs (TypeContainer::Populate): Also method definitions can
8972         fail now, keep track of this.
8973
8974         (TypeContainer::FindMembers): Implement support for
8975         DeclaredOnly/noDeclaredOnly flag.
8976
8977         (Constructor::Emit) Return the ConstructorBuilder.
8978
8979         (Method::Emit) Return the MethodBuilder. 
8980         Check for abstract or virtual methods to be public.
8981
8982         * rootcontext.cs (RootContext::CreateType): Register all the
8983         abstract methods required for the class to be complete and the
8984         interface methods that must be implemented. 
8985
8986         * cs-parser.jay: Report error 501 (method requires body if it is
8987         not marked abstract or extern).
8988
8989         * expression.cs (TypeOf::Emit): Implement.
8990
8991         * typemanager.cs: runtime_handle_type, new global type.
8992
8993         * class.cs (Property::Emit): Generate code for properties.
8994
8995 2001-10-02  Ravi Pratap  <ravi@ximian.com>
8996
8997         * expression.cs (Unary::ResolveOperator): Find operators on base type
8998         too - we now conform exactly to the spec.
8999
9000         (Binary::ResolveOperator): Same here.
9001
9002         * class.cs (Operator::Define): Fix minor quirk in the tests.
9003
9004         * ../errors/cs0215.cs : Added.
9005
9006         * ../errors/cs0556.cs : Added.
9007
9008         * ../errors/cs0555.cs : Added.
9009
9010 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
9011
9012         * cs-tokenizer.cs: Reimplemented Location to be a struct with a
9013         single integer which is really efficient
9014
9015 2001-10-01  Ravi Pratap  <ravi@ximian.com>
9016
9017         *  expression.cs (Expression::ImplicitUserConversion): Use location
9018         even in the case when we are examining True operators.
9019  
9020         * class.cs (Operator::Define): Perform extensive checks to conform
9021         with the rules for operator overloading in the spec.
9022
9023         * expression.cs (Expression::ImplicitReferenceConversion): Implement
9024         some of the other conversions mentioned in the spec.
9025
9026         * typemanager.cs (array_type): New static member for the System.Array built-in
9027         type.
9028
9029         (cloneable_interface): For System.ICloneable interface.
9030
9031         * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
9032         we start resolving the tree and populating types.
9033
9034         * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
9035  
9036 2001-10-01  Miguel de Icaza  <miguel@ximian.com>
9037
9038         * expression.cs (Expression::ExprClassFromMemberInfo,
9039         Expression::Literalize): Create literal expressions from
9040         FieldInfos which are literals.
9041
9042         (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
9043         type casts, because they were wrong.  The test suite in tests
9044         caught these ones.
9045
9046         (ImplicitNumericConversion): ushort to ulong requires a widening
9047         cast. 
9048
9049         Int32 constant to long requires widening cast as well.
9050
9051         * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
9052         for integers because the type on the stack is not i4.
9053
9054 2001-09-30  Miguel de Icaza  <miguel@ximian.com>
9055
9056         * expression.cs (report118): require location argument. 
9057
9058         * parameter.cs: Do not dereference potential null value.
9059
9060         * class.cs: Catch methods that lack the `new' keyword when
9061         overriding a name.  Report warnings when `new' is used without
9062         anything being there to override.
9063
9064         * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
9065
9066         * class.cs: Only add constructor to hashtable if it is non-null
9067         (as now constructors can fail on define).
9068
9069         (TypeManager, Class, Struct): Take location arguments.
9070
9071         Catch field instance initialization in structs as errors.
9072
9073         accepting_filter: a new filter for FindMembers that is static so
9074         that we dont create an instance per invocation.
9075
9076         (Constructor::Define): Catch errors where a struct constructor is
9077         parameterless 
9078
9079         * cs-parser.jay: Pass location information for various new
9080         constructs. 
9081         
9082         * delegate.cs (Delegate): take a location argument.
9083
9084         * driver.cs: Do not call EmitCode if there were problesm in the
9085         Definition of the types, as many Builders wont be there. 
9086
9087         * decl.cs (Decl::Decl): Require a location argument.
9088
9089         * cs-tokenizer.cs: Handle properly hex constants that can not fit
9090         into integers, and find the most appropiate integer for it.
9091
9092         * literal.cs: Implement ULongLiteral.
9093
9094         * rootcontext.cs: Provide better information about the location of
9095         failure when CreateType fails.
9096         
9097 2001-09-29  Miguel de Icaza  <miguel@ximian.com>
9098
9099         * rootcontext.cs (RootContext::PopulateTypes): Populates structs
9100         as well.
9101
9102         * expression.cs (Binary::CheckShiftArguments): Add missing type
9103         computation.
9104         (Binary::ResolveOperator): Add type to the logical and and logical
9105         or, Bitwise And/Or and Exclusive Or code paths, it was missing
9106         before.
9107
9108         (Binary::DoNumericPromotions): In the case where either argument
9109         is ulong (and most signed types combined with ulong cause an
9110         error) perform implicit integer constant conversions as well.
9111
9112 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
9113
9114         * expression.cs (UserImplicitCast): Method should always be
9115         non-null. 
9116         (Invocation::BetterConversion): Simplified test for IntLiteral.
9117
9118         (Expression::ImplicitNumericConversion): Split this routine out.
9119         Put the code that performs implicit constant integer conversions
9120         here. 
9121
9122         (Expression::Resolve): Become a wrapper around DoResolve so we can
9123         check eclass and type being set after resolve.
9124
9125         (Invocation::Badness): Remove this dead function
9126
9127         (Binary::ResolveOperator): Do not compute the expensive argumnets
9128         unless we have a union for it.
9129
9130         (Probe::Emit): Is needs to do an isinst and then
9131         compare against null.
9132
9133         (::CanConvert): Added Location argument.  If the Location argument
9134         is null (Location.Null), then we do not report errors.  This is
9135         used by the `probe' mechanism of the Explicit conversion.  We do
9136         not want to generate an error for something that the user
9137         explicitly requested to be casted.  But the pipeline for an
9138         explicit cast first tests for potential implicit casts.
9139
9140         So for now, if the Location is null, it means `Probe only' to
9141         avoid adding another argument.   Might have to revise this
9142         strategy later.
9143
9144         (ClassCast): New class used to type cast objects into arbitrary
9145         classes (used in Explicit Reference Conversions).
9146
9147         Implement `as' as well.
9148
9149         Reverted all the patches from Ravi below: they were broken:
9150
9151                 * The use of `level' as a mechanism to stop recursive
9152                   invocations is wrong.  That was there just to catch the
9153                   bug with a strack trace but not as a way of addressing
9154                   the problem.
9155
9156                   To fix the problem we have to *understand* what is going
9157                   on and the interactions and come up with a plan, not
9158                   just get things going.
9159
9160                 * The use of the type conversion cache that I proposed
9161                   last night had an open topic: How does this work across
9162                   protection domains.  A user defined conversion might not
9163                   be public in the location where we are applying the
9164                   conversion, a different conversion might be selected
9165                   (ie, private A->B (better) but public B->A (worse),
9166                   inside A, A->B applies, but outside it, B->A will
9167                   apply).
9168
9169                 * On top of that (ie, even if the above is solved),
9170                   conversions in a cache need to be abstract.  Ie, `To
9171                   convert from an Int to a Short use an OpcodeCast', not
9172                   `To convert from an Int to a Short use the OpcodeCast on
9173                   the variable 5' (which is what this patch was doing).
9174         
9175 2001-09-28  Ravi Pratap  <ravi@ximian.com>
9176
9177         * expression.cs (Invocation::ConversionExists): Re-write to use
9178         the conversion cache
9179         
9180         (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
9181         cache all conversions done, not just user-defined ones.
9182
9183         (Invocation::BetterConversion): The real culprit. Use ConversionExists
9184         to determine if a conversion exists instead of acutually trying to 
9185         perform the conversion. It's faster too.
9186
9187         (Expression::ConvertExplicit): Modify to use ConversionExists to check
9188         and only then attempt the implicit conversion.
9189
9190 2001-09-28  Ravi Pratap  <ravi@ximian.com>
9191
9192         * expression.cs (ConvertImplicit): Use a cache for conversions
9193         already found. Check level of recursion and bail out if necessary.
9194         
9195 2001-09-28  Miguel de Icaza  <miguel@ximian.com>
9196
9197         * typemanager.cs (string_concat_string_string, string_concat_object_object):
9198         Export standard methods that we expect for string operations.
9199         
9200         * statement.cs (Block::UsageWarning): Track usage of variables and
9201         report the errors for not used variables.
9202
9203         * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
9204         operator. 
9205
9206 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
9207
9208         * codegen.cs: remove unnneded code 
9209
9210         * expression.cs: Removed BuiltinTypeAccess class
9211
9212         Fix the order in which implicit conversions are
9213         done.  
9214
9215         The previous fixed dropped support for boxed conversions (adding a
9216         test to the test suite now)
9217
9218         (UserImplicitCast::CanConvert): Remove test for source being null,
9219         that code is broken.  We should not feed a null to begin with, if
9220         we do, then we should track the bug where the problem originates
9221         and not try to cover it up here.
9222
9223         Return a resolved expression of type UserImplicitCast on success
9224         rather than true/false.  Ravi: this is what I was talking about,
9225         the pattern is to use a static method as a "constructor" for
9226         objects. 
9227
9228         Also, do not create arguments until the very last minute,
9229         otherwise we always create the arguments even for lookups that
9230         will never be performed. 
9231
9232         (UserImplicitCast::Resolve): Eliminate, objects of type
9233         UserImplicitCast are born in a fully resolved state. 
9234         
9235         * typemanager.cs (InitCoreTypes): Init also value_type
9236         (System.ValueType). 
9237
9238         * expression.cs (Cast::Resolve): First resolve the child expression.
9239
9240         (LValue): Add new method AddressOf to be used by
9241         the `&' operator.  
9242
9243         Change the argument of Store to take an EmitContext instead of an
9244         ILGenerator, because things like FieldExpr need to be able to call
9245         their children expression to generate the instance code. 
9246
9247         (Expression::Error, Expression::Warning): Sugar functions for
9248         reporting errors.
9249
9250         (Expression::MemberLookup): Accept a TypeContainer instead of a
9251         Report as the first argument.
9252
9253         (Expression::ResolvePrimary): Killed.  I still want to improve
9254         this as currently the code is just not right.
9255
9256         (Expression::ResolveMemberAccess): Simplify, but it is still
9257         wrong. 
9258
9259         (Unary::Resolve): Catch errors in AddressOf operators.
9260
9261         (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
9262         index to a byte for the short-version, or the compiler will choose
9263         the wrong Emit call, which generates the wrong data.
9264
9265         (ParameterReference::Emit, ::Store): same.
9266
9267         (FieldExpr::AddressOf): Implement.
9268         
9269         * typemanager.cs: TypeManager: made public variable instead of
9270         property.
9271         
9272         * driver.cs: document --fatal.
9273
9274         * report.cs (ErrorMessage, WarningMessage): new names for the old
9275         Error and Warning classes.
9276
9277         * cs-parser.jay (member_access): Turn built-in access to types
9278         into a normal simplename
9279
9280 2001-09-27  Ravi Pratap  <ravi@ximian.com>
9281
9282         * expression.cs (Invocation::BetterConversion): Fix to cope
9283         with q being null, since this was introducing a bug.
9284
9285         * expression.cs (ConvertImplicit): Do built-in conversions first.
9286
9287 2001-09-27  Ravi Pratap  <ravi@ximian.com>
9288
9289         * expression.cs (UserImplicitCast::Resolve): Fix bug.
9290
9291 2001-09-27  Ravi Pratap  <ravi@ximian.com>
9292
9293         * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
9294         I had introduced long ago (what's new ?).
9295
9296         * expression.cs (UserImplicitCast::CanConvert): Static method to do 
9297         the work of all the checking. 
9298         (ConvertImplicit): Call CanConvert and only then create object if necessary.
9299         (UserImplicitCast::CanConvert, ::Resolve): Re-write.
9300
9301         (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
9302         that is the right way. 
9303
9304         (Invocation::MakeUnionSet): Convenience function to make unions of sets for 
9305         overloading resolution. Use everywhere instead of cutting and pasting code.
9306
9307         (Binary::ResolveOperator): Use MakeUnionSet.
9308
9309         (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when 
9310         we have to convert to bool types. Not complete yet.
9311         
9312 2001-09-27  Miguel de Icaza  <miguel@ximian.com>
9313
9314         * typemanager.cs (TypeManager::CSharpName): support ushort.
9315
9316         * expression.cs (Expression::TryImplicitIntConversion): Attempts
9317         to provide an expression that performsn an implicit constant int
9318         conversion (section 6.1.6).
9319         (Expression::ConvertImplicitRequired): Reworked to include
9320         implicit constant expression conversions.
9321
9322         (Expression::ConvertNumericExplicit): Finished.
9323
9324         (Invocation::Emit): If InstanceExpression is null, then it means
9325         that we perform a call on this.
9326         
9327 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
9328
9329         * expression.cs (Unary::Emit): Remove some dead code.
9330         (Probe): Implement Resolve and Emit for `is'.
9331         (Expression::ConvertImplicitRequired): Attempt to do constant
9332         expression conversions here.  Maybe should be moved to
9333         ConvertImplicit, but I am not sure.
9334         (Expression::ImplicitLongConstantConversionPossible,
9335         Expression::ImplicitIntConstantConversionPossible): New functions
9336         that tell whether is it possible to apply an implicit constant
9337         expression conversion.
9338
9339         (ConvertNumericExplicit): Started work on explicit numeric
9340         conversions.
9341
9342         * cs-parser.jay: Update operator constants.
9343
9344         * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
9345         (Parameters::GetSignature): Hook up VerifyArgs here.
9346         (Parameters::VerifyArgs): Verifies that no two arguments have the
9347         same name. 
9348
9349         * class.cs (Operator): Update the operator names to reflect the
9350         ones that the spec expects (as we are just stringizing the
9351         operator names).
9352         
9353         * expression.cs (Unary::ResolveOperator): Fix bug: Use
9354         MethodInfo's ReturnType instead of LookupMethodByBuilder as the
9355         previous usage did only work for our methods.
9356         (Expression::ConvertImplicit): Handle decimal implicit numeric
9357         conversions as well.
9358         (Expression::InternalTypeConstructor): Used to invoke constructors
9359         on internal types for default promotions.
9360
9361         (Unary::Emit): Implement special handling for the pre/post
9362         increment/decrement for overloaded operators, as they need to have
9363         the same semantics as the other operators.
9364
9365         (Binary::ResolveOperator): ditto.
9366         (Invocation::ConversionExists): ditto.
9367         (UserImplicitCast::Resolve): ditto.
9368         
9369 2001-09-26  Ravi Pratap  <ravi@ximian.com>
9370
9371         * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
9372         operator, return after emitting body. Regression tests pass again !
9373
9374         * expression.cs (ConvertImplicit): Take TypeContainer as first argument
9375         (Unary::ForceConversion, Binary::ForceConversion): Ditto.
9376         (Invocation::OverloadResolve): Ditto.
9377         (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
9378
9379         * everywhere : update calls to the above methods accordingly.
9380
9381 2001-09-26  Miguel de Icaza  <miguel@ximian.com>
9382
9383         * assign.cs (Assign): Make it inherit from ExpressionStatement.
9384
9385         * expression.cs (ExpressionStatement): New base class used for
9386         expressions that can appear in statements, so that we can provide
9387         an alternate path to generate expression that do not leave a value
9388         on the stack.
9389
9390         (Expression::Emit, and all the derivatives): We no longer return
9391         whether a value is left on the stack or not.  Every expression
9392         after being emitted leaves a single value on the stack.
9393
9394         * codegen.cs (EmitContext::EmitStatementExpression): Use the
9395         facilties of ExpressionStatement if possible.
9396
9397         * cs-parser.jay: Update statement_expression.
9398
9399 2001-09-25  Miguel de Icaza  <miguel@ximian.com>
9400
9401         * driver.cs: Change the wording of message
9402
9403 2001-09-25  Ravi Pratap  <ravi@ximian.com>
9404
9405         * expression.cs (Binary::ResolveOperator): Had forgottten to set 
9406         the type of the expression to the return type of the method if
9407         we have an overloaded operator match ! The regression tests pass again !
9408         (Unary::ResolveOperator): Ditto.
9409
9410         * expression.cs (Invocation::ConversionExists): Correct the member lookup
9411         to find "op_Implicit", not "implicit" ;-)
9412         (UserImplicitCast): New class to take care of user-defined implicit conversions.
9413         (ConvertImplicit, ForceConversion): Take TypeContainer argument
9414
9415         * everywhere : Correct calls to the above accordingly.
9416
9417         * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
9418         (ConvertImplicit): Do user-defined conversion if it exists.
9419
9420 2001-09-24  Miguel de Icaza  <miguel@ximian.com>
9421
9422         * assign.cs: track location.
9423         (Resolve): Use implicit conversions on assignment.
9424
9425         * literal.cs: Oops.  Not good, Emit of short access values should
9426         pass (Bytes) or the wrong argument will be selected.
9427
9428         * expression.cs (Unary::Emit): Emit code for -expr.
9429         
9430         (Unary::ResolveOperator): Handle `Substract' for non-constants
9431         (substract from zero from the non-constants).
9432         Deal with Doubles as well. 
9433         
9434         (Expression::ConvertImplicitRequired): New routine that reports an
9435         error if no implicit conversion exists. 
9436
9437         (Invocation::OverloadResolve): Store the converted implicit
9438         expressions if we make them
9439         
9440 2001-09-24  Ravi Pratap  <ravi@ximian.com>
9441
9442         * class.cs (ConstructorInitializer): Take a Location argument.
9443         (ConstructorBaseInitializer): Same here.
9444         (ConstructorThisInitializer): Same here.
9445
9446         * cs-parser.jay : Update all calls accordingly.
9447
9448         * expression.cs (Unary, Binary, New): Take location argument.
9449         Update accordingly everywhere.
9450
9451         * cs-parser.jay : Update all calls to the above to take a location
9452         argument.
9453
9454         * class.cs : Ditto.
9455
9456 2001-09-24  Ravi Pratap  <ravi@ximian.com>
9457
9458         * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
9459         (Invocation::BetterConversion): Same here
9460         (Invocation::ConversionExists): Ditto.
9461
9462         (Invocation::ConversionExists): Implement.
9463
9464 2001-09-22  Ravi Pratap  <ravi@ximian.com>
9465
9466         * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
9467         Also take an additional TypeContainer argument.
9468
9469         * All over : Pass in TypeContainer as argument to OverloadResolve.
9470
9471         * typemanager.cs (CSharpName): Update to check for the string type and return
9472         that too.
9473
9474         * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
9475         a given method.
9476         
9477 2001-09-21  Ravi Pratap  <ravi@ximian.com>
9478
9479         * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
9480         (Invocation::BetterFunction): Implement.
9481         (Invocation::BetterConversion): Implement.
9482         (Invocation::ConversionExists): Skeleton, no implementation yet.
9483
9484         Okay, things work fine !
9485
9486 2001-09-21  Miguel de Icaza  <miguel@ximian.com>
9487
9488         * typemanager.cs: declare and load enum_type, delegate_type and
9489         void_type. 
9490
9491         * expression.cs (Expression::Emit): Now emit returns a value that
9492         tells whether a value is left on the stack or not.  This strategy
9493         might be reveted tomorrow with a mechanism that would address
9494         multiple assignments.
9495         (Expression::report118): Utility routine to report mismatches on
9496         the ExprClass.
9497
9498         (Unary::Report23): Report impossible type/operator combination
9499         utility function.
9500
9501         (Unary::IsIncrementableNumber): Whether the type can be
9502         incremented or decremented with add.
9503         (Unary::ResolveOperator): Also allow enumerations to be bitwise
9504         complemented. 
9505         (Unary::ResolveOperator): Implement ++, !, ~,
9506
9507         (Invocation::Emit): Deal with new Emit convetion.
9508         
9509         * All Expression derivatives: Updated their Emit method to return
9510         whether they leave values on the stack or not.
9511         
9512         * codegen.cs (CodeGen::EmitStatement): Pop values left on the
9513         stack for expressions that are statements. 
9514
9515 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
9516
9517         * expression.cs (LValue): New interface.  Must be implemented by
9518         LValue objects.
9519         (LocalVariableReference, ParameterReference, FieldExpr): Implement
9520         LValue interface.
9521         
9522         * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
9523         interface for generating code, simplifies the code.
9524
9525 2001-09-20  Ravi Pratap  <ravi@ximian.com>
9526
9527         * expression.cs (everywhere): Comment out return statements in ::Resolve
9528         methods to avoid the warnings.
9529
9530 2001-09-20  Miguel de Icaza  <miguel@ximian.com>
9531
9532         * driver.cs (parse): Report error 2001 if we can not open the
9533         source file.
9534
9535         * expression.cs (SimpleName::ResolveSimpleName): Error if we can
9536         not resolve it.
9537
9538         * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
9539         object. 
9540
9541         * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
9542         otherwise nested blocks end up with the same index.
9543
9544         * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
9545
9546         * expression.cs:  Instead of having FIXMEs in the Resolve
9547         functions, throw exceptions so it is obvious that we are facing a
9548         bug. 
9549
9550         * cs-parser.jay (invocation_expression): Pass Location information.
9551
9552         * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
9553         Use a basename for those routines because .NET does not like paths
9554         on them. 
9555
9556         * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
9557         already defined.
9558
9559 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
9560
9561         * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
9562         are loading the correct data types (throws an exception if not).
9563         (TypeManager::InitCoreTypes): Use CoreLookupType
9564
9565         * expression.cs (Unary::ResolveOperator): return the child
9566         expression for expressions which are just +expr.
9567         (Unary::ResolveOperator): Return negative literals for -LITERAL
9568         expressions (otherwise they are Unary {Literal}).
9569         (Invocation::Badness): Take into account `Implicit constant
9570         expression conversions'.
9571
9572         * literal.cs (LongLiteral): Implement long literal class.
9573         (IntLiteral): export the `Value' of the intliteral. 
9574
9575 2001-09-19  Ravi Pratap  <ravi@ximian.com>
9576
9577         * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
9578
9579         * class.cs (Operator::Define): Change the methodname prefix to 'op_' 
9580         instead of 'Operator'
9581
9582         * expression.cs (Binary::ResolveOperator): Update accordingly.
9583         (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
9584         and 'Minus'
9585
9586         * cs-parser.jay (unary_expression): Update to use the new names.
9587
9588         * gen-treedump.cs (GetUnary): Same here.
9589
9590         * expression.cs (Unary::Resolve): Implement.
9591         (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded 
9592         operators are found instead of making noise ;-)
9593         (Unary::ResolveOperator): New method to do precisely the same thing which
9594         Binary::ResolveOperator does for Binary expressions.
9595         (Unary.method, .Arguments): Add.
9596         (Unary::OperName): Implement.   
9597         (Unary::ForceConversion): Copy and Paste !
9598
9599         * class.cs (Operator::Define): Fix a small bug for the case when we have 
9600         a unary operator.
9601
9602         * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
9603         for the inbuilt operators. Only overloading works for now ;-)
9604
9605 2001-09-18  Miguel de Icaza  <miguel@ximian.com>
9606
9607         * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
9608         UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
9609
9610         * expression.cs (This::Emit): Implement. 
9611         (This::Resolve): Implement.
9612         (TypeOf:Resolve): Implement.
9613         (Expression::ResolveSimpleName): Add an implicit this to instance
9614         field references. 
9615         (MemberAccess::Resolve): Deal with Parameters and Fields. 
9616         Bind instance variable to Field expressions.
9617         (FieldExpr::Instance): New field used to track the expression that
9618         represents the object instance.
9619         (FieldExpr::Resolve): Track potential errors from MemberLookup not
9620         binding 
9621         (FieldExpr::Emit): Implement.
9622
9623         * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
9624         the last instruction contains a return opcode to avoid generating
9625         the last `ret' instruction (this generates correct code, and it is
9626         nice to pass the peverify output).
9627
9628         * class.cs (TypeContainer::EmitFieldInitializers): Implement field
9629         initializer for static and instance variables.
9630         (Constructor::Emit): Allow initializer to be null in the case of
9631         static constructors.  Only emit initializer for instance
9632         constructors. 
9633
9634         (TypeContainer::FindMembers): Return a null array if there are no
9635         matches.
9636
9637         Also fix the code for the MemberTypes.Method branch, as it was not
9638         scanning that for operators (or tried to access null variables before).
9639
9640         * assign.cs (Assign::Emit): Handle instance and static fields. 
9641
9642         * TODO: Updated.
9643
9644         * driver.cs: Stop compilation if there are parse errors.
9645
9646         * cs-parser.jay (constructor_declaration): Provide default base
9647         initializer for non-static constructors.
9648         (constructor_declarator): Do not provide a default base
9649         initializers if none was specified.
9650         Catch the fact that constructors should not have parameters.
9651
9652         * class.cs: Do not emit parent class initializers for static
9653         constructors, that should be flagged as an error.
9654
9655 2001-09-18  Ravi Pratap  <ravi@ximian.com>
9656
9657         * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
9658         Move back code into TypeContainer::Populate.
9659
9660 2001-09-18  Ravi Pratap  <ravi@ximian.com>
9661
9662         * class.cs (TypeContainer::AddConstructor): Fix the check to
9663         compare against Name, not Basename. 
9664         (Operator::OpType): Change Plus and Minus to Add and Subtract.
9665
9666         * cs-parser.jay : Update accordingly.
9667
9668         * class.cs (TypeContainer::FindMembers): For the case where we are searching
9669         for methods, don't forget to look into the operators too.
9670         (RegisterMethodBuilder): Helper method to take care of this for
9671         methods, constructors and operators.
9672         (Operator::Define): Completely revamp.
9673         (Operator.OperatorMethod, MethodName): New fields.
9674         (TypeContainer::Populate): Move the registering of builders into
9675         RegisterMethodBuilder.
9676         (Operator::Emit): Re-write.
9677
9678         * expression.cs (Binary::Emit): Comment out code path to emit method
9679         invocation stuff for the case when we have a user defined operator. I am
9680         just not able to get it right !
9681         
9682 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
9683
9684         * expression.cs (Expression::OverloadResolve): Drop TypeContainer
9685         argument. 
9686
9687         (Expression::MemberLookup): Provide a version that allows to
9688         specify the MemberTypes and BindingFlags. 
9689
9690         * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
9691         so it was not fetching variable information from outer blocks.
9692
9693         * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
9694         Beforefieldinit as it was buggy.
9695
9696         * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
9697         that Ravi put here.  
9698
9699         * class.cs (Constructor::Emit): Only emit if block is not null.
9700         (TypeContainer::EmitDefaultConstructor): Removed routine, now we
9701         deal with this by semantically definining it as if the user had
9702         done it.
9703
9704         (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
9705         constructors as we now "emit" them at a higher level.
9706
9707         (TypeContainer::DefineDefaultConstructor): Used to define the
9708         default constructors if none was provided.
9709
9710         (ConstructorInitializer): Add methods Resolve and Emit. 
9711         
9712         * expression.cs: Cast to ConstructorInfo instead of MethodInfo
9713
9714 2001-09-17  Ravi Pratap  <ravi@ximian.com>
9715
9716         * class.cs (TypeContainer::EmitDefaultConstructor): Register
9717         the default constructor builder with our hashtable for methodbuilders
9718         to methodcores.
9719
9720         * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
9721         and argument_count is 0 in which case we have a match.
9722         (Binary::ResolveOperator): More null checking and miscellaneous coding
9723         style cleanup.
9724
9725 2001-09-17  Ravi Pratap  <ravi@ximian.com>
9726
9727         * rootcontext.cs (IsNameSpace): Compare against null.
9728
9729         * everywhere : Correct spelling to 'Greater' and to 'Subtract'
9730
9731         * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
9732         and Unary::Operator.
9733
9734         * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
9735         accordingly.
9736
9737         * expression.cs (Binary::method): New member to hold the MethodBase for the case when
9738         we have overloaded operators.
9739         (Binary::ResolveOperator): Implement the part which does the operator overload
9740         resolution.
9741
9742         * class.cs (Operator::Emit): Implement.
9743         (TypeContainer::Emit): Emit the operators we have too.
9744
9745         * expression.cs (Binary::Emit): Update to emit the appropriate code for
9746         the case when we have a user-defined operator.
9747         
9748 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
9749
9750         * rootcontext.cs: Fix bug: tree.Namespaces might be null.
9751
9752 2001-09-16  Ravi Pratap  <ravi@ximian.com>
9753
9754         * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
9755         (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
9756         (Constructor::Emit): Implement.
9757         (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
9758         if we have no work to do. 
9759         (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's 
9760         Emit method.
9761
9762         * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
9763         (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
9764
9765         * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
9766         of parent.parent.
9767
9768 2001-09-15  Ravi Pratap  <ravi@ximian.com>
9769
9770         * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
9771         in the source.
9772         (Tree::RecordNamespace): Method to do what the name says ;-)
9773         (Tree::Namespaces): Property to get at the namespaces hashtable.
9774
9775         * cs-parser.jay (namespace_declaration): Call RecordNamespace to 
9776         keep track.
9777
9778         * rootcontext.cs (IsNamespace): Fixed it :-)
9779
9780 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
9781
9782         * class.cs (TypeContainer::FindMembers): Add support for
9783         constructors. 
9784         (MethodCore): New class that encapsulates both the shared aspects
9785         of a Constructor and a Method.  
9786         (Method, Constructor): Factored pieces into MethodCore.
9787
9788         * driver.cs: Added --fatal which makes errors throw exceptions.
9789         Load System assembly as well as part of the standard library.
9790
9791         * report.cs: Allow throwing exceptions on errors for debugging.
9792
9793         * modifiers.cs: Do not use `parent', instead use the real type
9794         container to evaluate permission settings.
9795
9796         * class.cs: Put Ravi's patch back in.  He is right, and we will
9797         have to cope with the
9798
9799 2001-09-14  Ravi Pratap  <ravi@ximian.com>
9800
9801         * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
9802         FamORAssem, not FamANDAssem.
9803         
9804 2001-09-14  Miguel de Icaza  <miguel@ximian.com>
9805
9806         * driver.cs: Added --parse option that only parses its input files
9807         and terminates.
9808
9809         * class.cs: Reverted last change from Ravi to IsTopLevel.  That is
9810         incorrect.  IsTopLevel is not used to tell whether an object is
9811         root_types or not (that can be achieved by testing this ==
9812         root_types).  But to see if this is a top-level *class* (not
9813         necessarly our "toplevel" container). 
9814
9815 2001-09-14  Ravi Pratap  <ravi@ximian.com>
9816
9817         * enum.cs (Enum::Define): Modify to call the Lookup method on the
9818         parent instead of a direct call to GetType.
9819
9820 2001-09-14  Ravi Pratap  <ravi@ximian.com>
9821
9822         * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
9823         Modifiers.TypeAttr. This should just be a call to that method.
9824
9825         * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
9826         object so that we can determine if we are top-level or not.
9827
9828         * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the 
9829         TypeContainer too.
9830
9831         * enum.cs (Enum::Define): Ditto.
9832
9833         * modifiers.cs (FieldAttr): Re-write.
9834
9835         * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
9836         (TypeContainer::HaveStaticConstructor): New property to provide access
9837         to precisely that info.
9838
9839         * modifiers.cs (MethodAttr): Re-write.
9840         (EventAttr): Remove altogether as there seems to be no ostensible use for it.
9841
9842         * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
9843         of top-level types as claimed.
9844         
9845 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
9846
9847         * expression.cs (MemberLookup): Fruitless attempt to lookup
9848         constructors.  Maybe I need to emit default constructors?  That
9849         might be it (currently .NET emits this for me automatically).
9850         (Invocation::OverloadResolve): Cope with Arguments == null.
9851         (Invocation::EmitArguments): new function, shared by the new
9852         constructor and us.
9853         (Invocation::Emit): Handle static and instance methods.  Emit
9854         proper call instruction for virtual or non-virtual invocations.
9855         (New::Emit): Implement.
9856         (New::Resolve): Implement.
9857         (MemberAccess:Resolve): Implement.
9858         (MethodGroupExpr::InstanceExpression): used conforming to the spec
9859         to track instances.
9860         (FieldExpr::Resolve): Set type.
9861
9862         * support.cs: Handle empty arguments.
9863                 
9864         * cs-parser.jay (CompositeLookup, QualifierIdentifier,
9865         SimpleLookup): Auxiliary routines to help parse a qualifier
9866         identifier.  
9867
9868         Update qualifier_identifier rule.
9869
9870         * codegen.cs: Removed debugging messages.
9871
9872         * class.cs: Make this a global thing, this acts just as a "key" to
9873         objects that we might have around.
9874
9875         (Populate): Only initialize method_builders_to_methods once.
9876
9877         * expression.cs (PropertyExpr): Initialize type from the
9878         PropertyType. 
9879
9880         * codegen.cs (EmitContext::EmitBoolExpression): Use propper
9881         Resolve pattern.  Attempt to implicitly convert value to boolean.
9882         Emit code.
9883
9884         * expression.cs: Set the type for the int32/int32 argument case.
9885         (Binary::ResolveOperator): Set the return type to boolean for
9886         comparission operators
9887
9888         * typemanager.cs: Remove debugging print code.
9889
9890         (Invocation::Resolve): resolve type.
9891
9892         * class.cs: Allocate a MemberInfo of the correct size, as the code
9893         elsewhere depends on the test to reflect the correct contents.
9894
9895         (Method::) Keep track of parameters, due to System.Reflection holes
9896
9897         (TypeContainer::Populate): Keep track of MethodBuilders to Method
9898         mapping here.
9899
9900         (TypeContainer::FindMembers): Use ArrayList and then copy an array
9901         of the exact size and return that.
9902
9903         (Class::LookupMethodByBuilder): New function that maps
9904         MethodBuilders to its methods.  Required to locate the information
9905         on methods because System.Reflection bit us again.
9906
9907         * support.cs: New file, contains an interface ParameterData and
9908         two implementations: ReflectionParameters and InternalParameters
9909         used to access Parameter information.  We will need to grow this
9910         as required.
9911
9912         * expression.cs (Invocation::GetParameterData): implement a cache
9913         and a wrapper around the ParameterData creation for methods. 
9914         (Invocation::OverloadResolve): Use new code.
9915
9916 2001-09-13  Ravi Pratap  <ravi@ximian.com>
9917
9918         * class.cs (TypeContainer::EmitField): Remove and move into 
9919         (Field::Define): here and modify accordingly.
9920         (Field.FieldBuilder): New member.
9921         (TypeContainer::Populate): Update accordingly.
9922         (TypeContainer::FindMembers): Implement.
9923
9924 2001-09-13  Miguel de Icaza  <miguel@ximian.com>
9925
9926         * statement.cs: (VariableInfo::VariableType): New field to be
9927         initialized with the full type once it is resolved. 
9928
9929 2001-09-12  Miguel de Icaza  <miguel@ximian.com>
9930
9931         * parameter.cs (GetParameterInfo): Use a type cache to compute
9932         things only once, and to reuse this information
9933
9934         * expression.cs (LocalVariableReference::Emit): Implement.
9935         (OpcodeCast::Emit): fix.
9936
9937         (ParameterReference::Resolve): Implement.
9938         (ParameterReference::Emit): Implement.
9939
9940         * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
9941         that are expressions need to stay as Expressions.
9942
9943         * typemanager.cs (CSharpName): Returns the C# name of a type if
9944         possible. 
9945
9946         * expression.cs (Expression::ConvertImplicit): New function that
9947         implements implicit type conversions.
9948
9949         (Expression::ImplicitReferenceConversion): Implements implicit
9950         reference conversions.
9951
9952         (EmptyCast): New type for transparent casts.
9953
9954         (OpcodeCast): New type for casts of types that are performed with
9955         a sequence of bytecodes.
9956         
9957         (BoxedCast): New type used for casting value types into reference
9958         types.  Emits a box opcode.
9959
9960         (Binary::DoNumericPromotions): Implements numeric promotions of
9961         and computation of the Binary::Type.
9962
9963         (Binary::EmitBranchable): Optimization.
9964
9965         (Binary::Emit): Implement code emission for expressions.
9966         
9967         * typemanager.cs (TypeManager): Added two new core types: sbyte
9968         and byte.
9969
9970 2001-09-12  Ravi Pratap  <ravi@ximian.com>
9971
9972         * class.cs (TypeContainer::FindMembers): Method which does exactly
9973         what Type.FindMembers does, only we don't have to use reflection. No
9974         implementation yet.
9975
9976         * typemanager.cs (typecontainers): New hashtable to hold the corresponding
9977         typecontainer objects as we need to get at them.
9978         (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
9979
9980         * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
9981         typecontainer object.
9982
9983         * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
9984         of just a Report object.
9985
9986 2001-09-11  Ravi Pratap  <ravi@ximian.com>
9987
9988         * class.cs (Event::Define): Go back to using the prefixes "add_" and
9989         "remove_"
9990         (TypeContainer::Populate): Now define the delegates of the type too.
9991         (TypeContainer.Delegates): Property to access the list of delegates defined
9992         in the type.
9993
9994         * delegates.cs (Delegate::Define): Implement partially.
9995
9996         * modifiers.cs (TypeAttr): Handle more flags.
9997
9998 2001-09-11  Ravi Pratap  <ravi@ximian.com>
9999
10000         * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
10001         and not <=
10002         (Operator::Define): Re-write logic to get types by using the LookupType method
10003         instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
10004         (Indexer::Define): Ditto.
10005         (Event::Define): Ditto.
10006         (Property::Define): Ditto.
10007         
10008 2001-09-10  Ravi Pratap  <ravi@ximian.com>
10009
10010         * class.cs (TypeContainer::Populate): Now define operators too. 
10011         (TypeContainer.Operators): New property to access the list of operators
10012         in a type.
10013         (Operator.OperatorMethodBuilder): New member to hold the method builder
10014         for the operator we are defining.
10015         (Operator::Define): Implement.
10016
10017 2001-09-10  Ravi Pratap  <ravi@ximian.com>
10018
10019         * class.cs (Event::Define): Make the prefixes of the accessor methods
10020         addOn_ and removeOn_ 
10021
10022         * genericparser.cs (GenericParser::error): Overloaded method to handle the case
10023         of the location being passed in too. Ideally, this should go later since all
10024         error reporting should be done through the Report object.
10025
10026         * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
10027         (Populate): Iterate thru the indexers we have and define them too.
10028         (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
10029         for the get and set accessors.
10030         (Indexer::Define): Implement.
10031         
10032 2001-09-09  Miguel de Icaza  <miguel@ximian.com>
10033
10034         * expression.cs (Binary::Resolve): Beginning of it.  I scratched
10035         my previous implementation, did not work.
10036
10037         * typemanager.cs: Add a couple of missing types (the longs).
10038
10039         * literal.cs: Use TypeManager.bool_type instead of getting it.
10040
10041         * expression.cs (EventExpr): New kind of expressions.
10042         (Expressio::ExprClassFromMemberInfo): finish
10043
10044 2001-09-08  Miguel de Icaza  <miguel@ximian.com>
10045
10046         * assign.cs: Emit stores to static fields differently.
10047
10048 2001-09-08  Ravi Pratap  <ravi@ximian.com>
10049
10050         * Merge in changes and adjust code to tackle conflicts. Backed out my
10051         code in Assign::Resolve ;-) 
10052
10053 2001-09-08  Ravi Pratap  <ravi@ximian.com>
10054
10055         * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
10056         instead Report.Error and also pass in the location.
10057         (CSharpParser::Lexer): New readonly property to return the reference
10058         to the Tokenizer object.
10059         (declare_local_variables): Use Report.Error with location instead of plain 
10060         old error.
10061         (CheckDef): Ditto.
10062
10063         * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
10064         (Operator.CheckBinaryOperator): Ditto.
10065
10066         * cs-parser.jay (operator_declarator): Update accordingly.
10067
10068         * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
10069         (CheckBinaryOperator): Same here.
10070
10071         * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
10072         on the name without any prefixes of namespace names etc. This is because we
10073         already might have something already fully qualified like 
10074         'System.Console.WriteLine'
10075
10076         * assign.cs (Resolve): Begin implementation. Stuck ;-)
10077
10078 2001-09-07  Ravi Pratap  <ravi@ximian.com>
10079
10080         * cs-tokenizer.cs (location): Return a string which also contains
10081         the file name.
10082
10083         * expression.cs (ElementAccess): New class for expressions of the
10084         type 'element access.'
10085         (BaseAccess): New class for expressions of the type 'base access.'
10086         (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
10087         respectively.
10088         
10089         * cs-parser.jay (element_access): Implement action.
10090         (base_access): Implement actions.
10091         (checked_expression, unchecked_expression): Implement.
10092
10093         * cs-parser.jay (local_variable_type): Correct and implement.
10094         (type_suffixes, type_suffix_list, type_suffix): Implement actions.
10095
10096         * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
10097
10098         * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
10099         name and the specifiers.
10100
10101         * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
10102         
10103         * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of 
10104         making them all public ;-)
10105
10106         * cs-parser.jay (error): Remove entirely as we have an implementation in the base
10107         class anyways.
10108         
10109 2001-09-07  Miguel de Icaza  <miguel@ximian.com>
10110
10111         * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
10112         PropertyExprs.
10113         (FieldExpr, PropertyExprs): New resolved expressions.
10114         (SimpleName::MemberStaticCheck): Perform static checks for access
10115         to non-static fields on static methods. Maybe this should be
10116         generalized for MemberAccesses. 
10117         (SimpleName::ResolveSimpleName): More work on simple name
10118         resolution. 
10119
10120         * cs-parser.jay (primary_expression/qualified_identifier): track
10121         the parameter index.
10122
10123         * codegen.cs (CodeGen::Save): Catch save exception, report error.
10124         (EmitContext::EmitBoolExpression): Chain to expression generation
10125         instead of temporary hack.
10126         (::EmitStatementExpression): Put generic expression code generation.
10127
10128         * assign.cs (Assign::Emit): Implement variable assignments to
10129         local variables, parameters and fields.
10130
10131 2001-09-06  Miguel de Icaza  <miguel@ximian.com>
10132
10133         * statement.cs (Block::GetVariableInfo): New method, returns the
10134         VariableInfo for a variable name in a block.
10135         (Block::GetVariableType): Implement in terms of GetVariableInfo
10136
10137         * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
10138         DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
10139
10140 2001-09-06  Ravi Pratap  <ravi@ximian.com>
10141
10142         * cs-parser.jay (operator_declaration): Continue on my quest : update
10143         to take attributes argument.
10144         (event_declaration): Ditto.
10145         (enum_declaration): Ditto.
10146         (indexer_declaration): Ditto.
10147         
10148         * class.cs (Operator::Operator): Update constructor accordingly.
10149         (Event::Event): Ditto.
10150
10151         * delegate.cs (Delegate::Delegate): Same here.
10152
10153         * enum.cs (Enum::Enum): Same here.
10154         
10155 2001-09-05  Ravi Pratap  <ravi@ximian.com>
10156
10157         * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
10158
10159         * ../tests/cs0658.cs : New file to demonstrate error 0658.
10160
10161         * attribute.cs (Attributes): New class to encapsulate all attributes which were
10162         being passed around as an arraylist.
10163         (Attributes::AddAttribute): Method to add attribute sections.
10164
10165         * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
10166         (struct_declaration): Update accordingly.
10167         (constant_declaration): Update.
10168         (field_declaration): Update.
10169         (method_header): Update.
10170         (fixed_parameter): Update.
10171         (parameter_array): Ditto.
10172         (property_declaration): Ditto.
10173         (destructor_declaration): Ditto.
10174         
10175         * class.cs (Struct::Struct): Update constructors accordingly.
10176         (Class::Class): Ditto.
10177         (Field::Field): Ditto.
10178         (Method::Method): Ditto.
10179         (Property::Property): Ditto.
10180         (TypeContainer::OptAttribute): update property's return type.
10181         
10182         * interface.cs (Interface.opt_attributes): New member.
10183         (Interface::Interface): Update to take the extra Attributes argument.
10184
10185         * parameter.cs (Parameter::Parameter): Ditto.
10186
10187         * constant.cs (Constant::Constant): Ditto.
10188
10189         * interface.cs (InterfaceMemberBase): New OptAttributes field.
10190         (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take 
10191         the attributes as a parameter.
10192         (InterfaceProperty): Update constructor call.
10193         (InterfaceEvent): Ditto.
10194         (InterfaceMethod): Ditto.
10195         (InterfaceIndexer): Ditto.
10196
10197         * cs-parser.jay (interface_indexer_declaration): Update call to constructor to 
10198         pass the attributes too.
10199         (interface_event_declaration): Ditto.
10200         (interface_property_declaration): Ditto.
10201         (interface_method_declaration): Ditto.
10202         (interface_declaration): Ditto.
10203
10204 2001-09-05  Miguel de Icaza  <miguel@ximian.com>
10205
10206         * class.cs (Method::Define): Track the "static Main" definition to
10207         create an entry point. 
10208
10209         * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
10210         EntryPoint if we find it. 
10211
10212         * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
10213         (EmitContext::ig): Make this variable public.
10214
10215         * driver.cs: Make the default output file be the first file name
10216         with the .exe extension.  
10217
10218         Detect empty compilations
10219
10220         Handle various kinds of output targets.  Handle --target and
10221         rename -t to --dumper.
10222
10223         * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
10224         methods inherited from Expression return now an Expression.  This
10225         will is used during the tree rewriting as we resolve them during
10226         semantic analysis.
10227
10228         (Expression::MemberLookup): Implements the MemberLookup (7.3) from
10229         the spec.  Missing entirely is the information about
10230         accessability of elements of it.
10231
10232         (Expression::ExprClassFromMemberInfo): New constructor for
10233         Expressions that creates a fully initialized Expression based on
10234         a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
10235         a Type.
10236
10237         (Invocation::Resolve): Begin implementing resolution of invocations.
10238         
10239         * literal.cs (StringLiteral):  Implement Emit.
10240
10241 2001-09-05  Ravi Pratap  <ravi@ximian.com>
10242
10243         * cs-parser.jay (error): Add new modifier because we are hiding an inherited
10244         member.
10245         
10246 2001-09-04  Ravi Pratap  <ravi@ximian.com>
10247
10248         * cs-parser.jay (attribute_arguments): Implement actions.
10249         (attribute): Fix bug in production. Implement action.
10250         (attribute_list): Implement.
10251         (attribute_target): Implement.
10252         (attribute_target_specifier, opt_target_specifier): Implement
10253         (CheckAttributeTarget): New method to check if the attribute target
10254         is valid.
10255         (attribute_section): Implement.
10256         (opt_attributes): Implement.
10257
10258         * attribute.cs : New file to handle attributes.
10259         (Attribute): Class to hold attribute info.
10260
10261         * cs-parser.jay (opt_attribute_target_specifier): Remove production
10262         (attribute_section): Modify production to use 2 different rules to 
10263         achieve the same thing. 1 s/r conflict down !
10264         Clean out commented, useless, non-reducing dimension_separator rules.
10265         
10266         * class.cs (TypeContainer.attributes): New member to hold list
10267         of attributes for a type.
10268         (Struct::Struct): Modify to take one more argument, the attribute list.
10269         (Class::Class): Ditto.
10270         (Field::Field): Ditto.
10271         (Method::Method): Ditto.
10272         (Property::Property): Ditto.
10273         
10274         * cs-parser.jay (struct_declaration): Update constructor call to
10275         pass in the attributes too.
10276         (class_declaration): Ditto.
10277         (constant_declaration): Ditto.
10278         (field_declaration): Ditto.
10279         (method_header): Ditto.
10280         (fixed_parameter): Ditto.
10281         (parameter_array): Ditto.
10282         (property_declaration): Ditto.
10283
10284         * constant.cs (Constant::Constant): Update constructor similarly.
10285         Use System.Collections.
10286
10287         * parameter.cs (Parameter::Parameter): Update as above.
10288
10289 2001-09-02  Ravi Pratap  <ravi@ximian.com>
10290
10291         * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
10292         (TypeContainer.delegates): New member to hold list of delegates.
10293
10294         * cs-parser.jay (delegate_declaration): Implement the action correctly 
10295         this time as I seem to be on crack ;-)
10296
10297 2001-09-02  Miguel de Icaza  <miguel@ximian.com>
10298
10299         * rootcontext.cs (RootContext::IsNamespace): new function, used to
10300         tell whether an identifier represents a namespace.
10301
10302         * expression.cs (NamespaceExpr): A namespace expression, used only
10303         temporarly during expression resolution.
10304         (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
10305         utility functions to resolve names on expressions.
10306
10307 2001-09-01  Miguel de Icaza  <miguel@ximian.com>
10308
10309         * codegen.cs: Add hook for StatementExpressions. 
10310
10311         * class.cs: Fix inverted test for static flag in methods.
10312
10313 2001-09-02  Ravi Pratap  <ravi@ximian.com>
10314
10315         * class.cs (Operator::CheckUnaryOperator): Correct error number used
10316         to make it coincide with MS' number.
10317         (Operator::CheckBinaryOperator): Ditto.
10318
10319         * ../errors/errors.txt : Remove error numbers added earlier.
10320
10321         * ../errors/cs1019.cs : Test case for error # 1019
10322
10323         * ../errros/cs1020.cs : Test case for error # 1020
10324
10325         * cs-parser.jay : Clean out commented cruft.
10326         (dimension_separators, dimension_separator): Comment out. Ostensibly not
10327         used anywhere - non-reducing rule.
10328         (namespace_declarations): Non-reducing rule - comment out.
10329
10330         * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
10331         with TypeContainer::AddEnum.
10332
10333         * delegate.cs : New file for delegate handling classes.
10334         (Delegate): Class for declaring delegates.
10335
10336         * makefile : Update.
10337
10338         * cs-parser.jay (delegate_declaration): Implement.
10339
10340 2001-09-01  Ravi Pratap  <ravi@che.iitm.ac.in>
10341
10342         * class.cs (Event::Define): Implement.
10343         (Event.EventBuilder): New member.
10344
10345         * class.cs (TypeContainer::Populate): Update to define all enums and events
10346         we have.
10347         (Events): New property for the events arraylist we hold. Shouldn't we move to using
10348         readonly fields for all these cases ?
10349
10350 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
10351
10352         * class.cs (Property): Revamp to use the convention of making fields readonly.
10353         Accordingly modify code elsewhere.
10354
10355         * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
10356         the Define method of the Property class.
10357
10358         * class.cs : Clean up applied patch and update references to variables etc. Fix 
10359         trivial bug.
10360         (TypeContainer::Populate): Update to define all the properties we have. Also
10361         define all enumerations.
10362
10363         * enum.cs (Define): Implement.
10364         
10365 2001-08-31  Ravi Pratap  <ravi@che.iitm.ac.in>
10366
10367         * cs-parser.jay (overloadable_operator): The semantic value is an
10368         enum of the Operator class.
10369         (operator_declarator): Implement actions.
10370         (operator_declaration): Implement.
10371
10372         * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
10373         validity of definitions.
10374         (Operator::CheckBinaryOperator): Static method to check for binary operators
10375         (TypeContainer::AddOperator): New method to add an operator to a type.
10376
10377         * cs-parser.jay (indexer_declaration): Added line to actually call the
10378         AddIndexer method so it gets added ;-)
10379
10380         * ../errors/errors.txt : Update to include new error numbers. Are these numbers 
10381         already taken care of by the MS compiler ?  
10382
10383 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
10384
10385         * class.cs (Operator): New class for operator declarations.
10386         (Operator::OpType): Enum for the various operators.
10387
10388 2001-08-29  Ravi Pratap  <ravi@che.iitm.ac.in>
10389
10390         * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
10391         ostensibly handle this in semantic analysis.
10392
10393         * cs-parser.jay (general_catch_clause): Comment out
10394         (specific_catch_clauses, specific_catch_clause): Ditto.
10395         (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
10396         (catch_args, opt_catch_args): New productions.
10397         (catch_clause): Rewrite to use the new productions above
10398         (catch_clauses): Modify accordingly.
10399         (opt_catch_clauses): New production to use in try_statement
10400         (try_statement): Revamp. Basically, we get rid of one unnecessary rule
10401         and re-write the code in the actions to extract the specific and
10402         general catch clauses by being a little smart ;-)
10403
10404         * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
10405         Hooray, try and catch statements parse fine !
10406         
10407 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
10408
10409         * statement.cs (Block::GetVariableType): Fix logic to extract the type
10410         string from the hashtable of variables.
10411
10412         * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
10413         I end up making that mistake ;-)
10414         (catch_clauses): Fixed gross error which made Key and Value of the 
10415         DictionaryEntry the same : $1 !!
10416
10417 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
10418
10419         * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
10420
10421         * cs-parser.jay (event_declaration): Correct to remove the semicolon
10422         when the add and remove accessors are specified. 
10423
10424 2001-08-28  Ravi Pratap  <ravi@che.iitm.ac.in>
10425
10426         * cs-parser.jay (IndexerDeclaration): New helper class to hold
10427         information about indexer_declarator.
10428         (indexer_declarator): Implement actions.
10429         (parsing_indexer): New local boolean used to keep track of whether
10430         we are parsing indexers or properties. This is necessary because 
10431         implicit_parameters come into picture even for the get accessor in the 
10432         case of an indexer.
10433         (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
10434
10435         * class.cs (Indexer): New class for indexer declarations.
10436         (TypeContainer::AddIndexer): New method to add an indexer to a type.
10437         (TypeContainer::indexers): New member to hold list of indexers for the
10438         type.
10439
10440 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
10441
10442         * cs-parser.jay (add_accessor_declaration): Implement action.
10443         (remove_accessor_declaration): Implement action.
10444         (event_accessors_declaration): Implement
10445         (variable_declarators): swap statements for first rule - trivial.
10446
10447         * class.cs (Event): New class to hold information about event
10448         declarations.
10449         (TypeContainer::AddEvent): New method to add an event to a type
10450         (TypeContainer::events): New member to hold list of events.
10451
10452         * cs-parser.jay (event_declaration): Implement actions.
10453
10454 2001-08-27  Ravi Pratap  <ravi@che.iitm.ac.in>
10455
10456         * cs-parser.jay (dim_separators): Implement. Make it a string
10457         concatenating all the commas together, just as they appear.
10458         (opt_dim_separators): Modify accordingly
10459         (rank_specifiers): Update accordingly. Basically do the same
10460         thing - instead, collect the brackets here.
10461         (opt_rank_sepcifiers): Modify accordingly.
10462         (array_type): Modify to actually return the complete type string
10463         instead of ignoring the rank_specifiers.
10464         (expression_list): Implement to collect the expressions
10465         (variable_initializer): Implement. We make it a list of expressions
10466         essentially so that we can handle the array_initializer case neatly too.
10467         (variable_initializer_list): Implement.
10468         (array_initializer): Make it a list of variable_initializers
10469         (opt_array_initializer): Modify accordingly.
10470
10471         * expression.cs (New::NType): Add enumeration to help us
10472         keep track of whether we have an object/delegate creation
10473         or an array creation.
10474         (New:NewType, New::Rank, New::Indices, New::Initializers): New
10475         members to hold data about array creation.
10476         (New:New): Modify to update NewType
10477         (New:New): New Overloaded contructor for the array creation
10478         case.
10479
10480         * cs-parser.jay (array_creation_expression): Implement to call
10481         the overloaded New constructor.
10482         
10483 2001-08-26  Ravi Pratap  <ravi@che.iitm.ac.in>
10484
10485         * class.cs (TypeContainer::Constructors): Return member
10486         constructors instead of returning null.
10487
10488 2001-08-26  Miguel de Icaza  <miguel@ximian.com>
10489
10490         * typemanager.cs (InitCoreTypes): Initialize the various core
10491         types after we have populated the type manager with the user
10492         defined types (this distinction will be important later while
10493         compiling corlib.dll)
10494
10495         * expression.cs, literal.cs, assign.cs, constant.cs: Started work
10496         on Expression Classification.  Now all expressions have a method
10497         `Resolve' and a method `Emit'.
10498
10499         * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
10500         generation from working.     Also add some temporary debugging
10501         code. 
10502         
10503 2001-08-24  Miguel de Icaza  <miguel@ximian.com>
10504
10505         * codegen.cs: Lots of code generation pieces.  This is only the
10506         beginning, will continue tomorrow with more touches of polish.  We
10507         handle the fundamentals of if, while, do, for, return.  Others are
10508         trickier and I need to start working on invocations soon.
10509         
10510         * gen-treedump.cs: Bug fix, use s.Increment here instead of
10511         s.InitStatement. 
10512
10513         * codegen.cs (EmitContext): New struct, used during code
10514         emission to keep a context.   Most of the code generation will be
10515         here. 
10516
10517         * cs-parser.jay: Add embedded blocks to the list of statements of
10518         this block.  So code generation proceeds in a top down fashion.
10519
10520 2001-08-23  Miguel de Icaza  <miguel@ximian.com>
10521
10522         * statement.cs: Add support for multiple child blocks.
10523
10524 2001-08-22  Miguel de Icaza  <miguel@ximian.com>
10525
10526         * codegen.cs (EmitCode): New function, will emit the code for a
10527         Block of code given a TypeContainer and its ILGenerator. 
10528
10529         * statement.cs (Block): Standard public readonly optimization.
10530         (Block::Block constructors): Link children. 
10531         (Block::Child): Child Linker.
10532         (Block::EmitVariables): Emits IL variable declarations.
10533
10534         * class.cs: Drop support for MethodGroups here, delay until
10535         Semantic Analysis.
10536         (Method::): Applied the same simplification that I did before, and
10537         move from Properties to public readonly fields.
10538         (Method::ParameterTypes): Returns the parameter types for the
10539         function, and implements a cache that will be useful later when I
10540         do error checking and the semantic analysis on the methods is
10541         performed.
10542         (Constructor::GetCallingConvention): Renamed from CallingConvetion
10543         and made a method, optional argument tells whether this is a class
10544         or a structure to apply the `has-this' bit.
10545         (Method::GetCallingConvention): Implement, returns the calling
10546         convention. 
10547         (Method::Define): Defines the type, a second pass is performed
10548         later to populate the methods.
10549
10550         (Constructor::ParameterTypes): implement a cache similar to the
10551         one on Method::ParameterTypes, useful later when we do semantic
10552         analysis. 
10553
10554         (TypeContainer::EmitMethod):  New method.  Emits methods.
10555
10556         * expression.cs: Removed MethodGroup class from here.
10557         
10558         * parameter.cs (Parameters::GetCallingConvention): new method.
10559
10560 2001-08-21  Miguel de Icaza  <miguel@ximian.com>
10561
10562         * class.cs (TypeContainer::Populate): Drop RootContext from the
10563         argument. 
10564
10565         (Constructor::CallingConvention): Returns the calling convention.
10566         (Constructor::ParameterTypes): Returns the constructor parameter
10567         types. 
10568         
10569         (TypeContainer::AddConstructor): Keep track of default constructor
10570         and the default static constructor.
10571
10572         (Constructor::) Another class that starts using `public readonly'
10573         instead of properties. 
10574
10575         (Constructor::IsDefault): Whether this is a default constructor. 
10576
10577         (Field::) use readonly public fields instead of properties also.
10578
10579         (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
10580         track of static constructors;  If none is used, turn on
10581         BeforeFieldInit in the TypeAttributes. 
10582
10583         * cs-parser.jay (opt_argument_list): now the return can be null
10584         for the cases where there are no arguments. 
10585
10586         (constructor_declarator): If there is no implicit `base' or
10587         `this', then invoke the default parent constructor. 
10588         
10589         * modifiers.cs (MethodAttr): New static function maps a set of
10590         modifiers flags into a MethodAttributes enum
10591         (FieldAttr): renamed from `Map'.  So now we have FieldAttr,
10592         MethodAttr, TypeAttr to represent the various mappings where the
10593         modifiers are used.
10594         (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'  
10595
10596 2001-08-19  Miguel de Icaza  <miguel@ximian.com>
10597
10598         * parameter.cs (GetParameterInfo): Fix bug where there would be no
10599         method arguments.
10600
10601         * interface.cs (PopulateIndexer): Implemented the code generator
10602         for interface indexers.
10603
10604 2001-08-17  Miguel de Icaza  <miguel@ximian.com>
10605
10606         * interface.cs (InterfaceMemberBase): Now we track the new status
10607         here.  
10608
10609         (PopulateProperty): Implement property population.  Woohoo!  Got
10610         Methods and Properties going today. 
10611
10612         Removed all the properties for interfaces, and replaced them with
10613         `public readonly' fields. 
10614
10615 2001-08-16  Miguel de Icaza  <miguel@ximian.com>
10616
10617         * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
10618         initialize their hashtables/arraylists only when they are needed
10619         instead of doing this always.
10620
10621         * parameter.cs: Handle refs and out parameters.
10622
10623         * cs-parser.jay: Use an ArrayList to construct the arguments
10624         instead of the ParameterCollection, and then cast that to a
10625         Parameter[] array.
10626
10627         * parameter.cs: Drop the use of ParameterCollection and use
10628         instead arrays of Parameters.
10629
10630         (GetParameterInfo): Use the Type, not the Name when resolving
10631         types. 
10632
10633 2001-08-13  Miguel de Icaza  <miguel@ximian.com>
10634
10635         * parameter.cs: Eliminate the properties Name, Type and ModFlags,
10636         and instead use public readonly fields.
10637
10638         * class.cs: Put back walking code for type containers.
10639
10640 2001-08-11  Miguel de Icaza  <miguel@ximian.com>
10641
10642         * class.cs (MakeConstant): Code to define constants.
10643
10644         * rootcontext.cs (LookupType): New function.  Used to locate types 
10645
10646         
10647 2001-08-08  Miguel de Icaza  <miguel@ximian.com>
10648
10649         * rootcontext.cs: OH MY!  My trick works!   It is amazing how nice
10650         this System.Reflection code is.  Kudos to Microsoft
10651         
10652         * typemanager.cs: Implement a type cache and avoid loading all
10653         types at boot time.  Wrap in LookupType the internals.  This made
10654         the compiler so much faster.  Wow.  I rule!
10655         
10656         * driver.cs: Make sure we always load mscorlib first (for
10657         debugging purposes, nothing really important).
10658
10659         * Renamespaced things that were on `CSC' to `CIR'.  Maybe I should
10660         have moved to `CSC' rather than `CIR'.  Oh man!  The confussion!  
10661
10662         * rootcontext.cs: Lookup types on their namespace;  Lookup types
10663         on namespaces that have been imported using the `using' keyword.
10664
10665         * class.cs (TypeContainer::TypeAttr): Virtualize.
10666         (Class::TypeAttr): Return attributes suitable for this bad boy.
10667         (Struct::TypeAttr): ditto.
10668         Handle nested classes.
10669         (TypeContainer::) Remove all the type visiting code, it is now
10670         replaced with the rootcontext.cs code
10671
10672         * rootcontext.cs (GetClassBases): Added support for structs. 
10673
10674 2001-08-06  Miguel de Icaza  <miguel@ximian.com>
10675
10676         * interface.cs, statement.cs, class.cs, parameter.cs,
10677         rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
10678         Drop use of TypeRefs, and use strings instead.
10679
10680 2001-08-04  Miguel de Icaza  <miguel@ximian.com>
10681
10682         * rootcontext.cs: 
10683
10684         * class.cs (Struct::Struct): set the SEALED flags after
10685         checking the modifiers.
10686         (TypeContainer::TypeAttr): new property, returns the
10687         TypeAttributes for a class.  
10688
10689         * cs-parser.jay (type_list): Oops, list production was creating a
10690         new list of base types.
10691
10692         * rootcontext.cs (StdLib): New property.
10693         (GetInterfaceTypeByName): returns an interface by type name, and
10694         encapsulates error handling here.
10695         (GetInterfaces): simplified.
10696         (ResolveTree): Encapsulated all the tree resolution here.
10697         (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
10698         types. 
10699         
10700         * driver.cs: Add support for --nostdlib, to avoid loading the
10701         default assemblies.
10702         (Main): Do not put tree resolution here. 
10703
10704         * rootcontext.cs: Beginning of the class resolution.
10705
10706 2001-08-03  Miguel de Icaza  <miguel@ximian.com>
10707
10708         * rootcontext.cs: Provide better error reporting. 
10709
10710         * cs-parser.jay (interface_base): set our $$ to be interfaces.
10711
10712         * rootcontext.cs (CreateInterface): Handle the case where there
10713         are no parent interfaces.
10714         
10715         (CloseTypes): Routine to flush types at the end.
10716         (CreateInterface): Track types.
10717         (GetInterfaces): Returns an array of Types from the list of
10718         defined interfaces.
10719
10720         * typemanager.c (AddUserType): Mechanism to track user types (puts
10721         the type on the global type hash, and allows us to close it at the
10722         end). 
10723         
10724 2001-08-02  Miguel de Icaza  <miguel@ximian.com>
10725
10726         * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
10727         RecordInterface instead.
10728
10729         * cs-parser.jay: Updated to reflect changes above.
10730
10731         * decl.cs (Definition): Keep track of the TypeBuilder type that
10732         represents this type here.  Not sure we will use it in the long
10733         run, but wont hurt for now.
10734
10735         * driver.cs: Smaller changes to accomodate the new code.
10736
10737         Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
10738         when done. 
10739
10740         * rootcontext.cs (CreateInterface):  New method, used to create
10741         the System.TypeBuilder type for interfaces.
10742         (ResolveInterfaces): new entry point to resolve the interface
10743         hierarchy. 
10744         (CodeGen): Property, used to keep track of the code generator.
10745
10746 2001-07-26  Miguel de Icaza  <miguel@ximian.com>
10747
10748         * cs-parser.jay: Add a second production for delegate_declaration
10749         with `VOID'.
10750
10751         (enum_body): Put an opt_comma here instead of putting it on
10752         enum_body or enum_member_declarations so we can handle trailing
10753         commas on enumeration members.  Gets rid of a shift/reduce.
10754         
10755         (type_list): Need a COMMA in the middle.
10756
10757         (indexer_declaration): Tell tokenizer to recognize get/set
10758
10759         * Remove old targets.
10760
10761         * Re-add the parser target.
10762
10763 2001-07-13  Simon Cozens <simon@simon-cozens.org>
10764
10765         * cs-parser.jay: Add precendence rules for a number of operators
10766         ot reduce the number of shift/reduce conflicts in the grammar.
10767         
10768 2001-07-17  Miguel de Icaza  <miguel@ximian.com>
10769
10770         * tree.cs: moved IGenerator interface and renamed it to ITreeDump
10771         and put it here.
10772
10773         Get rid of old crufty code.
10774
10775         * rootcontext.cs: Use this to keep track of the parsed
10776         representation and the defined types available to the program. 
10777
10778         * gen-treedump.cs: adjust for new convention.
10779
10780         * type.cs: Split out the type manager, and the assembly builder
10781         from here. 
10782
10783         * typemanager.cs: the type manager will live here now.
10784
10785         * cil-codegen.cs: And the code generator here. 
10786
10787 2001-07-14  Sean MacIsaac  <macisaac@ximian.com>
10788
10789         * makefile: Fixed up for easy making.
10790
10791 2001-07-13  Simon Cozens <simon@simon-cozens.org>
10792
10793         * cs-parser.jay (rank_specifier): Remove a conflict by reordering
10794         the 
10795
10796         (unary_expression): Expand pre_increment_expression and
10797         post_decrement_expression to reduce a shift/reduce.
10798
10799 2001-07-11  Simon Cozens
10800
10801         * cs-tokenizer.cs: Hex numbers should begin with a 0.
10802
10803         Improve allow_keyword_as_indent name.
10804
10805 2001-06-19  Miguel de Icaza  <miguel@ximian.com>
10806
10807         * Adjustments for Beta2. 
10808
10809 2001-06-13  Miguel de Icaza  <miguel@ximian.com>
10810
10811         * decl.cs: Added `Define' abstract method.
10812         (InTransit): new property, used to catch recursive definitions. 
10813
10814         * interface.cs: Implement `Define'. 
10815
10816         * modifiers.cs: Map Modifiers.constants to
10817         System.Reflection.TypeAttribute flags.
10818
10819         * class.cs: Keep track of types and user-defined types.
10820         (BuilderInit): New method for creating an assembly
10821         (ResolveType): New function to launch the resolution process, only
10822         used by interfaces for now.
10823
10824         * cs-parser.jay: Keep track of Classes, Structs and Interfaces
10825         that are inserted into the name space. 
10826
10827 2001-06-08  Miguel de Icaza  <miguel@ximian.com>
10828
10829         * ARGH.  I have screwed up my tree so many times due to the use of
10830         rsync rather than using CVS.  Going to fix this at once. 
10831
10832         * driver.cs: Objetify driver.  Load assemblies, use assemblies to
10833         load types.
10834
10835 2001-06-07  Miguel de Icaza  <miguel@ximian.com>
10836
10837         * Experiment successful: Use System.Type rather that our own
10838         version of Type.  
10839
10840 2001-05-25  Miguel de Icaza  <miguel@ximian.com>
10841
10842         * cs-parser.jay: Removed nsAliases from here.
10843
10844         Use new namespaces, handle `using XXX;' 
10845
10846         * namespace.cs: Reimplemented namespace handling, use a recursive
10847         definition of the class.  Now we can keep track of using clauses
10848         and catch invalid using clauses.
10849
10850 2001-05-24  Miguel de Icaza  <miguel@ximian.com>
10851
10852         * gen-treedump.cs: Adapted for all the renaming.
10853
10854         * expression.cs (Expression): this class now has a Type property
10855         which returns an expression Type.
10856
10857         (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
10858         `Type', as this has a different meaning now in the base
10859
10860 2001-05-22  Miguel de Icaza  <miguel@ximian.com>
10861
10862         * interface.cs, class.cs: Removed from all the sources the
10863         references to signature computation, as we can not do method
10864         signature computation during the parsing time, as we are not
10865         trying to solve at that point distinguishing:
10866
10867         class X {
10868                 void a (Blah x) {}
10869                 void a (NS.Blah x) {}
10870         }
10871
10872         Which depending on the context might be valid or not, as we do not
10873         know if Blah is the same thing as NS.Blah at that point.
10874
10875         * Redid everything so the code uses TypeRefs now instead of
10876         Types.  TypeRefs are just temporary type placeholders, that need
10877         to be resolved.  They initially have a pointer to a string and the
10878         current scope in which they are used.  This is used later by the
10879         compiler to resolve the reference to an actual Type. 
10880
10881         * DeclSpace is no longer a CIR.Type, and neither are
10882         TypeContainers (Class and Struct) nor Interfaces nor Enums.  They
10883         are all DeclSpaces, but no Types. 
10884
10885         * type.cs (TypeRefManager): This implements the TypeRef manager,
10886         which keeps track of all the types that need to be resolved after
10887         the parsing has finished. 
10888
10889 2001-05-13  Miguel de Icaza  <miguel@ximian.com>
10890
10891         * ARGH.  We are going to have to store `foreach' as a class rather
10892         than resolving it, as we need to verify error 1579 after name
10893         resolution.   *OR* we could keep a flag that says `This request to
10894         IEnumerator comes from a foreach statement' which we can then use
10895         to generate the error.
10896
10897 2001-05-10  Miguel de Icaza  <miguel@ximian.com>
10898
10899         * class.cs (TypeContainer.AddMethod): we now add methods to the
10900         MethodGroup instead of the method hashtable.  
10901
10902         * expression.cs: Add MethodGroup abstraction, which gets us one
10903         step closer to the specification in the way we handle method
10904         declarations.  
10905
10906         * cs-parser.jay (primary_expression): qualified_identifier now
10907         tried to match up an identifier to a local variable reference or
10908         to a parameter reference.
10909
10910         current_local_parameters is now a parser global variable that
10911         points to the current parameters for the block, used during name
10912         lookup.
10913
10914         (property_declaration): Now creates an implicit `value' argument to
10915         the set accessor.
10916
10917 2001-05-09  Miguel de Icaza  <miguel@ximian.com>
10918
10919         * parameter.cs: Do not use `param' arguments as part of the
10920         signature, per the spec.
10921
10922 2001-05-08  Miguel de Icaza  <miguel@ximian.com>
10923
10924         * decl.cs: Base class for classes, structs and interfaces.  This
10925         is the "Declaration Space" 
10926
10927         * cs-parser.jay: Use CheckDef for checking declaration errors
10928         instead of having one on each function.
10929
10930         * class.cs: Factor out some code for handling error handling in
10931         accordance to the "Declarations" section in the "Basic Concepts"
10932         chapter in the ECMA C# spec.
10933
10934         * interface.cs: Make all interface member classes derive from
10935         InterfaceMemberBase.
10936
10937 2001-05-07  Miguel de Icaza  <miguel@ximian.com>
10938
10939         * Many things: all interfaces are parsed and generated in
10940         gen-treedump.  Support for member variables, constructors,
10941         destructors, properties, constants is there.
10942
10943         Beginning of the IL backend, but very little done, just there for
10944         testing purposes. 
10945
10946 2001-04-29  Miguel de Icaza  <miguel@ximian.com>
10947
10948         * cs-parser.jay: Fix labeled statement.
10949
10950         * cs-tokenizer.cs (escape): Escape " and ' always.
10951         ref_line, ref_name: keep track of the line/filename as instructed
10952         by #line by the compiler.
10953         Parse #line.
10954
10955 2001-04-27  Miguel de Icaza  <miguel@ximian.com>
10956
10957         * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
10958         to match the values in System.CodeDOM.
10959
10960         Divid renamed to Divide.
10961
10962         * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
10963         statements. 
10964         (Statements.set): remove.
10965
10966         * System.CodeDOM/CodeCatchClause.cs: always have a valid
10967         statements. 
10968
10969         * System.CodeDOM/CodeIfStatement.cs: trueStatements and
10970         falseStatements always have valid values. 
10971
10972         * cs-parser.jay: Use System.CodeDOM now.
10973