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