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