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