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