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